Sha256: 86c9958e283496864c61113fbfda95eefa1fd1adb16a92c5297b542830ec1979
Contents?: true
Size: 948 Bytes
Versions: 5
Compression:
Stored size: 948 Bytes
Contents
module HelpCenter::SupportThreadsHelper # Used for flagging links in the navbar as active def support_link_to(path, opts={}, &block) link_to path, class: support_link_class(path, opts), &block end 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 # 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 # # https://mattbrictson.com/easier-nested-layouts-in-rails # def parent_layout(layout) @view_flow.set(:layout, output_buffer) output = render(template: "layouts/#{layout}") self.output_buffer = ActionView::OutputBuffer.new(output) end end
Version data entries
5 entries across 5 versions & 1 rubygems