opinio 0.4 → 0.4.1

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.
@@ -1,11 +1,15 @@
1
1
  $('#no_comments').fadeOut()
2
- <% if @reply %>
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 %>')
2
+ <% if @comment.valid? %>
3
+ <% if @reply %>
4
+ if($('#comment_<%= @comment.commentable_id %> ul').length == 0)
5
+ $('#comment_<%= @comment.commentable_id %>').append('<ul id="comment_<%= @comment.commentable_id %>_replies" class="replies"></ul>')
6
+ $('#comment_<%= @comment.commentable_id %>_replies').append("<%= escape_javascript( render @comment, :locals => {:reply => @reply} ) %>")
7
+ $('#commentable_id').val('<%= @comment.commentable.commentable_id %>')
8
+ $('#commentable_type').val('<%= @comment.commentable.commentable_type %>')
9
+ <% else %>
10
+ $('#comments').prepend("<%= escape_javascript( render @comment, :locals => {:reply => @reply} ) %>")
11
+ <% end %>
8
12
  <% else %>
9
- $('#comments').prepend("<%= escape_javascript( render @comment, :locals => {:reply => @reply} ) %>")
13
+ $('#comments').prepend("<%= escape_javascript(flash[:notice]) %>");
14
+ $('#comments').prepend("<%= escape_javascript(flash[:error]) %>");
10
15
  <% end %>
11
-
@@ -61,6 +61,8 @@ module Opinio
61
61
 
62
62
  validates_presence_of :commentable
63
63
 
64
+ validates :owner, :presence => true, :associated => true
65
+
64
66
  scope :owned_by, lambda {|owner| where('owner_id = ?', owner.id) }
65
67
 
66
68
  send :include, Opinio::OpinioModel::InstanceMethods
@@ -39,6 +39,12 @@ shared_examples_for :opinio do
39
39
  comment.errors[:commentable].should be_present
40
40
  end
41
41
 
42
+ it "and it should insist on having an owner" do
43
+ c = Comment.new(:body => "The Comment !")
44
+ c.commentable = @post
45
+ c.save.should == false
46
+ end
47
+
42
48
  end
43
49
 
44
50
 
@@ -1,5 +1,5 @@
1
1
  module Opinio
2
2
  class Version
3
- VERSION = '0.4'
3
+ VERSION = '0.4.1'
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.4'
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-07 00:00:00.000000000Z
12
+ date: 2012-02-23 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &2156948880 !ruby/object:Gem::Requirement
16
+ requirement: &2153246840 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '3'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2156948880
24
+ version_requirements: *2153246840
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: kaminari
27
- requirement: &2156948260 !ruby/object:Gem::Requirement
27
+ requirement: &2153246340 !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: *2156948260
35
+ version_requirements: *2153246340
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: jquery-rails
38
- requirement: &2156947720 !ruby/object:Gem::Requirement
38
+ requirement: &2153245840 !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: *2156947720
46
+ version_requirements: *2153245840
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