summaryrefslogtreecommitdiffstats
path: root/app/views
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-05-05 15:21:18 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-05-05 15:21:18 +0000
commit3eed7e622c3856f3b2395f883b5c3bdc20a7a95d (patch)
treefcc10a79cc3afea3b2f361c8aaec547bf67f3b28 /app/views
parenta6a181c70c054070b687e73eb1505bfcb434b692 (diff)
downloadredmine-3eed7e622c3856f3b2395f883b5c3bdc20a7a95d.tar.gz
redmine-3eed7e622c3856f3b2395f883b5c3bdc20a7a95d.zip
Members management in project settings is now AJAXified
git-svn-id: http://redmine.rubyforge.org/svn/trunk@508 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views')
-rw-r--r--app/views/projects/_members.rhtml43
-rw-r--r--app/views/projects/settings.rhtml45
2 files changed, 47 insertions, 41 deletions
diff --git a/app/views/projects/_members.rhtml b/app/views/projects/_members.rhtml
new file mode 100644
index 000000000..4283b2ef8
--- /dev/null
+++ b/app/views/projects/_members.rhtml
@@ -0,0 +1,43 @@
+<%= error_messages_for 'member' %>
+<% roles = Role.find(:all, :order => 'position') %>
+<% users = User.find_active(:all) - @project.users %>
+
+<table class="list">
+ <thead>
+ <th><%= l(:label_user) %></th>
+ <th><%= l(:label_role) %></th>
+ <th></th>
+ </thead>
+ <tbody>
+ <% @project.members.find(:all, :include => [:role, :user]).sort{|x,y| x.role.position <=> y.role.position}.each do |member| %>
+ <% next if member.new_record? %>
+ <tr class="<%= cycle 'odd', 'even' %>">
+ <td><%= member.user.display_name %></td>
+ <td align="center">
+ <% if authorize_for('members', 'edit') %>
+ <% remote_form_for(:member, member, :url => {:controller => 'members', :action => 'edit', :id => member}, :method => :post) do |f| %>
+ <%= f.select :role_id, roles.collect{|role| [role.name, role.id]}, {}, :class => "small" %>
+ <%= submit_tag l(:button_change), :class => "small" %>
+ <% end %>
+ <% end %>
+ </td>
+ <td align="center">
+ <small><%= link_to_remote l(:button_delete), { :url => {:controller => 'members', :action => 'destroy', :id => member},
+ :method => :post
+ }, :title => l(:button_delete),
+ :class => 'icon icon-del' %></small>
+ </td>
+ </tr>
+ </tbody>
+<% end; reset_cycle %>
+</table>
+&nbsp;
+
+<% if authorize_for('projects', 'add_member') && !users.empty? %>
+ <p><label for="member_user_id"><%=l(:label_member_new)%></label></p>
+ <% remote_form_for(:member, @member, :url => {:controller => 'projects', :action => 'add_member', :tab => 'members', :id => @project}, :method => :post) do |f| %>
+ <%= f.select :user_id, users.collect{|user| [user.name, user.id]} %>
+ <%= l(:label_role) %>: <%= f.select :role_id, roles.collect{|role| [role.name, role.id]}, :selected => nil %>
+ <%= submit_tag l(:button_add) %>
+ <% end %>
+<% end %>
diff --git a/app/views/projects/settings.rhtml b/app/views/projects/settings.rhtml
index aaa4e6522..69d26d299 100644
--- a/app/views/projects/settings.rhtml
+++ b/app/views/projects/settings.rhtml
@@ -19,44 +19,7 @@
</div>
<div id="tab-content-members" class="tab-content" style="display:none;">
-<%= error_messages_for 'member' %>
-<table class="list">
- <thead><th><%= l(:label_user) %></th><th><%= l(:label_role) %></th><th></th></thead>
- <tbody>
- <% @project.members.find(:all, :include => [:role, :user]).sort{|x,y| x.role.position <=> y.role.position}.each do |member| %>
- <% unless member.new_record? %>
- <tr class="<%= cycle 'odd', 'even' %>">
- <td><%= member.user.display_name %></td>
- <td align="center">
- <% if authorize_for('members', 'edit') %>
- <% form_tag({:controller => 'members', :action => 'edit', :id => member}) do %>
- <select name="member[role_id]">
- <%= options_from_collection_for_select @roles, "id", "name", member.role_id %>
- </select>
- <%= submit_tag l(:button_change), :class => "button-small" %>
- <% end %>
- <% end %>
- </td>
- <td align="center">
- <%= 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' %>
- </td>
- </tr>
- <% end %>
- </tbody>
-<% end; reset_cycle %>
-</table>
-<% if authorize_for('projects', 'add_member') %>
- <label><%=l(:label_member_new)%></label><br/>
- <% form_tag({:controller => 'projects', :action => 'add_member', :tab => 'members', :id => @project}) do %>
- <select name="member[user_id]">
- <%= options_from_collection_for_select @users, "id", "display_name", @member.user_id %>
- </select>
- <select name="member[role_id]">
- <%= options_from_collection_for_select @roles, "id", "name", @member.role_id %>
- </select>
- <%= submit_tag l(:button_add) %>
- <% end %>
-<% end %>
+ <%= render :partial => 'members' %>
</div>
<div id="tab-content-versions" class="tab-content" style="display:none;">
@@ -68,8 +31,8 @@
<td><%=h version.name %></td>
<td align="center"><%= format_date(version.effective_date) %></td>
<td><%=h version.description %></td>
- <td align="center"><%= link_to_if_authorized l(:button_edit), { :controller => 'versions', :action => 'edit', :id => version }, :class => 'icon icon-edit' %></td>
- <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>
+ <td align="center"><small><%= link_to_if_authorized l(:button_edit), { :controller => 'versions', :action => 'edit', :id => version }, :class => 'icon icon-edit' %></small></td>
+ <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>
</td>
</tr>
<% end; reset_cycle %>
@@ -94,7 +57,7 @@
<% end %>
</td>
<td align="center">
- <%= 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><%= 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>
</td>
</tr>
<% end %>