vanilla 1.9.14.1 → 1.9.14.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +1 -1
- data/lib/vanilla/dynasnips/comments.rb +9 -10
- data/test/tmp/soup/current_snip.yml +2 -2
- data/test/tmp/soup/system.yml +2 -2
- metadata +2 -2
data/Rakefile
CHANGED
@@ -6,23 +6,22 @@ class Comments < Dynasnip
|
|
6
6
|
usage %|
|
7
7
|
Embed comments within snips!
|
8
8
|
|
9
|
-
{comments <
|
9
|
+
{comments <false>}
|
10
10
|
|
11
11
|
This will embed a list of comments, and a comment form, in a snip
|
12
12
|
If the snip is being rendered within another snip, it will show a link to the snip,
|
13
|
-
with the number of comments.
|
13
|
+
with the number of comments. Add a parameter to disable new comments.
|
14
14
|
|
|
15
15
|
|
16
|
-
def get(
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
comments_html = if app.request.snip_name == snip_name
|
16
|
+
def get(disable_new_comments=false)
|
17
|
+
return usage if self.class.snip_name == app.request.snip_name
|
18
|
+
comments = app.soup.sieve(:commenting_on => enclosing_snip.name)
|
19
|
+
comments_html = if app.request.snip_name == enclosing_snip.name
|
21
20
|
rendered_comments = render_comments(comments)
|
22
|
-
rendered_comments += comment_form.gsub('SNIP_NAME',
|
21
|
+
rendered_comments += comment_form.gsub('SNIP_NAME', enclosing_snip.name) unless disable_new_comments
|
23
22
|
rendered_comments
|
24
23
|
else
|
25
|
-
%{<a href="#{url_to(
|
24
|
+
%{<a href="#{url_to(enclosing_snip.name)}">#{comments.length} comments for #{enclosing_snip.name}</a>}
|
26
25
|
end
|
27
26
|
return comments_html
|
28
27
|
end
|
@@ -52,7 +51,7 @@ class Comments < Dynasnip
|
|
52
51
|
def render_comments(comments)
|
53
52
|
"<h2>Comments</h2><ol class='comments'>" + comments.map do |comment|
|
54
53
|
rendered_comment = comment_template.gsub('COMMENT_CONTENT', app.render(comment)).
|
55
|
-
gsub('COMMENT_DATE', comment.created_at)
|
54
|
+
gsub('COMMENT_DATE', comment.created_at.to_s)
|
56
55
|
author = comment.author
|
57
56
|
author = "Anonymous" unless author && author != ""
|
58
57
|
if comment.website && comment.website != ""
|
@@ -1,5 +1,5 @@
|
|
1
1
|
CurrentSnip--- # Soup attributes
|
2
|
-
:updated_at: 2009-11-
|
2
|
+
:updated_at: 2009-11-24 10:47:54.395720 +00:00
|
3
3
|
:name: current_snip
|
4
4
|
:render_as: Ruby
|
5
5
|
:usage: |-
|
@@ -12,4 +12,4 @@ CurrentSnip--- # Soup attributes
|
|
12
12
|
{current_snip name}
|
13
13
|
|
14
14
|
will output the name of the current snip, or the name of the snip currently being edited.
|
15
|
-
:created_at: 2009-11-
|
15
|
+
:created_at: 2009-11-24 10:47:54.395718 +00:00
|
data/test/tmp/soup/system.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
--- # Soup attributes
|
2
|
-
:updated_at: 2009-11-
|
2
|
+
:updated_at: 2009-11-24 10:47:54.396490 +00:00
|
3
3
|
:name: system
|
4
4
|
:main_template: "{current_snip}"
|
5
|
-
:created_at: 2009-11-
|
5
|
+
:created_at: 2009-11-24 10:47:54.396487 +00:00
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vanilla
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.14.
|
4
|
+
version: 1.9.14.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Adam
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-24 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|