Sha256: fff5434aba017371a9d9d1948e7572078acd32bc51a5da4c580f500d2e5dcee8

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

module ApplicationHelper
  def admin_navigation
    return unless signed_in?
    render 'sessions/navigation'
  end

  def title_tag(title = 'Ecrire')
    content_tag :title do
      if block_given?
        yield
      elsif !@post.nil?
        @post.title
      else
        title
      end
    end
  end

  def meta_informations_tags
    [
      content_tag(:link, nil, rel: 'alternate', type: 'application/rss+xml', title: 'RSS', href: '/feed'),
      content_tag(:link, nil, rel: %w(shortcut icon), href: asset_url('favicon.ico')),
      csrf_meta_tags
    ].join.html_safe
  end

  def description_meta_tag
    if Rails.application.secrets.fetch(:meta, {}).has_key?(:description)
      content_tag :meta, nil, name: 'description', content: Rails.application.secrets[:meta][:description]
    end
  end

  def open_graph_type
    if @post.nil?
      'website'
    else
      'article'
    end
  end

  def body_tag(html_options = {}, &block)
    html_options[:id] ||= [controller_name, action_name].map(&:capitalize).join
    content_tag :body, html_options, &block
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ecrire-0.25.2 lib/ecrire/app/helpers/application_helper.rb
ecrire-0.25.1 lib/ecrire/app/helpers/application_helper.rb
ecrire-0.25.0 lib/ecrire/app/helpers/application_helper.rb