From 36fc7beb2fe21beaf56b640b97e3079c7399a48f Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 15 Nov 2014 11:20:47 +0000 Subject: Moved new project member to its own action MemberController#new. git-svn-id: http://svn.redmine.org/redmine/trunk@13600 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/views/members/_new_form.html.erb | 16 ++++++++++++++++ app/views/members/_new_modal.html.erb | 9 +++++++++ app/views/members/create.js.erb | 3 ++- app/views/members/new.html.erb | 6 ++++++ app/views/members/new.js.erb | 2 ++ 5 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 app/views/members/_new_form.html.erb create mode 100644 app/views/members/_new_modal.html.erb create mode 100644 app/views/members/new.html.erb create mode 100644 app/views/members/new.js.erb (limited to 'app/views/members') 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 @@ +
+ <%= label_tag("principal_search", l(:label_principal_search)) %> +

<%= text_field_tag('principal_search', nil) %>

+ <%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_project_memberships_path(@project, :format => 'js') }')" %> +
+ <%= render_principals_for_new_members(@project) %> +
+
+
+ <%= l(:label_role_plural) %> <%= toggle_checkboxes_link('.roles-selection input') %> +
+ <% Role.givable.all.each do |role| %> + + <% end %> +
+
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 @@ +

<%= l(:label_member_new) %>

+ +<%= form_for @member, :as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post do |f| %> + <%= render :partial => 'new_form' %> +

+ <%= submit_tag l(:button_add), :id => 'member-add-submit' %> + <%= submit_tag l(:button_cancel), :name => nil, :onclick => "hideModal(this);", :type => 'button' %> +

+<% 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 @@ +

<%= l(:label_member_new) %>

+ +<%= form_for @member, :as => :membership, :url => project_memberships_path(@project), :method => :post do |f| %> + <%= render :partial => 'new_form' %> +

<%= submit_tag l(:button_add), :name => nil %>

+<% 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'); -- cgit v1.2.3