Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should return false after a router becomes inactive', function() {
Backbone.history.trigger('route', this.router);
Backbone.history.trigger('route', {});
expect(this.router.isActive()).to.be.false;
});
});
Notifier.init({
editorModel: editorModel
});
MetricsTracker.init({
userId: userModel.get('id'),
visId: visModel.get('id'),
configModel: configModel
});
var notifierView = Notifier.getView();
$('.js-notifier').append(notifierView.render().el);
var rootUrl = configModel.get('base_url').replace(window.location.origin, '') + '/dataset/';
Backbone.history.start({
pushState: true,
root: rootUrl
});
if (tableModel.isOwner(userModel) && visModel.get('locked')) {
modals.create(function (modalModel) {
return new DatasetUnlockModalView({
modalModel: modalModel,
visModel: visModel,
configModel: configModel,
tableName: tableModel.getUnquotedName()
});
});
}
if (!configModel.get('cartodb_com_hosted')) {
import $ from 'jquery';
import Backbone from 'backbone';
import './utils/strings';
import Router from './router';
const router = new Router();
Backbone.history.start();
});
if (getCurrentUser().get('admin')) {
navItems.push({
name: 'Admin console',
icon: 'icon-wrench',
target: 'admin'
});
}
}
}
this.$el.html(LayoutGlobalNavTemplate({
navItems: navItems
}));
if (Backbone.history.fragment) {
this.$('[g-target="' + Backbone.history.fragment + '"]')
.parent().addClass('g-active');
}
return this;
},
showTimetable: function (academicYear, semester, queryString) {
semester = parseInt(semester, 10);
if (!(semester >= 1 && semester <= 4)) {
return Backbone.history.navigate(
config.semTimetableFragment(),
{
trigger: true,
replace: true
});
}
academicYear = academicYear.replace('-', '/');
navigationItem.select();
Promise.resolve().then(function () {
if (queryString) {
var selectedModules = App.request('selectedModules', semester);
var timetable = selectedModules.timetable;
timetable.reset();
var selectedCodes = selectedModules.pluck('ModuleCode');
var routeModules = TimetableModuleCollection.fromQueryStringToJSON(queryString);
var routeCodes = _.pluck(routeModules, 'ModuleCode');
Backbone.$(document).on("ready", function() {
Backbone.history.start();
});
}
$(function () {
Backbone.history.start();
});
App.on('start', function () {
initializeUI();
Fastclick.attach(document.body);
if (Backbone.history) {
Backbone.history.start();
}
});
};
app.router = new Marionette.AppRouter({
controller: controller,
appRoutes: {
':tab': 'changeTab'
}
});
this.listenTo(app.navbar, 'navigate', function (target) {
app.router.navigate(target);
controller.changeTab(target);
app.hideError();
});
if (Backbone.history) {
Backbone.history.start();
}
if (Backbone.history.fragment === '') {
app.router.navigate('cdr', { trigger: true });
}
});
copyToClipboard: function(e) {
e.preventDefault();
var href = Backbone.history.location.href;
if (href.lastIndexOf("/permissions") !== -1) {
href = href.substr(0, href.lastIndexOf("/permissions"));
}
window.prompt("Copy to clipboard: Ctrl+C, Enter", href);
},