opinio 0.3.3 → 0.3.4

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.
@@ -3,7 +3,7 @@ source "http://rubygems.org"
3
3
  gemspec
4
4
 
5
5
  gem "kaminari"
6
- gem "rails", "~> 3.0.4"
6
+ gem "rails", "~> 3.0.0"
7
7
  gem "sqlite3"
8
8
  gem "jquery-rails"
9
9
 
@@ -0,0 +1,29 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem "kaminari"
6
+ gem "rails", ">= 3.1"
7
+ gem "sqlite3"
8
+ gem "jquery-rails"
9
+
10
+ group :development do
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
17
+ end
18
+
19
+ group :test do
20
+ gem "cucumber"
21
+ gem "cucumber-rails"
22
+ gem "capybara"
23
+ gem "launchy"
24
+ gem "database_cleaner"
25
+ gem "rspec-rails"
26
+ end
27
+ # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
28
+ # gem 'ruby-debug'
29
+ # gem 'ruby-debug19'
@@ -10,14 +10,14 @@ class Opinio::CommentsController < ApplicationController
10
10
  @comment = resource.comments.build(params[:comment])
11
11
  @comment.owner = send(Opinio.current_user_method)
12
12
  if @comment.save
13
- flash[:notice] = I18n.translate('opinio.comment.sent', :default => "Comment sent successfully.")
13
+ messages = {:notice => I18n.translate('opinio.comment.sent', :default => "Comment sent successfully.")}
14
14
  else
15
- flash[:error] = I18n.translate('opinio.comment.error', :default => "Error sending the comment.")
15
+ messages = {:error => I18n.translate('opinio.comment.error', :default => "Error sending the comment.")}
16
16
  end
17
17
 
18
18
  respond_to do |format|
19
19
  format.js
20
- format.html { redirect_to( resource ) }
20
+ format.html { redirect_to( resource, :flash => messages ) }
21
21
  end
22
22
  end
23
23
 
@@ -4,7 +4,7 @@
4
4
  <%= form_for Comment.new, :remote => true do |f| %>
5
5
  <p>
6
6
  <%= f.label :body, "Comment" %>
7
- <%= f.text_area :body %>
7
+ <%= f.text_area :body, :id => "Comment" %>
8
8
  </p>
9
9
  <%= hidden_field_tag :commentable_id, commentable.id %>
10
10
  <%= hidden_field_tag :commentable_type, commentable.class.base_class.name.to_s %>
@@ -1,3 +1,4 @@
1
1
  $("#commentable_id").val('<%= @commentable_id %>')
2
2
  $("#commentable_type").val('<%= @commentable_type %>')
3
+ $("#new_comment textarea").val('')
3
4
  $("#new_comment textarea").focus()
@@ -9,7 +9,8 @@ module Opinio
9
9
 
10
10
  def render_comments(object, options = {})
11
11
  limit = options.delete(:limit) || Opinio.model_name.constantize.default_per_page
12
- render( :partial => "opinio/comments/comments", :locals => {:comments => object.comments.page(1).limit(limit), :commentable => object, :options => options} )
12
+ page = options.delete(:page) || 1
13
+ render( :partial => "opinio/comments/comments", :locals => {:comments => object.comments.page(page).limit(limit), :commentable => object, :options => options} )
13
14
  end
14
15
 
15
16
  def render_comments_form(object, options = {})
@@ -32,7 +32,7 @@ module Opinio
32
32
  if Opinio.use_title
33
33
  attr_accessible :title
34
34
  validates :title,
35
- {}.merge( :length => options[:title_length] )
35
+ {:presence => true}.merge( :length => options[:title_length] )
36
36
  end
37
37
  attr_accessible :body
38
38
 
@@ -66,13 +66,19 @@ module Opinio
66
66
  send :include, Opinio::OpinioModel::InstanceMethods
67
67
 
68
68
  if Opinio.accept_replies
69
- validate :cannot_be_comment_of_a_comments_comment
70
- opinio_subjectum :order => 'created_at ASC'
69
+ send :include, RepliesSupport
71
70
  end
