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
|
params = OrbitHelper.params
|
||||||
categories = []
|
categories = []
|
||||||
data = []
|
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|
|
ModuleApp.find_by(key: 'journal').categories.each do |e|
|
||||||
categories << [e.id.to_s, e.title]
|
categories << [e.id.to_s, e.title]
|
||||||
end
|
end
|
||||||
|
@ -71,7 +71,7 @@ class JournalsController < ApplicationController
|
||||||
def show_list
|
def show_list
|
||||||
params = OrbitHelper.params
|
params = OrbitHelper.params
|
||||||
journal = Journal.find_by(uid: params[:uid])
|
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 = []
|
data = []
|
||||||
chapters.each do |node|
|
chapters.each do |node|
|
||||||
data << {
|
data << {
|
||||||
|
@ -128,10 +128,12 @@ class JournalsController < ApplicationController
|
||||||
"author_title" => t('journal.author'),
|
"author_title" => t('journal.author'),
|
||||||
"cover" => journal.cover.url,
|
"cover" => journal.cover.url,
|
||||||
"cover_title" => t('journal.cover'),
|
"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_date_title" => t('journal.pub_date'),
|
||||||
"pub_information" => journal.pub_information,
|
"pub_information" => journal.pub_information,
|
||||||
"pub_information_title" => t('journal.pub_information'),
|
"pub_information_title" => t('journal.pub_information'),
|
||||||
|
link_to_list: OrbitHelper.url_to_show("#{journal.to_param}?mode=many"),
|
||||||
|
|
||||||
"extras" => {
|
"extras" => {
|
||||||
"mode" => "journal"
|
"mode" => "journal"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue