From 00ec7b9177acca7bd6ec59ef7b33b7eaf01d56a1 Mon Sep 17 00:00:00 2001 From: Saurabh Bhatia Date: Wed, 9 Jul 2014 12:12:51 +0800 Subject: [PATCH] fix layout and member list --- app/controllers/admin/books_controller.rb | 1 + app/models/book.rb | 6 +++++- app/views/admin/books/book_setting.html.erb | 11 ----------- app/views/admin/books/edit.html.erb | 10 ---------- app/views/admin/books/index.html.erb | 8 -------- app/views/admin/books/new.html.erb | 10 ---------- 6 files changed, 6 insertions(+), 40 deletions(-) diff --git a/app/controllers/admin/books_controller.rb b/app/controllers/admin/books_controller.rb index 2e144b8..dc9319a 100644 --- a/app/controllers/admin/books_controller.rb +++ b/app/controllers/admin/books_controller.rb @@ -1,5 +1,6 @@ class Admin::BooksController < OrbitMemberController include Admin::JournalPapersHelper + layout "member_plugin" before_action :set_book, only: [:show, :edit , :update, :destroy] before_action :get_plugins, only: [:index, :book_setting, :new, :create, :edit, :update] diff --git a/app/models/book.rb b/app/models/book.rb index 6ecb312..8b449d4 100644 --- a/app/models/book.rb +++ b/app/models/book.rb @@ -58,7 +58,11 @@ class Book members = MemberProfile.all member_data = [] members.each do |m| - member_data << {"memberId" => m.id.to_s, "memberName" => m.name} + 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/books/book_setting.html.erb b/app/views/admin/books/book_setting.html.erb index 2bcce55..036484b 100644 --- a/app/views/admin/books/book_setting.html.erb +++ b/app/views/admin/books/book_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 %> - - -
diff --git a/app/views/admin/books/edit.html.erb b/app/views/admin/books/edit.html.erb index 6b28149..4e9bc4e 100644 --- a/app/views/admin/books/edit.html.erb +++ b/app/views/admin/books/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(current_site), :icon => 'icons-users', :side_bar_content => 'admin/members/side_bar'} %> -<% end %> - - - <%= form_for @book, url: admin_book_path(@book), html: {class: "form-horizontal main-forms previewable"} do |f| %>
<%= render partial: 'form', locals: {f: f} %> diff --git a/app/views/admin/books/index.html.erb b/app/views/admin/books/index.html.erb index 8281d3d..e96a2cc 100644 --- a/app/views/admin/books/index.html.erb +++ b/app/views/admin/books/index.html.erb @@ -1,11 +1,3 @@ -<% content_for :side_bar do %> - <%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:user), :link_url => admin_site_site_info_path(current_site), :icon => 'icons-users', :side_bar_content => 'admin/members/side_bar'} %> -<% end %> - - - diff --git a/app/views/admin/books/new.html.erb b/app/views/admin/books/new.html.erb index 08be316..b8d9d61 100644 --- a/app/views/admin/books/new.html.erb +++ b/app/views/admin/books/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(current_site), :icon => 'icons-users', :side_bar_content => 'admin/members/side_bar'} %> -<% end %> - - - <%= form_for @book, url: admin_books_path, html: {class: "form-horizontal main-forms previewable"} do |f| %>
<%= render partial: 'form', locals: {f: f} %>