From faf5a6a1cbc3ebb5b28ac25c939ba05001a7adb9 Mon Sep 17 00:00:00 2001 From: simonbrandhof Date: Thu, 9 Sep 2010 10:08:51 +0000 Subject: fix some issues on the page "permalinks" of profiles console : * available for anonymous users * url is wrong --- .../WEB-INF/app/controllers/profiles_controller.rb | 2 +- .../WEB-INF/app/views/profiles/index.html.erb | 85 ++++++++++++---------- .../WEB-INF/app/views/profiles/permalinks.html.erb | 4 +- .../webapp/WEB-INF/app/views/sessions/login.rhtml | 2 +- 4 files changed, 49 insertions(+), 44 deletions(-) (limited to 'sonar-server/src') diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb index 64cf71cec06..1cf760c2b3a 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb @@ -21,7 +21,7 @@ class ProfilesController < ApplicationController SECTION=Navigation::SECTION_CONFIGURATION verify :method => :post, :only => ['create', 'delete', 'copy', 'set_as_default', 'restore', 'backup', 'set_projects', 'rename'], :redirect_to => { :action => 'index' } - before_filter :admin_required, :except => [ 'index', 'show', 'projects' ] + before_filter :admin_required, :except => [ 'index', 'show', 'projects', 'permalinks', 'export' ] # # 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 c259dac4a46..df7b69fcda4 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 @@ -2,7 +2,8 @@ languages.sort{|x,y| x.getName() <=> y.getName()}.each do |language| importers=controller.java_facade.getProfileImportersForLanguage(language.getKey()) %> -
+
+ <% if administrator? %> + <% end %>

<%= language.getName() %> profiles

@@ -70,7 +72,9 @@ Alerts Projects Default + <% if administrator? %> Operations + <% end %> @@ -91,56 +95,57 @@ - <% if (!profile.default_profile? && administrator?) %> - <%= button_to 'Set as default', { :action => 'set_as_default', :id => profile.id }, :class => 'action', - :id => "activate_#{u profile.key}", - :confirm => "Are you sure that you want to set the profile '#{profile.name}' as default ?", - :method => :post %> - <% end %> - <% if profile.default_profile? %> - <%= image_tag 'tick.png', :id => "is_active_#{u profile.key}" %> - <% end %> + <% if (!profile.default_profile? && administrator?) %> + <%= button_to 'Set as default', { :action => 'set_as_default', :id => profile.id }, :class => 'action', + :id => "activate_#{u profile.key}", + :confirm => "Are you sure that you want to set the profile '#{profile.name}' as default ?", + :method => :post %> + <% end %> + <% if profile.default_profile? %> + <%= image_tag 'tick.png', :id => "is_active_#{u profile.key}" %> + <% end %> + <% if administrator? %> + + <% if !profile.provided? %> + <% form_tag(:action => 'backup', :id => profile.id) do -%> + + <% end + end %> + - <% if (!profile.provided? && administrator?) %> - <% form_tag(:action => 'backup', :id => profile.id) do -%> - - <% end - end %> - + <% if !profile.provided? %> + <% form_tag(:action => 'rename', :id => profile.id) do -%> + <%= hidden_field_tag 'rename_' + profile.id.to_s %> + + <% end + end %> + - - <% if !profile.provided? && administrator? %> - <% form_tag(:action => 'rename', :id => profile.id) do -%> - <%= hidden_field_tag 'rename_' + profile.id.to_s %> - - <% end - end %> - + + <% form_tag(:action => 'copy', :id => profile.id) do -%> + <%= hidden_field_tag 'copy_' + profile.id.to_s %> + + <% end + - - <% if administrator? %> - <% form_tag(:action => 'copy', :id => profile.id) do -%> - <%= hidden_field_tag 'copy_' + profile.id.to_s %> - - <% end - end %> - + + <% if (!(profile.provided?) && !(profile.default_profile?)) %> + <%= button_to "Delete", { :action => 'delete', :id => profile.id }, :class => 'action', + :id => "delete_#{u profile.key}", + :confirm => "Are you sure that you want to delete the profile '#{profile.name}' ?", + :method => :post %> + <% end %> + - - <% if (!(profile.provided?) && !(profile.default_profile?) && administrator?) %> - <%= button_to "Delete", { :action => 'delete', :id => profile.id }, :class => 'action', - :id => "delete_#{u profile.key}", - :confirm => "Are you sure that you want to delete the profile '#{profile.name}' ?", - :method => :post %> - <% end %> - + <% end %> <% end %> +

<% end %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/permalinks.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/permalinks.html.erb index 5f4fc6d131c..3989f6a0471 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/permalinks.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/permalinks.html.erb @@ -14,8 +14,8 @@ <%= h exporter.getName() -%> - <% permalink=url_for :action => 'export', :language => @profile.language, :name => url_encode(@profile.name), :format => exporter.getKey(), :only_path => false %> - <%= link_to permalink, :url => permalink, :id => "export_" + exporter.getKey().to_s + "_" + u(@profile.key) %> + <% permalink=url_for :controller => 'profiles', :action => 'export', :language => @profile.language, :name => url_encode(@profile.name), :format => exporter.getKey(), :only_path => false %> + <%= link_to permalink, permalink, :id => "export_" + exporter.getKey().to_s + "_" + u(@profile.key) %> <% end %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/sessions/login.rhtml b/sonar-server/src/main/webapp/WEB-INF/app/views/sessions/login.rhtml index 1761378c8a0..6a95a10cc23 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/sessions/login.rhtml +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/sessions/login.rhtml @@ -19,7 +19,7 @@ <%= check_box_tag 'remember_me', '1', @remember_me %> <%= label_tag 'remember_me', 'Remember me on this computer' %>

- <%= submit_tag 'Log in' %> cancel + <%= submit_tag 'Log in' %> Cancel

<% if flash[:loginerror] %> -- cgit v1.2.3