something fix

This commit is contained in:
spen 2015-01-09 15:38:49 +08:00
parent 3f56689240
commit 28db2f309e
50 changed files with 597 additions and 636 deletions

View File

@ -1,50 +1,43 @@
class Admin::BookAuthorTypesController < OrbitMemberController class Admin::BookAuthorTypesController < OrbitMemberController
before_action :set_book_author_type, only: [:edit, :update, :destroy] before_action :allow_admin_only
def initialize
super
@app_type = 'book_author_type'
end
def new def new
@book_author_type = BookAuthorType.new @author_type = BookAuthorType.new
end @url = admin_book_author_types_path(@author_type)
render :layout=>false
def edit
end end
def create def create
@book_author_type = BookAuthorType.new(book_author_type_attributes) @author_type = BookAuthorType.new(author_type_params)
@author_type.save
@author_types = BookAuthorType.all
render :partial=>'list', :layout=>false
end
respond_to do |format| def edit
if @book_author_type.save @author_type = BookAuthorType.find(params[:id])
format.js { render 'create_book_setting' } @url = admin_book_author_type_path(@author_type)
end render :layout=>false
end
end end
def update def update
respond_to do |format| @author_type = BookAuthorType.find(params[:id])
if @book_author_type.update_attributes(book_author_type_attributes) @author_type.update_attributes(author_type_params)
format.js { render 'update_book_setting' } @author_type.save
end @author_types = BookAuthorType.all
end render :partial=>'list', :layout=>false
end end
def destroy def destroy
@book_author_type.destroy author_type = BookAuthorType.find(params[:id])
respond_to do |format| author_type.destroy
format.js { render 'delete_book_setting' } @author_types = BookAuthorType.all
end render :partial=>'list', :layout=>false
end end
private private
def set_book_author_type def author_type_params
@book_author_type = BookAuthorType.find(params[:id])
end
def book_author_type_attributes
params.require(:book_author_type).permit! rescue nil params.require(:book_author_type).permit! rescue nil
end end
end end

View File

@ -1,8 +0,0 @@
class Admin::BookIntrosController < Admin::PersonalPluginIntrosController
def initialize
super
@app_type = 'book_intro'
@app_type_name = 'book_paper'
@reback_name = 'Book'
end
end

View File

@ -1,50 +1,43 @@
class Admin::BookTypesController < ApplicationController class Admin::BookTypesController < OrbitMemberController
before_action :set_book_type, only: [:edit, :update, :destroy] before_action :allow_admin_only
def initialize
super
@app_type = 'book_type'
end
def new def new
@book_type = BookType.new @book_type = BookType.new
end @url = admin_book_types_path(@book_type)
render :layout=>false
def edit
end end
def create def create
@book_type = BookType.new(book_type_attributes) @book_type = BookType.new(book_type_params)
respond_to do |format| @book_type.save
if @book_type.save @book_types = BookType.all
format.js { render 'create_book_setting' } render :partial=>'list', :layout=>false
end end
end
def edit
@book_type = BookType.find(params[:id])
@url = admin_book_type_path(@book_type)
render :layout=>false
end end
def update def update
respond_to do |format| @book_type = BookType.find(params[:id])
if @book_type.update_attributes(book_type_attributes) @book_type.update_attributes(book_type_params)
format.js { render 'update_book_setting' } @book_type.save
end @book_types = BookType.all
end render :partial=>'list', :layout=>false
end end
def destroy def destroy
@book_type.destroy book_type = BookType.find(params[:id])
respond_to do |format| book_type.destroy
format.js { render 'delete_book_setting' } @book_types = BookType.all
end render :partial=>'list', :layout=>false
end end
private private
def set_book_type def book_type_params
@book_type = BookType.find(params[:id])
end
def book_type_attributes
params.require(:book_type).permit! rescue nil params.require(:book_type).permit! rescue nil
end end
end end

View File

