made scopes robust against deep links
parent
45754d3b75
commit
c8cf2abbd9
|
@ -882,9 +882,11 @@ var AppRouter = Backbone.Router.extend({
|
|||
|
||||
var scope = new SystemScopeModel();
|
||||
|
||||
this.systemScopeFormView = new SystemScopeFormView({model:scope});
|
||||
$('#content').html(this.systemScopeFormView.render().el);
|
||||
setPageTitle($.t('scope.system-scope-form.new'));
|
||||
var view = new SystemScopeFormView({model:scope});
|
||||
view.load(function() {
|
||||
$('#content').html(view.render().el);
|
||||
setPageTitle($.t('scope.system-scope-form.new'));
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
|
@ -905,10 +907,15 @@ var AppRouter = Backbone.Router.extend({
|
|||
this.updateSidebar('admin/scope');
|
||||
|
||||
var scope = this.systemScopeList.get(sid);
|
||||
if (!scope) {
|
||||
scope = new SystemScopeModel({id: sid});
|
||||
}
|
||||
|
||||
this.systemScopeFormView = new SystemScopeFormView({model:scope});
|
||||
$('#content').html(this.systemScopeFormView.render().el);
|
||||
setPageTitle($.t('scope.system-scope-form.edit'));
|
||||
var view = new SystemScopeFormView({model:scope});
|
||||
view.load(function() {
|
||||
$('#content').html(view.render().el);
|
||||
setPageTitle($.t('scope.system-scope-form.new'));
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
|
|
|
@ -284,6 +284,25 @@ var SystemScopeFormView = Backbone.View.extend({
|
|||
'change #isStructured input':'toggleStructuredParamDescription'
|
||||
},
|
||||
|
||||
load:function(callback) {
|
||||
if (this.model.isFetched) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
$('#loadingbox').sheet('show');
|
||||
$('#loading').html(
|
||||
'<span class="label" id="loading-scopes">' + $.t("common.scopes") + '</span> '
|
||||
);
|
||||
|
||||
$.when(this.model.fetchIfNeeded({success:function(e) {$('#loading-scopes').addClass('label-success');}}))
|
||||
.done(function() {
|
||||
$('#loadingbox').sheet('hide');
|
||||
callback();
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
toggleStructuredParamDescription:function(e) {
|
||||
if ($('#isStructured input', this.el).is(':checked')) {
|
||||
$('#structuredParamDescription', this.el).show();
|
||||
|
|
Loading…
Reference in New Issue