]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2602 complete messages + refactor the ruby helper link_to_action
authorSimon Brandhof <simon.brandhof@gmail.com>
Sun, 30 Sep 2012 16:03:00 +0000 (18:03 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Sun, 30 Sep 2012 16:03:00 +0000 (18:03 +0200)
plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties
sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb
sonar-server/src/main/webapp/WEB-INF/app/views/confirm/_confirm.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/profiles/projects.html.erb

index 267ccceeffe3f40a3d3e5da2b962dbdaccf41197..5003e8c59c80d22a27a6f5a47f2083abd03dad95 100644 (file)
@@ -1193,7 +1193,15 @@ quality_profiles.with_same_configuration=With same configuration
 quality_profiles.x_rules_only_in={0} rules only in
 quality_profiles.x_rules_have_different_configuration={0} rules have a different configuration
 quality_profiles.export_all_rules=All rules
+quality_profiles.remove_project_action=Remove
 quality_profiles.remove_projects_action=Remove All
+quality_profiles.add_project_action=Add Project
+quality_profiles.remove_project_confirm_title=Remove Project from Profile
+quality_profiles.remove_project_confirm_message=Are you sure you want to dissociate the project {0} from this profile ? The default profile will be used during next analysis of this project.
+quality_profiles.remove_project_confirm_button=Remove
+quality_profiles.remove_projects_confirm_title=Remove All Projects from Profile
+quality_profiles.remove_projects_confirm_message=Are you sure you want to dissociate all projects from this profile ? The default profile will be used during next analysis of these projects.
+quality_profiles.remove_projects_confirm_button=Remove All
 quality_profiles.copy_x_title=Copy Profile {0}
 quality_profiles.copy_new_name=New Name
 
index 8720d718e204a710f0d6b32c54e1ed82f08520cb..465d2ada0b472c28f1b626ffe77eebdccdfd005a 100644 (file)
@@ -725,29 +725,29 @@ module ApplicationHelper
   # ==== Options
   # * <tt>:id</tt> - HTML ID of the button
   # * <tt>:class</tt> - Additional CSS class, generally 'red-button' for deletions
-  # * <tt>:button_key</tt> - Default is 'confirm'
-  # * <tt>:title_key</tt> -
-  # * <tt>:message_key</tt> -
-  # * <tt>:message_params</tt> -
-  # * <tt>:width</tt> - width in pixels
+  # * <tt>:confirm_button</tt> - L10n key of the confirmation button
+  # * <tt>:confirm_title</tt> - L10n key of the confirmation title
+  # * <tt>:confirm_msg</tt> - L10n key of the confirmation message
+  # * <tt>:confirm_msg_params</tt> - Array of parameters used for building the confirmation message
+  # * <tt>:confirm_width</tt> - width in pixels of the confirmation pop-up
   #
   def link_to_action(label, post_url, options={})
     clazz = options[:class]
     id = "id='#{options[:id]}'" if options[:id]
-    title_key = options[:title_key]
-    button_key = options[:button_key]
-    message_key = options[:message_key]
-    message_params = options[:message_params]
-    width = options[:width]||500
+    title_key = options[:confirm_title]
+    button_key = options[:confirm_button]
+    message_key = options[:confirm_msg]
+    message_params = options[:confirm_msg_params]
+    width = options[:confirm_width]||500
 
     url = "#{ApplicationController.root_context}/confirm?url=#{u post_url}"
-    url += "&tk=#{title_key}" if title_key
+    url += "&tk=#{title_key}" if title_key
     if message_key
-      url += "&mk=#{message_key}&"
-      url += message_params.map{|p| "mp=#{u p}"}.join('&') if message_params
+      url += "&mk=#{message_key}&"
+      url += message_params.map{|p| "mp[]=#{u p}"}.join('&') if message_params
     end
     if button_key
-      url += "&bk=#{button_key}"
+      url += "&bk=#{button_key}"
     end
 
     "<a href='#{url}' modal-width='#{width}' class='open-modal #{clazz}' #{id}>#{h label}</a>"
index 63c5e59835a118f32c04cc0aeab259a7214ddec8..5a13c773ed8e7534a623fca88c277deeed472ede 100644 (file)
@@ -1,7 +1,7 @@
 <%
    title_key = params[:tk] || 'confirm'
    message_key = params[:mk] || 'are_you_sure'
-   message_params = params[:mp] || []
+   message_params = params['mp'] || []
    button_key = params[:bk] || title_key
 %>
 <form id="confirm-form" method="post" action="<%= params[:url] -%>">
index 50efc517ad0930427c51be52b40bd92fa3caaf4b..8a308747afacb86be2b9ab3d4456095a4b41dac4 100644 (file)
@@ -65,9 +65,9 @@
             <%= link_to_action message('set_as_default'), "profiles/set_as_default?id=#{profile.id}",
                                                :id => "activate_#{profile.key.parameterize}",
                                                :class => 'button',
-                                               :title_key => 'set_as_default',
-                                               :message_key => 'quality_profiles.are_you_sure_want_x_profile_as_default',
-                                               :message_params => [profile.name] -%>
+                                               :confirm_title => 'set_as_default',
+                                               :confirm_msg => 'quality_profiles.are_you_sure_want_x_profile_as_default',
+                                               :confirm_msg_params => [profile.name] -%>
           <% end %>
           <% if profile.default_profile? %>
             <%= image_tag 'tick.png', :id => "is_active_#{u profile.key}" %>
               <%= link_to_action message('delete'), "profiles/delete/#{profile.id}",
                                    :class => 'button red-button',
                                    :id => "delete_#{profile.key.parameterize}",
-                                   :button_key => 'delete',
-                                   :title_key => 'quality_profiles.delete_confirm_title',
-                                   :message_key => 'quality_profiles.are_you_sure_want_delete_profile_x',
-                                   :message_params => [profile.name]
+                                   :confirm_button => 'delete',
+                                   :confirm_title => 'quality_profiles.delete_confirm_title',
+                                   :confirm_msg => 'quality_profiles.are_you_sure_want_delete_profile_x',
+                                   :confirm_msg_params => [profile.name]
               -%>
             <% end %>
           </td>
index fc19e5201a80fda4ec9642f1bbdeeef46174d63d..3aa33d6a880b4222eeac758a5e85332d48cf6c63 100644 (file)
@@ -1,4 +1,5 @@
-<h1 class="marginbottom10"><%= link_to message('quality_profiles.quality_profiles'), :controller => 'profiles', :action => 'index' -%> / <%= h @profile.language -%>
+<h1 class="marginbottom10"><%= link_to message('quality_profiles.quality_profiles'), :controller => 'profiles', :action => 'index' -%>
+  / <%= h @profile.language -%>
   / <%= h @profile.name %></h1>
 <%= render :partial => 'profiles/tabs', :locals => {:selected_tab => 'Projects'} %>
 
         <% @profile.sorted_projects.each do |project| %>
           <tr class="<%= cycle('even', 'odd') -%>">
             <td class="thin">
-              <%= link_to_action message('remove'),
+              <%= link_to_action message('quality_profiles.remove_project_action'),
                                  "#{ApplicationController.root_context}/profiles/remove_project?id=#{@profile.id}&project_id=#{project.id}",
                                  :class => 'link-action',
-                                 :id => "link-remove-#{project.key.parameterize}" -%>
+                                 :id => "link-remove-#{project.key.parameterize}",
+                                 :confirm_title => 'quality_profiles.remove_project_confirm_title',
+                                 :confirm_button => 'quality_profiles.remove_project_confirm_button',
+                                 :confirm_msg => 'quality_profiles.remove_project_confirm_message',
+                                 :confirm_msg_params => [project.name]
+              -%>
             </td>
             <td><%= h project.name -%> <span class="small gray"><%= h project.key -%></span></td>
           </tr>
             <%= link_to_action message('quality_profiles.remove_projects_action'),
                                "#{ApplicationController.root_context}/profiles/remove_projects?id=#{@profile.id}",
                                :class => 'link-action',
-                               :id => "link-remove-projects" -%>
+                               :id => "link-remove-projects",
+                               :confirm_title => 'quality_profiles.remove_projects_confirm_title',
+                               :confirm_button => 'quality_profiles.remove_projects_confirm_button',
+                               :confirm_msg => 'quality_profiles.remove_projects_confirm_message'
+            -%>
           </td>
         </tr>
         </tfoot>