add data can select member

This commit is contained in:
spen 2015-01-20 14:42:30 +08:00
parent 840d2c0dca
commit 959f782028
4 changed files with 59 additions and 9 deletions

View File

@ -23,14 +23,50 @@ class Admin::ExperiencesController < OrbitMemberController
end
def create
@member = MemberProfile.find(experience_params['member_profile_id']) rescue nil
@experience = Experience.new(experience_params)
@experience.save
if params[:desktop] == "true"
render json: {"data" => get_paper_list}.to_json
else
if !experience_params['member_profile_id'].blank?
@member = MemberProfile.find(experience_params['member_profile_id']) rescue nil
@experience = Experience.new(experience_params)
@experience.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|
experience_params['member_profile_id'] = author_member
@experience = Experience.new(experience_params)
@experience.save
if params[:desktop] == "true"
render json: {"data" => get_paper_list}.to_json
end
end
redirect_to params['referer_url']
else
experience_params['member_profile_id'] = User.find(current_user.id).member_profile_id
@experience = Experience.new(experience_params)
@experience.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

@ -57,7 +57,7 @@ class Experience
pd_data = []
fields_to_show.collect do |t|
if t == "organizationt_title"
pd_data << { "data_title" => "<a href='#{OrbitHelper.url_to_plugin_show(p.to_param,'personal_experience')}'>#{p.send(t)}" }
pd_data << { "data_title" => "<a href='#{OrbitHelper.url_to_plugin_show(p.to_param,'personal_experience')}' target='_blank'>#{p.send(t)}" }
elsif t == "duration"
if !p.send('start_date').nil? or !p.send('end_date').nil?

View File

@ -85,13 +85,26 @@
<!-- 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>
</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 %>
<!-- experience_category -->
<div class="control-group">

View File

@ -15,6 +15,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_experience_path, :class => 'btn btn-primary' %>
<%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t('setting'), admin_experience_setting_path, :class => 'btn btn-primary pull-right' %>
</div>
<div class="pagination pagination-centered">