diff --git a/app/assets/javascripts/discourse/controllers/tag-groups-show.js.es6 b/app/assets/javascripts/discourse/controllers/tag-groups-show.js.es6 index 1def5910f..1eca5728a 100644 --- a/app/assets/javascripts/discourse/controllers/tag-groups-show.js.es6 +++ b/app/assets/javascripts/discourse/controllers/tag-groups-show.js.es6 @@ -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'); + }); + } + } + ); } } }); diff --git a/app/assets/javascripts/discourse/models/tag-group.js.es6 b/app/assets/javascripts/discourse/models/tag-group.js.es6 index 2bebcc333..6ab079c37 100644 --- a/app/assets/javascripts/discourse/models/tag-group.js.es6 +++ b/app/assets/javascripts/discourse/models/tag-group.js.es6 @@ -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"}); } }); diff --git a/app/assets/javascripts/discourse/templates/tag-groups-show.hbs b/app/assets/javascripts/discourse/templates/tag-groups-show.hbs index e2555d40e..aec3ce6e5 100644 --- a/app/assets/javascripts/discourse/templates/tag-groups-show.hbs +++ b/app/assets/javascripts/discourse/templates/tag-groups-show.hbs @@ -8,5 +8,6 @@
+ {{model.savingStatus}} \ No newline at end of file diff --git a/app/assets/stylesheets/common/base/tagging.scss b/app/assets/stylesheets/common/base/tagging.scss index c1ed04ec9..3d90c7709 100644 --- a/app/assets/stylesheets/common/base/tagging.scss +++ b/app/assets/stylesheets/common/base/tagging.scss @@ -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; } } \ No newline at end of file diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index b9e43f883..1cbcce0e7 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -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: