修改BUG

This commit is contained in:
nwb 2014-05-22 13:40:41 +08:00
parent f51873d98b
commit 4f9625b265
2 changed files with 6 additions and 1 deletions

View File

@ -47,6 +47,8 @@ class MembersController < ApplicationController
def create def create
if params[:refusal_button] if params[:refusal_button]
members = []
applied_members = true
if params[:membership] if params[:membership]
if params[:membership][:user_ids] if params[:membership][:user_ids]
attrs = params[:membership].dup attrs = params[:membership].dup
@ -57,6 +59,7 @@ class MembersController < ApplicationController
end end
end end
else else
applied_members = false
members = [] members = []
project_info = [] project_info = []
user_grades = [] user_grades = []
@ -94,7 +97,7 @@ class MembersController < ApplicationController
respond_to do |format| respond_to do |format|
format.html { redirect_to_settings_in_projects } format.html { redirect_to_settings_in_projects }
format.js { @members = members;@applied_members = members; } format.js { @members = members;@applied_members = applied_members; }
format.api { format.api {
@member = members.first @member = members.first
if @member.valid? if @member.valid?

View File

@ -1,6 +1,7 @@
$('#tab-content-members').html('<%= escape_javascript(render :partial => 'projects/settings/members') %>'); $('#tab-content-members').html('<%= escape_javascript(render :partial => 'projects/settings/members') %>');
hideOnLoad(); hideOnLoad();
<%if !@applied_members%>
<% if @members.present? && @members.all? {|m| m.valid? } %> <% if @members.present? && @members.all? {|m| m.valid? } %>
<% @members.each do |member| %> <% @members.each do |member| %>
$("#member-<%= member.id %>").effect("highlight"); $("#member-<%= member.id %>").effect("highlight");
@ -9,3 +10,4 @@ hideOnLoad();
<% errors = @members.collect {|m| m.errors.full_messages}.flatten.uniq.join(', ') %> <% errors = @members.collect {|m| m.errors.full_messages}.flatten.uniq.join(', ') %>
alert('<%= raw(escape_javascript(l(:notice_failed_to_save_members, :errors => errors))) %>'); alert('<%= raw(escape_javascript(l(:notice_failed_to_save_members, :errors => errors))) %>');
<% end %> <% end %>
<%end%>