commontator 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,12 +23,6 @@
23
23
  float: right;
24
24
  }
25
25
 
26
- .comment_body p {
27
- margin: 0px;
28
-
29
- overflow: hidden;
30
- }
31
-
32
26
  .comment_body {
33
27
  margin-left: 55px;
34
28
  margin-top: -60px;
@@ -37,6 +31,20 @@
37
31
  padding: 8px;
38
32
  }
39
33
 
34
+ .comment_body p {
35
+ margin: 0px;
36
+
37
+ overflow: hidden;
38
+ }
39
+
40
+ .comment_body textarea {
41
+ width: 100%;
42
+ }
43
+
44
+ .comment_form_actions {
45
+ margin-top: 10px;
46
+ }
47
+
40
48
  .comment_gravatar_image img {
41
49
  margin-top: 5px;
42
50
  }
@@ -23,12 +23,6 @@
23
23
  float: right;
24
24
  }
25
25
 
26
- .comment_body p {
27
- margin: 0px;
28
-
29
- overflow: hidden;
30
- }
31
-
32
26
  .comment_body {
33
27
  margin-left: 55px;
34
28
  margin-top: -60px;
@@ -37,6 +31,16 @@
37
31
  padding: 8px;
38
32
  }
39
33
 
34
+ .comment_body p {
35
+ margin: 0px;
36
+
37
+ overflow: hidden;
38
+ }
39
+
40
+ .comment_body textarea {
41
+ width: 100%;
42
+ }
43
+
40
44
  .comment_gravatar_image img {
41
45
  margin-top: 5px;
42
46
  }
@@ -59,6 +63,6 @@
59
63
  margin: 0px;
60
64
  }
61
65
 
