diff --git a/frontend/client/src/views/role/record/edit.js b/frontend/client/src/views/role/record/edit.js index 41d7ade4ce..bbc5af6e36 100644 --- a/frontend/client/src/views/role/record/edit.js +++ b/frontend/client/src/views/role/record/edit.js @@ -17,41 +17,41 @@ * * You should have received a copy of the GNU General Public License * along with EspoCRM. If not, see http://www.gnu.org/licenses/. - ************************************************************************/ + ************************************************************************/ Espo.define('Views.Role.Record.Edit', 'Views.Record.Edit', function (Dep) { return Dep.extend({ - + sideView: 'Role.Record.DetailSide', events: _.extend({ 'change select[data-type="access"]': function (e) { var scope = $(e.target).attr('name'); var $dropdowns = this.$el.find('select[data-scope="' + scope + '"]'); - + if ($(e.target).val() == 'enabled') { $dropdowns.removeAttr('disabled'); } else { - $dropdowns.attr('disabled', 'disabled'); - } + $dropdowns.attr('disabled', 'disabled'); + } } }, Dep.prototype.events), - + fetch: function () { - var data = Dep.prototype.fetch.call(this); - + var data = Dep.prototype.fetch.call(this); + data['data'] = {}; - + var scopeList = this.getView('extra').scopeList; - var actionList = this.getView('extra').actionList; + var actionList = this.getView('extra').actionList; var aclTypeMap = this.getView('extra').aclTypeMap; - - for (var i in scopeList) { - var scope = scopeList[i]; - if (this.$el.find('select[name="' + scope + '"]').val() == 'not-set') { + + for (var i in scopeList) { + var scope = scopeList[i]; + if (this.$el.find('select[name="' + scope + '"]').val() == 'not-set') { continue; - } + } if (this.$el.find('select[name="' + scope + '"]').val() == 'disabled') { data['data'][scope] = false; } else { @@ -64,7 +64,7 @@ Espo.define('Views.Role.Record.Edit', 'Views.Record.Edit', function (Dep) { } } data['data'][scope] = o; - } + } } data['data'] = JSON.stringify(data['data']); @@ -79,23 +79,23 @@ Espo.define('Views.Role.Record.Edit', 'Views.Record.Edit', function (Dep) { { name: 'name', type: 'varchar', - }, + }, ] - } - ]; + } + ]; callback({ type: 'record', layout: this._convertSimplifiedLayout(simpleLayout) }); }, - + setup: function () { - Dep.prototype.setup.call(this); - + Dep.prototype.setup.call(this); + this.createView('extra', 'Role.Record.Table', { mode: 'edit', aclData: JSON.parse(this.model.get('data') || '{}') || {} - }); + }); }, }); });