Sha256: a8ee3091674b56d46e39de1b7bc4a447fbc36ba0706019f1beb06302d647cb33

Contents?: true

Size: 1.08 KB

Versions: 38

Compression:

Stored size: 1.08 KB

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

    # TODO deprecate!
    def time(datetime)
      forum_time(datetime)
    end

    def upload_allowed_extensions
      Attachment::ALLOWED_FILE_EXTENSIONS
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
my_forum-0.0.2.4 app/helpers/my_forum/application_helper.rb
my_forum-0.0.2.3 app/helpers/my_forum/application_helper.rb
my_forum-0.0.2.2 app/helpers/my_forum/application_helper.rb
my_forum-0.0.2.1 app/helpers/my_forum/application_helper.rb
my_forum-0.0.2 app/helpers/my_forum/application_helper.rb
my_forum-0.0.1.beta60 app/helpers/my_forum/application_helper.rb
my_forum-0.0.1.beta59 app/helpers/my_forum/application_helper.rb
my_forum-0.0.1.beta58 app/helpers/my_forum/application_helper.rb
my_forum-0.0.1.beta57 app/helpers/my_forum/application_helper.rb
my_forum-0.0.1.beta56 app/helpers/my_forum/application_helper.rb
my_forum-0.0.1.beta55 app/helpers/my_forum/application_helper.rb
my_forum-0.0.1.beta54 app/helpers/my_forum/application_helper.rb
my_forum-0.0.1.beta53 app/helpers/my_forum/application_helper.rb
my_forum-0.0.1.beta52 app/helpers/my_forum/application_helper.rb
my_forum-0.0.1.beta51 app/helpers/my_forum/application_helper.rb
my_forum-0.0.1.beta50 app/helpers/my_forum/application_helper.rb
my_forum-0.0.1.beta49 app/helpers/my_forum/application_helper.rb
my_forum-0.0.1.beta48 app/helpers/my_forum/application_helper.rb
my_forum-0.0.1.beta47 app/helpers/my_forum/application_helper.rb
my_forum-0.0.1.beta46 app/helpers/my_forum/application_helper.rb