diff options
17 files changed, 57 insertions, 49 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/admin_dashboards_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/admin_dashboards_controller.rb index d57f4dd806b..a6653fe99b5 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/admin_dashboards_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/admin_dashboards_controller.rb @@ -26,7 +26,7 @@ class AdminDashboardsController < ApplicationController before_filter :load_default_dashboards def index - @default_dashboards=::Dashboard.find(:all, :conditions => {:shared => true}) + @default_dashboards=::Dashboard.find(:all, :conditions => {:shared => true}).sort{|a,b| a.name.downcase<=>b.name.downcase} ids=@actives.map{|af| af.dashboard_id} if !ids.nil? && !ids.empty? @default_dashboards=@default_dashboards.reject!{|f| ids.include?(f.id) } diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/admin_filters_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/admin_filters_controller.rb index 8ac69071732..8e2202f50b3 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/admin_filters_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/admin_filters_controller.rb @@ -27,7 +27,7 @@ class AdminFiltersController < ApplicationController before_filter :load_active_filters def index - @shared_filters=::Filter.find(:all, :conditions => {:shared => true}) + @shared_filters=::Filter.find(:all, :conditions => {:shared => true}).sort{|a,b| a.name.downcase<=>b.name.downcase} ids=@actives.map{|af| af.filter_id} @shared_filters.reject!{|f| ids.include?(f.id) } end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb index b420f46502a..150d50153e0 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb @@ -31,8 +31,7 @@ class RolesController < ApplicationController def projects @projects=Project.find(:all, :conditions => {:enabled=>true, :scope => Project::SCOPE_SET, :qualifier => [Project::QUALIFIER_VIEW, Project::QUALIFIER_SUBVIEW, Project::QUALIFIER_PROJECT]}, - :include => ['user_roles', 'group_roles'], - :order => 'name') + :include => ['user_roles', 'group_roles']).sort{|a,b| a.name.downcase<=>b.name.downcase} end def edit_users diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/users_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/users_controller.rb index 7c54458f96c..cc5d91ad9ac 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/users_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/users_controller.rb @@ -52,7 +52,7 @@ class UsersController < ApplicationController end def index - @users = User.find(:all, :include => 'groups', :order => 'name') + @users = User.find(:all, :include => 'groups') if params[:id] @user = User.find(params[:id]) else @@ -69,7 +69,7 @@ class UsersController < ApplicationController end def change_password - @users = User.find(:all, :include => 'groups', :order => 'name') + @users = User.find(:all, :include => 'groups') @user = User.find(params[:id]) render :action => 'index', :id => params[:id] end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/group.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/group.rb index 3acfda55b1a..5db64145349 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/group.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/group.rb @@ -41,7 +41,8 @@ class Group < ActiveRecord::Base end def <=>(other) - return 1 if other.nil? - name<=>other.name + return -1 if name.nil? + return 1 if other.nil? || other.name.nil? + name.downcase<=>other.name.downcase end end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb index b21f4a4480e..6eb8b76436a 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb @@ -58,8 +58,10 @@ class Rule < ActiveRecord::Base !parent_id.nil? end - def <=>(rule) - name<=>rule.name + def <=>(other) + return -1 if other.nil? + return 1 if other.name.nil? + name.downcase<=>other.name.downcase end def name @@ -222,7 +224,7 @@ class Rule < ActiveRecord::Base end includes=(options[:include_parameters] ? :rules_parameters : nil) - rules = Rule.find(:all, :include => includes, :conditions => [conditions.join(" AND "), values]).sort_by { |rule| rule.name } + rules = Rule.find(:all, :include => includes, :conditions => [conditions.join(" AND "), values]).sort filter(rules, options) end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/user.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/user.rb index ac04601fe30..599c749be57 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/user.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/user.rb @@ -61,7 +61,6 @@ class User < ActiveRecord::Base result.blank? ? login : result end - def email=(value) write_attribute :email, (value ? value.downcase : nil) end @@ -79,7 +78,9 @@ class User < ActiveRecord::Base end def <=>(other) - name<=>other.name + return -1 if name.nil? + return 1 if other.name.nil? + name.downcase<=>other.name.downcase end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/event_categories/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/event_categories/index.html.erb index c1ea394f144..c2224d3ccf2 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/event_categories/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/event_categories/index.html.erb @@ -4,7 +4,7 @@ <table class="sortable data width100" id="event_categories"> <thead> <tr> - <th class="left">Name</th> + <th class="left sortfirstasc">Name</th> <th class="left">Description</th> <th class="left nosort" colspan="2">Operations</th> </tr> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/groups/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/groups/index.html.erb index a2e41ce838b..9515cb7471c 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/groups/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/groups/index.html.erb @@ -3,10 +3,10 @@ <td valign="top"> <h1 class="marginbottom10">Groups</h1> - <table class="data width100" id="groups"> + <table class="data width100 sortable" id="groups"> <thead> <tr> - <th class="left">Name</th> + <th class="left sortfirstasc">Name</th> <th class="left">Description</th> <th class="left">Members</th> <th class="left" nowrap>Operations</th> @@ -30,6 +30,7 @@ <% end %> </tbody> </table> + <script>TableKit.Sortable.init('groups');</script> </td> <td class="sep"> </td> <td valign="top" align="right" width="210"> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/groups/select_user.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/groups/select_user.html.erb index 0a162f38161..cb724249258 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/groups/select_user.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/groups/select_user.html.erb @@ -10,9 +10,9 @@ <tr> <td style="padding: 5px 0pt;" valign="top"> <h2>Non-members</h2> - <select name="from" id="from" size="10" style="margin: 5px 0pt; width: 300px;" multiple="multiple"> + <select name="from" id="from" size="30" style="margin: 5px 0pt; width: 300px;" multiple="multiple"> <% @group.available_users.sort.each do |user| %> - <option value="<%= user.id -%>"><%= user.login %></option> + <option value="<%= user.id -%>"><%= user.name -%></option> <% end %> </select> </td> @@ -25,8 +25,8 @@ <td class="box" style="padding: 5px 10px;" valign="top"> <h2>Members</h2> - <select name="users[]" id="to" size="10" multiple="multiple" style="margin: 5px 0pt; width: 300px;"> - <%= options_from_collection_for_select(@group.users.sort, "id", "login") %> + <select name="users[]" id="to" size="30" multiple="multiple" style="margin: 5px 0pt; width: 300px;"> + <%= options_from_collection_for_select(@group.users.sort, "id", "name") %> </select><br> <div style="padding: 5px 0pt;"> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/metrics/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/metrics/index.html.erb index 9eed83c9fd7..a4cc8514682 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/metrics/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/metrics/index.html.erb @@ -5,7 +5,7 @@ <thead> <tr> <th class="left">Key</th> - <th class="left">Name</th> + <th class="left sortfirstasc">Name</th> <th class="left">Description</th> <th class="left">Domain</th> <th class="left">Type</th> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/project_roles/edit_users.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/project_roles/edit_users.html.erb index 8690154c077..03728a5f532 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/project_roles/edit_users.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/project_roles/edit_users.html.erb @@ -7,17 +7,17 @@ <br/> <div id="main_content"> <form action="<%= url_for :action => 'grant_users' -%>" method="post"> - <input name="resource" value="<%= params[:resource] -%>" type="hidden"> - <input name="role" value="<%= @role -%>" type="hidden"> - <input name="redirect" value="<%= params[:redirect] -%>" type="hidden"></input> + <input name="resource" value="<%= params[:resource] -%>" type="hidden"/> + <input name="role" value="<%= @role -%>" type="hidden"/> + <input name="redirect" value="<%= params[:redirect] -%>" type="hidden"/> <table> <tbody> <tr> <td style="padding: 5px 0pt;" valign="top"> <h2>Ungranted users</h2> - <select name="from" id="from" size="20" style="margin: 5px 0pt; width: 300px;" multiple="multiple"> - <% ungranted_users.each do |user| %> - <option value="<%= user.id -%>"><%= user.login %></option> + <select name="from" id="from" size="30" style="margin: 5px 0pt; width: 300px;" multiple="multiple"> + <% ungranted_users.sort.each do |user| %> + <option value="<%= user.id -%>"><%= user.name -%></option> <% end %> </select> </td> @@ -30,8 +30,8 @@ <td class="box" style="padding: 5px 10px;" valign="top"> <h2>Role: <%= role_name(@role) -%></h2> - <select name="users[]" id="to" size="20" multiple="multiple" style="margin: 5px 0pt; width: 300px;"> - <%= options_from_collection_for_select(granted_users, "id", "login") %> + <select name="users[]" id="to" size="30" multiple="multiple" style="margin: 5px 0pt; width: 300px;"> + <%= options_from_collection_for_select(granted_users, "id", "name") %> </select><br> <div style="padding: 5px 0pt;"> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_groups.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_groups.html.erb index cec13d9232a..33a568e23b2 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_groups.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_groups.html.erb @@ -14,17 +14,17 @@ <br/> <div> <form action="<%= url_for :action => 'grant_groups' -%>" method="post"> - <input name="resource" value="<%= params[:resource] -%>" type="hidden"></input> - <input name="role" value="<%= @role -%>" type="hidden"></input> - <input name="redirect" value="<%= params[:redirect] -%>" type="hidden"></input> + <input name="resource" value="<%= params[:resource] -%>" type="hidden"/> + <input name="role" value="<%= @role -%>" type="hidden"/> + <input name="redirect" value="<%= params[:redirect] -%>" type="hidden"/> <table> <tbody> <tr> <td style="padding: 5px 0pt;" valign="top"> <h2>Ungranted groups</h2> <select name="from" id="from" size="20" style="margin: 5px 0pt; width: 300px;" multiple="multiple"> - <% ungranted_groups.each do |group| %> - <option value="<%= group ? group.id : '' -%>"><%= group_name(group) %></option> + <% ungranted_groups.sort.each do |group| %> + <option value="<%= group ? group.id : '' -%>"><%= group_name(group) -%></option> <% end %> </select> </td> @@ -38,8 +38,8 @@ <h2>Role: <%= role_name(@role) -%></h2> <select name="groups[]" id="to" size="20" multiple="multiple" style="margin: 5px 0pt; width: 300px;"> - <% granted_groups.each do |group| %> - <option value="<%= group ? group.id : '' -%>"><%= group_name(group) %></option> + <% granted_groups.sort.each do |group| %> + <option value="<%= group ? group.id : '' -%>"><%= group_name(group) -%></option> <% end %> </select><br> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_users.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_users.html.erb index 7882fe88bb3..b0be2583ba5 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_users.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_users.html.erb @@ -14,17 +14,17 @@ <br/> <div id="main_content"> <form action="<%= url_for :action => 'grant_users' -%>" method="post"> - <input name="resource" value="<%= params[:resource] -%>" type="hidden"> - <input name="role" value="<%= @role -%>" type="hidden"> - <input name="redirect" value="<%= params[:redirect] -%>" type="hidden"></input> + <input name="resource" value="<%= params[:resource] -%>" type="hidden"/> + <input name="role" value="<%= @role -%>" type="hidden" /> + <input name="redirect" value="<%= params[:redirect] -%>" type="hidden" /> <table> <tbody> <tr> <td style="padding: 5px 0pt;" valign="top"> <h2>Ungranted users</h2> - <select name="from" id="from" size="20" style="margin: 5px 0pt; width: 300px;" multiple="multiple"> - <% ungranted_users.each do |user| %> - <option value="<%= user.id -%>"><%= user.login %></option> + <select name="from" id="from" size="30" style="margin: 5px 0pt; width: 300px;" multiple="multiple"> + <% ungranted_users.sort.each do |user| %> + <option value="<%= user.id -%>"><%= user.name -%></option> <% end %> </select> </td> @@ -37,8 +37,8 @@ <td class="box" style="padding: 5px 10px;" valign="top"> <h2>Role: <%= role_name(@role) -%></h2> - <select name="users[]" id="to" size="20" multiple="multiple" style="margin: 5px 0pt; width: 300px;"> - <%= options_from_collection_for_select(granted_users, "id", "login") %> + <select name="users[]" id="to" size="30" multiple="multiple" style="margin: 5px 0pt; width: 300px;"> + <%= options_from_collection_for_select(granted_users, "id", "name") %> </select><br> <div style="padding: 5px 0pt;"> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/users/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/users/index.html.erb index 15fad13ebab..18f32f36365 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/users/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/users/index.html.erb @@ -6,7 +6,7 @@ <thead> <tr> <th class="left">Login</th> - <th class="left">Name</th> + <th class="left sortfirstasc">Name</th> <th class="left">Email</th> <th class="left nosort">Groups</th> <th class="left nosort" nowrap>Operations</th> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/users/select_group.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/users/select_group.html.erb index 536b3e326af..17bf426af4a 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/users/select_group.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/users/select_group.html.erb @@ -10,7 +10,7 @@ <td style="padding: 5px 0pt;" valign="top"> <h2>Not member of</h2> <select name="from" id="from" size="20" style="margin: 5px 0pt; width: 300px;" multiple="multiple"> - <% @user.available_groups.each do |group| %> + <% @user.available_groups.sort.each do |group| %> <option value="<%= group.id -%>"><%= group.name %></option> <% end %> @@ -26,7 +26,7 @@ <h2>Member of</h2> <select name="groups[]" id="to" size="20" multiple="multiple" style="margin: 5px 0pt; width: 300px;"> - <%= options_from_collection_for_select(@user.groups, "id", "name") %> + <%= options_from_collection_for_select(@user.groups.sort, "id", "name") %> </select><br> <div style="padding: 5px 0pt;"> diff --git a/sonar-server/src/main/webapp/javascripts/tablekit.js b/sonar-server/src/main/webapp/javascripts/tablekit.js index ddc5643a2f9..798f5c9f3c6 100644 --- a/sonar-server/src/main/webapp/javascripts/tablekit.js +++ b/sonar-server/src/main/webapp/javascripts/tablekit.js @@ -370,7 +370,11 @@ TableKit.Sortable = { _coltypecache : {} }; -TableKit.Sortable.detectors = $A($w('date-iso date date-eu date-au time currency datasize number casesensitivetext text')); // setting it here because Safari complained when I did it above... +//sonar +// Do not use case-sensitive sort except if explicitely defined +//TableKit.Sortable.detectors = $A($w('date-iso date date-eu date-au time currency datasize number text casesensitivetext')); // setting it here because Safari complained when I did it above... +TableKit.Sortable.detectors = $A($w('date-iso date date-eu date-au time currency datasize number text')); // setting it here because Safari complained when I did it above... +// /sonar TableKit.Sortable.Type = Class.create(); TableKit.Sortable.Type.prototype = { @@ -522,7 +526,7 @@ TableKit.Sortable.addSortType( return TableKit.Sortable.Type.compare(new Date(ds + a),new Date(ds + b)); }}), new TableKit.Sortable.Type('currency',{ - pattern : /^[$£¥€¤]/, // dollar,pound,yen,euro,generic currency symbol + pattern : /^[$����]/, // dollar,pound,yen,euro,generic currency symbol normal : function(v) { return v ? parseFloat(v.replace(/[^-\d\.]/g,'')) : 0; }}) |