Sha256: f683742b92f7c04a8f5df02e18ed3ec7b38da61775b75e13af1fb32d057f3c89
Contents?: true
Size: 1.25 KB
Versions: 2
Compression:
Stored size: 1.25 KB
Contents
class Foxynews::PressroomsController < ApplicationController helper Foxynews::FoxynewsHelper helper_method :pressroom, :presskit def index feature_id = Foxynews::FeaturedItem.where(featured: true).pluck(:article_id).first @press_release = feature_id ? Foxynews::PressReleaseSetter.find(feature_id, 'true') : nil page = params[:page] || 1 @limit = params[:limit] || 30 @timeline, @next_timeline_page, @next_page = pagination_content(page, @limit) end def show unless @press_release = Foxynews::PressReleaseSetter.find(params[:id], 'true') redirect_to root_path, flash: { error: I18n.t('error')} end end def archive page = params[:page] || 1 @limit = params[:limit] || 30 @timeline, @next_timeline_page, @next_page = pagination_content(page, @limit) end private def pressroom @pressroom ||= Foxynews::PressroomSetter.pressroom end def presskit @presskit ||= Foxynews::PresskitSetter.all end def pagination_content(page, limit) timeline = Foxynews::PressroomSetter.timeline({page: page, limit: limit}) next_page = page.to_i + 1 next_timeline_page = Foxynews::PressroomSetter.timeline({page: next_page, limit: limit}) [timeline, next_timeline_page, next_page] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
foxynews-1.0.1 | app/controllers/foxynews/pressrooms_controller.rb |
foxynews-1.0.0 | app/controllers/foxynews/pressrooms_controller.rb |