diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2010-09-09 10:08:51 +0000 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2010-09-09 10:08:51 +0000 |
commit | faf5a6a1cbc3ebb5b28ac25c939ba05001a7adb9 (patch) | |
tree | e5757cbb95e76512055ae8cd634c812e2ad744c9 | |
parent | 088d62c2b7900dc594c090c3e5659df77dfe7fbb (diff) | |
download | sonarqube-faf5a6a1cbc3ebb5b28ac25c939ba05001a7adb9.tar.gz sonarqube-faf5a6a1cbc3ebb5b28ac25c939ba05001a7adb9.zip |
fix some issues on the page "permalinks" of profiles console :
* available for anonymous users
* url is wrong
4 files changed, 49 insertions, 44 deletions
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()) %> -<div class="line-block marginbottom10"> +<div class="line-block"> + <% if administrator? %> <ul style="float: right" class="horizontal"> <li class="marginleft10 add"> <a href="#" onClick="$('create-form-<%= language.getKey() -%>').show();return false;">Create</a> @@ -11,6 +12,7 @@ <a href="#" onclick="$('restore-form-<%= language.getKey() -%>').show();return false;">Restore</a> </li> </ul> + <% end %> <h2><%= language.getName() %> profiles</h2> </div> @@ -70,7 +72,9 @@ <th class="right">Alerts</th> <th class="right">Projects</th> <th class="right">Default</th> + <% if administrator? %> <th width="1%" class="right" colspan="4">Operations</th> + <% end %> </tr> </thead> <tbody> @@ -91,56 +95,57 @@ </td> <td align="right"> - <% 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 %> </td> + <% if administrator? %> + <td align="right"> + <% if !profile.provided? %> + <% form_tag(:action => 'backup', :id => profile.id) do -%> + <input type="submit" name="button_backup" id="backup_<%= u profile.key %>" value="Backup"></input> + <% end + end %> + </td> <td align="right"> - <% if (!profile.provided? && administrator?) %> - <% form_tag(:action => 'backup', :id => profile.id) do -%> - <input type="submit" name="button_backup" id="backup_<%= u profile.key %>" value="Backup"></input> - <% end - end %> - </td> + <% if !profile.provided? %> + <% form_tag(:action => 'rename', :id => profile.id) do -%> + <%= hidden_field_tag 'rename_' + profile.id.to_s %> + <input type="button" name="button_rename" id="rename_<%= u profile.key %>" value="Rename" onClick='var name=prompt("New name"); if (name!=null) {$("rename_<%= profile.id %>").value=name; submit();} else {return false;}'> + <% end + end %> + </td> - <td align="right"> - <% if !profile.provided? && administrator? %> - <% form_tag(:action => 'rename', :id => profile.id) do -%> - <%= hidden_field_tag 'rename_' + profile.id.to_s %> - <input type="button" name="button_rename" id="rename_<%= u profile.key %>" value="Rename" onClick='var name=prompt("New name"); if (name!=null) {$("rename_<%= profile.id %>").value=name; submit();} else {return false;}'> - <% end - end %> - </td> + <td align="right"> + <% form_tag(:action => 'copy', :id => profile.id) do -%> + <%= hidden_field_tag 'copy_' + profile.id.to_s %> + <input type="button" name="button_copy" id="copy_<%= u profile.key %>" value="Copy" onClick='var name=prompt("Name for the new profile"); if (name!=null) {$("copy_<%= profile.id %>").value=name; submit();} else {return false;}'> + <% end + </td> - <td align="right"> - <% if administrator? %> - <% form_tag(:action => 'copy', :id => profile.id) do -%> - <%= hidden_field_tag 'copy_' + profile.id.to_s %> - <input type="button" name="button_copy" id="copy_<%= u profile.key %>" value="Copy" onClick='var name=prompt("Name for the new profile"); if (name!=null) {$("copy_<%= profile.id %>").value=name; submit();} else {return false;}'> - <% end - end %> - </td> + <td> + <% 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 %> + </td> - <td> - <% 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 %> - </td> + <% end %> </tr> <% end %> </tbody> </table> +<br/><br/> <% 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() -%> </td> <td> - <% permalink=url_for :action => 'export', :language => @profile.language, :name => url_encode(@profile.name), :format => exporter.getKey(), :only_path => false %> - <span class="small"><%= link_to permalink, :url => permalink, :id => "export_" + exporter.getKey().to_s + "_" + u(@profile.key) %></span> + <% permalink=url_for :controller => 'profiles', :action => 'export', :language => @profile.language, :name => url_encode(@profile.name), :format => exporter.getKey(), :only_path => false %> + <span class="small"><%= link_to permalink, permalink, :id => "export_" + exporter.getKey().to_s + "_" + u(@profile.key) %></span> </td> </tr> <% 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' %> </p> <p> - <%= submit_tag 'Log in' %> <a href="<%= home_path -%>" class="action">cancel</a> + <%= submit_tag 'Log in' %> <a href="<%= home_path -%>" class="action">Cancel</a> </p> </form> <% if flash[:loginerror] %> |