add year and journal type setting for index page
This commit is contained in:
parent
1e9a0cb143
commit
a0e5539620
|
@ -222,6 +222,7 @@ class Admin::JournalPapersController < OrbitMemberController
|
||||||
@journal_levels = JournalLevel.all
|
@journal_levels = JournalLevel.all
|
||||||
@author_types = JournalPaperAuthorType.all
|
@author_types = JournalPaperAuthorType.all
|
||||||
@paper_types = JournalPaperType.all
|
@paper_types = JournalPaperType.all
|
||||||
|
@journal_types = JournalType.all
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_plugin
|
def set_plugin
|
||||||
|
|
|
@ -3,7 +3,15 @@ class PersonalJournalsController < ApplicationController
|
||||||
def index
|
def index
|
||||||
params = OrbitHelper.params
|
params = OrbitHelper.params
|
||||||
page_data_count = OrbitHelper.page_data_count
|
page_data_count = OrbitHelper.page_data_count
|
||||||
journal_papers = JournalPaper.sort_for_frontend.page(OrbitHelper.params[:page_no]).per(page_data_count)
|
page = OrbitHelper.page
|
||||||
|
journal_paper_query = JournalPaper.sort_for_frontend
|
||||||
|
if (!page.year.blank? rescue false)
|
||||||
|
journal_paper_query = journal_paper_query.where(:year.in => page.year.to_a )
|
||||||
|
end
|
||||||
|
if (!page.journal_type.blank? rescue false)
|
||||||
|
journal_paper_query = journal_paper_query.where(:journal_type_id.in => page.journal_type.to_a )
|
||||||
|
end
|
||||||
|
journal_papers = journal_paper_query.page(OrbitHelper.params[:page_no]).per(page_data_count)
|
||||||
page = Page.where(page_id: params[:page_id]).first rescue nil
|
page = Page.where(page_id: params[:page_id]).first rescue nil
|
||||||
if page.custom_string_field == 'table'
|
if page.custom_string_field == 'table'
|
||||||
fields_to_show = page.custom_array_field rescue []
|
fields_to_show = page.custom_array_field rescue []
|
||||||
|
@ -25,7 +33,7 @@ class PersonalJournalsController < ApplicationController
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
if !params[:selectbox].nil?
|
if !params[:selectbox].nil?
|
||||||
journal_papers_temp = JournalPaper.where(is_hidden: false).sort_by { |tp| [-tp[:year].to_i, -tp[:publication_date].to_i] }
|
journal_papers_temp = journal_paper_query.sort_by { |tp| [-tp[:year].to_i, -tp[:publication_date].to_i] }
|
||||||
case params[:selectbox]
|
case params[:selectbox]
|
||||||
when 'paper_title', 'default'
|
when 'paper_title', 'default'
|
||||||
if page.custom_string_field == 'table'
|
if page.custom_string_field == 'table'
|
||||||
|
|
|
@ -33,6 +33,8 @@ class JournalPaper
|
||||||
#relations
|
#relations
|
||||||
belongs_to :member_profile
|
belongs_to :member_profile
|
||||||
belongs_to :journal_paper_type
|
belongs_to :journal_paper_type
|
||||||
|
belongs_to :journal_type
|
||||||
|
|
||||||
has_and_belongs_to_many :journal_levels
|
has_and_belongs_to_many :journal_levels
|
||||||
|
|
||||||
has_many :journal_paper_files, autosave: true, dependent: :destroy
|
has_many :journal_paper_files, autosave: true, dependent: :destroy
|
||||||
|
|
|
@ -197,6 +197,14 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- journal_type -->
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted"><%= t("personal_journal.journal_type") %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.select :journal_type_id, @journal_types.collect {|t| [ t.title, t.id ]}, {include_blank: ''}, :class => "span3" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- paper_type -->
|
<!-- paper_type -->
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted"><%= t("personal_journal.paper_type") %></label>
|
<label class="control-label muted"><%= t("personal_journal.paper_type") %></label>
|
||||||
|
|
|
@ -98,6 +98,33 @@
|
||||||
</div>
|
</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_journal_type_path %>#journal_type_modal" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
|
||||||
|
<span><%= t("personal_journal.journal_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="journal_types" class="table table-striped">
|
||||||
|
<tbody>
|
||||||
|
<%= render :partial => 'list_journal_type', :collection => @journal_types %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="paper_type_qe">
|
<div id="paper_type_qe">
|
||||||
|
@ -113,4 +140,10 @@
|
||||||
<div id="author_type_qe">
|
<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 style="display:none;" class="modal" id="author_type_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="journal_type_qe">
|
||||||
|
<div style="display:none;" class="modal" id="journal_type_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -44,6 +44,7 @@ en:
|
||||||
graph_by : "Graph By"
|
graph_by : "Graph By"
|
||||||
frontend:
|
frontend:
|
||||||
writing_journals: "Journal Paper Front-end"
|
writing_journals: "Journal Paper Front-end"
|
||||||
|
journal_type: Journal Name
|
||||||
strict_compare_mode: Strict Compare mode
|
strict_compare_mode: Strict Compare mode
|
||||||
create_success : "Successfully Create"
|
create_success : "Successfully Create"
|
||||||
update_success : "Successfully Update"
|
update_success : "Successfully Update"
|
||||||
|
|
|
@ -43,6 +43,7 @@ zh_tw:
|
||||||
graph_by : "Graph By"
|
graph_by : "Graph By"
|
||||||
frontend:
|
frontend:
|
||||||
writing_journals: "期刊論文前台"
|
writing_journals: "期刊論文前台"
|
||||||
|
journal_type: 期刊類別
|
||||||
strict_compare_mode: "嚴格比較模式"
|
strict_compare_mode: "嚴格比較模式"
|
||||||
create_success : "新增完成!!"
|
create_success : "新增完成!!"
|
||||||
update_success : "更新完成!!"
|
update_success : "更新完成!!"
|
||||||
|
|
|
@ -2,40 +2,41 @@ 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
|
||||||
get 'writing_journal_setting' => "journal_papers#setting"
|
get 'writing_journal_setting' => "journal_papers#setting"
|
||||||
get 'journal_papers/download_excel_format' => 'journal_papers#excel_format'
|
get 'journal_papers/download_excel_format' => 'journal_papers#excel_format'
|
||||||
post 'journal_papers/import_from_excel' => 'journal_papers#import_from_excel'
|
post 'journal_papers/import_from_excel' => 'journal_papers#import_from_excel'
|
||||||
|
|
||||||
resources :journal_papers do
|
resources :journal_papers do
|
||||||
collection do
|
collection do
|
||||||
post 'merge_process' => 'journal_papers#merge_process'
|
post 'merge_process' => 'journal_papers#merge_process'
|
||||||
get 'merge' => 'journal_papers#merge'
|
get 'merge' => 'journal_papers#merge'
|
||||||
get 'toggle_hide' => 'journal_papers#toggle_hide'
|
get 'toggle_hide' => 'journal_papers#toggle_hide'
|
||||||
get 'analysis'
|
get 'analysis'
|
||||||
get 'analysis_report'
|
get 'analysis_report'
|
||||||
get "download_excel"
|
get "download_excel"
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
resources :members do
|
|
||||||
collection do
|
resources :members do
|
||||||
scope '(:name-:uid)' do
|
collection do
|
||||||
resources :journal_papers do
|
scope '(:name-:uid)' do
|
||||||
collection do
|
resources :journal_papers do
|
||||||
get 'frontend_setting' => 'journal_papers#frontend_setting'
|
collection do
|
||||||
post 'update_frontend_setting' => 'journal_papers#update_frontend_setting'
|
get 'frontend_setting' => 'journal_papers#frontend_setting'
|
||||||
end
|
post 'update_frontend_setting' => 'journal_papers#update_frontend_setting'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
resources :journal_levels
|
|
||||||
resources :journal_paper_author_types
|
resources :journal_levels
|
||||||
resources :journal_paper_types
|
resources :journal_paper_author_types
|
||||||
resources :journal_paper_intros
|
resources :journal_paper_types
|
||||||
|
resources :journal_types
|
||||||
|
resources :journal_paper_intros
|
||||||
end
|
end
|
||||||
get "/xhr/personal_journal/get_fields_for_index" => "personal_journals#get_fields_for_index"
|
get "/xhr/personal_journal/get_fields_for_index" => "personal_journals#get_fields_for_index"
|
||||||
post "/xhr/personal_journal/save_index_fields" => "personal_journals#save_index_fields"
|
post "/xhr/personal_journal/save_index_fields" => "personal_journals#save_index_fields"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,6 +6,12 @@ module PersonalJournal
|
||||||
base_url File.expand_path File.dirname(__FILE__)
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
personal_plugin :enable => true, :sort_number => '5', :app_name=>"JournalPaper", :intro_app_name=>"JournalPaperlIntro",:path=>"/plugin/personal_journal/profile",:front_path=>"/profile",:admin_path=>"/admin/journal_papers/",:i18n=>'module_name.journal_paper', :module_app_name=>'PersonalJournal', :one_line_title => true, :field_modifiable => true, :analysis => true, :analysis_path => "/admin/journal_papers/analysis"
|
personal_plugin :enable => true, :sort_number => '5', :app_name=>"JournalPaper", :intro_app_name=>"JournalPaperlIntro",:path=>"/plugin/personal_journal/profile",:front_path=>"/profile",:admin_path=>"/admin/journal_papers/",:i18n=>'module_name.journal_paper', :module_app_name=>'PersonalJournal', :one_line_title => true, :field_modifiable => true, :analysis => true, :analysis_path => "/admin/journal_papers/analysis"
|
||||||
|
|
||||||
|
begin
|
||||||
|
page_custom_option({year: '<%= f.select :year, (1930...(DateTime.now.year+5)).to_a.reverse, {:include_blank => ""}, {multiple: true} %>'})
|
||||||
|
page_custom_option({journal_type: '<% JournalType.all.each do |journal_type| %><label><%= f.check_box :journal_type, {multiple: true}, journal_type.id.to_s, nil %><%= journal_type.title %></label><% end %>'})
|
||||||
|
rescue => e
|
||||||
|
puts ['there_was_no_page_custom_option',e]
|
||||||
|
end
|
||||||
version "0.1"
|
version "0.1"
|
||||||
desktop_enabled true
|
desktop_enabled true
|
||||||
organization "Rulingcom"
|
organization "Rulingcom"
|
||||||
|
|
Loading…
Reference in New Issue