How to use the backbone.history function in backbone

To help you get started, we’ve selected a few backbone examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jamiebuilds / backbone-routing / test / unit / routing.js View on Github external
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;
    });
  });
github CartoDB / cartodb / lib / assets / javascripts / cartodb3 / dataset.js View on Github external
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')) {
github alfg / spotlistTV / app / web / src / app / main.js View on Github external
import $ from 'jquery';
import Backbone from 'backbone';
import './utils/strings';

import Router from './router';


const router = new Router();

Backbone.history.start();
github girder / girder / girder / web_client / src / views / layout / GlobalNavView.js View on Github external
});
                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;
    },
github nusmodifications / nusmods / app / scripts / timetable / controllers / TimetableController.js View on Github external
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');
github jtangelder / react-flux-backbone / src / project / router / RouterStore.js View on Github external
Backbone.$(document).on("ready", function() {
            Backbone.history.start();
        });
    }
github Accenture / generator-mario / generators / app / templates / es6 / app / scripts / app.js View on Github external
App.on('start', function () {
    initializeUI();
    Fastclick.attach(document.body);
    if (Backbone.history) {
        Backbone.history.start();
    }
});
github ipoddubny / webcdr / public / js / main.js View on Github external
};

  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 });
  }
});
github galaxyproject / galaxy / client / galaxy / scripts / mvc / library / library-dataset-view.js View on Github external
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);
    },