Class: ActiveAdmin::Comments::Views::Comments
- Inherits:
-
Views::Panel
show all
- Defined in:
- lib/active_admin/comments/views/active_admin_comments.rb
Instance Method Summary
collapse
#add_child
#default_class_name, #initialize, #tag_name
Instance Method Details
#build(record) ⇒ Object
11
12
13
14
15
|
# File 'lib/active_admin/comments/views/active_admin_comments.rb', line 11
def build(record)
@record = record
super(title_content, :for => record)
end
|
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/active_admin/comments/views/active_admin_comments.rb', line 38
def ()
div :for => do
div :class => "active_admin_comment_meta" do
user_name = .author ? auto_link(.author) : "Anonymous"
h4(user_name, :class => "active_admin_comment_author")
span(pretty_format(.created_at))
end
div :class => "active_admin_comment_body" do
simple_format(.body)
end
div :style => "clear:both;"
end
end
|
66
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/active_admin/comments/views/active_admin_comments.rb', line 66
def
self << active_admin_form_for(ActiveAdmin::Comment.new, :url => , :html => {:class => "inline_form"}) do |form|
form.inputs do
form.input :resource_type, :value => ActiveAdmin::Comment.resource_type(@record), :as => :hidden
form.input :resource_id, :value => @record.id, :as => :hidden
form.input :body, :input_html => {:size => "80x8"}, :label => false
end
form.buttons do
form.commit_button 'Add Comment'
end
end
end
|
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/active_admin/comments/views/active_admin_comments.rb', line 27
def
if .count > 0
.each do ||
()
end
else
build_empty_message
end
end
|
#build_empty_message ⇒ Object
52
53
54
55
56
|
# File 'lib/active_admin/comments/views/active_admin_comments.rb', line 52
def build_empty_message
span :class => "empty" do
"No comments yet."
end
end
|
58
59
60
61
62
63
64
|
# File 'lib/active_admin/comments/views/active_admin_comments.rb', line 58
def
if active_admin_namespace.root?
else
send(:"#{active_admin_namespace.name}_comments_path")
end
end
|
#default_id_for_prefix ⇒ Object
79
80
81
|
# File 'lib/active_admin/comments/views/active_admin_comments.rb', line 79
def default_id_for_prefix
'active_admin_comments_for'
end
|
#title_content ⇒ Object
19
20
21
|
# File 'lib/active_admin/comments/views/active_admin_comments.rb', line 19
def title_content
"Comments (#{.count})"
end
|