Sha256: 3a7c082bad11b353d89b9913ae553d0a15cac4cd45f1aaa2ee2ec1d5fd36ad26
Contents?: true
Size: 908 Bytes
Versions: 1
Compression:
Stored size: 908 Bytes
Contents
# frozen_string_literal: true module Talkie class CommentsRenderer attr_reader :commentable def initialize(view_context, commentable, options = {}) @view_context = view_context @commentable = commentable @options = options end def render @view_context.render "talkie/comments/template" end def nested_enabled? @options[:nested] || false end def display_user_avatar? @options[:display_user_avatar].present? end def display_user_handler? @options[:display_user_handler] || false end def root_comments comments = @commentable.root_parents comments = comments.includes(:creator) if display_user_info? comments = comments.includes(:children) if nested_enabled? comments end private def display_user_info? display_user_handler? || display_user_avatar? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
talkie-0.1.0 | lib/talkie/comments_renderer.rb |