class NewsController < WithCatalogueSectionsController

  def index
    @from = Time.new(params[:from][:year], params[:from][:month]) rescue Time.now
    @news_items = NewsItem.visible_to_user.select([:id, :title, :description, :published_at]).where("published_at <= ?", @from.since(2.month)).page(params[:page])
  end

  def show
    @news_item = NewsItem.visible_to_user.find(params[:id])
  end

end
