add data can select member
This commit is contained in:
parent
865f0265a2
commit
8e68fee3f6
|
@ -23,14 +23,50 @@ class Admin::DiplomasController < OrbitMemberController
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
|
||||||
|
if !diploma_params['member_profile_id'].blank?
|
||||||
|
|
||||||
@member = MemberProfile.find(diploma_params['member_profile_id']) rescue nil
|
@member = MemberProfile.find(diploma_params['member_profile_id']) rescue nil
|
||||||
@diploma = Diploma.new(diploma_params)
|
@diploma = Diploma.new(diploma_params)
|
||||||
@diploma.save
|
@diploma.save
|
||||||
|
|
||||||
if params[:desktop] == "true"
|
if params[:desktop] == "true"
|
||||||
render json: {"data" => get_paper_list}.to_json
|
render json: {"data" => get_paper_list}.to_json
|
||||||
else
|
else
|
||||||
redirect_to params['referer_url']
|
redirect_to params['referer_url']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
elsif !params[:author_members].blank?
|
||||||
|
|
||||||
|
params[:author_members].each do |author_member|
|
||||||
|
|
||||||
|
diploma_params['member_profile_id'] = author_member
|
||||||
|
@diploma = Diploma.new(diploma_params)
|
||||||
|
@diploma.save
|
||||||
|
|
||||||
|
if params[:desktop] == "true"
|
||||||
|
render json: {"data" => get_paper_list}.to_json
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
redirect_to params['referer_url']
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
diploma_params['member_profile_id'] = User.find(current_user.id).member_profile_id
|
||||||
|
|
||||||
|
@diploma = Diploma.new(diploma_params)
|
||||||
|
@diploma.save
|
||||||
|
|
||||||
|
if params[:desktop] == "true"
|
||||||
|
render json: {"data" => get_paper_list}.to_json
|
||||||
|
end
|
||||||
|
|
||||||
|
redirect_to params['referer_url']
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
|
|
|
@ -58,7 +58,7 @@ class Diploma
|
||||||
pd_data = []
|
pd_data = []
|
||||||
fields_to_show.collect do |t|
|
fields_to_show.collect do |t|
|
||||||
if t == "school_name"
|
if t == "school_name"
|
||||||
pd_data << { "data_title" => "<a href='#{OrbitHelper.url_to_plugin_show(p.to_param,'personal_diploma')}'>#{p.send(t)}" }
|
pd_data << { "data_title" => "<a href='#{OrbitHelper.url_to_plugin_show(p.to_param,'personal_diploma')}' target='_blank'>#{p.send(t)}" }
|
||||||
elsif t == "duration"
|
elsif t == "duration"
|
||||||
if !p.send('start_date').nil? or !p.send('end_date').nil?
|
if !p.send('start_date').nil? or !p.send('end_date').nil?
|
||||||
date = (p.send('start_date').strftime('%Y.%m') rescue "")+' ~ '+(p.send('end_date').strftime('%Y.%m') rescue I18n.t('personal_diploma.up_to_today'))
|
date = (p.send('start_date').strftime('%Y.%m') rescue "")+' ~ '+(p.send('end_date').strftime('%Y.%m') rescue I18n.t('personal_diploma.up_to_today'))
|
||||||
|
|
|
@ -94,14 +94,27 @@
|
||||||
<!-- 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 %>
|
||||||
|
|
||||||
<!-- start_date -->
|
<!-- start_date -->
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted"><%= t("personal_diploma.start_date") %></label>
|
<label class="control-label muted"><%= t("personal_diploma.start_date") %></label>
|
||||||
|
|
|
@ -14,6 +14,9 @@
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div class="bottomnav clearfix">
|
<div class="bottomnav clearfix">
|
||||||
|
<div class="action pull-right">
|
||||||
|
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:new_), new_admin_diploma_path, :class => 'btn btn-primary' %>
|
||||||
|
</div>
|
||||||
<div class="pagination pagination-centered">
|
<div class="pagination pagination-centered">
|
||||||
<%= content_tag :div, paginate(@diplomas), class: "pagination pagination-centered" %>
|
<%= content_tag :div, paginate(@diplomas), class: "pagination pagination-centered" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue