Sha256: d87996030a978a4dd3423b31f89a3be76937163feb95bee3f61666bd153c6674

Contents?: true

Size: 882 Bytes

Versions: 4

Compression:

Stored size: 882 Bytes

Contents

class NotesController < ContentController
  require 'json'

  layout :theme_layout

  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

4 entries across 4 versions & 1 rubygems

Version Path
publify_core-9.0.0.pre6 app/controllers/notes_controller.rb
publify_core-9.0.0.pre5 app/controllers/notes_controller.rb
publify_core-9.0.0.pre4 app/controllers/notes_controller.rb
publify_core-9.0.0.pre3 app/controllers/notes_controller.rb