From 285189e190a6bada706257bfd1b5873ef3b28b6f Mon Sep 17 00:00:00 2001 From: Saurabh Bhatia Date: Wed, 9 Jul 2014 12:11:18 +0800 Subject: [PATCH] Fix journal paper layout and member list --- app/controllers/admin/journal_papers_controller.rb | 3 +++ app/models/journal_paper.rb | 8 ++++++-- app/views/admin/journal_papers/edit.html.erb | 10 ---------- app/views/admin/journal_papers/index.html.erb | 10 ---------- app/views/admin/journal_papers/new.html.erb | 10 ---------- .../journal_papers/writing_journal_setting.html.erb | 11 ----------- 6 files changed, 9 insertions(+), 43 deletions(-) diff --git a/app/controllers/admin/journal_papers_controller.rb b/app/controllers/admin/journal_papers_controller.rb index 8525f33..cee68ad 100644 --- a/app/controllers/admin/journal_papers_controller.rb +++ b/app/controllers/admin/journal_papers_controller.rb @@ -1,5 +1,7 @@ class Admin::JournalPapersController < OrbitMemberController include Admin::JournalPapersHelper + layout "member_plugin" + before_action :set_journal_paper, only: [:show, :edit , :update, :destroy] before_action :get_plugins, only: [:index, :writing_journal_setting, :new, :create, :edit, :update] before_action :set_types, only: [:writing_journal_setting, :new, :edit, :create, :update] @@ -24,6 +26,7 @@ class Admin::JournalPapersController < OrbitMemberController def new @journal_paper = JournalPaper.new @members_data = JournalPaper.member_data rescue nil + Rails.logger.info"@@@@@@@@@@@@"+@members_data.inspect respond_to do |format| format.html # new.html.erb diff --git a/app/models/journal_paper.rb b/app/models/journal_paper.rb index f870b74..43ed5eb 100644 --- a/app/models/journal_paper.rb +++ b/app/models/journal_paper.rb @@ -71,8 +71,12 @@ class JournalPaper def self.member_data members = MemberProfile.all member_data = [] - members.each do |m| - member_data << {"memberId" => m.id.to_s, "memberName" => m.name} + members.each do |m| + if (m.first_name || m.last_name) + member_data << {"memberId" => m.id.to_s, "memberName" => m.name} + else + member_data << {"memberId" => m.id.to_s, "memberName" => "No Name"} + end end member_data.to_json end diff --git a/app/views/admin/journal_papers/edit.html.erb b/app/views/admin/journal_papers/edit.html.erb index 07d52cc..1307b99 100644 --- a/app/views/admin/journal_papers/edit.html.erb +++ b/app/views/admin/journal_papers/edit.html.erb @@ -1,13 +1,3 @@ -<% content_for :side_bar do %> - <%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:user), :link_url => admin_site_site_info_path(site_id: current_site.id), :icon => 'icons-users', :side_bar_content => 'admin/members/side_bar'} %> -<% end %> - - - <%= form_for @journal_paper, url: admin_journal_paper_path(@journal_paper), html: {class: "form-horizontal main-forms previewable"} do |f| %>
<%= render partial: 'form', locals: {f: f} %> diff --git a/app/views/admin/journal_papers/index.html.erb b/app/views/admin/journal_papers/index.html.erb index 5e43349..52f0f70 100644 --- a/app/views/admin/journal_papers/index.html.erb +++ b/app/views/admin/journal_papers/index.html.erb @@ -1,13 +1,3 @@ -<% content_for :side_bar do %> - <%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:user), :link_url => admin_site_site_info_path(site_id: current_site.id), :icon => 'icons-users', :side_bar_content => 'admin/members/side_bar'} %> -<% end %> - - - diff --git a/app/views/admin/journal_papers/new.html.erb b/app/views/admin/journal_papers/new.html.erb index a29eee0..0152957 100644 --- a/app/views/admin/journal_papers/new.html.erb +++ b/app/views/admin/journal_papers/new.html.erb @@ -1,13 +1,3 @@ -<% content_for :side_bar do %> - <%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:user), :link_url => admin_site_site_info_path(site_id: current_site.id), :icon => 'icons-users', :side_bar_content => 'admin/members/side_bar'} %> -<% end %> - - - <%= form_for @journal_paper, url: admin_journal_papers_path, html: {class: "form-horizontal main-forms previewable"} do |f| %>
<%= render partial: 'form', locals: {f: f} %> diff --git a/app/views/admin/journal_papers/writing_journal_setting.html.erb b/app/views/admin/journal_papers/writing_journal_setting.html.erb index 0006596..6babb86 100644 --- a/app/views/admin/journal_papers/writing_journal_setting.html.erb +++ b/app/views/admin/journal_papers/writing_journal_setting.html.erb @@ -1,15 +1,4 @@ <% # encoding: utf-8 %> - -<% content_for :side_bar do %> - <%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:user), :link_url => admin_site_site_info_path(site_id: current_site.id), :icon => 'icons-users', :side_bar_content => 'admin/members/side_bar'} %> -<% end %> - - -