summaryrefslogtreecommitdiffstats
path: root/app/views
diff options
context:
space:
mode:
Diffstat (limited to 'app/views')
-rw-r--r--app/views/members/_new_form.html.erb16
-rw-r--r--app/views/members/_new_modal.html.erb9
-rw-r--r--app/views/members/create.js.erb3
-rw-r--r--app/views/members/new.html.erb6
-rw-r--r--app/views/members/new.js.erb2
-rw-r--r--app/views/principal_memberships/_new_form.html.erb2
-rw-r--r--app/views/projects/settings/_members.html.erb32
7 files changed, 38 insertions, 32 deletions
diff --git a/app/views/members/_new_form.html.erb b/app/views/members/_new_form.html.erb
new file mode 100644
index 000000000..9140da7c4
--- /dev/null
+++ b/app/views/members/_new_form.html.erb
@@ -0,0 +1,16 @@
+<fieldset class="box">
+ <legend><%= label_tag("principal_search", l(:label_principal_search)) %></legend>
+ <p><%= text_field_tag('principal_search', nil) %></p>
+ <%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_project_memberships_path(@project, :format => 'js') }')" %>
+ <div id="principals_for_new_member">
+ <%= render_principals_for_new_members(@project) %>
+ </div>
+</fieldset>
+<fieldset class="box">
+ <legend><%= l(:label_role_plural) %> <%= toggle_checkboxes_link('.roles-selection input') %></legend>
+ <div class="roles-selection">
+ <% Role.givable.all.each do |role| %>
+ <label><%= check_box_tag 'membership[role_ids][]', role.id, false, :id => nil %> <%= role %></label>
+ <% end %>
+ </div>
+</fieldset>
diff --git a/app/views/members/_new_modal.html.erb b/app/views/members/_new_modal.html.erb
new file mode 100644
index 000000000..0338a953c
--- /dev/null
+++ b/app/views/members/_new_modal.html.erb
@@ -0,0 +1,9 @@
+<h3 class="title"><%= l(:label_member_new) %></h3>
+
+<%= form_for @member, :as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post do |f| %>
+ <%= render :partial => 'new_form' %>
+ <p class="buttons">
+ <%= submit_tag l(:button_add), :id => 'member-add-submit' %>
+ <%= submit_tag l(:button_cancel), :name => nil, :onclick => "hideModal(this);", :type => 'button' %>
+ </p>
+<% end %>
diff --git a/app/views/members/create.js.erb b/app/views/members/create.js.erb
index 11c468a76..d716743ef 100644
--- a/app/views/members/create.js.erb
+++ b/app/views/members/create.js.erb
@@ -2,10 +2,11 @@ $('#tab-content-members').html('<%= escape_javascript(render :partial => 'projec
hideOnLoad();
<% if @members.present? && @members.all? {|m| m.valid? } %>
+ hideModal();
<% @members.each do |member| %>
$("#member-<%= member.id %>").effect("highlight");
<% end %>
-<% else %>
+<% elsif @members.present? %>
<% errors = @members.collect {|m| m.errors.full_messages}.flatten.uniq.join(', ') %>
alert('<%= raw(escape_javascript(l(:notice_failed_to_save_members, :errors => errors))) %>');
<% end %>
diff --git a/app/views/members/new.html.erb b/app/views/members/new.html.erb
new file mode 100644
index 000000000..97dd380c7
--- /dev/null
+++ b/app/views/members/new.html.erb
@@ -0,0 +1,6 @@
+<h2><%= l(:label_member_new) %></h2>
+
+<%= form_for @member, :as => :membership, :url => project_memberships_path(@project), :method => :post do |f| %>
+ <%= render :partial => 'new_form' %>
+ <p><%= submit_tag l(:button_add), :name => nil %></p>
+<% end %>
diff --git a/app/views/members/new.js.erb b/app/views/members/new.js.erb
new file mode 100644
index 000000000..2d60e296a
--- /dev/null
+++ b/app/views/members/new.js.erb
@@ -0,0 +1,2 @@
+$('#ajax-modal').html('<%= escape_javascript(render :partial => 'members/new_modal') %>');
+showModal('ajax-modal', '700px');
diff --git a/app/views/principal_memberships/_new_form.html.erb b/app/views/principal_memberships/_new_form.html.erb
index 2a0d50dbc..c49d84993 100644
--- a/app/views/principal_memberships/_new_form.html.erb
+++ b/app/views/principal_memberships/_new_form.html.erb
@@ -1,6 +1,6 @@
<fieldset class="box">
<legend><%= l(:label_project_plural) %> <%= toggle_checkboxes_link('.projects-selection input:enabled') %></legend>
- <div style="max-height:300px; overflow:auto;">
+ <div class="objects-selection">
<div class="projects-selection">
<%= render_project_nested_lists(@projects) do |p| %>
<label>
diff --git a/app/views/projects/settings/_members.html.erb b/app/views/projects/settings/_members.html.erb
index 392d1d4b5..569684a58 100644
--- a/app/views/projects/settings/_members.html.erb
+++ b/app/views/projects/settings/_members.html.erb
@@ -1,8 +1,8 @@
-<%= error_messages_for 'member' %>
<% roles = Role.find_all_givable
members = @project.member_principals.includes(:member_roles, :roles, :principal).to_a.sort %>
-<div class="splitcontentleft">
+<p><%= link_to l(:label_member_new), new_project_membership_path(@project), :remote => true, :class => "icon icon-add" %></p>
+
<% if members.any? %>
<table class="list members">
<thead>
@@ -62,31 +62,3 @@
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
-</div>
-
-<div class="splitcontentright">
-<% if roles.any? %>
- <%= form_for(@member,
- {:as => :membership, :url => project_memberships_path(@project),
- :remote => true, :method => :post}) do |f| %>
- <fieldset>
- <legend><%=l(:label_member_new)%></legend>
- <p>
- <%= label_tag("principal_search", l(:label_principal_search)) %>
- <%= text_field_tag('principal_search', nil) %>
- </p>
- <%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_project_memberships_path(@project, :format => 'js') }')" %>
- <div id="principals_for_new_member">
- <%= render_principals_for_new_members(@project) %>
- </div>
- <p>
- <%= l(:label_role_plural) %>:
- <% roles.each do |role| %>
- <label><%= check_box_tag 'membership[role_ids][]', role.id, false, :id => nil %> <%= role %></label>
- <% end %>
- </p>
- <p><%= submit_tag l(:button_add), :id => 'member-add-submit' %></p>
- </fieldset>
- <% end %>
-<% end %>
-</div>