add data can select member

This commit is contained in:
spen 2015-01-20 14:47:46 +08:00
parent e7aecbaec2
commit b8fb7e90d4
4 changed files with 60 additions and 8 deletions

View File

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

@ -58,7 +58,7 @@ class Research
pd_data = []
fields_to_show.collect do |t|
if t == "research_title"
pd_data << { "data_title" => "<a href='#{OrbitHelper.url_to_plugin_show(p.to_param,'personal_research')}'>#{p.send(t)}" }
pd_data << { "data_title" => "<a href='#{OrbitHelper.url_to_plugin_show(p.to_param,'personal_research')}' target='_blank'>#{p.send(t)}" }
else
pd_data << { "data_title" => p.send(t) }
end

View File

@ -115,14 +115,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_research.year") %></label>

View File

@ -13,6 +13,9 @@
</table>
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:new_), new_admin_research_path, :class => 'btn btn-primary' %>
</div>
<div class="pagination pagination-centered">
<%= content_tag :div, paginate(@researchs), class: "pagination pagination-centered" %>
</div>