Module: Thredded::NavHelper

Included in:
ApplicationHelper
Defined in:
app/helpers/thredded/nav_helper.rb

Constant Summary collapse

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]
)

Instance Method Summary collapse

Instance Method Details

#current_page_moderation?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'app/helpers/thredded/nav_helper.rb', line 42

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

#current_page_preferences?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'app/helpers/thredded/nav_helper.rb', line 38

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

#current_page_private_topics?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'app/helpers/thredded/nav_helper.rb', line 46

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

#current_page_unread_topics?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'app/helpers/thredded/nav_helper.rb', line 34

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


50
51
52
# File 'app/helpers/thredded/nav_helper.rb', line 50

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