mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
delete tag group
This commit is contained in:
parent
0181f22c70
commit
aa3152530c
5 changed files with 30 additions and 2 deletions
|
@ -1,7 +1,27 @@
|
|||
export default Ember.Controller.extend({
|
||||
needs: ['tagGroups'],
|
||||
|
||||
actions: {
|
||||
save() {
|
||||
this.get('model').save();
|
||||
},
|
||||
|
||||
destroy() {
|
||||
const self = this;
|
||||
return bootbox.confirm(
|
||||
I18n.t("tagging.groups.confirm_delete"),
|
||||
I18n.t("no_value"),
|
||||
I18n.t("yes_value"),
|
||||
function(destroy) {
|
||||
if (destroy) {
|
||||
const c = self.controllerFor('tagGroups');
|
||||
return self.get('model').destroy().then(function() {
|
||||
c.removeObject(self.get('model'));
|
||||
self.transitionToRoute('tagGroups');
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -7,7 +7,7 @@ const TagGroup = RestModel.extend({
|
|||
return Ember.isEmpty(this.get('name')) || Ember.isEmpty(this.get('tag_names')) || this.get('saving');
|
||||
},
|
||||
|
||||
save: function() {
|
||||
save() {
|
||||
var url = "/tag_groups",
|
||||
self = this;
|
||||
if (this.get('id')) {
|
||||
|
@ -28,6 +28,10 @@ const TagGroup = RestModel.extend({
|
|||
self.set('savingStatus', I18n.t('saved'));
|
||||
self.set('saving', false);
|
||||
});
|
||||
},
|
||||
|
||||
destroy() {
|
||||
return Discourse.ajax("/tag_groups/" + this.get('id'), {type: "DELETE"});
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -8,5 +8,6 @@
|
|||
</div>
|
||||
<br/>
|
||||
<button {{action "save"}} disabled={{model.disableSave}} class='btn'>{{i18n 'tagging.groups.save'}}</button>
|
||||
<button {{action "destroy"}} class='btn btn-danger'><i class="fa fa-trash-o"></i> {{i18n 'tagging.groups.delete'}}</button>
|
||||
<span class="saving {{unless model.savingStatus 'hidden'}}">{{model.savingStatus}}</span>
|
||||
</div>
|
|
@ -229,7 +229,8 @@ header .discourse-tag {color: $tag-color !important; }
|
|||
height: 150px !important; // to fight with select2.scss's important
|
||||
}
|
||||
}
|
||||
.btn {margin-left: 10px;}
|
||||
.saving {
|
||||
margin-left: 10px;
|
||||
margin-left: 20px;
|
||||
}
|
||||
}
|
|
@ -3014,6 +3014,8 @@ en:
|
|||
tags_label: "Tags in this group:"
|
||||
new_name: "New Tag Group"
|
||||
save: "Save"
|
||||
delete: "Delete"
|
||||
confirm_delete: "Are you sure you want to delete this tag group?"
|
||||
|
||||
topics:
|
||||
none:
|
||||
|
|
Loading…
Reference in a new issue