From: Simon Brandhof Date: Sun, 30 Sep 2012 16:03:00 +0000 (+0200) Subject: SONAR-2602 complete messages + refactor the ruby helper link_to_action X-Git-Tag: 3.3~169 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8a4202ca07b467cf99aa0065308aa98a898021f4;p=sonarqube.git SONAR-2602 complete messages + refactor the ruby helper link_to_action --- diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties index 267ccceeffe..5003e8c59c8 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties @@ -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 diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb index 8720d718e20..465d2ada0b4 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb @@ -725,29 +725,29 @@ module ApplicationHelper # ==== Options # * :id - HTML ID of the button # * :class - Additional CSS class, generally 'red-button' for deletions - # * :button_key - Default is 'confirm' - # * :title_key - - # * :message_key - - # * :message_params - - # * :width - width in pixels + # * :confirm_button - L10n key of the confirmation button + # * :confirm_title - L10n key of the confirmation title + # * :confirm_msg - L10n key of the confirmation message + # * :confirm_msg_params - Array of parameters used for building the confirmation message + # * :confirm_width - 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=#{u 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=#{u message_key}&" + url += message_params.map{|p| "mp[]=#{u p}"}.join('&') if message_params end if button_key - url += "&bk=#{button_key}" + url += "&bk=#{u button_key}" end "#{h label}" diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/confirm/_confirm.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/confirm/_confirm.html.erb index 63c5e59835a..5a13c773ed8 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/confirm/_confirm.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/confirm/_confirm.html.erb @@ -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 %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb index 50efc517ad0..8a308747afa 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb @@ -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}" %> @@ -100,10 +100,10 @@ <%= 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 %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/projects.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/projects.html.erb index fc19e5201a8..3aa33d6a880 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/projects.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/projects.html.erb @@ -1,4 +1,5 @@ -

<%= link_to message('quality_profiles.quality_profiles'), :controller => 'profiles', :action => 'index' -%> / <%= h @profile.language -%> +

<%= link_to message('quality_profiles.quality_profiles'), :controller => 'profiles', :action => 'index' -%> + / <%= h @profile.language -%> / <%= h @profile.name %>

<%= render :partial => 'profiles/tabs', :locals => {:selected_tab => 'Projects'} %> @@ -30,10 +31,15 @@ <% @profile.sorted_projects.each do |project| %> - <%= 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] + -%> <%= h project.name -%> <%= h project.key -%> @@ -45,7 +51,11 @@ <%= 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' + -%>