Module: HelpCenter::SupportThreadsHelper
- Defined in:
- app/helpers/help_center/support_threads_helper.rb
Instance Method Summary collapse
-
#parent_layout(layout) ⇒ Object
A nice hack to manipulate the layout so we can have sub-layouts without any changes in the user’s application.
- #support_link_class(matches, opts = {}) ⇒ Object
-
#support_link_to(path, opts = {}, &block) ⇒ Object
Used for flagging links in the navbar as active.
Instance Method Details
#parent_layout(layout) ⇒ Object
A nice hack to manipulate the layout so we can have sub-layouts without any changes in the user’s application.
We use this for rendering the sidebar layout for all the support pages
23 24 25 26 27 |
# File 'app/helpers/help_center/support_threads_helper.rb', line 23 def parent_layout(layout) @view_flow.set(:layout, output_buffer) output = render(template: "layouts/#{layout}") self.output_buffer = ActionView::OutputBuffer.new(output) end |
#support_link_class(matches, opts = {}) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'app/helpers/help_center/support_threads_helper.rb', line 7 def support_link_class(matches, opts={}) case matches when Array "active" if matches.any?{ |m| request.path.starts_with?(m) } when String "active" if opts.fetch(:exact, false) ? request.path == matches : request.path.starts_with?(matches) end end |
#support_link_to(path, opts = {}, &block) ⇒ Object
Used for flagging links in the navbar as active
3 4 5 |
# File 'app/helpers/help_center/support_threads_helper.rb', line 3 def support_link_to(path, opts={}, &block) link_to path, class: support_link_class(path, opts), &block end |