forked from saurabh/personal-honor
add data can select member
This commit is contained in:
parent
bd3677f2c6
commit
3ec3ccc13f
|
@ -23,14 +23,50 @@ class Admin::HonorsController < OrbitMemberController
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@member = MemberProfile.find(honor_params['member_profile_id']) rescue nil
|
|
||||||
@honor = Honor.new(honor_params)
|
if !honor_params['member_profile_id'].blank?
|
||||||
@honor.save
|
|
||||||
if params[:desktop] == "true"
|
@member = MemberProfile.find(honor_params['member_profile_id']) rescue nil
|
||||||
render json: {"data" => get_paper_list}.to_json
|
@honor = Honor.new(honor_params)
|
||||||
else
|
@honor.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|
|
||||||
|
|
||||||
|
honor_params['member_profile_id'] = author_member
|
||||||
|
@honor = Honor.new(honor_params)
|
||||||
|
@honor.save
|
||||||
|
|
||||||
|
if params[:desktop] == "true"
|
||||||
|
render json: {"data" => get_paper_list}.to_json
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
redirect_to params['referer_url']
|
redirect_to params['referer_url']
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
honor_params['member_profile_id'] = User.find(current_user.id).member_profile_id
|
||||||
|
|
||||||
|
@honor = Honor.new(honor_params)
|
||||||
|
@honor.save
|
||||||
|
|
||||||
|
if params[:desktop] == "true"
|
||||||
|
render json: {"data" => get_paper_list}.to_json
|
||||||
|
end
|
||||||
|
|
||||||
|
redirect_to params['referer_url']
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
|
|
|
@ -55,7 +55,7 @@ class Honor
|
||||||
pd_data = []
|
pd_data = []
|
||||||
fields_to_show.collect do |t|
|
fields_to_show.collect do |t|
|
||||||
if t == "award_name"
|
if t == "award_name"
|
||||||
pd_data << { "data_title" => "<a href='#{OrbitHelper.url_to_plugin_show(p.to_param,'personal_honor')}'>#{p.send(t)}" }
|
pd_data << { "data_title" => "<a href='#{OrbitHelper.url_to_plugin_show(p.to_param,'personal_honor')}' target='_blank'>#{p.send(t)}" }
|
||||||
else
|
else
|
||||||
pd_data << { "data_title" => p.send(t) }
|
pd_data << { "data_title" => p.send(t) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -72,13 +72,26 @@
|
||||||
<!-- Basic Module -->
|
<!-- Basic Module -->
|
||||||
<div class="tab-pane fade in active" id="basic">
|
<div class="tab-pane fade in active" id="basic">
|
||||||
|
|
||||||
|
<% if !@member.nil? %>
|
||||||
|
|
||||||
<div class="control-group big-group">
|
<div class="control-group big-group">
|
||||||
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
|
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= @member.name rescue ''%>
|
<%= @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>
|
</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 %>
|
||||||
|
|
||||||
<!-- personal_honor -->
|
<!-- personal_honor -->
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
<div class="bottomnav clearfix">
|
<div class="bottomnav clearfix">
|
||||||
<div class="action pull-right">
|
<div class="action pull-right">
|
||||||
|
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:new_), new_admin_honor_path, :class => 'btn btn-primary' %>
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t('setting'), admin_honor_setting_path, :class => 'btn btn-primary pull-right' %>
|
<%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t('setting'), admin_honor_setting_path, :class => 'btn btn-primary pull-right' %>
|
||||||
</div>
|
</div>
|
||||||
<div class="pagination pagination-centered">
|
<div class="pagination pagination-centered">
|
||||||
|
|
Loading…
Reference in New Issue