@ -1,15 +1,13 @@
class Admin::BooksController < OrbitMemberController class Admin::BooksController < OrbitMemberController
include Admin::BooksHelper
layout "member_plugin" layout "member_plugin"
include Admin::PersonalBooksHelper
before_action :set_book, only: [:show, :edit , :update] before_action :set_book, only: [:show, :edit , :update, :destroy]
before_action :find_book, only: [:destroy]
before_action :get_plugins, only: [:index, :book_setting, :new, :create, :edit, :update]
before_action :set_types, only: [:index,:book_setting, :new, :edit, :create, :update]
before_action :set_plugin before_action :set_plugin
before_action :get_settings,:only => [:new, :edit, :setting]
before_action :need_access_right before_action :need_access_right
before_action :allow_admin_only, :only => [:index, :book_setting] before_action :allow_admin_only, :only => [:index, :setting]
def index def index
@writing_books = Book.order_by(:year=>'desc').page(params[:page]).per(10) @writing_books = Book.order_by(:year=>'desc').page(params[:page]).per(10)
@ -36,7 +34,7 @@ class Admin::BooksController < OrbitMemberController
def update def update
@member = @book.member_profile @member = @book.member_profile
@book.update_attributes(book_attributes) @book.update_attributes(book_params)
@book.save @book.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
@ -47,15 +45,15 @@ class Admin::BooksController < OrbitMemberController
def new def new
@book = Book.new @book = Book.new
@member = MemberProfile.find_by(:id=>params['member_profile_id']) rescue nil @member = MemberProfile.find_by(:uid=>params['uid']) rescue nil
if params[:desktop] if params[:desktop]
render :layout => false render :layout => false
end end
end end
def create def create
@member = MemberProfile.find(book_attributes['member_profile_id']) rescue nil @member = MemberProfile.find(book_params['member_profile_id']) rescue nil
@book = Book.new(book_attributes) @book = Book.new(book_params)
@book.save @book.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
@ -64,18 +62,6 @@ class Admin::BooksController < OrbitMemberController
end end
end end
def book_setting
if current_user.is_admin?
@set_author_type = BookAuthorType.new(display: 'List')
@author_type_url = admin_books_path
@set_book_type = BookType.new(display: 'List')
@book_type_url = admin_books_path
else
render_401
end
end
def destroy def destroy
@book.destroy @book.destroy
respond_to do |format| respond_to do |format|
@ -86,45 +72,7 @@ class Admin::BooksController < OrbitMemberController
end end
end end
def add_author_type def toggle_hide
@set_author_type = BookAuthorType.new(display: 'List')
@author_type_url = admin_book_author_types_path
@set_author_type.id = params[:id]
respond_to do |format|
format.js
end
end
def edit_author_type
@set_author_type = BookAuthorType.find(params[:book_id])
@author_type_url = admin_book_author_type_path(@set_author_type)
respond_to do |format|
format.js
end
end
def add_book_type
@set_book_type = BookType.new(display: 'List')
@book_type_url = admin_book_types_path
@set_book_type.id = params[:id]
respond_to do |format|
format.js
end
end
def edit_book_type
@set_book_type = BookType.find(params[:book_id])
@book_type_url = admin_book_type_path(@set_book_type)
respond_to do |format|
format.js
end
end
def data_share
if params[:ids] if params[:ids]
@books = Book.any_in(_id: params[:ids]) @books = Book.any_in(_id: params[:ids])
@ -134,13 +82,34 @@ class Admin::BooksController < OrbitMemberController
end end
end end
respond_to do |format| render json: {"success"=>true}
format.html { redirect_to(admin_member_path(id: params[:member_profile_id],show_plugin_profile: "Book")) }
format.json { render json: {"success"=>true}.to_json}
end
end end
def delete def setting
end
def frontend_setting
@member = MemberProfile.find_by(:uid=>params['uid']) rescue nil
@intro = BookIntro.find_by(:member_profile_id=>@member.id) rescue nil
@intro = @intro.nil? ? BookIntro.new({:member_profile_id=>@member.id}) : @intro
end
def update_frontend_setting
@member = MemberProfile.find(intro_params['member_profile_id']) rescue nil
@intro = BookIntro.find_by(:member_profile_id=>@member.id) rescue nil
@intro = @intro.nil? ? BookIntro.new({:member_profile_id=>@member.id}) : @intro
@intro.update_attributes(intro_params)
@intro.save
redirect_to URI.encode('/admin/members/'+@member.to_param+'/Book')
end
def get_settings
@author_types = BookAuthorType.all
@book_types = BookType.all
end
def set_plugin
@plugin = OrbitApp::Plugin::Registration.all.select{|plugin| plugin.app_name.eql? 'Book'}.first
end end
private private
@ -154,27 +123,14 @@ class Admin::BooksController < OrbitMemberController
uid = path[-2].split("-").last uid = path[-2].split("-").last
uid = uid.split("?").first uid = uid.split("?").first
end end
@book = Book.find_by(uid: uid) @book = Book.find_by(:uid => uid) rescue Book.find(params[:id])
end end
def find_book def intro_params
@book = Book.find_by(id: params[:id]) params.require(:book_intro).permit! rescue nil
end end
def book_attributes def book_params
params.require(:book).permit! rescue nil params.require(:book).permit! rescue nil
end end
def get_plugins
@plugins = OrbitApp::Plugin::Registration.all rescue nil
end
def set_plugin
@plugin = OrbitApp::Plugin::Registration.all.select{|plugin| plugin.app_name.eql? 'Book'}.first
end
def set_types
@author_types = BookAuthorType.all
@book_types = BookType.all
end
end end

View File

@ -1,11 +1,12 @@
class BooksController < ApplicationController class PersonalBooksController < ApplicationController
def index def index
books = Book.order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count) books = Book.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
book_list = books.collect do |book| book_list = books.collect do |book|
{ {
"book_title" => book.book_title, "book_title" => book.create_link,
"author" => book.authors, "author" => book.authors,
"year" => book.year, "year" => book.year,
"book_paper_type" => book.book_type.title,
"link_to_show" => OrbitHelper.url_to_show(book.to_param) "link_to_show" => OrbitHelper.url_to_show(book.to_param)
} }
end end
@ -15,6 +16,7 @@ class BooksController < ApplicationController
"widget-title" => t("module_name.book"), "widget-title" => t("module_name.book"),
"th_year" => t('personal_plugins.year'), "th_year" => t('personal_plugins.year'),
"th_title" => t("personal_book.book_title"), "th_title" => t("personal_book.book_title"),
"th_book_paper_type" => t("personal_book.book_paper_type"),
"th_author" => t('personal_book.authors') "th_author" => t('personal_book.authors')
}, },
"total_pages" => books.total_pages "total_pages" => books.total_pages
@ -23,24 +25,25 @@ class BooksController < ApplicationController
def show def show
params = OrbitHelper.params params = OrbitHelper.params
plugin = Book.find_by(uid: params[:uid]) plugin = Book.where(:is_hidden=>false).find_by(uid: params[:uid])
fields_to_show = [ fields_to_show = [
"book_title", "year",
"author_name", "author_name",
"authors", "authors",
"number_of_authors", "book_paper_type",
"editor", "book_title",
"extracted_chapters",
"publisher", "publisher",
"publish_date", "publish_date",
"publication_date",
"isbn",
"extracted_chapters",
"pages", "pages",
"editor",
"author_type",
"number_of_authors",
"isbn",
"url", "url",
"keywords", "file",
"note", "publication_date",
"file" "language"
] ]
{"plugin_datas"=>plugin.get_plugin_data(fields_to_show)} {"plugin_datas"=>plugin.get_plugin_data(fields_to_show)}

View File

@ -1,2 +0,0 @@
module Admin::BookAuthorTypesHelper
end

View File

@ -1,2 +0,0 @@
module Admin::BookIntrosHelper
end

View File

@ -1,2 +0,0 @@
module Admin::BookTypesHelper
end

View File

