Sha256: b8e937f4a6d6d5685893d0fec01d0df7b812a20d07ee57fd1a6c62055045fc10

Contents?: true

Size: 1002 Bytes

Versions: 6

Compression:

Stored size: 1002 Bytes

Contents

module MyForum
  module ApplicationHelper

    def draw_navigation
      html_li  = content_tag :li, link_to('Forums', root_path)

      if @forum
        html_li += content_tag :li, '→'.html_safe
        html_li += content_tag :li, link_to(@forum.name, forum_path(@forum))
      end

      if @forum && @topic && !@topic.new_record?
        html_li += content_tag :li, '→'.html_safe
        html_li += content_tag :li, link_to(@topic.name.html_safe, forum_topic_path(@forum, @topic))
      end

      html = content_tag :ul, class: 'draw-navigation' do
        html_li
      end

      html.html_safe
    end

    def online_users
      User.online.pluck(:login).join(', ')
    end

    def today_was_users
      User.today_visited.pluck(:login).join(', ')
    end

    def errors_for(obj)
      return if obj.errors.blank?

      content_tag :div, obj.errors.full_messages.to_sentence, class: 'errors_for'
    end

    def time(datetime)
      datetime.strftime('%T %F')
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
my_forum-0.0.1.beta8 app/helpers/my_forum/application_helper.rb
my_forum-0.0.1.beta7 app/helpers/my_forum/application_helper.rb
my_forum-0.0.1.beta5 app/helpers/my_forum/application_helper.rb
my_forum-0.0.1.beta4 app/helpers/my_forum/application_helper.rb
my_forum-0.0.1.beta3 app/helpers/my_forum/application_helper.rb
my_forum-0.0.1.beta2 app/helpers/my_forum/application_helper.rb