@@ -0,0 +1,10 | |||
|
1 | class AddRolePosition < ActiveRecord::Migration | |
|
2 | def self.up | |
|
3 | add_column :roles, :position, :integer, :default => 1, :null => false | |
|
4 | Role.find(:all).each_with_index {|role, i| role.update_attribute(:position, i+1)} | |
|
5 | end | |
|
6 | ||
|
7 | def self.down | |
|
8 | remove_column :roles, :position | |
|
9 | end | |
|
10 | end |
@@ -91,7 +91,7 class ProjectsController < ApplicationController | |||
|
91 | 91 | @custom_fields = IssueCustomField.find(:all) |
|
92 | 92 | @issue_category ||= IssueCategory.new |
|
93 | 93 | @member ||= @project.members.new |
|
94 | @roles = Role.find(:all) | |
|
94 | @roles = Role.find(:all, :order => 'position') | |
|
95 | 95 | @users = User.find_active(:all) - @project.users |
|
96 | 96 | @custom_values ||= ProjectCustomField.find(:all).collect { |x| @project.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x) } |
|
97 | 97 | end |
@@ -18,6 +18,9 | |||
|
18 | 18 | class RolesController < ApplicationController |
|
19 | 19 | layout 'base' |
|
20 | 20 | before_filter :require_admin |
|
21 | ||
|
22 | verify :method => :post, :only => [ :destroy, :move ], | |
|
23 | :redirect_to => { :action => :list } | |
|
21 | 24 | |
|
22 | 25 | def index |
|
23 | 26 | list |
@@ -25,7 +28,7 class RolesController < ApplicationController | |||
|
25 | 28 | end |
|
26 | 29 | |
|
27 | 30 | def list |
|
28 | @role_pages, @roles = paginate :roles, :per_page => 10 | |
|
31 | @role_pages, @roles = paginate :roles, :per_page => 10, :order => "position" | |
|
29 | 32 | render :action => "list", :layout => false if request.xhr? |
|
30 | 33 | end |
|
31 | 34 | |
@@ -62,6 +65,21 class RolesController < ApplicationController | |||
|
62 | 65 | redirect_to :action => 'list' |
|
63 | 66 | end |
|
64 | 67 | |
|
68 | def move | |
|
69 | @role = Role.find(params[:id]) | |
|
70 | case params[:position] | |
|
71 | when 'highest' | |
|
72 | @role.move_to_top | |
|
73 | when 'higher' | |
|
74 | @role.move_higher | |
|
75 | when 'lower' | |
|
76 | @role.move_lower | |
|
77 | when 'lowest' | |
|
78 | @role.move_to_bottom | |
|
79 | end if params[:position] | |
|
80 | redirect_to :action => 'list' | |
|
81 | end | |
|
82 | ||
|
65 | 83 | def workflow |
|
66 | 84 | @role = Role.find_by_id(params[:role_id]) |
|
67 | 85 | @tracker = Tracker.find_by_id(params[:tracker_id]) |
@@ -77,7 +95,7 class RolesController < ApplicationController | |||
|
77 | 95 | flash[:notice] = l(:notice_successful_update) |
|
78 | 96 | end |
|
79 | 97 | end |
|
80 |
@roles = Role.find : |
|
|
98 | @roles = Role.find(:all, :order => 'position') | |
|
81 | 99 | @trackers = Tracker.find :all |
|
82 | 100 | @statuses = IssueStatus.find(:all, :include => :workflows, :order => 'position') |
|
83 | 101 | end |
@@ -80,7 +80,7 class UsersController < ApplicationController | |||
|
80 | 80 | end |
|
81 | 81 | end |
|
82 | 82 | @auth_sources = AuthSource.find(:all) |
|
83 |
@roles = Role.find : |
|
|
83 | @roles = Role.find(:all, :order => 'position') | |
|
84 | 84 | @projects = Project.find(:all) - @user.projects |
|
85 | 85 | @membership ||= Member.new |
|
86 | 86 | end |
@@ -20,6 +20,7 class Role < ActiveRecord::Base | |||
|
20 | 20 | has_and_belongs_to_many :permissions |
|
21 | 21 | has_many :workflows, :dependent => :delete_all |
|
22 | 22 | has_many :members |
|
23 | acts_as_list | |
|
23 | 24 | |
|
24 | 25 | validates_presence_of :name |
|
25 | 26 | validates_uniqueness_of :name |
@@ -1,10 +1,10 | |||
|
1 | 1 | <h2><%=l(:label_member_plural)%></h2> |
|
2 | 2 | |
|
3 | 3 | <% members = @members.group_by {|m| m.role } %> |
|
4 | <% members.each do |role, member| %> | |
|
4 | <% members.keys.sort{|x,y| x.position <=> y.position}.each do |role| %> | |
|
5 | 5 | <h3><%= role.name %></h3> |
|
6 | 6 | <ul> |
|
7 | <% member.each do |m| %> | |
|
7 | <% members[role].each do |m| %> | |
|
8 | 8 | <li><%= link_to m.user.display_name, :controller => 'account', :action => 'show', :id => m.user %> (<%= format_date m.created_on %>)</li> |
|
9 | 9 | <% end %> |
|
10 | 10 | </ul> |
@@ -23,7 +23,7 | |||
|
23 | 23 | <table class="list"> |
|
24 | 24 | <thead><th><%= l(:label_user) %></th><th><%= l(:label_role) %></th><th></th></thead> |
|
25 | 25 | <tbody> |
|
26 | <% for member in @project.members.find(:all, :include => :user) %> | |
|
26 | <% @project.members.find(:all, :include => [:role, :user]).sort{|x,y| x.role.position <=> y.role.position}.each do |member| %> | |
|
27 | 27 | <% unless member.new_record? %> |
|
28 | 28 | <tr class="<%= cycle 'odd', 'even' %>"> |
|
29 | 29 | <td><%= member.user.display_name %></td> |
@@ -7,6 +7,7 | |||
|
7 | 7 | <table class="list"> |
|
8 | 8 | <thead><tr> |
|
9 | 9 | <th><%=l(:label_role)%></th> |
|
10 | <th><%=l(:button_sort)%></th> | |
|
10 | 11 | <th></th> |
|
11 | 12 | </tr></thead> |
|
12 | 13 | <tbody> |
@@ -14,6 +15,12 | |||
|
14 | 15 | <tr class="<%= cycle("odd", "even") %>"> |
|
15 | 16 | <td><%= link_to role.name, :action => 'edit', :id => role %></td> |
|
16 | 17 | <td align="center"> |
|
18 | <%= link_to image_tag('2uparrow.png', :alt => l(:label_sort_highest)), {:action => 'move', :id => role, :position => 'highest'}, :method => :post, :title => l(:label_sort_highest) %> | |
|
19 | <%= link_to image_tag('1uparrow.png', :alt => l(:label_sort_higher)), {:action => 'move', :id => role, :position => 'higher'}, :method => :post, :title => l(:label_sort_higher) %> - | |
|
20 | <%= link_to image_tag('1downarrow.png', :alt => l(:label_sort_lower)), {:action => 'move', :id => role, :position => 'lower'}, :method => :post, :title => l(:label_sort_lower) %> | |
|
21 | <%= link_to image_tag('2downarrow.png', :alt => l(:label_sort_lowest)), {:action => 'move', :id => role, :position => 'lowest'}, :method => :post, :title => l(:label_sort_lowest) %> | |
|
22 | </td> | |
|
23 | <td align="center"> | |
|
17 | 24 | <%= button_to l(:button_delete), { :action => 'destroy', :id => role }, :confirm => l(:text_are_you_sure), :class => "button-small" %> |
|
18 | 25 | </tr> |
|
19 | 26 | <% end %> |
@@ -11,7 +11,7 http://redmine.rubyforge.org/ | |||
|
11 | 11 | * settings are now stored in the database and editable through the application in: Admin -> Settings (config_custom.rb is no longer used) |
|
12 | 12 | * mail notifications added when a document, a file or an attachment is added |
|
13 | 13 | * tooltips added on Gantt chart and calender to view the details of the issues |
|
14 | * ability to set the sort order for issue statuses | |
|
14 | * ability to set the sort order for roles, issue statuses | |
|
15 | 15 | * added missing fields to csv export: priority, start date, due date, done ratio |
|
16 | 16 | * all icons replaced (new icons are based on GPL icon set: "KDE Crystal Diamond 2.5" -by paolino- and "kNeu! Alpha v0.1" -by Pablo Fabregat-) |
|
17 | 17 | * added back "fixed version" field on issue screen and in filters |
General Comments 0
You need to be logged in to leave comments.
Login now