@ -1,35 +0,0 @@
module Admin::BooksHelper
def page_for_book(book_object)
book_page = nil
page = Page.find_by(:module=>"book") rescue nil
book_page = page if book_page.nil?
request.protocol+(request.host_with_port+book_page.url+'/'+book_object.to_param).gsub('//','/') rescue "/"
end
def get_paper_list
user = current_user.nil? ? OrbitHelper.current_user : current_user
user_profile = user.member_profile
books = Book.where(:member_profile_id => user_profile.id)
books = books.collect do |b|
files = b.book_files.collect do |bf|
{
"title" => bf.title,
"description" => bf.description,
"link" => bf.member_book_file.url,
"extension" => (bf.file.url.split(".").last rescue "")
}
end
{
"id" => b.id.to_s,
"edit_url" => "/#{I18n.locale.to_s}/admin/books/#{b.to_param}/edit",
"delete_url" => "/#{I18n.locale.to_s}/admin/books/#{b.id.to_s}",
"paper_title" => b.book_title,
"keywords" => b.keywords,
"files" => files
}
end
books
end
end

View File

@ -0,0 +1,28 @@
module Admin::PersonalBooksHelper
def get_paper_list
user = current_user.nil? ? OrbitHelper.current_user : current_user
user_profile = user.member_profile
books = Book.where(:member_profile_id => user_profile.id)
books = books.collect do |b|
files = b.book_files.collect do |bf|
{
"title" => bf.title,
"description" => bf.description,
"link" => bf.member_book_file.url,
"extension" => (bf.file.url.split(".").last rescue "")
}
end
{
"id" => b.id.to_s,
"edit_url" => "/#{I18n.locale.to_s}/admin/members/#{user_profile.to_param}/books/#{b.to_param}/edit",
"delete_url" => "/#{I18n.locale.to_s}/admin/books/#{b.id.to_s}",
"paper_title" => b.book_title,
"keywords" => b.keywords,
"files" => files
}
end
books
end
end

View File

@ -1,2 +0,0 @@
module BooksHelper
end

View File

@ -30,13 +30,13 @@ class Book
paginates_per 10 paginates_per 10
belongs_to :member_profile belongs_to :member_profile
belongs_to :book_type
has_many :book_files, autosave: true, dependent: :destroy has_many :book_files, autosave: true, dependent: :destroy
accepts_nested_attributes_for :book_files, :allow_destroy => true accepts_nested_attributes_for :book_files, :allow_destroy => true
has_and_belongs_to_many :book_author_types has_and_belongs_to_many :book_author_types
belongs_to :book_type
before_validation :add_http before_validation :add_http
def create_link def create_link
@ -44,6 +44,7 @@ class Book
title << self.member_profile.name if self.member_profile.present? title << self.member_profile.name if self.member_profile.present?
title << self.authors if self.authors.present? title << self.authors if self.authors.present?
title << self.book_title if self.book_title.present? title << self.book_title if self.book_title.present?
title << self.extracted_chapters if self.extracted_chapters.present?
title << self.publisher if self.publisher.present? title << self.publisher if self.publisher.present?
title << self.isbn if self.isbn.present? title << self.isbn if self.isbn.present?
@ -52,6 +53,9 @@ class Book
title << pd[0]+"/"+pd[1] title << pd[0]+"/"+pd[1]
end end
title << self.pages if self.pages.present?
title << self.year
title.join(', ') title.join(', ')
end end
@ -67,6 +71,10 @@ class Book
def get_plugin_field_data(field) def get_plugin_field_data(field)
case field case field
when "book_paper_type"
value = self.book_type.title rescue ""
when "author_type"
value = self.book_author_types.collect{|type| type.title}.join(',') rescue ""
when "author_name" when "author_name"
value = [] value = []
([I18n.locale]+(Site.first.in_use_locales-[I18n.locale])).each do |locale| ([I18n.locale]+(Site.first.in_use_locales-[I18n.locale])).each do |locale|

View File

@ -1,8 +1,6 @@
class BookAuthorType class BookAuthorType
include Mongoid::Document include Mongoid::Document
include Mongoid::Timestamps include Mongoid::Timestamps
include Mongoid::Attributes::Dynamic
include OrbitCoreLib::ObjectDisable
field :title, type: String, localize: true field :title, type: String, localize: true

View File

@ -1,10 +1,8 @@
class BookType class BookType
include Mongoid::Document include Mongoid::Document
include Mongoid::Timestamps include Mongoid::Timestamps
include Mongoid::Attributes::Dynamic
include OrbitCoreLib::ObjectDisable
field :title, type: String, localize: true field :title, localize: true
has_many :books has_many :books
end end

View File

