Skip to content

Commit 85bc9e9

Browse files
committed
front IE issues - sidebar fixed
1 parent b2c1131 commit 85bc9e9

9 files changed

Lines changed: 17594 additions & 30 deletions

File tree

src/LIN3S/AdminBundle/Resources/private/js/app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import 'parsleyjs';
1717

1818
import './components/Filter';
1919
import './components/FormCollection';
20+
import './components/FormSidebar';
2021
import './components/MenuToggle';
2122
import './components/Panel';
2223
import './polyfills';
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* This file is part of the Admin Bundle.
3+
*
4+
* Copyright (c) 2015-present LIN3S <info@lin3s.com>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*
9+
* @author Andrés Montejo <andres@lin3s.com>
10+
*/
11+
12+
import {onDomReady} from 'lin3s-event-bus';
13+
14+
class FormSidebar {
15+
constructor(rootNode) {
16+
this.rootNode = rootNode;
17+
this.fixedElement = this.rootNode.querySelector('.form-sidebar__fixed');
18+
this.fixedElementWidth = this.fixedElement.offsetWidth;
19+
20+
this.onScroll = this.onScroll.bind(this);
21+
22+
window.addEventListener('scroll', () => requestAnimationFrame(this.onScroll));
23+
}
24+
25+
offsetTop() {
26+
const rect = this.rootNode.getBoundingClientRect();
27+
28+
return rect.top + document.body.scrollTop;
29+
}
30+
31+
onScroll() {
32+
// var width = parseInt(this.fixedElementWidth);
33+
34+
if (document.body.scrollTop > this.offsetTop() - 20) {
35+
(this.rootNode).style.position = 'relative';
36+
37+
(this.fixedElement).style.position = 'fixed';
38+
(this.fixedElement).style.top = '20px';
39+
(this.fixedElement).style.width = this.fixedElementWidth + 'px';
40+
} else {
41+
this.rootNode.style = '';
42+
this.fixedElement.style = '';
43+
}
44+
}
45+
}
46+
47+
const onReady = () => {
48+
const rootNode = document.querySelector('.form-sidebar');
49+
50+
if (null === rootNode) {
51+
return;
52+
}
53+
54+
new FormSidebar(rootNode);
55+
56+
};
57+
58+
onDomReady(onReady);

src/LIN3S/AdminBundle/Resources/private/scss/components/_form.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,13 @@ select {
140140
@media #{$large-up} {
141141
.form__column--left {
142142
flex: 1 1 66.666%;
143+
max-width: 66.666%;
143144
padding-right: 15px;
144145
}
145146

146147
.form__column--right {
147148
flex: 1 1 33.333%;
149+
max-width: 33.333%;
148150
padding-left: 15px;
149151
}
150152
}

src/LIN3S/AdminBundle/Resources/private/scss/components/_layout.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ $layout-header-height: 30px !default;
5050

5151
.layout__menu {
5252
height: auto;
53-
position: initial;
53+
position: inherit;
5454
width: 200px;
5555

5656
.menu-toggle {

src/LIN3S/AdminBundle/Resources/public/css/bundle.min.css

Lines changed: 776 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/LIN3S/AdminBundle/Resources/public/js/bundle.min.js

Lines changed: 16734 additions & 21 deletions
Large diffs are not rendered by default.

src/LIN3S/AdminBundle/Resources/public/js/bundle.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{% set form_sidebar_content %}{%- block form_sidebar_content -%}{%- endblock form_sidebar_content -%}{% endset %}
2+
3+
<div class="form-sidebar">
4+
<div class="form-sidebar__fixed">
5+
{{- form_sidebar_content -}}
6+
</div>
7+
</div>

src/LIN3S/AdminBundle/Resources/views/form.html.twig

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@
121121
{%- block form -%}
122122
{{- form_start(form) -}}
123123

124+
{% set lin3s_admin_submit %}
125+
{{ block('lin3s_admin_submit') }}
126+
{% endset %}
127+
124128
{% if form.vars.groups is defined %}
125129
<div class="form__column form__column--left">
126130
{% for group in form.vars.groups %}
@@ -130,12 +134,16 @@
130134
{% endfor %}
131135
</div>
132136
<div class="form__column form__column--right">
133-
{{- block('lin3s_admin_submit') -}}
134-
{% for group in form.vars.groups %}
135-
{% if group.position is defined and group.position == 'right' %}
136-
{{- block('lin3s_admin_panel') -}}
137-
{% endif %}
138-
{% endfor %}
137+
{% embed 'Lin3sAdminBundle:components:form_sidebar.html.twig' %}
138+
{% block form_sidebar_content %}
139+
{{- lin3s_admin_submit -}}
140+
{% for group in form.vars.groups %}
141+
{% if group.position is defined and group.position == 'right' %}
142+
{{- block('lin3s_admin_panel') -}}
143+
{% endif %}
144+
{% endfor %}
145+
{% endblock %}
146+
{% endembed %}
139147
</div>
140148
{% else %}
141149
{% embed 'Lin3sAdminBundle:components:panel.html.twig' %}

0 commit comments

Comments
 (0)