aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorstephenbroyer <stephen.broyer@sonarsource.com>2013-08-07 18:27:19 +0200
committerstephenbroyer <stephen.broyer@sonarsource.com>2013-08-09 16:20:28 +0200
commit7b1835e8cbecd91f56af45f20da9409d0ba3b9ef (patch)
tree6cd3cf46b3eeca4c9b137035dd0719cee22a7706 /sonar-server
parentdb58d55d4f1003359380545968216dcf2024e154 (diff)
downloadsonarqube-7b1835e8cbecd91f56af45f20da9409d0ba3b9ef.tar.gz
sonarqube-7b1835e8cbecd91f56af45f20da9409d0ba3b9ef.zip
SONAR-4517 move Quality Profiles pages to Jquery
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule.html.erb18
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/index.html.erb2
2 files changed, 9 insertions, 11 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule.html.erb
index d25dac950c9..6e735af4d2b 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule.html.erb
@@ -3,17 +3,15 @@
<% enable_modification = profiles_administrator?
select_box_id = "levels_select_#{rule.id}"
check_box_id = "levels_check_#{rule.id}"
- rule_select_box = "$('#{select_box_id}')"
- rule_check_box = "$('#{check_box_id}')"
- changel_level = remote_function(
- :url => {:action => 'activate_rule', :rule_id => rule.id, :id => profile.id},
- :loading => "$('levels_#{rule.id}').replace('<img src=\"#{ApplicationController.root_context}/images/loading.gif\"/>');",
- :with => "'level=' + #{rule_select_box}.value", :condition => "#{rule_check_box}.checked")
- activate_rule = remote_function(
- :url => {:action => 'activate_rule', :rule_id => rule.id, :id => profile.id},
- :loading => "$('levels_#{rule.id}').replace('<img src=\"#{ApplicationController.root_context}/images/loading.gif\"/>');",
- :with => "'level=' + get_level_for_rule(#{rule_select_box},#{rule_check_box})")
+ activate_rule = "$j.ajax({url:'#{ApplicationController.root_context}/rules_configuration/activate_rule/#{profile.id}?rule_id=#{rule.id}',type: 'POST',
+ beforeSend: function(request){$j('#levels_#{rule.id}').replaceWith('<img src=\"#{ApplicationController.root_context}/images/loading.gif\"/>');},
+ data: 'level='+ get_level_for_rule($j('#levels_select_#{rule.id} :selected'),$j('#levels_check_#{rule.id}'))});"
+ changel_level = "if($j('#levels_check_#{rule.id}').prop('checked'))
+ {$j.ajax({url:'#{ApplicationController.root_context}/rules_configuration/activate_rule/#{profile.id}?rule_id=#{rule.id}',type:'POST',
+ beforeSend:function(request){$j('#levels_#{rule.id}').replaceWith('<img src=\"#{ApplicationController.root_context}/images/loading.gif\"/>');},
+ data:'level='+$j('#levels_select_#{rule.id} :selected').val()})}"
%>
+
<%= check_box_tag(check_box_id, 'yes', (!active_rule.nil?), :onclick => activate_rule, :disabled => !enable_modification || (active_rule && (active_rule.inherited? || active_rule.overrides?))) %>
<%= select_tag(select_box_id, options_for_select(RulesConfigurationController::RULE_PRIORITIES, (active_rule.nil? ? rule.priority_text : active_rule.priority_text)),
{:onchange => changel_level, :disabled => (!(enable_modification) || active_rule.nil?)}) %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/index.html.erb
index f1b85a44719..ba9dc323455 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/index.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/index.html.erb
@@ -2,7 +2,7 @@
var localModifications=false;
function get_level_for_rule(rule_select_box,rule_check_box) {
- return rule_check_box.checked ? rule_select_box.value : '';
+ return rule_check_box.prop('checked') ? rule_select_box.val() : '';
}
function submitBulkForm() {