Sha256: 80c43f4ca39d517c79c2d3f47738bc22dc1d72b1c7173b6dca01528aa04eedc4

Contents?: true

Size: 1.27 KB

Versions: 23

Compression:

Stored size: 1.27 KB

Contents

# frozen_string_literal: true

require 'set'
module Thredded
  module NavHelper
    USER_NAV_MODERATION_PAGES = Set.new(
      %w[
        thredded--pending-moderation
        thredded--moderation-activity
        thredded--moderation-history
        thredded--moderation-users
        thredded--moderation-user
      ]
    )

    USER_NAV_PREFERENCES_PAGES = Set.new(
      %w[
        thredded--preferences
      ]
    )

    USER_NAV_PRIVATE_TOPICS_PAGES = Set.new(
      %w[
        thredded--new-private-topic
        thredded--private-topics-index
        thredded--private-topic-show
      ]
    )

    USER_NAV_UNREAD_TOPICS = Set.new(
      %w[thredded--unread-topics]
    )

    def current_page_unread_topics?
      USER_NAV_UNREAD_TOPICS.include?(content_for(:thredded_page_id))
    end

    def current_page_preferences?
      USER_NAV_PREFERENCES_PAGES.include?(content_for(:thredded_page_id))
    end

    def current_page_moderation?
      USER_NAV_MODERATION_PAGES.include?(content_for(:thredded_page_id))
    end

    def current_page_private_topics?
      USER_NAV_PRIVATE_TOPICS_PAGES.include?(content_for(:thredded_page_id))
    end

    def nav_back_path(messageboard = nil)
      messageboard ? messageboard_topics_path(messageboard) : messageboards_path
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
thredded-1.1.0 app/helpers/thredded/nav_helper.rb
thredded-1.0.1 app/helpers/thredded/nav_helper.rb
thredded-1.0.0 app/helpers/thredded/nav_helper.rb
thredded-0.16.16 app/helpers/thredded/nav_helper.rb
thredded-0.16.15 app/helpers/thredded/nav_helper.rb
thredded-0.16.14 app/helpers/thredded/nav_helper.rb
thredded-0.16.13 app/helpers/thredded/nav_helper.rb
thredded-0.16.12 app/helpers/thredded/nav_helper.rb
thredded-0.16.11 app/helpers/thredded/nav_helper.rb
thredded-0.16.10 app/helpers/thredded/nav_helper.rb
thredded-0.16.9 app/helpers/thredded/nav_helper.rb
thredded-0.16.8 app/helpers/thredded/nav_helper.rb
thredded-0.16.7 app/helpers/thredded/nav_helper.rb
thredded-0.16.6 app/helpers/thredded/nav_helper.rb
thredded-0.16.5 app/helpers/thredded/nav_helper.rb
thredded-0.16.4 app/helpers/thredded/nav_helper.rb
thredded-0.16.3 app/helpers/thredded/nav_helper.rb
thredded-0.16.1 app/helpers/thredded/nav_helper.rb
thredded-0.16.0 app/helpers/thredded/nav_helper.rb
thredded-0.15.5 app/helpers/thredded/nav_helper.rb