submitExtendDescription() {
const that = this;
this.ui.extendDescriptionForm.addClass('hidden');
+ const data = {
+ key: this.model.get('key'),
+ markdown_note: this.ui.extendDescriptionText.val()
+ };
+ if (this.options.app.organization) {
+ data.organization = this.options.app.organization;
+ }
return $.ajax({
type: 'POST',
url: window.baseUrl + '/api/rules/update',
dataType: 'json',
- data: {
- key: this.model.get('key'),
- markdown_note: this.ui.extendDescriptionText.val()
- }
+ data
})
.done(r => {
that.model.set({
return {
...Marionette.ItemView.prototype.serializeData.apply(this, arguments),
isCustom: this.model.get('isCustom'),
- canCustomizeRule: this.options.app.canWrite && this.options.app.customRules
+ canCustomizeRule: this.options.app.canWrite
};
}
});
requestTags() {
const url = window.baseUrl + '/api/rules/tags';
- return $.get(url);
+ const data = this.options.app.organization
+ ? { organization: this.options.app.organization }
+ : undefined;
+ return $.get(url, data);
},
changeTags() {
editDone() {
const that = this;
const tags = this.ui.tagInput.val();
+ const data = { key: this.model.get('key'), tags };
+ if (this.options.app.organization) {
+ data.organization = this.options.app.organization;
+ }
return $.ajax({
type: 'POST',
url: window.baseUrl + '/api/rules/update',
- data: {
- key: this.model.get('key'),
- tags
- }
+ data
})
.done(r => {
that.model.set('tags', r.rule.tags);
return {
...Marionette.ItemView.prototype.serializeData.apply(this, arguments),
- canCustomizeRule: this.options.app.canWrite && this.options.app.customRules,
+ canCustomizeRule: this.options.app.canWrite,
allTags: union(this.model.get('sysTags'), this.model.get('tags')),
permalink: window.baseUrl + permalinkPath + '#rule_key=' + encodeURIComponent(this.model.id)
};
data-toggle="tooltip" data-placement="bottom" title="Rule tags">
<i class="icon-tags"></i>
<span>{{#if allTags}}{{join allTags ', '}}{{else}}{{t 'coding_rules.no_tags'}}{{/if}}</span>
- {{#if canWrite}}<i class="icon-dropdown"></i>{{/if}}
+ {{#if canCustomizeRule}}<i class="icon-dropdown"></i>{{/if}}
</li>
{{#if canCustomizeRule}}