@@ -0,0 +1,43 | |||
|
1 | <%= error_messages_for 'member' %> | |
|
2 | <% roles = Role.find(:all, :order => 'position') %> | |
|
3 | <% users = User.find_active(:all) - @project.users %> | |
|
4 | ||
|
5 | <table class="list"> | |
|
6 | <thead> | |
|
7 | <th><%= l(:label_user) %></th> | |
|
8 | <th><%= l(:label_role) %></th> | |
|
9 | <th></th> | |
|
10 | </thead> | |
|
11 | <tbody> | |
|
12 | <% @project.members.find(:all, :include => [:role, :user]).sort{|x,y| x.role.position <=> y.role.position}.each do |member| %> | |
|
13 | <% next if member.new_record? %> | |
|
14 | <tr class="<%= cycle 'odd', 'even' %>"> | |
|
15 | <td><%= member.user.display_name %></td> | |
|
16 | <td align="center"> | |
|
17 | <% if authorize_for('members', 'edit') %> | |
|
18 | <% remote_form_for(:member, member, :url => {:controller => 'members', :action => 'edit', :id => member}, :method => :post) do |f| %> | |
|
19 | <%= f.select :role_id, roles.collect{|role| [role.name, role.id]}, {}, :class => "small" %> | |
|
20 | <%= submit_tag l(:button_change), :class => "small" %> | |
|
21 | <% end %> | |
|
22 | <% end %> | |
|
23 | </td> | |
|
24 | <td align="center"> | |
|
25 | <small><%= link_to_remote l(:button_delete), { :url => {:controller => 'members', :action => 'destroy', :id => member}, | |
|
26 | :method => :post | |
|
27 | }, :title => l(:button_delete), | |
|
28 | :class => 'icon icon-del' %></small> | |
|
29 | </td> | |
|
30 | </tr> | |
|
31 | </tbody> | |
|
32 | <% end; reset_cycle %> | |
|
33 | </table> | |
|
34 | | |
|
35 | ||
|
36 | <% if authorize_for('projects', 'add_member') && !users.empty? %> | |
|
37 | <p><label for="member_user_id"><%=l(:label_member_new)%></label></p> | |
|
38 | <% remote_form_for(:member, @member, :url => {:controller => 'projects', :action => 'add_member', :tab => 'members', :id => @project}, :method => :post) do |f| %> | |
|
39 | <%= f.select :user_id, users.collect{|user| [user.name, user.id]} %> | |
|
40 | <%= l(:label_role) %>: <%= f.select :role_id, roles.collect{|role| [role.name, role.id]}, :selected => nil %> | |
|
41 | <%= submit_tag l(:button_add) %> | |
|
42 | <% end %> | |
|
43 | <% end %> |
@@ -21,15 +21,19 class MembersController < ApplicationController | |||
|
21 | 21 | |
|
22 | 22 | def edit |
|
23 | 23 | if request.post? and @member.update_attributes(params[:member]) |
|
24 | flash[:notice] = l(:notice_successful_update) | |
|
25 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project | |
|
24 | respond_to do |format| | |
|
25 | format.html { redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project } | |
|
26 | format.js { render(:update) {|page| page.replace_html "tab-content-members", :partial => 'projects/members'} } | |
|
27 | end | |
|
26 | 28 | end |
|
27 | 29 | end |
|
28 | 30 | |
|
29 | 31 | def destroy |
|
30 | 32 | @member.destroy |
|
31 | flash[:notice] = l(:notice_successful_delete) | |
|
32 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project | |
|
33 | respond_to do |format| | |
|
34 | format.html { redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project } | |
|
35 | format.js { render(:update) {|page| page.replace_html "tab-content-members", :partial => 'projects/members'} } | |
|
36 | end | |
|
33 | 37 | end |
|
34 | 38 | |
|
35 | 39 | private |
@@ -96,8 +96,6 class ProjectsController < ApplicationController | |||
|
96 | 96 | @custom_fields = IssueCustomField.find(:all) |
|
97 | 97 | @issue_category ||= IssueCategory.new |
|
98 | 98 | @member ||= @project.members.new |
|
99 | @roles = Role.find(:all, :order => 'position') | |
|
100 | @users = User.find_active(:all) - @project.users | |
|
101 | 99 | @custom_values ||= ProjectCustomField.find(:all).collect { |x| @project.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x) } |
|
102 | 100 | end |
|
103 | 101 | |
@@ -172,14 +170,14 class ProjectsController < ApplicationController | |||
|
172 | 170 | # Add a new member to @project |
|
173 | 171 | def add_member |
|
174 | 172 | @member = @project.members.build(params[:member]) |
|
175 | if request.post? | |
|
176 | if @member.save | |
|
177 | flash[:notice] = l(:notice_successful_create) | |
|
178 | redirect_to :action => 'settings', :tab => 'members', :id => @project | |
|
179 | else | |
|
180 | settings | |
|
181 | render :action => 'settings' | |
|
173 | if request.post? && @member.save | |
|
174 | respond_to do |format| | |
|
175 | format.html { redirect_to :action => 'settings', :tab => 'members', :id => @project } | |
|
176 | format.js { render(:update) {|page| page.replace_html "tab-content-members", :partial => 'members'} } | |
|
182 | 177 | end |
|
178 | else | |
|
179 | settings | |
|
180 | render :action => 'settings' | |
|
183 | 181 | end |
|
184 | 182 | end |
|
185 | 183 |
@@ -19,44 +19,7 | |||
|
19 | 19 | </div> |
|
20 | 20 | |
|
21 | 21 | <div id="tab-content-members" class="tab-content" style="display:none;"> |
|
22 | <%= error_messages_for 'member' %> | |
|
23 | <table class="list"> | |
|
24 | <thead><th><%= l(:label_user) %></th><th><%= l(:label_role) %></th><th></th></thead> | |
|
25 | <tbody> | |
|
26 | <% @project.members.find(:all, :include => [:role, :user]).sort{|x,y| x.role.position <=> y.role.position}.each do |member| %> | |
|
27 | <% unless member.new_record? %> | |
|
28 | <tr class="<%= cycle 'odd', 'even' %>"> | |
|
29 | <td><%= member.user.display_name %></td> | |
|
30 | <td align="center"> | |
|
31 | <% if authorize_for('members', 'edit') %> | |
|
32 | <% form_tag({:controller => 'members', :action => 'edit', :id => member}) do %> | |
|
33 | <select name="member[role_id]"> | |
|
34 | <%= options_from_collection_for_select @roles, "id", "name", member.role_id %> | |
|
35 | </select> | |
|
36 | <%= submit_tag l(:button_change), :class => "button-small" %> | |
|
37 | <% end %> | |
|
38 | <% end %> | |
|
39 | </td> | |
|
40 | <td align="center"> | |
|
41 | <%= link_to_if_authorized l(:button_delete), {:controller => 'members', :action => 'destroy', :id => member}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %> | |
|
42 | </td> | |
|
43 | </tr> | |
|
44 | <% end %> | |
|
45 | </tbody> | |
|
46 | <% end; reset_cycle %> | |
|
47 | </table> | |
|
48 | <% if authorize_for('projects', 'add_member') %> | |
|
49 | <label><%=l(:label_member_new)%></label><br/> | |
|
50 | <% form_tag({:controller => 'projects', :action => 'add_member', :tab => 'members', :id => @project}) do %> | |
|
51 | <select name="member[user_id]"> | |
|
52 | <%= options_from_collection_for_select @users, "id", "display_name", @member.user_id %> | |
|
53 | </select> | |
|
54 | <select name="member[role_id]"> | |
|
55 | <%= options_from_collection_for_select @roles, "id", "name", @member.role_id %> | |
|
56 | </select> | |
|
57 | <%= submit_tag l(:button_add) %> | |
|
58 | <% end %> | |
|
59 | <% end %> | |
|
22 | <%= render :partial => 'members' %> | |
|
60 | 23 | </div> |
|
61 | 24 | |
|
62 | 25 | <div id="tab-content-versions" class="tab-content" style="display:none;"> |
@@ -68,8 +31,8 | |||
|
68 | 31 | <td><%=h version.name %></td> |
|
69 | 32 | <td align="center"><%= format_date(version.effective_date) %></td> |
|
70 | 33 | <td><%=h version.description %></td> |
|
71 | <td align="center"><%= link_to_if_authorized l(:button_edit), { :controller => 'versions', :action => 'edit', :id => version }, :class => 'icon icon-edit' %></td> | |
|
72 | <td align="center"><%= link_to_if_authorized l(:button_delete), {:controller => 'versions', :action => 'destroy', :id => version}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %></td> | |
|
34 | <td align="center"><small><%= link_to_if_authorized l(:button_edit), { :controller => 'versions', :action => 'edit', :id => version }, :class => 'icon icon-edit' %></small></td> | |
|
35 | <td align="center"><small><%= link_to_if_authorized l(:button_delete), {:controller => 'versions', :action => 'destroy', :id => version}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %></small></td> | |
|
73 | 36 | </td> |
|
74 | 37 | </tr> |
|
75 | 38 | <% end; reset_cycle %> |
@@ -94,7 +57,7 | |||
|
94 | 57 | <% end %> |
|
95 | 58 | </td> |
|
96 | 59 | <td align="center"> |
|
97 |
|
|
|
60 | <small><%= link_to_if_authorized l(:button_delete), {:controller => 'issue_categories', :action => 'destroy', :id => @category}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %></small> | |
|
98 | 61 | </td> |
|
99 | 62 | </tr> |
|
100 | 63 | <% end %> |
@@ -242,7 +242,7 text-decoration:none; | |||
|
242 | 242 | |
|
243 | 243 | form {display: inline;} |
|
244 | 244 | blockquote {padding-left: 6px; border-left: 2px solid #ccc;} |
|
245 |
input, select {vertical-align: middle; margin-bottom: |
|
|
245 | input, select {vertical-align: middle; margin-top: 1px; margin-bottom: 1px;} | |
|
246 | 246 | |
|
247 | 247 | input.button-small {font-size: 0.8em;} |
|
248 | 248 | textarea.wiki-edit { width: 99.5%; } |
General Comments 0
You need to be logged in to leave comments.
Login now