From 9b622b132a5d7deae78a4932456338efb668374a Mon Sep 17 00:00:00 2001 From: chiu Date: Wed, 30 Oct 2019 21:38:00 +0800 Subject: [PATCH] fix error --- .../admin/journal_papers_controller.rb | 11 +++++----- app/views/admin/journal_papers/_form.html.erb | 20 +++++-------------- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/app/controllers/admin/journal_papers_controller.rb b/app/controllers/admin/journal_papers_controller.rb index 3073be8..548ff40 100644 --- a/app/controllers/admin/journal_papers_controller.rb +++ b/app/controllers/admin/journal_papers_controller.rb @@ -64,17 +64,17 @@ class Admin::JournalPapersController < OrbitMemberController elsif !params[:author_members].blank? - params[:author_members].each do |author_member| + #params[:author_members].each do |author_member| - journal_paper_params['member_profile_id'] = author_member + journal_paper_params['member_profile_id'] = params[:author_members] @journal_paper = JournalPaper.new(journal_paper_params) @journal_paper.save - + if params[:desktop] == "true" render json: {"data" => get_paper_list}.to_json end - end + #end redirect_to params['referer_url'] @@ -96,7 +96,8 @@ class Admin::JournalPapersController < OrbitMemberController end def edit - @member = @journal_paper.member_profile + @member = MemberProfile.find(@journal_paper.member_profile_id) + puts [@journal_paper.inspect,'help',@member.inspect] if params[:desktop] render :layout => false end diff --git a/app/views/admin/journal_papers/_form.html.erb b/app/views/admin/journal_papers/_form.html.erb index 3661f1f..c338a4a 100644 --- a/app/views/admin/journal_papers/_form.html.erb +++ b/app/views/admin/journal_papers/_form.html.erb @@ -120,27 +120,17 @@
- <% if !@member.nil? %> -
- <%= @member.name rescue ''%> - <%= f.hidden_field :member_profile_id, :value => @member.id %> -
-
- - <% else %> - -
- -
- <%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'author_members[]', email_members:[]} %> + <% if !@member.nil? %> + <%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'author_members[]', email_members:@member} %> + <% else %> + <%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'author_members[]', email_members:[]} %> + <% end %>
- <% end %> -