diff options
Diffstat (limited to 'server/sonar-web/src/main/js/quality-profiles/profile-details-view.js')
-rw-r--r-- | server/sonar-web/src/main/js/quality-profiles/profile-details-view.js | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/server/sonar-web/src/main/js/quality-profiles/profile-details-view.js b/server/sonar-web/src/main/js/quality-profiles/profile-details-view.js index bf4dc4b5c48..9c08fb31ac8 100644 --- a/server/sonar-web/src/main/js/quality-profiles/profile-details-view.js +++ b/server/sonar-web/src/main/js/quality-profiles/profile-details-view.js @@ -18,9 +18,13 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ define([ + 'quality-profiles/change-profile-parent-view', 'common/select-list', + 'quality-profiles/helpers', 'templates/quality-profiles' -], function () { +], function (ChangeProfileParentView) { + + var $ = jQuery; return Marionette.ItemView.extend({ template: Templates['quality-profiles-profile-details'], @@ -29,6 +33,11 @@ define([ 'change': 'render' }, + events: { + 'click .js-profile': 'onProfileClick', + 'click #quality-profile-change-parent': 'onChangeParentClick' + }, + onRender: function () { var key = this.model.get('key'); if (!this.model.get('isDefault')) { @@ -52,7 +61,7 @@ define([ selected: t('quality_gates.projects.with'), deselected: t('quality_gates.projects.without'), all: t('quality_gates.projects.all'), - noResults: t('quality_gates.projects.noResults'), + noResults: t('quality_gates.projects.noResults') }, tooltips: { select: t('quality_gates.projects.select_hint'), @@ -62,6 +71,26 @@ define([ } }, + onProfileClick: function (e) { + var key = $(e.currentTarget).data('key'), + profile = this.model.collection.get(key); + if (profile != null) { + e.preventDefault(); + this.model.collection.trigger('select', profile); + } + }, + + onChangeParentClick: function (e) { + e.preventDefault(); + this.changeParent(); + }, + + changeParent: function () { + new ChangeProfileParentView({ + model: this.model + }).render(); + }, + serializeData: function () { var key = this.model.get('key'), rulesSearchUrl = '/coding_rules#qprofile=' + encodeURIComponent(key) + '|activation=true'; |