Sha256: 7e8ad00695d1bcecdfcab55b5f3e1cb4c230b54a010cf58e4a92272127997e5d
Contents?: true
Size: 1009 Bytes
Versions: 3
Compression:
Stored size: 1009 Bytes
Contents
# frozen_string_literal: true require_relative "../../../../views" module ActiveAdmin module Comments module Views class Comments < Arbre::Element builder_method :active_admin_comments_for def build(resource) if authorized?(ActiveAdmin::Auth::READ, ActiveAdmin::Comment) comments = active_admin_authorization.scope_collection(ActiveAdmin::Comment.find_for_resource_in_namespace(resource, active_admin_namespace.name).includes(:author).page(params[:page])) render("active_admin/shared/resource_comments", resource: resource, comments: comments, comment_form_url: comment_form_url) end end protected def comment_form_url parts = [] parts << active_admin_namespace.name unless active_admin_namespace.root? parts << active_admin_namespace.comments_registration_name.underscore.pluralize parts << "path" send parts.join "_" end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems