Sha256: 459c47ed207270c76fdf6ca285754ed2e95ed0e234ca9cae1d60ceb2447e78b1

Contents?: true

Size: 987 Bytes

Versions: 2

Compression:

Stored size: 987 Bytes

Contents

class NotesController < ContentController
  require 'json'

  layout :theme_layout
  cache_sweeper :blog_sweeper
  caches_page :index, :show, if: proc { |c| c.request.query_string == '' }

  after_action :set_blog_infos

  def index
    @notes = Note.published.page(params[:page]).per(this_blog.limit_article_display)

    if @notes.empty?
      @message = I18n.t('errors.no_notes_found')
      render 'notes/error', status: 200
    end
  end

  def show
    @note = Note.published.find_by permalink: CGI.escape(params[:permalink])

    return render 'errors/404', status: 404 unless @note

    if @note.in_reply_to_message.present?
      @reply = JSON.parse(@note.in_reply_to_message)
      render :show_in_reply
    end
  end

  private

  def set_blog_infos
    @keywords = this_blog.meta_keywords
    @page_title = this_blog.statuses_title_template.to_title(@notes, this_blog, params)
    @description = this_blog.statuses_desc_template.to_title(@notes, this_blog, params)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
publify_core-9.0.0.pre2 app/controllers/notes_controller.rb
publify_core-9.0.0.pre1 app/controllers/notes_controller.rb