commontator 1.0.3 → 1.0.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.
data/README.md CHANGED
@@ -95,6 +95,8 @@ Follow the steps below to add commontator to your models and views:
95
95
  Where commontable is an instance of some model that acts_as_commontable.
96
96
  Note that model's record must already exist in the database, so do not use this in new.html.erb, _form.html.erb or similar.
97
97
  We recommend you use this in the model's show.html.erb.
98
+ When you do this, it is up to you to ensure that the user has the proper permission
99
+ to read the thread or else a SecurityTransgression will be raised.
98
100
 
99
101
  3. Controllers
100
102
 
@@ -47,6 +47,8 @@
47
47
 
48
48
  .comment_votes {
49
49
  float: right;
50
+
51
+ text-align: center;
50
52
  }
51
53
 
52
54
  .comment_votes input,
@@ -54,35 +56,9 @@
54
56
  border: none;
55
57
  background-color: transparent;
56
58
  padding: 0px;
57
- margin: 5px;
58
- }
59
-
60
- .comment_upvote {
61
- display: table;
62
- }
63
-
64
- .comment_upvote form {
65
- display: table-cell;
66
- }
67
-
68
- .comment_downvote {
69
- display: table;
59
+ margin: 0px;
70
60
  }
71
61
 
72
- .comment_downvote form {
73
- display: table-cell;
74
- }
75
-
76
- .comment_upvote_count {
77
- display: table-cell;
78
- vertical-align: middle;
79
-
80
- padding-top: 1px;
81
- }
82
-
83
- .comment_downvote_count {
84
- display: table-cell;
85
- vertical-align: middle;
86
-
87
- padding-bottom: 7px;
62
+ .comment_vote_count p {
63
+ margin: 0px;
88
64
  }
@@ -15,6 +15,8 @@
15
15
  color: #000;
16
16
  border-color: #ddd;
17
17
  background-color: #fff;
18
+
19
+ clear: both;
18
20
  }
19
21
 
20
22
  .comment_actions {
@@ -45,6 +47,8 @@
45
47
 
46
48
  .comment_votes {
47
49
  float: right;
50
+
51
+ text-align: center;
48
52
  }
49
53
 
50
54
  .comment_votes input,
@@ -52,35 +56,9 @@
52
56
  border: none;
53
57
  background-color: transparent;
54
58
  padding: 0px;
55
- margin: 5px;
56
- }
57
-
58
- .comment_upvote {
59
- display: table;
60
- }
61
-
62
- .comment_upvote form {
63
- display: table-cell;
64
- }
65
-
66
- .comment_downvote {
67
- display: table;
68
- }
69
-
70
- .comment_downvote form {
71
- display: table-cell;
59
+ margin: 0px;
72
60
  }
73
61
 
