add data can select member
This commit is contained in:
parent
8093483d6f
commit
7874c30149
|
@ -52,14 +52,50 @@ class Admin::BooksController < OrbitMemberController
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@member = MemberProfile.find(book_params['member_profile_id']) rescue nil
|
|
||||||
@book = Book.new(book_params)
|
if !book_params['member_profile_id'].blank?
|
||||||
@book.save
|
|
||||||
if params[:desktop] == "true"
|
@member = MemberProfile.find(book_params['member_profile_id']) rescue nil
|
||||||
render json: {"data" => get_paper_list}.to_json
|
@book = Book.new(book_params)
|
||||||
else
|
@book.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|
|
||||||
|
|
||||||
|
book_params['member_profile_id'] = author_member
|
||||||
|
@book = Book.new(book_params)
|
||||||
|
@book.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
|
||||||
|
|
||||||
|
book_params['member_profile_id'] = User.find(current_user.id).member_profile_id
|
||||||
|
|
||||||
|
@book = Book.new(book_params)
|
||||||
|
@book.save
|
||||||
|
|
||||||
|
if params[:desktop] == "true"
|
||||||
|
render json: {"data" => get_paper_list}.to_json
|
||||||
|
end
|
||||||
|
|
||||||
|
redirect_to params['referer_url']
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
|
|
@ -138,14 +138,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>
|
||||||
|
|
||||||
|
<% 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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<!-- year -->
|
<!-- year -->
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted"><%= t("personal_book.year") %></label>
|
<label class="control-label muted"><%= t("personal_book.year") %></label>
|
||||||
|
|
|
@ -13,6 +13,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_book_path, :class => 'btn btn-primary' %>
|
||||||
<% if current_user.is_admin? %>
|
<% if current_user.is_admin? %>
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t('setting'), admin_book_setting_path, :class => 'btn btn-primary pull-right' %>
|
<%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t('setting'), admin_book_setting_path, :class => 'btn btn-primary pull-right' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in New Issue