laurynasl-sunflower-comments 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -2
- data/app/controllers/comments.rb +13 -1
- data/lib/sunflower-comments.rb +1 -0
- metadata +1 -1
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@ AUTHOR = "Laurynas Liutkus"
|
|
9
9
|
EMAIL = "laurynasl@gmail.com"
|
10
10
|
HOMEPAGE = "http://github.com/laurynasl/sunflower-comments/"
|
11
11
|
SUMMARY = "Merb Slice that provides sequel + postgres + comments = comment anything (polymorphic, with database triggers)"
|
12
|
-
GEM_VERSION = "0.0.
|
12
|
+
GEM_VERSION = "0.0.5"
|
13
13
|
|
14
14
|
spec = Gem::Specification.new do |s|
|
15
15
|
s.rubyforge_project = 'merb'
|
@@ -23,7 +23,7 @@ spec = Gem::Specification.new do |s|
|
|
23
23
|
s.author = AUTHOR
|
24
24
|
s.email = EMAIL
|
25
25
|
s.homepage = HOMEPAGE
|
26
|
-
s.add_dependency('merb-slices', '>= 1.0.3')
|
26
|
+
#s.add_dependency('merb-slices', '>= 1.0.3')
|
27
27
|
s.require_path = 'lib'
|
28
28
|
s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,spec,app,public,stubs}/**/*")
|
29
29
|
end
|
data/app/controllers/comments.rb
CHANGED
@@ -15,13 +15,25 @@ class SunflowerComments::Comments < SunflowerComments::Application
|
|
15
15
|
@parent = SunflowerComments.classes_hash[params[:parent_table]][params[:parent_id]]
|
16
16
|
user_login = @reply_to_comment.user ? @reply_to_comment.user.login : 'Anonimas'
|
17
17
|
@comment = Comment.new(
|
18
|
-
:body =>
|
18
|
+
:body => make_quote(@reply_to_comment, user_login)
|
19
19
|
)
|
20
20
|
render
|
21
21
|
end
|
22
22
|
|
23
|
+
def quote
|
24
|
+
@reply_to_comment = Comment[params[:id]]
|
25
|
+
user_login = @reply_to_comment.user ? @reply_to_comment.user.login : 'Anonimas'
|
26
|
+
make_quote(@reply_to_comment, user_login)
|
27
|
+
end
|
28
|
+
|
23
29
|
def report
|
24
30
|
Comment.filter(:id => params[:id]).update(:reported => (:reported + 1))
|
25
31
|
"Ačiū, kad pranešėte. Patikrinsime."
|
26
32
|
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def make_quote(comment, user_login)
|
37
|
+
"<blockquote>\n<i><strong>#{h user_login}</strong> rašė:</i>\n\n\n#{comment.body}\n</blockquote>\n\n"
|
38
|
+
end
|
27
39
|
end
|
data/lib/sunflower-comments.rb
CHANGED
@@ -73,6 +73,7 @@ if defined?(Merb::Plugins)
|
|
73
73
|
scope.match(prefix+"/comments/:id", :method => :delete).to(hash.merge(:action => 'destroy')).name(:"#{singular}_comment")
|
74
74
|
|
75
75
|
scope.match(prefix+"/comments/:id/report", :method => :get).to(hash.merge(:action => 'report')).name(:"report_#{singular}_comment")
|
76
|
+
scope.match(prefix+"/comments/:id/quote", :method => :get).to(hash.merge(:action => 'quote')).name(:"quote_#{singular}_comment")
|
76
77
|
end
|
77
78
|
end
|
78
79
|
|