|
|
|
@ -90,7 +90,7 @@
|
|
|
|
|
model = new URIModel({item:input_value});
|
|
|
|
|
} else {
|
|
|
|
|
model = new Backbone.Model({item:input_value});
|
|
|
|
|
model.validate = function() { if(!this.get("item")) return "value can't be null" };
|
|
|
|
|
model.validate = function() { if(!this.get("item")) return "value can't be null"; };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if it's valid and doesn't already exist
|
|
|
|
@ -558,10 +558,10 @@
|
|
|
|
|
var AppRouter = Backbone.Router.extend({
|
|
|
|
|
|
|
|
|
|
routes:{
|
|
|
|
|
"clients":"listClients",
|
|
|
|
|
"client/new":"newClient",
|
|
|
|
|
"client/:id":"editClient",
|
|
|
|
|
"white_list":"whiteList",
|
|
|
|
|
"admin/clients":"listClients",
|
|
|
|
|
"admin/client/new":"newClient",
|
|
|
|
|
"admin/client/:id":"editClient",
|
|
|
|
|
"admin/white_list":"whiteList",
|
|
|
|
|
'*path': 'listClients'
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
@ -584,10 +584,13 @@
|
|
|
|
|
startAfter:function (collections) {
|
|
|
|
|
// Start history when required collections are loaded
|
|
|
|
|
var start = _.after(collections.length, _.once(function () {
|
|
|
|
|
Backbone.history.start()
|
|
|
|
|
var baseUrl = $.url($('base').attr('href'));
|
|
|
|
|
|
|
|
|
|
Backbone.history.start({pushState: true, root: baseUrl.attr('relative') + 'manage/'});
|
|
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
_.each(collections, function (collection) {
|
|
|
|
|
collection.bind('reset', start, Backbone.history)
|
|
|
|
|
collection.bind('reset', start, Backbone.history);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
@ -595,8 +598,8 @@
|
|
|
|
|
|
|
|
|
|
this.breadCrumbView.collection.reset();
|
|
|
|
|
this.breadCrumbView.collection.add([
|
|
|
|
|
{text:"Home", href:"/"},
|
|
|
|
|
{text:"Manage Clients", href:"admin/manage/#clients"}
|
|
|
|
|
{text:"Home", href:""},
|
|
|
|
|
{text:"Manage Clients", href:"manage/#admin/clients"}
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
$('#content').html(this.clientListView.render().el);
|
|
|
|
@ -608,9 +611,9 @@
|
|
|
|
|
|
|
|
|
|
this.breadCrumbView.collection.reset();
|
|
|
|
|
this.breadCrumbView.collection.add([
|
|
|
|
|
{text:"Home", href:"/"},
|
|
|
|
|
{text:"Manage Clients", href:"admin/manage/#clients"},
|
|
|
|
|
{text:"New", href:"#"}
|
|
|
|
|
{text:"Home", href:""},
|
|
|
|
|
{text:"Manage Clients", href:"manage/#admin/clients"},
|
|
|
|
|
{text:"New", href:""}
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
var client = new ClientModel();
|
|
|
|
@ -631,9 +634,9 @@
|
|
|
|
|
|
|
|
|
|
this.breadCrumbView.collection.reset();
|
|
|
|
|
this.breadCrumbView.collection.add([
|
|
|
|
|
{text:"Home", href:"/"},
|
|
|
|
|
{text:"Manage Clients", href:"admin/manage/#clients"},
|
|
|
|
|
{text:"Edit", href:"#"}
|
|
|
|
|
{text:"Home", href:""},
|
|
|
|
|
{text:"Manage Clients", href:"manage/#admin/clients"},
|
|
|
|
|
{text:"Edit", href:"manage/#admin/client/" + id}
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
var client = this.clientList.get(id);
|
|
|
|
@ -681,6 +684,11 @@
|
|
|
|
|
app = new AppRouter();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('a[href*="#"').on('click', function(event) {
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
app.navigate(this.hash.slice(1), {trigger: true});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|