fix order & add link_to_list to journal show
This commit is contained in:
parent
54011e5ca5
commit
4b2f23ca81
|
@ -4,7 +4,7 @@ class JournalsController < ApplicationController
|
|||
params = OrbitHelper.params
|
||||
categories = []
|
||||
data = []
|
||||
journals = Journal.filter_by_categories.filter_by_tags.page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
|
||||
journals = Journal.order(created_at: :desc).filter_by_categories.filter_by_tags.page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
|
||||
ModuleApp.find_by(key: 'journal').categories.each do |e|
|
||||
categories << [e.id.to_s, e.title]
|
||||
end
|
||||
|
@ -71,7 +71,7 @@ class JournalsController < ApplicationController
|
|||
def show_list
|
||||
params = OrbitHelper.params
|
||||
journal = Journal.find_by(uid: params[:uid])
|
||||
chapters = Chapter.where(journal_id: journal.id).page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
|
||||
chapters = Chapter.where(journal_id: journal.id).order(sort_number: :asc).page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
|
||||
data = []
|
||||
chapters.each do |node|
|
||||
data << {
|
||||
|
@ -128,10 +128,12 @@ class JournalsController < ApplicationController
|
|||
"author_title" => t('journal.author'),
|
||||
"cover" => journal.cover.url,
|
||||
"cover_title" => t('journal.cover'),
|
||||
"pub_date" => journal.pub_date,
|
||||
"pub_date" => journal.pub_date.strftime('%Y-%m-%d'),
|
||||
"pub_date_title" => t('journal.pub_date'),
|
||||
"pub_information" => journal.pub_information,
|
||||
"pub_information_title" => t('journal.pub_information'),
|
||||
link_to_list: OrbitHelper.url_to_show("#{journal.to_param}?mode=many"),
|
||||
|
||||
"extras" => {
|
||||
"mode" => "journal"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue