Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue/1521: remove navigation from #wrapper #1522

Merged
merged 1 commit into from
May 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/core/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,26 @@ require([
Adapt.log.error('Error during app:dataReady trigger', e);
}

Adapt.navigation = new NavigationView();// This should be triggered after 'app:dataReady' as plugins might want to manipulate the navigation
addNavigationBar();

Adapt.initialize();

Adapt.off('adaptCollection:dataLoaded courseModel:dataLoaded');
}

function addNavigationBar() {

var adaptConfig = Adapt.course.get("_navigation");

if (adaptConfig && adaptConfig._isDefaultNavigationDisabled) {
Adapt.trigger("navigation:initialize");
return;
}

Adapt.navigation = new NavigationView();// This should be triggered after 'app:dataReady' as plugins might want to manipulate the navigation

}

function configureInview() {

var adaptConfig = Adapt.config.get("_inview");
Expand Down
13 changes: 13 additions & 0 deletions src/core/js/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ define([
this.showLoading();
// Store #wrapper element to cache for later
this.$wrapper = $('#wrapper');
this.$html = $('html');

Adapt.once('app:dataReady', function() {
document.title = Adapt.course.get('title');
});
Expand Down Expand Up @@ -309,6 +311,17 @@ define([
+ ' location-id-'
+ Adapt.location._currentId :
'location-' + Adapt.location._currentLocation;

var previousClasses = Adapt.location._previousClasses;
if (previousClasses) {
this.$html.removeClass(previousClasses);
}
Adapt.location._previousClasses = classes;

this.$html
.addClass(classes)
.attr('data-location', Adapt.location._currentLocation);

this.$wrapper
.removeClass()
.addClass(classes)
Expand Down
2 changes: 1 addition & 1 deletion src/core/js/views/navigationView.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ define([
_globals: Adapt.course.get("_globals"),
_accessibility: Adapt.config.get("_accessibility")
}
)).appendTo('#wrapper');
)).insertBefore('#wrapper');

_.defer(_.bind(function() {
Adapt.trigger('navigationView:postRender', this);
Expand Down