Sha256: 5d7fb751f4027af5c04aa43776acd995439487238c2a2eba1090b959b3470868
Contents?: true
Size: 1.29 KB
Versions: 3
Compression:
Stored size: 1.29 KB
Contents
# frozen_string_literal: true require "talkie/comments_renderer" module Talkie module RendererHelper extend ActiveSupport::Concern DELEGATED_METHODS_TO_COMMENTS_RENDERER = %i[commentable root_comments nested_enabled? display_user_handler? display_user_avatar? deletable?].freeze HELPER_METHODS = %i[talkie_on nested_enabled? display_user_handler? display_user_avatar? deletable? root_comments commentable].freeze included do delegate *DELEGATED_METHODS_TO_COMMENTS_RENDERER, to: :comments_renderer if respond_to?(:helper_method) helper_method *HELPER_METHODS end end protected def talkie_on(*args) options = args.extract_options! commentable = args[0] @comments_renderer ||= Talkie::CommentsRenderer.new(view_context, commentable, options) @comments_renderer.render end def comments_renderer @comments_renderer end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
talkie-0.5.1 | lib/talkie/renderer_helper.rb |
talkie-0.5.0 | lib/talkie/renderer_helper.rb |
talkie-0.4.1 | lib/talkie/renderer_helper.rb |