修改issues返回count

This commit is contained in:
sylor_huang@126.com 2020-05-29 12:32:01 +08:00
parent 1e9716b84a
commit b9c12d8f5d
2 changed files with 8 additions and 3 deletions

View File

@ -7,9 +7,13 @@ class JournalsController < ApplicationController
def index
@page = params[:page] || 1
@limit = params[:limit] || 10
journals = @issue.journals.journal_includes.order("created_on desc")
@journals_size = journals.size
@journals = journals.parent_journals.page(@page).per(@limit)
total_journals = @issue.journals.journal_includes
@jounals_total = total_journals.size
parent_journals =journals.parent_journals.order("created_on desc")
@journals = parent_journals.order("created_on desc").page(@page).per(@limit)
@journals_size = parent_journals.size
end
def create

View File

@ -1,6 +1,7 @@
json.partial! "commons/success"
json.limit @limit
json.journals_count @journals_size
json.journals_total_count @jounals_total
json.issue_journals do
json.array! @journals do |journal|
json.partial! "journals/journal_item", journal: journal