aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/issues/search.html.erb1
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issue_detail.hbs.erb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issue_detail_set_severity_form.hbs.erb16
-rw-r--r--sonar-server/src/main/webapp/javascripts/navigator/issues.js57
-rw-r--r--sonar-server/src/main/webapp/stylesheets/style.css4
5 files changed, 78 insertions, 2 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/search.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/search.html.erb
index c1d758e2e36..8d86d8813a5 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/search.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/search.html.erb
@@ -20,6 +20,7 @@
<%= render :partial => '/issues/templates/issue_detail.hbs' -%>
<%= render :partial => '/issues/templates/issue_detail_comment_form.hbs' -%>
<%= render :partial => '/issues/templates/issue_detail_rule.hbs' -%>
+<%= render :partial => '/issues/templates/issue_detail_set_severity_form.hbs' -%>
<script>
_.templateSettings = {
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issue_detail.hbs.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issue_detail.hbs.erb
index dd3a402b859..658460581c6 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issue_detail.hbs.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issue_detail.hbs.erb
@@ -166,7 +166,7 @@
<ul style="display: none" class="dropdown-menu">
{{#inArray actions "set_severity"}}
<li>
- <a id="issue-change-severity" class="link-action spacer-right">{{translate "actions.set_severity"}}</a>
+ <a id="issue-set-severity" class="link-action spacer-right">{{translate "actions.set_severity"}}</a>
</li>
{{/inArray}}
{{#pluginActions actions}}
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issue_detail_set_severity_form.hbs.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issue_detail_set_severity_form.hbs.erb
new file mode 100644
index 00000000000..7e164a5bfd2
--- /dev/null
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issue_detail_set_severity_form.hbs.erb
@@ -0,0 +1,16 @@
+<script id="issue-detail-set-severity-form-template" type="text/x-handlebars-template">
+ <table class="width100">
+ <tr>
+ <td style="vertical-align:top">
+ <select id="issue-set-severity-select" autofocus>
+ <% Severity::KEYS.each do |severity| %>
+ <option class="sev_<%= severity -%>" value="<%= severity -%>" <%= 'selected' if severity==Severity::MAJOR -%>><%= message("severity.#{severity}") -%></option>
+ <% end %>
+ </select>
+
+ <input id="issue-set-severity-submit" type="submit" value="<%= message('issue.set_severity.submit') -%>">
+ <a id="issue-set-severity-cancel" class="link-action"><%= message('cancel') -%></a>
+ </td>
+ </tr>
+ </table>
+</script>
diff --git a/sonar-server/src/main/webapp/javascripts/navigator/issues.js b/sonar-server/src/main/webapp/javascripts/navigator/issues.js
index bd28e7c7d62..6502cb843fc 100644
--- a/sonar-server/src/main/webapp/javascripts/navigator/issues.js
+++ b/sonar-server/src/main/webapp/javascripts/navigator/issues.js
@@ -421,6 +421,51 @@ jQuery(function() {
+ var IssueDetailSetSeverityFormView = Backbone.Marionette.ItemView.extend({
+ template: Handlebars.compile(jQuery('#issue-detail-set-severity-form-template').html() || ''),
+
+
+ ui: {
+ select: '#issue-set-severity-select'
+ },
+
+
+ events: {
+ 'click #issue-set-severity-cancel': 'cancel',
+ 'click #issue-set-severity-submit': 'submit'
+ },
+
+
+ onRender: function() {
+ this.ui.select.select2({
+ minimumResultsForSearch: 100
+ });
+ },
+
+
+ cancel: function() {
+ this.options.detailView.updateAfterAction(false);
+ },
+
+
+ submit: function() {
+ var that = this;
+
+ jQuery.ajax({
+ type: 'POST',
+ url: baseUrl + '/api/issues/set_severity',
+ data: {
+ issue: this.options.issue.get('key'),
+ severity: this.ui.select.val()
+ }
+ }).done(function() {
+ that.options.detailView.updateAfterAction(true);
+ });
+ }
+ });
+
+
+
var IssueDetailRuleView = Backbone.Marionette.ItemView.extend({
template: Handlebars.compile(jQuery('#issue-detail-rule-template').html() || ''),
className: 'rule-desc',
@@ -445,7 +490,8 @@ jQuery(function() {
'click #issue-comment': 'comment',
'click .issue-comment-edit': 'editComment',
'click .issue-comment-delete': 'deleteComment',
- 'click .issue-transition': 'transition'
+ 'click .issue-transition': 'transition',
+ 'click #issue-set-severity': 'setSeverity'
},
@@ -551,6 +597,15 @@ jQuery(function() {
}).done(function() {
that.model.fetch();
});
+ },
+
+
+ setSeverity: function() {
+ var setSeverityFormView = new IssueDetailSetSeverityFormView({
+ issue: this.model,
+ detailView: this
+ });
+ this.showActionView(setSeverityFormView);
}
});
diff --git a/sonar-server/src/main/webapp/stylesheets/style.css b/sonar-server/src/main/webapp/stylesheets/style.css
index 0a591220c92..9e2a5248033 100644
--- a/sonar-server/src/main/webapp/stylesheets/style.css
+++ b/sonar-server/src/main/webapp/stylesheets/style.css
@@ -828,6 +828,10 @@ th.operations, td.operations {
padding: 5px 10px;
}
+.code-issue-form input[type=submit] {
+ vertical-align: middle;
+}
+
.code-issue-comment h4 {
font-size: 11px;
margin-bottom: 2px;