opinio 0.3.1 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -8,7 +8,12 @@ gem "sqlite3"
8
8
  gem "jquery-rails"
9
9
 
10
10
  group :development do
11
- gem "ruby-debug19"
11
+ gem "ruby-debug19" if RUBY_VERSION == '1.9.2'
12
+ gem 'guard-rspec'
13
+ if RUBY_PLATFORM =~ /darwin/i
14
+ gem 'rb-fsevent'
15
+ gem 'growl'
16
+ end
12
17
  end
13
18
 
14
19
  group :test do
@@ -1,4 +1,5 @@
1
- = Opinio
1
+ = Opinio
2
+ {}[http://travis-ci.org/Draiken/opinio.png]
2
3
 
3
4
  == Description
4
5
 
@@ -50,6 +51,11 @@ If you want to display the comments for the item outside of the resource, you ca
50
51
  And there you go, you can now comment in your post.
51
52
  Aditional options can be found on the {RDocs}[http://rubydoc.info/github/Draiken/opinio/master/frames]
52
53
 
54
+ Alternatively you can render just the comments or just the form like this:
55
+
56
+ <%= render_comments @post %>
57
+ <%= render_comments_form @post %>
58
+
53
59
  == Customization
54
60
 
55
61
  === Views
@@ -121,7 +127,3 @@ Remember this engine is still in development :)
121
127
  * Support for deeper levels of replies
122
128
  * Refactor the `comments_for` helper
123
129
  * Extract documentation to wiki
124
- * Add tons of rspecs for
125
- * controllers
126
- * routes
127
- * model extensions
@@ -14,6 +14,11 @@ class Opinio::CommentsController < ApplicationController
14
14
  else
15
15
  flash[:error] = I18n.translate('opinio.comment.error', :default => "Error sending the comment.")
16
16
  end
17
+
18
+ respond_to do |format|
19
+ format.js
20
+ format.html { redirect_to( resource ) }
21
+ end
17
22
  end
18
23
 
19
24
  def destroy
@@ -24,8 +29,13 @@ class Opinio::CommentsController < ApplicationController
24
29
  flash[:notice] = I18n.translate('opinio.comment.destroyed', :default => "Comment removed successfully")
25
30
  else
26
31
  #flash[:error] = I18n.translate('opinio.comment.not_permitted', :default => "Not permitted")
27
- logger.warning "user #{send(Opinio.current_user_method)} tried to remove a comment from another user #{@comment.owner.id}"
28
- render :text => "unauthorized", :status => 401
32
+ logger.warn "user #{send(Opinio.current_user_method)} tried to remove a comment from another user #{@comment.owner.id}"
33
+ render :text => "unauthorized", :status => 401 and return
34
+ end
35
+
36
+ respond_to do |format|
37
+ format.js
38
+ format.html { redirect_to( @comment.commentable ) }
29
39
  end
30
40
  end
31
41
 
@@ -1,11 +1,11 @@
1
- jQuery('#no_comments').fadeOut()
1
+ $('#no_comments').fadeOut()
2
2
  <% if @reply %>
3
- if(jQuery('#comment_<%= @comment.commentable_id %> ul').length == 0)
4
- jQuery('#comment_<%= @comment.commentable_id %>').append('<ul id="comment_<%= @comment.commentable_id %>_replies" class="replies"></ul>')
5
- jQuery('#comment_<%= @comment.commentable_id %>_replies').append("<%= escape_javascript( render @comment, :locals => {:reply => @reply} ) %>")
6
- jQuery('#commentable_id').val('<%= @comment.commentable.commentable_id %>')
7
- jQuery('#commentable_type').val('<%= @comment.commentable.commentable_type %>')
3
+ if($('#comment_<%= @comment.commentable_id %> ul').length == 0)
4
+ $('#comment_<%= @comment.commentable_id %>').append('<ul id="comment_<%= @comment.commentable_id %>_replies" class="replies"></ul>')
5
+ $('#comment_<%= @comment.commentable_id %>_replies').append("<%= escape_javascript( render @comment, :locals => {:reply => @reply} ) %>")
6
+ $('#commentable_id').val('<%= @comment.commentable.commentable_id %>')
7
+ $('#commentable_type').val('<%= @comment.commentable.commentable_type %>')
8
8
  <% else %>
9
- jQuery('#comments').prepend("<%= escape_javascript( render @comment, :locals => {:reply => @reply} ) %>")
9
+ $('#comments').prepend("<%= escape_javascript( render @comment, :locals => {:reply => @reply} ) %>")
10
10
  <% end %>
11
11
 
@@ -1,3 +1,3 @@
1
- jQuery("#commentable_id").val('<%= @commentable_id %>')
2
- jQuery("#commentable_type").val('<%= @commentable_type %>')
3
- jQuery("#new_comment textarea").focus()
1
+ $("#commentable_id").val('<%= @commentable_id %>')
2
+ $("#commentable_type").val('<%= @commentable_type %>')
3
+ $("#new_comment textarea").focus()
@@ -18,5 +18,4 @@ module Opinio
18
18
  end
19
19
 
20
20
  end
21
-
22
21
  end
@@ -11,7 +11,7 @@ module ActionDispatch::Routing
11
11
  def opinio_model(*args)
12
12
  options = args.extract_options!
13
13
  options[:controller] ||= 'opinio/comments'
14
- resources :comments, :controller => options[:controller] do
14
+ resources :comments, options do
15
15
  get 'reply', :on => :member if Opinio.accept_replies
16
16
  end
17
17
  end
@@ -1,5 +1,5 @@
1
1
  module Opinio
2
2
  class Version
3
- VERSION = '0.3.1'
3
+ VERSION = '0.3.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opinio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-06-09 00:00:00.000000000 -03:00
13
- default_executable:
12
+ date: 2011-12-20 00:00:00.000000000Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: rails
17
- requirement: &2157417420 !ruby/object:Gem::Requirement
16
+ requirement: &22270380 !ruby/object:Gem::Requirement
18
17
  none: false
19
18
  requirements:
20
19
  - - ~>
@@ -22,10 +21,10 @@ dependencies:
22
21
  version: '3.0'
23
22
  type: :runtime
24
23
  prerelease: false
25
- version_requirements: *2157417420
24
+ version_requirements: *22270380
26
25
  - !ruby/object:Gem::Dependency
27
26
  name: kaminari
28
- requirement: &2157417000 !ruby/object:Gem::Requirement
27
+ requirement: &22269960 !ruby/object:Gem::Requirement
29
28
  none: false
30
29
  requirements:
31
30
  - - ! '>='
@@ -33,10 +32,10 @@ dependencies:
33
32
  version: '0'
34
33
  type: :runtime
35
34
  prerelease: false
36
- version_requirements: *2157417000
35
+ version_requirements: *22269960
37
36
  - !ruby/object:Gem::Dependency
38
37
  name: jquery-rails
39
- requirement: &2157416540 !ruby/object:Gem::Requirement
38
+ requirement: &22269500 !ruby/object:Gem::Requirement
40
39
  none: false
41
40
  requirements:
42
41
  - - ! '>='
@@ -44,7 +43,7 @@ dependencies:
44
43
  version: '0'
45
44
  type: :runtime
46
45
  prerelease: false
47
- version_requirements: *2157416540
46
+ version_requirements: *22269500
48
47
  description: Opinio is an engine used to add comments functionallity to rails 3 applications.
49
48
  email:
50
49
  - luiz.felipe.gp@gmail.com
@@ -52,37 +51,36 @@ executables: []
52
51
  extensions: []
53
52
  extra_rdoc_files: []
54
53
  files:
55
- - app/controllers/opinio/comments_controller.rb
56
- - app/views/opinio/comments/_comment.html.erb
57
54
  - app/views/opinio/comments/_comments.html.erb
58
55
  - app/views/opinio/comments/_new.html.erb
59
56
  - app/views/opinio/comments/create.js.erb
60
- - app/views/opinio/comments/destroy.js.erb
61
- - app/views/opinio/comments/index.html.erb
57
+ - app/views/opinio/comments/_comment.html.erb
62
58
  - app/views/opinio/comments/reply.js.erb
63
- - lib/generators/opinio/install/install_generator.rb
64
- - lib/generators/opinio/install/templates/initializers/opinio.erb
65
- - lib/generators/opinio/install/templates/migrations/create_model.rb
66
- - lib/generators/opinio/install/templates/models/model.rb
67
- - lib/generators/opinio/views/views_generator.rb
68
- - lib/opinio/controllers/extensions.rb
69
- - lib/opinio/controllers/helpers.rb
70
- - lib/opinio/controllers/internal_helpers.rb
71
- - lib/opinio/controllers/replies.rb
72
- - lib/opinio/opinio_model.rb
73
- - lib/opinio/opinio_subjectum.rb
74
- - lib/opinio/orm/active_record.rb
59
+ - app/views/opinio/comments/index.html.erb
60
+ - app/views/opinio/comments/destroy.js.erb
61
+ - app/controllers/opinio/comments_controller.rb
62
+ - lib/opinio/version.rb
75
63
  - lib/opinio/rails/routes.rb
76
- - lib/opinio/rails.rb
64
+ - lib/opinio/orm/active_record.rb
65
+ - lib/opinio/opinio_model.rb
77
66
  - lib/opinio/railtie.rb
67
+ - lib/opinio/rails.rb
68
+ - lib/opinio/opinio_subjectum.rb
78
69
  - lib/opinio/schema.rb
79
- - lib/opinio/version.rb
70
+ - lib/opinio/controllers/extensions.rb
71
+ - lib/opinio/controllers/internal_helpers.rb
72
+ - lib/opinio/controllers/replies.rb
73
+ - lib/opinio/controllers/helpers.rb
80
74
  - lib/opinio.rb
75
+ - lib/generators/opinio/install/install_generator.rb
76
+ - lib/generators/opinio/install/templates/migrations/create_model.rb
77
+ - lib/generators/opinio/install/templates/models/model.rb
78
+ - lib/generators/opinio/install/templates/initializers/opinio.erb
79
+ - lib/generators/opinio/views/views_generator.rb
81
80
  - MIT-LICENSE
82
81
  - Rakefile
83
82
  - Gemfile
84
83
  - README.rdoc
85
- has_rdoc: true
86
84
  homepage:
87
85
  licenses: []
88
86
  post_install_message:
@@ -103,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
101
  version: '0'
104
102
  requirements: []
105
103
  rubyforge_project:
106
- rubygems_version: 1.6.2
104
+ rubygems_version: 1.8.10
107
105
  signing_key:
108
106
  specification_version: 3
109
107
  summary: A rails 3 engine for comments.