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 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.2"
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
@@ -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 => "<blockquote>\n<i><strong>#{h user_login}</strong> rašė:</i>\n\n\n#{@reply_to_comment.body}\n</blockquote>\n\n"
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
@@ -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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: laurynasl-sunflower-comments
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Laurynas Liutkus