Skip to content

Commit c4a2650

Browse files
committed
fix: content loading
1 parent 6b9858d commit c4a2650

File tree

2 files changed

+0
-342
lines changed

2 files changed

+0
-342
lines changed

dist/js/app.js

Lines changed: 0 additions & 171 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ $(function(){
3737
this.$sidebar = $('#sidebar');
3838
this.$content = $('#content');
3939
this.$loaderWrap = $('.loader-wrap');
40-
this.$navigationStateToggle = $('#nav-state-toggle');
41-
this.$navigationCollapseToggle = $('#nav-collapse-toggle');
4240
this.settings = window.SingSettings;
4341
this.pageLoadCallbacks = {};
4442
this.resizeCallbacks = [];
@@ -55,21 +53,6 @@ $(function(){
5553
this._initOnResizeCallbacks();
5654
this._initOnScreenSizeCallbacks();
5755

58-
this.$sidebar.on('mouseenter', $.proxy(this._sidebarMouseEnter, this));
59-
this.$sidebar.on('mouseleave', $.proxy(this._sidebarMouseLeave, this));
60-
/**
61-
* open navigation in case collapsed sidebar clicked
62-
*/
63-
//$(document).on('click', '.nav-collapsed #sidebar', $.proxy(this.expandNavigation, this));
64-
//we don't need this cool feature for big boys
65-
if (Sing.isScreen('xs') || Sing.isScreen('sm')) {
66-
('ontouchstart' in window) && this.$content
67-
.hammer()
68-
.bind('swipeleft', $.proxy(this._contentSwipeLeft, this))
69-
.bind('swiperight', $.proxy(this._contentSwipeRight, this));
70-
}
71-
72-
this.checkNavigationState();
7356

7457
if (this.pjaxEnabled){
7558
/**
@@ -93,8 +76,6 @@ $(function(){
9376
$(document).on('pjax:end', $.proxy(this.pageLoaded, this));
9477
}
9578

96-
this.$navigationStateToggle.on('click', $.proxy(this.toggleNavigationState, this));
97-
this.$navigationCollapseToggle.on('click', $.proxy(this.toggleNavigationCollapseState, this));
9879

9980
/* reimplementing bs.collapse data-parent here as we don't want to use BS .panel*/
10081
this.$sidebar.find('.collapse').on('show.bs.collapse', function(e){
@@ -175,104 +156,6 @@ $(function(){
175156
this.pageResizeCallbacks = {};
176157
};
177158

178-
/**
179-
* Collapses navigation if nav-static local storage option is set to false
180-
*/
181-
SingAppView.prototype.checkNavigationState = function(){
182-
if (this.isNavigationStatic()){
183-
this.staticNavigationState();
184-
if (Sing.isScreen('md') || Sing.isScreen('sm') || Sing.isScreen('xs')){
185-
this.collapseNavigation();
186-
}
187-
} else {
188-
if (Sing.isScreen('lg') || Sing.isScreen('xl')){
189-
var view = this;
190-
setTimeout(function(){
191-
view.collapseNavigation();
192-
}, this.navCollapseTimeout);
193-
} else {
194-
this.collapseNavigation();
195-
}
196-
}
197-
};
198-
199-
SingAppView.prototype.collapseNavigation = function(){
200-
//this method only makes sense for non-static navigation state
201-
if (this.isNavigationStatic() && (Sing.isScreen('lg') || Sing.isScreen('xl'))) return;
202-
203-
// $('body').addClass('nav-collapsed');
204-
// this.$sidebar.find('.collapse.show').collapse('hide')
205-
// .siblings('[data-toggle=collapse]').addClass('collapsed');
206-
207-
};
208-
209-
SingAppView.prototype.expandNavigation = function(){
210-
//this method only makes sense for non-static navigation state
211-
if (this.isNavigationStatic() && (Sing.isScreen('lg') || Sing.isScreen('xl'))) return;
212-
213-
// $('body').removeClass('nav-collapsed');
214-
// this.$sidebar.find('.active .active').closest('.collapse').collapse('show')
215-
// .siblings('[data-toggle=collapse]').removeClass('collapsed');
216-
};
217-
218-
SingAppView.prototype._sidebarMouseEnter = function(){
219-
if (Sing.isScreen('lg') || Sing.isScreen('xl')){
220-
this.expandNavigation();
221-
}
222-
};
223-
224-
SingAppView.prototype._sidebarMouseLeave = function(){
225-
if (Sing.isScreen('lg') || Sing.isScreen('xl')){
226-
this.collapseNavigation();
227-
}
228-
};
229-
230-
SingAppView.prototype._collapseNavIfSmallScreen = function(){
231-
if (Sing.isScreen('xs') || Sing.isScreen('sm') || Sing.isScreen('md')){
232-
this.collapseNavigation();
233-
}
234-
};
235-
236-
/**
237-
* Toggles between static and collapsing navigation states.
238-
* Collapsing - navigation automatically collapse when mouse leaves it and expand when enters.
239-
* Static - stays always open.
240-
*/
241-
242-
SingAppView.prototype.toggleNavigationState = function(){
243-
if (this.isNavigationStatic()){
244-
this.collapsingNavigationState();
245-
} else {
246-
this.staticNavigationState();
247-
}
248-
$(window).trigger('sing-app:content-resize');
249-
};
250-
251-
/**
252-
* Turns on static navigation state.
253-
* Collapsing navigation state - navigation automatically collapse when mouse leaves it and expand when enters.
254-
* Static navigation state - navigation stays always open.
255-
*/
256-
SingAppView.prototype.staticNavigationState = function(){
257-
this.settings.set('nav-static', true).save();
258-
$('body').addClass('nav-static');
259-
};
260-
261-
/**
262-
* Turns on collapsing navigation state.
263-
* Collapsing navigation state - navigation automatically collapse when mouse leaves it and expand when enters.
264-
* Static navigation state - navigation stays always open.
265-
*/
266-
SingAppView.prototype.collapsingNavigationState = function(){
267-
this.settings.set('nav-static', false).save();
268-
$('body').removeClass('nav-static');
269-
this.collapseNavigation();
270-
};
271-
272-
SingAppView.prototype.isNavigationStatic = function(){
273-
return this.settings.get('nav-static') === true;
274-
};
275-
276159
/**
277160
* Changes active navigation item depending on current page.
278161
* Should be executed before page load
@@ -296,21 +179,6 @@ $(function(){
296179
.parents('li').addClass('active');
297180
};
298181

299-
/**
300-
* Checks whether screen is md or lg and closes navigation if opened
301-
* @private
302-
*/
303-
SingAppView.prototype._contentSwipeLeft = function(){
304-
var self = this;
305-
//this method only makes sense for small screens + ipad
306-
setTimeout(function () {
307-
if (Sing.isScreen('xl')) return;
308-
309-
// if (!$('body').is('.nav-collapsed')){
310-
// self.collapseNavigation();
311-
// }
312-
})
313-
};
314182

315183
/**
316184
* Checks whether screen is md or lg and opens navigation if closed
@@ -525,12 +393,10 @@ $(function(){
525393

526394
window.SingApp = new SingAppView();
527395

528-
// SingApp.expandNavigation();
529396

530397
initAppPlugins();
531398
initAppFunctions();
532399
initAppFixes();
533-
initDemoFunctions();
534400
});
535401

536402
/**
@@ -697,40 +563,3 @@ function initAppFixes(){
697563
}
698564
}
699565

700-
/**
701-
* Demo-only functions. Does not affect the core Sing functionality.
702-
* Should be removed when used in real app.
703-
*/
704-
705-
function initDemoFunctions(){
706-
!function($){
707-
$('.theme-helper-toggler').click(() => {
708-
$('.theme-helper').toggleClass('theme-helper-opened');
709-
});
710-
$('#load-notifications-btn').on('ajax-load:end', function () {
711-
setTimeout(function(){
712-
$('#notifications-list').find('.bg-attention').removeClass('bg-attention');
713-
}, 10000)
714-
});
715-
$('#notifications-toggle').find('input').on('ajax-load:end', function(){
716-
$('#notifications-list').find('[data-toggle=tooltip]').tooltip();
717-
});
718-
719-
720-
const mainSidebar = $('#sidebar');
721-
const toggleSidebar = $('#toggleSidebar');
722-
723-
$('.content-wrap').on('click', (e) => {
724-
if ($('.toggle-sidebar').hasClass('open')) {
725-
mainSidebar.removeClass('sidebar-open');
726-
$('.toggle-sidebar').removeClass('open');
727-
}
728-
});
729-
730-
toggleSidebar.on('click', (e) => {
731-
mainSidebar.toggleClass('sidebar-open');
732-
$('.toggle-sidebar').toggleClass('open');
733-
});
734-
735-
}(jQuery);
736-
}

0 commit comments

Comments
 (0)