Sha256: 98f25940b5b04b08bcb61cc6bf38c9fca15e40f5ad693768f3c6d5242c58cbc5

Contents?: true

Size: 471 Bytes

Versions: 3

Compression:

Stored size: 471 Bytes

Contents

module PostsHelper
  def post_path(post, options = {})
    if post.published?
      options[:year] = post.published_at.year
      options[:month] = post.published_at.month
    else
      options[:year] = post.created_at.year
      options[:month] = post.created_at.month
    end

    super(post.becomes(::Post), options)
  end

  def edit_post_link(options = {})
    return unless signed_in?

    link_to t('posts.edit'), edit_admin_post_path(post.id), options
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ecrire-0.22.1 lib/ecrire/app/helpers/posts_helper.rb
ecrire-0.21.0 lib/ecrire/app/helpers/posts_helper.rb
ecrire-0.20.0 lib/ecrire/app/helpers/posts_helper.rb