diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-11-18 09:55:57 +0100 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-11-18 11:31:57 +0100 |
commit | 0b95111aa150d768dfc1d954bbfa01ffcb342770 (patch) | |
tree | 57f8f9efb879da1da025aedee939e7d395684fdd | |
parent | 6cd23f9e6c49c4731da4c878c9891dd3cec8d08d (diff) | |
download | sonarqube-0b95111aa150d768dfc1d954bbfa01ffcb342770.tar.gz sonarqube-0b95111aa150d768dfc1d954bbfa01ffcb342770.zip |
SONAR-6907 apply feedback
2 files changed, 23 insertions, 6 deletions
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/restore-built-in-profiles-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/restore-built-in-profiles-view.js index 935f862bd07..9ac31668b06 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/restore-built-in-profiles-view.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/restore-built-in-profiles-view.js @@ -2,9 +2,15 @@ import $ from 'jquery'; import _ from 'underscore'; import ModalFormView from '../../components/common/modal-form'; import Template from './templates/quality-profiles-restore-built-in-profiles.hbs'; +import TemplateSuccess from './templates/quality-profiles-restore-built-in-profiles-success.hbs'; export default ModalFormView.extend({ template: Template, + successTemplate: TemplateSuccess, + + getTemplate: function () { + return this.selectedLanguage ? this.successTemplate : this.template; + }, onFormSubmit: function () { ModalFormView.prototype.onFormSubmit.apply(this, arguments); @@ -24,8 +30,8 @@ export default ModalFormView.extend({ var that = this, url = baseUrl + '/api/qualityprofiles/restore_built_in', lang = this.$('#restore-built-in-profiles-language').val(), - langName = _.findWhere(this.options.languages, { key: lang }).name, options = { language: lang }; + this.selectedLanguage = _.findWhere(this.options.languages, { key: lang }).name; return $.ajax({ type: 'POST', url: url, @@ -37,10 +43,7 @@ export default ModalFormView.extend({ }).done(function () { that.collection.fetch({ reset: true }); that.collection.trigger('destroy'); - that.$('#restore-built-in-profiles-form-success') - .text(window.tp('quality_profiles.restore_built_in_profiles_success_message', langName)) - .removeClass('hidden'); - that.enableForm(); + that.render(); }).fail(function (jqXHR) { that.showErrors(jqXHR.responseJSON.errors, jqXHR.responseJSON.warnings); that.enableForm(); @@ -49,7 +52,8 @@ export default ModalFormView.extend({ serializeData: function () { return _.extend(ModalFormView.prototype.serializeData.apply(this, arguments), { - languages: this.options.languages + languages: this.options.languages, + selectedLanguage: this.selectedLanguage }); } }); diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-restore-built-in-profiles-success.hbs b/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-restore-built-in-profiles-success.hbs new file mode 100644 index 00000000000..41c449e88d4 --- /dev/null +++ b/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-restore-built-in-profiles-success.hbs @@ -0,0 +1,13 @@ +<form id="restore-built-in-profiles-form"> + <div class="modal-head"> + <h2>{{t 'quality_profiles.restore_built_in_profiles'}}</h2> + </div> + <div class="modal-body"> + <div class="alert alert-success"> + {{tp 'quality_profiles.restore_built_in_profiles_success_message' selectedLanguage}} + </div> + </div> + <div class="modal-foot"> + <a href="#" class="js-modal-close">{{t 'close'}}</a> + </div> +</form> |