module ApplicationHelper

Provides functions to help build a theme's layout

Instance Methods

  1. admin_navigation ()

    Render the admin navigation bar if a user is signed in.

    You don't have to check if the user is signed in before using this method Ecrire will check this automatically

  2. favicon_tag (name = 'favicon.ico')

    Render the favicon tag

    Will generate the asset url given with the name of your favicon.

  3. main_tag (html_options = {}, &block)

    Render the <main> tag

    The html_options is a hash that will map to key/value for the tag. Unless you know what you are doing, you should not specify an id in html_options. Ecrire will generate one using the controller and action for the given request.

    You can also provide any key/value that you wish to see rendered in the main tag.

    Example with posts#index (/posts):

    <%= main_tag contentEditable: true do %>
      Hello world!
    <% end %>
    
    <main contentEditable=true id='PostsIndex'>
      Hello world!
    </main>

    Another example with posts#index (/posts):

    <%= main_tag class: 'content' do %>
      Hello World!
    <% end %>
    
    <main class='content' id='PostsIndex'>
      Hello World!
    </main>
  4. rss_tag (relative_path = '/feed')

    Render a RSS auto-discovery tag

    You can pass another relative path if you want. Ecrire will render an absolute path using the relative_path

  5. title_tag (title = 'Ecrire')

    Render <title> tag

    The content of the title tag can be one of three things. In priority of order:

    1. The value of content_for(:title) if it's set,

    2. The title of the variable @post, if it's set,

    3. The title passed

    If you need more information about content_for and how to use it, please read: ecrire.io/posts/configure-layout-element-with-content_for