72
71
 
73
72
  end
74
73
  end
75
74
 
75
+ module RepliesSupport
76
+ def self.included(base)
77
+ base.validate :cannot_be_comment_of_a_comments_comment
78
+ base.opinio_subjectum :order => 'created_at ASC'
79
+ end
80
+ end
81
+
76
82
  module InstanceMethods
77
83
 
78
84
  private
@@ -1,5 +1,5 @@
1
1
  module Opinio
2
2
  class Version
3
- VERSION = '0.3.3'
3
+ VERSION = '0.3.4'
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.3
4
+ version: 0.3.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-20 00:00:00.000000000Z
12
+ date: 2012-01-31 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &22270380 !ruby/object:Gem::Requirement
16
+ requirement: &2157268020 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '3.0'
21
+ version: '3'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *22270380
24
+ version_requirements: *2157268020
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: kaminari
27
- requirement: &22269960 !ruby/object:Gem::Requirement
27
+ requirement: &2157267600 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *22269960
35
+ version_requirements: *2157267600
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: jquery-rails
38
- requirement: &22269500 !ruby/object:Gem::Requirement
38
+ requirement: &2157267140 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *22269500
46
+ version_requirements: *2157267140
47
47
  description: Opinio is an engine used to add comments functionallity to rails 3 applications.
48
48
  email:
49
49
  - luiz.felipe.gp@gmail.com
@@ -51,35 +51,36 @@ executables: []
51
51
  extensions: []
52
52
  extra_rdoc_files: []
53
53
  files:
54
+ - app/controllers/opinio/comments_controller.rb
55
+ - app/views/opinio/comments/_comment.html.erb
54
56
  - app/views/opinio/comments/_comments.html.erb
55
57
  - app/views/opinio/comments/_new.html.erb
56
58
  - app/views/opinio/comments/create.js.erb
57
- - app/views/opinio/comments/_comment.html.erb
58
- - app/views/opinio/comments/reply.js.erb
59
- - app/views/opinio/comments/index.html.erb
60
59
  - app/views/opinio/comments/destroy.js.erb
61
- - app/controllers/opinio/comments_controller.rb
62
- - lib/opinio/version.rb
63
- - lib/opinio/rails/routes.rb
64
- - lib/opinio/orm/active_record.rb
65
- - lib/opinio/opinio_model.rb
66
- - lib/opinio/railtie.rb
67
- - lib/opinio/rails.rb
68
- - lib/opinio/opinio_subjectum.rb
69
- - lib/opinio/schema.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
74
- - lib/opinio.rb
60
+ - app/views/opinio/comments/index.html.erb
61
+ - app/views/opinio/comments/reply.js.erb
75
62
  - lib/generators/opinio/install/install_generator.rb
63
+ - lib/generators/opinio/install/templates/initializers/opinio.erb
76
64
  - lib/generators/opinio/install/templates/migrations/create_model.rb
77
65
  - lib/generators/opinio/install/templates/models/model.rb
78
- - lib/generators/opinio/install/templates/initializers/opinio.erb
79
66
  - lib/generators/opinio/views/views_generator.rb
67
+ - lib/opinio/controllers/extensions.rb
68
+ - lib/opinio/controllers/helpers.rb
69
+ - lib/opinio/controllers/internal_helpers.rb
70
+ - lib/opinio/controllers/replies.rb
71
+ - lib/opinio/opinio_model.rb
72
+ - lib/opinio/opinio_subjectum.rb
73
+ - lib/opinio/orm/active_record.rb
74
+ - lib/opinio/rails/routes.rb
75
+ - lib/opinio/rails.rb
76
+ - lib/opinio/railtie.rb
77
+ - lib/opinio/schema.rb
78
+ - lib/opinio/version.rb
79
+ - lib/opinio.rb
80
80
  - MIT-LICENSE
81
81
  - Rakefile
82
- - Gemfile
82
+ - Gemfile-rails-3.0.x
83
+ - Gemfile-rails-3.1.x
83
84
  - README.rdoc
84
85
  homepage:
85
86
  licenses: []