diff --git a/client/src/views/detail.js b/client/src/views/detail.js index 53bbdda71e..f06149dd3c 100644 --- a/client/src/views/detail.js +++ b/client/src/views/detail.js @@ -42,6 +42,8 @@ define('views/detail', 'views/main', function (Dep) { recordView: 'views/record/detail', + rootLinkDisabled: false, + addUnfollowButtonToMenu: function () { this.removeMenuItem('follow', true); @@ -196,9 +198,17 @@ define('views/detail', 'views/main', function (Dep) { var headerIconHtml = this.getHeaderIconHtml(); + var rootHtml = this.getLanguage().translate(this.scope, 'scopeNamesPlural'); + + if (!this.rootLinkDisabled) { + rootHtml = + '' + + rootHtml + + ''; + } + return this.buildHeaderHtml([ - headerIconHtml + '' + - this.getLanguage().translate(this.scope, 'scopeNamesPlural') + '', + headerIconHtml + rootHtml, name ]); }, diff --git a/client/src/views/edit.js b/client/src/views/edit.js index 697e088520..3c4fac9832 100644 --- a/client/src/views/edit.js +++ b/client/src/views/edit.js @@ -44,6 +44,8 @@ define('views/edit', 'views/main', function (Dep) { recordView: 'views/record/edit', + rootLinkDisabled: false, + setup: function () { this.headerView = this.options.headerView || this.headerView; this.recordView = this.options.recordView || this.recordView; @@ -56,7 +58,7 @@ define('views/edit', 'views/main', function (Dep) { this.createView('header', this.headerView, { model: this.model, el: '#main > .header', - scope: this.scope + scope: this.scope, }); }, @@ -64,14 +66,17 @@ define('views/edit', 'views/main', function (Dep) { var o = { model: this.model, el: '#main > .record', - scope: this.scope + scope: this.scope, }; + this.optionsToPass.forEach(function (option) { o[option] = this.options[option]; }, this); + if (this.options.params && this.options.params.rootUrl) { o.rootUrl = this.options.params.rootUrl; } + return this.createView('record', this.getRecordViewName(), o); }, @@ -80,22 +85,26 @@ define('views/edit', 'views/main', function (Dep) { }, getHeader: function () { - var html = ''; - var headerIconHtml = this.getHeaderIconHtml(); var arr = []; - if (this.options.noHeaderLinks) { + if (this.options.noHeaderLinks || this.rootLinkDisabled) { arr.push(this.getLanguage().translate(this.scope, 'scopeNamesPlural')); - } else { + } + else { var rootUrl = this.options.rootUrl || this.options.params.rootUrl || '#' + this.scope; - arr.push(headerIconHtml + '' + this.getLanguage().translate(this.scope, 'scopeNamesPlural') + ''); + + arr.push( + headerIconHtml + '' + + this.getLanguage().translate(this.scope, 'scopeNamesPlural') + '' + ); } if (this.model.isNew()) { arr.push(this.getLanguage().translate('create')); - } else { + } + else { var name = Handlebars.Utils.escapeExpression(this.model.get('name')); if (name === '') { @@ -104,25 +113,35 @@ define('views/edit', 'views/main', function (Dep) { if (this.options.noHeaderLinks) { arr.push(name); - } else { - arr.push('' + name + ''); + } + else { + arr.push( + '' + name + '' + ); } } + return this.buildHeaderHtml(arr); }, updatePageTitle: function () { var title; + if (this.model.isNew()) { - title = this.getLanguage().translate('Create') + ' ' + this.getLanguage().translate(this.scope, 'scopeNames'); - } else { + title = this.getLanguage().translate('Create') + ' ' + + this.getLanguage().translate(this.scope, 'scopeNames'); + } + else { var name = this.model.get('name'); + if (name) { title = name; - } else { + } + else { title = this.getLanguage().translate(this.scope, 'scopeNames') } } + this.setPageTitle(title); }, }); diff --git a/client/src/views/user/detail.js b/client/src/views/user/detail.js index cc152b67f1..c16c9bd471 100644 --- a/client/src/views/user/detail.js +++ b/client/src/views/user/detail.js @@ -33,6 +33,10 @@ define('views/user/detail', 'views/detail', function (Dep) { setup: function () { Dep.prototype.setup.call(this); + if (this.getUser().isPortal()) { + this.rootLinkDisabled = true; + } + if (this.model.id === this.getUser().id || this.getUser().isAdmin()) { if (this.model.isRegular() || this.model.isAdmin() || this.model.isPortal()) { @@ -114,5 +118,6 @@ define('views/user/detail', 'views/detail', function (Dep) { actionExternalAccounts: function () { this.getRouter().navigate('#ExternalAccount', {trigger: true}); }, + }); });