62
- .comment_count p {
66
+ .comment_vote_count p {
63
67
  margin: 0px;
64
68
  }
@@ -27,17 +27,17 @@ module Commontator
27
27
 
28
28
  raise SecurityTransgression unless @comment.can_be_created_by?(@user)
29
29
 
30
- if @comment.save
31
- @thread.subscribe(@user) if @thread.config.auto_subscribe_on_comment
32
- @thread.add_unread_except_for(@user)
33
- SubscriptionsMailer.comment_created_email(@comment, @commontable_url)
34
- else
35
- @errors = @comment.errors
36
- end
37
-
38
30
  respond_to do |format|
39
- format.html { redirect_to @thread }
40
- format.js
31
+ if @comment.save
32
+ @thread.subscribe(@user) if @thread.config.auto_subscribe_on_comment
33
+ @thread.add_unread_except_for(@user)
34
+ SubscriptionsMailer.comment_created_email(@comment, @commontable_url)
35
+ format.html { redirect_to @thread }
36
+ format.js
37
+ else
38
+ format.html { redirect_to @thread }
39
+ format.js { render :new }
40
+ end
41
41
  end
42
42
  end
43
43
 
@@ -55,11 +55,14 @@ module Commontator
55
55
  def update
56
56
  raise SecurityTransgression unless @comment.can_be_edited_by?(@user)
57
57
 
58
- @comment.update_attributes(params[:comment])
59
-
60
58
  respond_to do |format|
61
- format.html { redirect_to @thread }
62
- format.js
59
+ if @comment.update_attributes(params[:comment])
60
+ format.html { redirect_to @thread }
61
+ format.js
62
+ else
63
+ format.html { redirect_to @thread }
64
+ format.js { render :edit }
65
+ end
63
66
  end
64
67
  end
65
68
 
@@ -27,17 +27,17 @@ module Commontator
27
27
 
28
28
  raise SecurityTransgression unless @comment.can_be_created_by?(@user)
29
29
 
30
- if @comment.save
31
- @thread.subscribe(@user) if @thread.config.auto_subscribe_on_comment
32
- @thread.add_unread_except_for(@user)
33
- SubscriptionsMailer.comment_created_email(@comment, @commontable_url)
34
- else
35
- @errors = @comment.errors
36
- end
37
-
38
30
  respond_to do |format|
39
- format.html { redirect_to @thread }
40
- format.js
31
+ if @comment.save
32
+ @thread.subscribe(@user) if @thread.config.auto_subscribe_on_comment
33
+ @thread.add_unread_except_for(@user)
34
+ SubscriptionsMailer.comment_created_email(@comment, @commontable_url)
35
+ format.html { redirect_to @thread }
36
+ format.js
37
+ else
38
+ format.html { redirect_to @thread }
39
+ format.js { render :new }
40
+ end
41
41
  end
42
42
  end
43
43
 
@@ -55,11 +55,13 @@ module Commontator
55
55
  def update
56
56
  raise SecurityTransgression unless @comment.can_be_edited_by?(@user)
57
57
 
58
- @comment.update_attributes(params[:comment])
59
-
60
58
  respond_to do |format|
61
- format.html { redirect_to @thread }
62
- format.js
59
+ if @comment.update_attributes(params[:comment])
60
+ format.html { redirect_to @thread }
61
+ format.js
62
+ else
63
+ format.html { render action: "edit" }
64
+ end
63
65
  end
64
66
  end
65
67
 
@@ -81,7 +83,7 @@ module Commontator
81
83
  raise SecurityTransgression unless @comment.can_be_deleted_by?(@user)
82
84
 
83
85
  @comment.errors.add(:base, 'This comment is not deleted.') \
84
- unless @comment.undelete(@user)
86
+ unless @comment.undelete
85
87
 
86
88
  respond_to do |format|
87
89
  format.html { redirect_to @thread }
@@ -8,18 +8,31 @@
8
8
 
9
9
  <% config = comment.thread.config %>
10
10
 
11
+ <% if comment.errors.any? %>
12
+ <div class="comment_error_explanation">
13
+ <h3>This <%= config.comment_name %> could not be
14
+ <%= comment.id.blank? ? config.comment_create_verb_past : 'updated' %> because of the following error<%= comment.errors.count == 1 ? '' : 's' %>:</h3>
15
+
16
+ <ul>
17
+ <% comment.errors.full_messages.each do |msg| %>
18
+ <li><%= msg %></li>
19
+ <% end %>
20
+ </ul>
21
+ </div>
22
+ <% end %>
23
+
11
24
  <%= form_for([commontator, thread, comment],
12
25
  :remote => !no_remote) do |f| %>
13
-
14
- <p>
26
+
27
+ <div class="comment_form_field">
15
28
  <%= f.text_area :body, :rows => '7' %>
16
- </p>
29
+ </div>
17
30
 
18
- <p>
31
+ <div class="comment_form_actions">
19
32
  <%= f.submit (comment.id.blank? ? \
20
33
  config.comment_create_verb_present : \
21
34
  'update').capitalize + \
22
35
  ' ' + config.comment_name %>
23
- </p>
36
+ </div>
24
37
 
25
38
  <% end %>
@@ -8,17 +8,29 @@
8
8
 
9
9
  <% config = comment.thread.config %>
10
10
 
11
+ <% if comment.errors.any? %>
12
+ <div class="comment_error_explanation">
13
+ <h3>This <%= config.comment_name %> could not be
14
+ <%= comment.id.blank? ? config.comment_create_verb_past : 'updated' %> because of the following error<%= comment.errors.count == 1 ? '' : 's' %>:</h3>
15
+
16
+ <ul>
17
+ <% comment.errors.full_messages.each do |msg| %>
18
+ <li><%= msg %></li>
19
+ <% end %>
20
+ </ul>
21
+ </div>
22
+ <% end %>
23
+
11
24
  <%= form_for([commontator, thread, comment],
12
25
  :remote => !no_remote) do |f| %>
13
-
14
- <p>
15
- <%= f.text_area :body, :rows => '7' %>
16
- </p>
26
+
27
+ <%= f.text_area :body, :rows => '7' %>
17
28
 
18
29
  <p>
19
30
  <%= f.submit (comment.id.blank? ? \
20
31
  config.comment_create_verb_present : \
21
- 'update').capitalize + ' ' + config.comment_name %>
32
+ 'update').capitalize + \
33
+ ' ' + config.comment_name %>
22
34
  </p>
23
35
 
24
36
  <% end %>
@@ -1,3 +1,3 @@
1
1
  module Commontator
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  end
@@ -1,3 +1,3 @@
1
1
  module Commontator
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
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.4
4
+ version: 1.0.5
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-25 00:00:00.000000000 Z
12
+ date: 2012-07-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails