Skip to content

Commit 623ecae

Browse files
authored
Merge pull request #29 from LIN3S/fix/front-issues
Fix/front issues
2 parents b2c1131 + d746512 commit 623ecae

12 files changed

Lines changed: 658 additions & 400 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ To get the diff for a specific change, go to https://github.com/LIN3S/AdminBundl
66
To get the diff between two versions, go to https://github.com/LIN3S/AdminBundle/compare/v0.4.0...v0.5.0
77

88
* 0.6.0
9+
* Added sticky behaviour to the form right sidebar.
10+
* Made JavaScript and CSS code compatible with IE11.
911
* Imported `parsleyjs` module in the js entry file.
1012
* Updated lin3s-front-foundation dependency from v0.6.0 to v0.6.1.
1113
* Updated lin3s-front-foundation dependency from v0.5.0 to v0.6.0.

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: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
* @author Beñat Espiña <benatespina@gmail.com>
11+
*/
12+
13+
import {onDomReady} from 'lin3s-event-bus';
14+
15+
class FormSidebar {
16+
constructor(rootNode) {
17+
this.rootNode = rootNode;
18+
this.fixedElement = this.rootNode.querySelector('.form-sidebar__fixed');
19+
this.fixedElementWidth = this.fixedElement.offsetWidth;
20+
21+
this.onScroll = this.onScroll.bind(this);
22+
23+
window.addEventListener('scroll', () => requestAnimationFrame(this.onScroll));
24+
}
25+
26+
offsetTop() {
27+
const rect = this.rootNode.getBoundingClientRect();
28+
29+
return rect.top + document.body.scrollTop;
30+
}
31+
32+
onScroll() {
33+
if (document.body.scrollTop > this.offsetTop() - 20) {
34+
this.rootNode.style.position = 'relative';
35+
36+
this.fixedElement.style.position = 'fixed';
37+
this.fixedElement.style.top = '20px';
38+
this.fixedElement.style.width = `${this.fixedElementWidth}px`;
39+
} else {
40+
this.rootNode.removeAttribute('style');
41+
this.fixedElement.removeAttribute('style');
42+
}
43+
}
44+
}
45+
46+
const onReady = () => {
47+
const formSidebars = document.querySelectorAll('.form-sidebar');
48+
49+
if (formSidebars.length === 0) {
50+
return;
51+
}
52+
53+
Array.from(formSidebars).forEach((rootNode) => new FormSidebar(rootNode));
54+
};
55+
56+
onDomReady(onReady);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ $form-collection-item-toggle-icon-color: $color-mercury !default;
4141
padding-right: 30px;
4242

4343
.form-collection__toggle {
44-
right: 5px;
44+
right: 30px;
4545
}
4646
}
4747
}
@@ -81,7 +81,7 @@ $form-collection-item-toggle-icon-color: $color-mercury !default;
8181
height: 25px;
8282
padding: 5px;
8383
position: absolute;
84-
right: -10px;
84+
right: 15px;
8585
top: 25px;
8686
transform: translateY(-50%);
8787
width: 25px;

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,18 @@ select {
138138
}
139139

140140
@media #{$large-up} {
141+
$one-third: 100% / 3;
142+
$two-thirds: 100% / 3 * 2;
143+
141144
.form__column--left {
142-
flex: 1 1 66.666%;
145+
flex: 1 1 $two-thirds;
146+
max-width: $two-thirds;
143147
padding-right: 15px;
144148
}
145149

146150
.form__column--right {
147-
flex: 1 1 33.333%;
151+
flex: 1 1 $one-third;
152+
max-width: $one-third;
148153
padding-left: 15px;
149154
}
150155
}

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 {

0 commit comments

Comments
 (0)