74
- .comment_upvote_count {
75
- display: table-cell;
76
- vertical-align: middle;
77
-
78
- padding-top: 1px;
79
- }
80
-
81
- .comment_downvote_count {
82
- display: table-cell;
83
- vertical-align: middle;
84
-
85
- padding-bottom: 7px;
62
+ .comment_count p {
63
+ margin: 0px;
86
64
  }
@@ -27,12 +27,11 @@
27
27
  <% else %>
28
28
  <%= image_tag "commontator/upvote_hover.png" %>
29
29
  <% end %>
30
- <span id="comment_<%= comment.id %>_upvote_count_span" class="comment_upvote_count">
31
- <%= comment.upvotes.size %>
32
- </span>
33
30
  </span>
34
31
 
35
- <br/>
32
+ <span id="comment_<%= comment.id %>_vote_count_span" class="comment_vote_count">
33
+ <p>+ <%= comment.upvotes.size %><br><br>- <%= comment.downvotes.size %></p>
34
+ </span>
36
35
 
37
36
  <span id="comment_<%= comment.id %>_downvote_span" class="comment_downvote">
38
37
  <% if can_vote && (vote.blank? || vote.vote_flag) %>
@@ -54,8 +53,5 @@
54
53
  <% else %>
55
54
  <%= image_tag "commontator/downvote_hover.png" %>
56
55
  <% end %>
57
- <span id="comment_<%= comment.id %>_downvote_count_span" class="comment_downvote_count">
58
- <%= comment.downvotes.size %>
59
- </span>
60
56
  </span>
61
57
  <% end %>
@@ -0,0 +1,57 @@
1
+ <% # Clients of this partial must provide the following variable:
2
+ # comment
3
+ # user
4
+ %>
5
+
6
+ <% if comment.can_be_voted_on? %>
7
+ <% can_vote = comment.can_be_voted_on_by?(user) %>
8
+ <% vote = comment.votes.find_by_voter_id_and_voter_type(user.id, user.class.name) %>
9
+
10
+ <span id="comment_<%= comment.id %>_upvote_span" class="comment_upvote">
11
+ <% if can_vote && (vote.blank? || !vote.vote_flag) %>
12
+ <%= form_tag commontator.upvote_comment_path(comment),
13
+ :method => :put,
14
+ :remote => true do %>
15
+ <%= image_submit_tag "commontator/upvote.png",
16
+ :onmouseover => "this.src='/assets/commontator/upvote_hover.png'",
17
+ :onmouseout => "this.src='/assets/commontator/upvote.png'" %>
18
+ <% end %>
19
+ <% elsif can_vote %>
20
+ <%= form_tag commontator.unvote_comment_path(comment),
21
+ :method => :put,
22
+ :remote => true do %>
23
+ <%= image_submit_tag "commontator/upvote_hover.png",
24
+ :onmouseover => "this.src='/assets/commontator/upvote.png'",
25
+ :onmouseout => "this.src='/assets/commontator/upvote_hover.png'" %>
26
+ <% end %>
27
+ <% else %>
28
+ <%= image_tag "commontator/upvote_hover.png" %>
29
+ <% end %>
30
+ </span>
31
+
32
+ <span id="comment_<%= comment.id %>_vote_count_span" class="comment_vote_count">
33
+ <p>+ <%= comment.upvotes.size %> | - <%= comment.downvotes.size %></p>
34
+ </span>
35
+
36
+ <span id="comment_<%= comment.id %>_downvote_span" class="comment_downvote">
37
+ <% if can_vote && (vote.blank? || vote.vote_flag) %>
38
+ <%= form_tag commontator.downvote_comment_path(comment),
39
+ :method => :put,
40
+ :remote => true do %>
41
+ <%= image_submit_tag "commontator/downvote.png",
42
+ :onmouseover => "this.src='/assets/commontator/downvote_hover.png'",
43
+ :onmouseout => "this.src='/assets/commontator/downvote.png'" %>
44
+ <% end %>
45
+ <% elsif can_vote %>
46
+ <%= form_tag commontator.unvote_comment_path(comment),
47
+ :method => :put,
48
+ :remote => true do %>
49
+ <%= image_submit_tag "commontator/downvote_hover.png",
50
+ :onmouseover => "this.src='/assets/commontator/downvote.png'",
51
+ :onmouseout => "this.src='/assets/commontator/downvote_hover.png'" %>
52
+ <% end %>
53
+ <% else %>
54
+ <%= image_tag "commontator/downvote_hover.png" %>
55
+ <% end %>
56
+ </span>
57
+ <% end %>
@@ -1,3 +1,3 @@
1
1
  module Commontator
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
@@ -1,3 +1,3 @@
1
1
  module Commontator
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commontator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-20 00:00:00.000000000 Z
12
+ date: 2012-07-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -120,6 +120,7 @@ files:
120
120
  - app/mailers/commontator/subscriptions_mailer.rb
121
121
  - app/views/commontator/comments/_body.html.erb
122
122
  - app/views/commontator/comments/_show.html.erb~
123
+ - app/views/commontator/comments/_votes.html.erb~
123
124
  - app/views/commontator/comments/_form.html.erb
124
125
  - app/views/commontator/comments/delete.js.erb
125
126
  - app/views/commontator/comments/vote.js.erb