@ -0,0 +1,24 @@
<%= form_for(@author_type, :html =>{:class=>"form-horizontal", :style=>"margin: 0;"}, :remote => true, :url => @url ) do |f| %>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel"><%= t("personal_book.author_type") %></h3>
</div>
<div class="modal-body">
<%= f.fields_for :title_translations do |f| %>
<% @site_in_use_locales.each do |locale| %>
<div class="control-group">
<%= label_tag t(locale), t(locale), :class => 'control-label' %>
<div class="controls">
<%= f.text_field locale, :value => (@author_type.title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
<% end %>
</div>
<div class="modal-footer">
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
</div>
<% end %>

View File

@ -0,0 +1,2 @@
$('#author_types tbody').html("<%= j render :partial => '/admin/books/list_author_type', :collection => @author_types %>");
$('#author_type_modal').modal('hide');

View File

@ -1,2 +0,0 @@
$("#myModal2").modal('hide');
$('<%= j render :partial => 'admin/books/list_author_type', :collection => [@book_author_type] %>').appendTo('#author_types').hide().fadeIn();

View File

@ -1,3 +0,0 @@
$('.delete_author').bind('ajax:success', function() {
$(this).closest('tr').fadeOut();
});

View File

@ -0,0 +1 @@
$('#author_type_modal').html("<%= j render 'form' %>");

View File

@ -0,0 +1 @@
$('#author_type_modal').html("<%= j render 'form' %>");

View File

@ -1,2 +0,0 @@
$("#myModal2").modal('hide');
$("#<%= dom_id @book_author_type %>").replaceWith("<%= j render :partial => 'admin/books/list_author_type', :collection => [@book_author_type] %>");

View File

@ -0,0 +1,24 @@
<%= form_for(@book_type, :html =>{:class=>"form-horizontal", :style=>"margin: 0;"}, :remote => true, :url => @url ) do |f| %>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel"><%= t("personal_book.book_paper_type") %></h3>
</div>
<div class="modal-body">
<%= f.fields_for :title_translations do |f| %>
<% @site_in_use_locales.each do |locale| %>
<div class="control-group">
<%= label_tag t(locale), t(locale), :class => 'control-label' %>
<div class="controls">
<%= f.text_field locale, :value => (@book_type.title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
<% end %>
</div>
<div class="modal-footer">
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
</div>
<% end %>

View File

@ -0,0 +1,2 @@
$('#book_types tbody').html("<%= j render :partial => '/admin/books/list_book_type', :collection => @book_types %>");
$('#book_type_modal').modal('hide');

View File

@ -1,2 +0,0 @@
$("#myModal1").modal('hide');
$('<%= j render :partial => 'admin/books/list_book_type', :collection => [@book_type] %>').appendTo('#level_types').hide().fadeIn();

View File

@ -1,3 +0,0 @@
$('.delete_level').bind('ajax:success', function() {
$(this).closest('tr').fadeOut();
});

View File

@ -0,0 +1 @@
$('#book_type_modal').html("<%= j render 'form' %>");

View File

@ -0,0 +1 @@
$('#book_type_modal').html("<%= j render 'form' %>");

View File

@ -1,2 +0,0 @@
$("#myModal1").modal('hide');
$("#<%= dom_id @book_type %>").replaceWith("<%= j render :partial => 'admin/books/list_book_type', :collection => [@book_type] %>");

View File

@ -1,27 +0,0 @@
<% # encoding: utf-8 %>
<%= form_for(@set_author_type, :remote => true, :url => @author_type_url ) do |f| %>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabe2"><%= (@set_author_type.new_record? ? 'Add 作者型態' : 'Edit 作者型態') %></h3>
</div>
<div class="modal-body">
<%= f.fields_for :title_translations do |f| %>
<% @site_in_use_locales.each do |locale| %>
<div class="control-group">
<%= label_tag "link-#{locale}", "Name-#{t(locale)}", :class => 'control-label' %>
<div class="controls">
<%= f.text_field locale, :class => 'control-label', :value => (@set_author_type.title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
<% end %>
</div>
<div class="modal-footer">
<%= hidden_field_tag 'book[author_type]', @set_author_type.id %>
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
</div>
<% end %>

View File

@ -1,28 +0,0 @@
<% # encoding: utf-8 %>
<%= form_for(@set_book_type, :remote => true, :url => @book_type_url ) do |f| %>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabe1"><%= (@set_book_type.new_record? ? 'Add 類別' : 'Edit 類別') %></h3>
</div>
<div class="modal-body">
<%= f.fields_for :title_translations do |f| %>
<% @site_in_use_locales.each do |locale| %>
<div class="control-group">
<%= label_tag "link-#{locale}", "Name-#{t(locale)}", :class => 'control-label' %>
<div class="controls">
<%= f.text_field locale, :class => 'control-label', :value => (@set_book_type.title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
<% end %>
<div class="modal-footer">
<%= hidden_field_tag 'book[book_type]', @set_book_type.id %>
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
</div>
<% end %>

View File

@ -3,6 +3,7 @@
<%= stylesheet_link_tag "lib/main-forms" %> <%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/fileupload" %> <%= stylesheet_link_tag "lib/fileupload" %>
<%= stylesheet_link_tag "lib/main-list" %> <%= stylesheet_link_tag "lib/main-list" %>
<%= stylesheet_link_tag "lib/main-form-col2" %>
<% end %> <% end %>
<% content_for :page_specific_javascript do %> <% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %> <%= javascript_include_tag "lib/bootstrap-fileupload" %>
@ -17,156 +18,6 @@
<!-- Input Area --> <!-- Input Area -->
<div class="input-area"> <div class="input-area">
<!-- Module Tabs -->
<div class="nav-name"><strong><%= t(:module) %></strong></div>
<ul class="nav nav-pills module-nav">
<li></li>
<li class="active">
<a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
</li>
<li>
<a href="#status" data-toggle="tab"><%= t(:status) %></a>
</li>
</ul>
<!-- Module -->
<div class="tab-content module-area">
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<div class="control-group">
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
<div class="controls">
<%= @member.name rescue ''%>
<%= f.hidden_field :member_profile_id, :value => @member.id if !@member.nil? %>
</div>
</div>
<!-- author_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.author_type") %></label>
<div class="controls">
<% @author_types.each do |author_type| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'book[book_author_type_ids][]', author_type.id, @book.book_author_type_ids.include?(author_type.id)%>
<%= author_type.title %>
<% end %>
<% end %>
</div>
</div>
<!-- number_of_authors -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.number_of_authors") %></label>
<div class="controls">
<%= f.text_field :number_of_authors, :class=>'span1' %>
</div>
</div>
<!-- book_paper_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.book_paper_type") %></label>
<div class="controls">
<%= f.select :book_type_id, @book_types.collect {|t| [ t.title, t.id ]} %>
</div>
</div>
<!-- year -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.year") %></label>
<div class="controls">
<%= select_year((@book.year ? @book.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'book[year]',:class => 'span1'} ) %>
</div>
</div>
<!-- publish_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.publish_date") %></label>
<div class="controls">
<%= f.datetime_picker :publish_date, :no_label => true,:format=>"yyyy/MM/dd", :placeholder=>"YYYY/MM/DD" %>
</div>
</div>
<!-- publication_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.publication_date") %></label>
<div class="controls">
<%= f.datetime_picker :publication_date, :no_label => true,:format=>"yyyy/MM/dd", :placeholder=>"YYYY/MM/DD" %>
</div>
</div>
<!-- url -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.url") %></label>
<div class="controls">
<%= f.text_field :url , :class => "span6" %>
</div>
</div>
<!-- keywords -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.keywords") %></label>
<div class="controls">
<%= f.text_field :keywords %>
</div>
</div>
<!-- pages -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.pages") %></label>
<div class="controls">
<%= f.text_field :pages %>
</div>
</div>
<!-- isbn -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.isbn") %></label>
<div class="controls">
<%= f.text_field :isbn %>
</div>
</div>
<!-- language -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.language") %></label>
<div class="controls">
<select id="book_language" name="book[language]">
<% @site_in_use_locales.each do |locale| %>
<option value="<%= locale %>" <%= @book.language.eql?(locale.to_s) ? "selected" : ""%>><%= t(locale) %></option>
<% end %>
</select>
</div>
</div>
<!-- note -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.note") %></label>
<div class="controls">
<%= f.text_area :note, rows: 2, class: "input-block-level" %>
</div>
</div>
</div>
<!-- Status Module -->
<div class="tab-pane fade" id="status">
<!-- Status -->
<div class="control-group">
<label class="control-label muted"><%= t(:status) %></label>
<div class="controls" data-toggle="buttons-checkbox">
<label class="checkbox inline btn <%= 'active' if @book.is_hidden? %>">
<%= f.check_box :is_hidden %> <%= t(:hide) %>
</label>
</div>
</div>
</div>
</div>
<!-- Language Tabs --> <!-- Language Tabs -->
<div class="nav-name"><strong><%= t(:language) %></strong></div> <div class="nav-name"><strong><%= t(:language) %></strong></div>
<ul class="nav nav-pills language-nav"> <ul class="nav nav-pills language-nav">
@ -269,6 +120,156 @@
</div> </div>
<!-- Module Tabs -->
<div class="nav-name"><strong><%= t(:module) %></strong></div>
<ul class="nav nav-pills module-nav">
<li></li>
<li class="active">
<a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
</li>
<li>
<a href="#status" data-toggle="tab"><%= t(:status) %></a>
</li>
</ul>
<!-- Module -->
<div class="tab-content module-area">
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
<div class="controls">
<%= @member.name rescue ''%>
<%= f.hidden_field :member_profile_id, :value => @member.id if !@member.nil? %>
</div>
</div>
<!-- year -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.year") %></label>
<div class="controls">
<%= select_year((@book.year ? @book.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'book[year]',:class => 'span1'} ) %>
</div>
</div>
<!-- language -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.language") %></label>
<div class="controls">
<select id="book_language" name="book[language]">
<% @site_in_use_locales.each do |locale| %>
<option value="<%= locale %>" <%= @book.language.eql?(locale.to_s) ? "selected" : ""%>><%= t(locale) %></option>
<% end %>
</select>
</div>
</div>
<!-- book_paper_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.book_paper_type") %></label>
<div class="controls">
<%= f.select :book_type_id, @book_types.collect {|t| [ t.title, t.id ]} %>
</div>
</div>
<!-- pages -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.pages") %></label>
<div class="controls">
<%= f.text_field :pages %>
</div>
</div>
<!-- author_type -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.author_type") %></label>
<div class="controls">
<% @author_types.each do |author_type| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'book[book_author_type_ids][]', author_type.id, @book.book_author_type_ids.include?(author_type.id)%>
<%= author_type.title %>
<% end %>
<% end %>
</div>
</div>
<!-- number_of_authors -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_journal.number_of_authors") %></label>
<div class="controls">
<%= f.text_field :number_of_authors, :class=>'span1' %>
</div>
</div>
<!-- publish_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.publish_date") %></label>
<div class="controls">
<%= f.datetime_picker :publish_date, :no_label => true,:format=>"yyyy/MM/dd", :placeholder=>"YYYY/MM/DD" %>
</div>
</div>
<!-- publication_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.publication_date") %></label>
<div class="controls">
<%= f.datetime_picker :publication_date, :no_label => true,:format=>"yyyy/MM/dd", :placeholder=>"YYYY/MM/DD" %>
</div>
</div>
<!-- isbn -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_book.isbn") %></label>
<div class="controls">
<%= f.text_field :isbn %>
</div>
</div>
<!-- url -->
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_book.url") %></label>
<div class="controls">
<%= f.text_field :url , :class => "span6" %>
</div>
</div>
<!-- keywords -->
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_book.keywords") %></label>
<div class="controls">
<%= f.text_field :keywords %>
</div>
</div>
<!-- note -->
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_book.note") %></label>
<div class="controls">
<%= f.text_area :note, rows: 2, class: "input-block-level" %>
</div>
</div>
</div>
<!-- Status Module -->
<div class="tab-pane fade" id="status">
<!-- Status -->
<div class="control-group">
<label class="control-label muted"><%= t(:status) %></label>
<div class="controls" data-toggle="buttons-checkbox">
<label class="checkbox inline btn <%= 'active' if @book.is_hidden? %>">
<%= f.check_box :is_hidden %> <%= t(:hide) %>
</label>
</div>
</div>
</div>
</div>
</div> </div>

View File

@ -1,11 +1,10 @@
<% # encoding: utf-8 %> <% # encoding: utf-8 %>
<tr id="<%= dom_id list_author_type %>"> <tr id="<%= dom_id list_author_type %>">
<td><%= list_author_type.title %></td> <td><%= list_author_type.title %></td>
<td class="span2"> <td class="span2">
<a href="<%= admin_book_edit_author_type_path(list_author_type) %>#myModal2" data-toggle="modal" data-remote="true" class="action"><%= t('edit')%></a> <a href="<%= edit_admin_book_author_type_path(list_author_type) %>#author_type_modal" data-toggle="modal" data-remote="true" class="action"><%= t(:edit) %></a>
<%= link_to 'Delete', <%= link_to t(:delete_), admin_book_author_type_path(list_author_type), "data-confirm" => t('sure?'), :method => :delete, :remote => true,:class=>"archive_toggle action" %>
polymorphic_path([:admin, list_author_type]), data: { confirm: t('sure?') }, method: :delete, remote:true, class: "delete_author archive_toggle action" %> </td>
</td> </tr>
</tr>

View File

@ -1,10 +1,8 @@
<% # encoding: utf-8 %> <tr id="<%= dom_id list_book_type %>">
<td><%= list_book_type.title %></td>
<td class="span2">
<tr id="<%= dom_id list_book_type %>"> <a href="<%= edit_admin_book_type_path(list_book_type) %>#book_type_modal" data-toggle="modal" data-remote="true" class="action"><%= t(:edit) %></a>
<td><%= list_book_type.title %></td> <%= link_to t(:delete_), admin_book_type_path(list_book_type), "data-confirm" => t('sure?'), :method => :delete, :remote => true,:class=>"archive_toggle action" %>
<td class="span2"> </td>
</tr>
<a href="<%= admin_book_edit_book_type_path(list_book_type) %>#myModal1" data-toggle="modal" data-remote="true" class="action"><%= t('edit')%></a>
<%= link_to 'Delete', polymorphic_path([:admin, list_book_type]), data: { confirm: t('sure?') }, method: :delete, remote: true, class: "delete_level archive_toggle action" %>
</td>
</tr>

View File

@ -2,16 +2,16 @@
<tr id="<%= dom_id writing_book %>" class="with_action"> <tr id="<%= dom_id writing_book %>" class="with_action">
<td class="span1"><%= writing_book.year %></td> <td class="span1"><%= writing_book.year %></td>
<td class="span1"> <td class="span1">
<%= link_to writing_book.create_link, page_for_book(writing_book), target: "blank" %> <%= link_to writing_book.create_link, OrbitHelper.url_to_plugin_show(writing_book.to_param,'personal_book'), target: "blank" %>
<div class="quick-edit"> <div class="quick-edit">
<ul class="nav nav-pills hide"> <ul class="nav nav-pills hide">
<% if current_user.is_admin? %> <% if current_user.is_admin? %>
<li><%= link_to t('edit'), edit_admin_book_path(writing_book) %></li> <li><%= link_to t('edit'), edit_admin_book_path(writing_book) %></li>
<li><%= link_to t(:delete_), admin_book_path(writing_book), method: :delete, remote: true, data: { confirm: 'Are you sure?' } %></li> <li><%= link_to t(:delete_), admin_book_path(id: writing_book.id), method: :delete, remote: true, data: { confirm: 'Are you sure?' } %></li>
<% end %> <% end %>
</ul> </ul>
</div> </div>
</td> </td>
<td class="span1"><%= writing_book.authors%></td> <td><%= writing_book.member_profile.name rescue "" %></td>
</tr> </tr>
<% end %> <% end %>

View File

@ -1 +0,0 @@
$("#myModal2").html("<%= j render "author_type_qe" %>");

View File

@ -1 +0,0 @@
$("#myModal1").html("<%= j render "book_type_qe" %>");

View File

@ -1,97 +0,0 @@
<% # encoding: utf-8 %>
<div id="isotope">
<div class="item element">
<div class="detail w-a h-a">
<p class="totle">
<a class="btn btn-small btn-primary pull-right" href="<%= admin_book_add_book_type_path('add') %>#myModal1" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
<span><%= t("personal_book.book_paper_type") %></span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table id="level_types" class="table table-striped">
<tbody>
<%= render partial: 'list_book_type', collection: @book_types %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="item element">
<div class="detail w-a h-a">
<p class="totle">
<a class="btn btn-small btn-primary pull-right" href="<%= admin_book_add_author_type_path('add') %>#myModal2" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
<span><%= t("personal_book.author_type") %></span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table id="author_types" class="table table-striped">
<tbody>
<%= render partial: 'list_author_type', collection: @author_types %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="form-actions form-fixed pagination-right">
<!-- <a class="btn btn-primary pull-right" href><i class="icon-plus icon-white"></i> 匯出</a>&nbsp;
<a class="btn btn-primary pull-right" href><i class="icon-plus icon-white"></i> 匯入</a>&nbsp; -->
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_admin_book_path, :class => 'btn btn-primary pull-right' %>
</div>
<div id="level_type_qe">
<div style="display:none;" class="modal" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
</div>
</div>
<div id="author_type_qe">
<div style="display:none;" class="modal" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
</div>
</div>
<div style="display:none;" class="modal" id="myModal4" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">領域</h3>
</div>
<ul class="nav nav-tabs">
<li class="active"><a href="#">中文</a></li>
<li><a href="#">English</a></li>
</ul>
<div class="modal-body">
<form class="form-horizontal">
<div class="control-group">
<label class="control-label" for="inputvalue">名稱</label>
<div class="controls">
<input type="text" id="inputvalue" placeholder="Value">
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-primary">Save changes</button>
</div>
</div>

View File

@ -1,9 +0,0 @@
<% if !@book_type.blank? %>
$("#myModal1").modal('hide');
$('<%= j render :partial => 'list_book_type', :collection => [@book_type] %>').appendTo('#level_types').hide().fadeIn();
<% end %>
<% if !@book_author_type.blank? %>
$("#myModal2").modal('hide');
$('<%= j render :partial => 'list_author_type', :collection => [@book_author_type] %>').appendTo('#author_types').hide().fadeIn();
<% end %>

View File

@ -1 +0,0 @@
$("#myModal2").html("<%= j render "author_type_qe" %>");

View File

@ -1 +0,0 @@
$("#myModal1").html("<%= j render "book_type_qe" %>");

View File

@ -0,0 +1,93 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<%= form_for(:book_intro, :url => update_frontend_setting_admin_books_path, :method => "post", html: {class: "form-horizontal main-forms previewable"} ) do |f| %>
<fieldset>
<!-- Input Area -->
<div class="input-area">
<!-- Module Tabs -->
<div class="nav-name"><strong><%= t("module_name.book") %></strong></div>
<ul class="nav nav-pills module-nav">
<li></li>
<li class="active">
<a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
</li>
</ul>
<!-- Module -->
<div class="tab-content module-area">
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<% if !@member.blank? %>
<div class="control-group">
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
<div class="controls">
<%= @member.name rescue ''%>
<%= f.hidden_field :member_profile_id, :value => @member.id %>
</div>
</div>
<% end %>
<!-- frontend_page -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_plugins.frontend_page") %></label>
<div class="controls">
<%= f.check_box :brief_intro, :checked => @intro.brief_intro %> <%= t("personal_plugins.brief_intro") %>
<%= f.check_box :complete_list, :checked => @intro.complete_list %> <%= t("personal_plugins.complete_list") %>
</div>
</div>
</div>
</div>
<!-- Language Tabs -->
<div class="nav-name"><strong><%= t(:language) %></strong></div>
<ul class="nav nav-pills language-nav">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<li class="<%= 'active' if i == 0 %>">
<a data-toggle="tab" href=".<%= locale %>"><%= t(locale) %></a>
</li>
<% end %>
</ul>
<!-- Language -->
<div class="tab-content language-area">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
<!-- Content -->
<div class="control-group input-content">
<label class="control-label muted"><%= t(:content) %></label>
<div class="controls">
<div class="textarea">
<%= f.fields_for :text_translations do |f| %>
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@intro.text_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
</div>
<% end %>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
</fieldset>
<% end %>

View File

@ -0,0 +1,83 @@
<style type="text/css">
.element{
background: #FFF;
margin-bottom: 10px;
border-radius: 5px;
border: 1px solid #DDD;
}
.detail{
padding: 10px;
min-height: 250px;
}
.totle{
margin-bottom: 25px;
}
.totle span{
font-size: 18px;
}
</style>
<div class="row">
<div class="element span4">
<div class="detail w-a h-a">
<p class="totle">
<a class="btn btn-small btn-primary pull-right" href="<%= new_admin_book_type_path %>#book_type_modal" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
<span><%= t("personal_book.book_paper_type") %></span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table id="book_types" class="table table-striped">
<tbody>
<%= render :partial => 'list_book_type', :collection => @book_types %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="element span4">
<div class="detail w-a h-a">
<p class="totle">
<a class="btn btn-small btn-primary pull-right" href="<%= new_admin_book_author_type_path %>#author_type_modal" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
<span><%= t("personal_book.author_type") %></span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table id="author_types" class="table table-striped">
<tbody>
<%= render :partial => 'list_author_type', :collection => @author_types %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div id="paper_type_qe">
<div style="display:none;" class="modal" id="book_type_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
</div>
</div>
<div id="author_type_qe">
<div style="display:none;" class="modal" id="author_type_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
</div>
</div>

View File

@ -1,9 +0,0 @@
<% if !@book_type.blank? %>
$("#myModal1").modal('hide');
$("#<%= dom_id @book_type %>").replaceWith("<%= j render :partial => 'list_book_type', :collection => [@book_type] %>");
<% end %>
<% if !@book_author_type.blank? %>
$("#myModal2").modal('hide');
$("#<%= dom_id @book_author_type %>").replaceWith("<%= j render :partial => 'list_author_type', :collection => [@book_author_type] %>");
<% end %>

View File

@ -6,39 +6,20 @@
<% end %> <% end %>
<% <%
@filter = params[:filter] if has_access?
new_filter = params[:new_filter]
if @filter && params[:clear]
@filter.delete(params[:type])
elsif @filter && new_filter
if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s)
@filter[new_filter[:type]].delete(new_filter[:id].to_s)
elsif @filter.has_key?(new_filter[:type])
@filter[new_filter[:type]] << new_filter[:id].to_s
else
@filter.merge!({new_filter[:type] => [new_filter[:id].to_s]})
end
elsif new_filter
@filter = {new_filter[:type] => [new_filter[:id].to_s]}
end
is_autorized_user = (current_user==@member.user || current_user.is_admin?)
if is_autorized_user
@books = Book.where(member_profile_id: @member.id).desc(:year).page(params[:page]).per(10) @books = Book.where(member_profile_id: @member.id).desc(:year).page(params[:page]).per(10)
else else
@books = Book.where(is_hidden: false, member_profile_id: @member.id).desc(:year).page(params[:page]).per(10) @books = Book.where(is_hidden: false, member_profile_id: @member.id).desc(:year).page(params[:page]).per(10)
end end
%> %>
<% if has_access? %> <% if has_access? %>
<div class="list-active"> <div class="list-active">
<div class="btn-group"> <div class="btn-group">
<%= link_to('Hide', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-hide", :rel => data_share_admin_books_path(member_profile_id: params[:id], disable: 'true') ) %> <%= link_to('Hide', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-hide", :rel => toggle_hide_admin_books_path(member_profile_id: params[:id], disable: 'true') ) %>
<%= link_to('Show', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-show", :rel => data_share_admin_books_path(member_profile_id: params[:id], disable: 'false') ) %> <%= link_to('Show', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-show", :rel => toggle_hide_admin_books_path(member_profile_id: params[:id], disable: 'false') ) %>
</div>
</div> </div>
</div>
<% end -%> <% end -%>
<table class="table table-condensed table-striped main-list"> <table class="table table-condensed table-striped main-list">
@ -66,7 +47,7 @@
<% end -%> <% end -%>
<td><%= book.year %></td> <td><%= book.year %></td>
<td> <td>
<%= link_to book.create_link, page_for_book(book), target: "blank"%> <%= link_to book.create_link, OrbitHelper.url_to_plugin_show(book.to_param,'personal_book'), target: "blank"%>
<% if has_access? %> <% if has_access? %>
<div class="quick-edit"> <div class="quick-edit">
<ul class="nav nav-pills hide"> <ul class="nav nav-pills hide">
@ -85,19 +66,19 @@
</tbody> </tbody>
</table> </table>
<% if has_access? %>
<div class="bottomnav clearfix"> <div class="bottomnav clearfix">
<% if has_access? %>
<div class="action pull-right"> <div class="action pull-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('personal_plugins.edit_brief_intro'),admin_book_intros_path(member_profile_id: @member.id), :class => 'btn btn-primary' %> <%= link_to content_tag(:i, nil, :class => 'icon-edit') +' '+ t('setting'),'/admin/members/'+@member.to_param+'/books/frontend_setting', :class => 'btn btn-primary' %>
<%= link_to content_tag(:i, nil, :class => 'icon-plus') +' '+ t('new_'),
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('announcement.add_new'), new_admin_book_path(member_profile_id: @member.id), :class => 'btn btn-primary' %> '/admin/members/'+@member.to_param+'/books/new', :class => 'btn btn-primary' %>
</div> </div>
<% end %>
<div class="pagination pagination-centered"> <div class="pagination pagination-centered">
<%= paginate @books, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %> <%= paginate @books, :params => {:direction => params[:direction], :sort => params[:sort] } %>
</div> </div>
</div> </div>
<% end %>
<div id="dialog" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="Delete item" aria-hidden="true"> <div id="dialog" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="Delete item" aria-hidden="true">
<div class="modal-header"> <div class="modal-header">

View File

@ -2,6 +2,7 @@ en:
module_name: module_name:
book: Book book: Book
book_paper: Book book_paper: Book
personal_book: Book
personal_book: personal_book:
paper_title : "Paper Title" paper_title : "Paper Title"
book_title : "Book Title" book_title : "Book Title"
@ -9,6 +10,7 @@ en:
publisher : "Publishers" publisher : "Publishers"
editor: "Editor" editor: "Editor"
authors : "Authors" authors : "Authors"
author : "Author"
author_name: "Author Name" author_name: "Author Name"
number_of_authors: "Number Of Authors" number_of_authors: "Number Of Authors"
tags : "Tags" tags : "Tags"

View File

@ -2,12 +2,14 @@ zh_tw:
module_name: module_name:
book: 專書 book: 專書
book_paper: 專書 book_paper: 專書
personal_book : "專書"
personal_book: personal_book:
paper_title : "論文名稱" paper_title : "論文名稱"
book_title : "書名" book_title : "書名"
extracted_chapters : "部份章節" extracted_chapters : "部份章節"
publisher : "出版社" publisher : "出版社"
authors : "全部作者" authors : "全部作者"
author : "作者"
author_name: "作者姓名" author_name: "作者姓名"
number_of_authors: "著作人數" number_of_authors: "著作人數"
tags : "領域" tags : "領域"
@ -17,7 +19,7 @@ zh_tw:
vol_no : "卷數" vol_no : "卷數"
issue_no : "期數" issue_no : "期數"
form_to_start : "起" form_to_start : "起"
form_to_end : "" form_to_end : ""
total_pages : "總頁數" total_pages : "總頁數"
keywords : "關鍵字" keywords : "關鍵字"
abstract : "摘要" abstract : "摘要"
@ -27,7 +29,7 @@ zh_tw:
level_type : "期刊類別" level_type : "期刊類別"
author_type : "作者類別" author_type : "作者類別"
from : "起" from : "起"
to : "" to : ""
file : "檔案" file : "檔案"
file_name : "檔案名稱" file_name : "檔案名稱"
description : "描述" description : "描述"

View File

@ -1,22 +1,30 @@
Rails.application.routes.draw do Rails.application.routes.draw do
locales = Site.find_by(site_active: true).in_use_locales rescue I18n.available_locales locales = Site.find_by(site_active: true).in_use_locales rescue I18n.available_locales
scope "(:locale)", locale: Regexp.new(locales.join("|")) do scope "(:locale)", locale: Regexp.new(locales.join("|")) do
namespace :admin do namespace :admin do
match 'book_setting' => "books#book_setting" ,as: :book_setting, via: [:get] get 'book_setting' => "books#setting"
resources :books do
collection do resources :books do
get 'delete' collection do
get 'data_share' get 'toggle_hide' => 'books#toggle_hide'
end end
match "add_author_type" => "books#add_author_type" ,as: :add_author_type, via: [:get, :post] end
match "edit_author_type" => "books#edit_author_type" ,as: :edit_author_type, via: [:get, :post]
match "add_book_type" => "books#add_book_type" ,as: :add_book_type, via: [:get, :post] resources :members do
match "edit_book_type" => "books#edit_book_type" ,as: :edit_book_type, via: [:get, :post] collection do
end scope '(:name-:uid)' do
resources :book_author_types resources :books do
resources :book_types collection do
resources :book_intros get 'frontend_setting' => 'books#frontend_setting'
post 'update_frontend_setting' => 'books#update_frontend_setting'
end
end
end
end
end
resources :book_author_types
resources :book_types
resources :book_intros
end end
end end
end end

View File

@ -1,10 +1,10 @@
module PersonalBook module PersonalBook
class Engine < ::Rails::Engine class Engine < ::Rails::Engine
initializer "personal_book" do initializer "personal_book" do
OrbitApp.registration "Book",:type=> 'ModuleApp' do OrbitApp.registration "PersonalBook",:type=> 'ModuleApp' do
module_label 'module_name.book' module_label 'module_name.book'
base_url File.expand_path File.dirname(__FILE__) base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true, :sort_number => '25', :app_name=>"Book", :intro_app_name=>"BookIntro",:path=>"/plugin/book/profile",:front_path=>"/profile",:admin_path=>"/admin/books",:i18n=>'module_name.book',:module_app_name=>'Book' personal_plugin :enable => true, :sort_number => '25', :app_name=>"Book", :intro_app_name=>"BookIntro",:path=>"/plugin/personal_book/profile",:front_path=>"/profile",:admin_path=>"/admin/books",:i18n=>'module_name.book',:module_app_name=>'PersonalBook'
version "0.1" version "0.1"
desktop_enabled true desktop_enabled true