add data can select member

This commit is contained in:
spen 2015-01-20 14:43:31 +08:00
parent caca804465
commit cf8ffa8fbc
3 changed files with 57 additions and 7 deletions

View File

@ -23,14 +23,50 @@ class Admin::WritingConferencesController < OrbitMemberController
end
def create
@member = MemberProfile.find(conference_params['member_profile_id']) rescue nil
@writing_conference = WritingConference.new(conference_params)
@writing_conference.save
if params[:desktop] == "true"
render json: {"data" => get_paper_list}.to_json
else
if !conference_params['member_profile_id'].blank?
@member = MemberProfile.find(conference_params['member_profile_id']) rescue nil
@writing_conference = WritingConference.new(conference_params)
@writing_conference.save
if params[:desktop] == "true"
render json: {"data" => get_paper_list}.to_json
else
redirect_to params['referer_url']
end
elsif !params[:author_members].blank?
params[:author_members].each do |author_member|
conference_params['member_profile_id'] = author_member
@writing_conference = WritingConference.new(conference_params)
@writing_conference.save
if params[:desktop] == "true"
render json: {"data" => get_paper_list}.to_json
end
end
redirect_to params['referer_url']
else
conference_params['member_profile_id'] = User.find(current_user.id).member_profile_id
@writing_conference = WritingConference.new(conference_params)
@writing_conference.save
if params[:desktop] == "true"
render json: {"data" => get_paper_list}.to_json
end
redirect_to params['referer_url']
end
end
def edit

View File

@ -135,14 +135,27 @@
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<% if !@member.nil? %>
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
<div class="controls">
<%= @member.name rescue ''%>
<%= f.hidden_field :member_profile_id, :value => @member.id if !@member.nil? %>
<%= f.hidden_field :member_profile_id, :value => @member.id %>
</div>
</div>
<% else %>
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
<div class="controls">
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'author_members[]', email_members:[]} %>
</div>
</div>
<% end %>
<!-- year -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_conference.year") %></label>

View File

@ -13,6 +13,7 @@
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:new_), new_admin_writing_conference_path, :class => 'btn btn-primary' %>
<%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t('setting'), admin_writing_conference_setting_path, :class => 'btn btn-primary pull-right' %>
</div>
<div class="pagination pagination-centered">