commontator 6.1.1 → 6.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b43492888aa32e2a5281147f5b8fa373bf4368fdac7e251f56652aee7263c6e
4
- data.tar.gz: df8792352f99e43ae5bb707c73b8f7e2761d4172659816895603d1dc8d3a053d
3
+ metadata.gz: '090fc289133016e2dee74b6443dbb24d87474a147f0af5be10794d1528572f1f'
4
+ data.tar.gz: caa26ed1c165afc9dbc133196c0a1bc40c9fb5271835cf5c24195da98eacdb1a
5
5
  SHA512:
6
- metadata.gz: 8d8149b165e5a4a1b3dfe9b9035129fd1fa232c9c65b0b5852bb5944ea3e2e9188142124e376821ca624b268e19ba32a5a762de1416b72a4690d23325c9cf897
7
- data.tar.gz: 2c47c72b76baf4687caae23c5e6d5348e5ee4f1d987ef2ce6b07f22225e39d15be3a3cd2a450442c19bad1aa0712c7ed534e44cdb1f637d73f25518dbfdd45e5
6
+ metadata.gz: 6b4eb3166f2de162d2a34f1bcc724e14dd538043a90658a87515d6d105509a25570babdca58e25149cfc9aac2d1f496844753f8087923c922a4e1555ec57ad28
7
+ data.tar.gz: ddb3662fa3723c0fd27809eaa80e19ac1ffd46d9e80b8c0d9f5909e2e4fa159676ea8fe5fba9a220fb6d555ae20db5da30e1c144a3eec5840c12bf797d591199
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![Code Climate](https://codeclimate.com/github/lml/commontator/badges/gpa.svg)](https://codeclimate.com/github/lml/commontator)
6
6
  [![Code Coverage](https://codeclimate.com/github/lml/commontator/badges/coverage.svg)](https://codeclimate.com/github/lml/commontator)
7
7
 
8
- Commontator is a Rails engine for comments. It is compatible with Rails 5.
8
+ Commontator is a Rails engine for comments. It is compatible with Rails 5+.
9
9
  Being an engine means it is fully functional as soon as you install and
10
10
  configure the gem, providing models, views and controllers of its own.
11
11
  At the same time, almost anything about it can be configured or customized to suit your needs.
@@ -22,7 +22,7 @@ Follow the steps below to install Commontator:
22
22
  gem 'commontator'
23
23
  ```
24
24
 
25
- You will also need jquery-ujs and a sass compiler, which can be either be installed through
25
+ You will also need jquery and a sass compiler, which can be either be installed through
26
26
  the webpacker gem and yarn/npm/bower or through the jquery-rails and sass[c]-rails gems:
27
27
 
28
28
  ```rb
@@ -81,8 +81,15 @@ Follow the steps below to install Commontator:
81
81
 
82
82
  5. Javascripts
83
83
 
84
- Make sure your application.js requires jquery and jquery-ujs:
84
+ Make sure your application.js requires jquery and rails-ujs or jquery-ujs:
85
85
 
86
+ Rails 5.1+:
87
+ ```js
88
+ //= require jquery
89
+ //= require rails-ujs
90
+ ```
91
+
92
+ Rails 5.0:
86
93
  ```js
87
94
  //= require jquery
88
95
  // If jquery-ujs was installed through jquery-rails
@@ -11,7 +11,7 @@
11
11
  padding: 0;
12
12
  }
13
13
 
14
- .hidden {
14
+ .commontator-hidden {
15
15
  display: none;
16
16
  }
17
17
 
@@ -8,7 +8,7 @@
8
8
  <% if thread.is_closed? %>
9
9
  <p><%= t 'commontator.thread.status.cannot_post' %></p>
10
10
  <% elsif !user %>
11
- <p><%= t 'commontator.require_login' %>.</p>
11
+ <p><%= t 'commontator.require_login' %></p>
12
12
  <% else %>
13
13
  <% if @commontator_new_comment.nil? %>
14
14
  <div id="commontator-thread-<%= thread.id %>-new-comment-link" class="new-comment">
@@ -19,7 +19,7 @@
19
19
  <% end %>
20
20
 
21
21
  <div id="commontator-thread-<%= thread.id %>-new-comment" class="new-comment<%=
22
- @commontator_new_comment.nil? ? ' hidden' : '' %>">
22
+ @commontator_new_comment.nil? ? ' commontator-hidden' : '' %>">
23
23
  <% unless @commontator_new_comment.nil? %>
24
24
  <%=
25
25
  render partial: 'commontator/comments/form', locals: {
@@ -11,7 +11,7 @@
11
11
  nested_comments = thread.nested_comments_for(user, comments, show_all)
12
12
  %>
13
13
 
14
- <div id="commontator-thread-<%= thread.id %>-show" class="show hidden">
14
+ <div id="commontator-thread-<%= thread.id %>-show" class="show commontator-hidden">
15
15
  <%= link_to t('commontator.thread.actions.show'),
16
16
  '#',
17
17
  id: "commontator-thread-#{thread.id}-show-link" %>
@@ -20,7 +20,7 @@
20
20
  <div id="commontator-thread-<%= thread.id %>-content" class="content">
21
21
  <div id="commontator-thread-<%= thread.id %>-header" class="header">
22
22
  <span id="commontator-thread-<%= thread.id %>-actions" class="actions">
23
- <span id="commontator-thread-<%= thread.id %>-hide" class="hide hidden">
23
+ <span id="commontator-thread-<%= thread.id %>-hide" class="hide commontator-hidden">
24
24
  <%= link_to t('commontator.thread.actions.hide'),
25
25
  '#',
26
26
  id: "commontator-thread-#{thread.id}-hide-link" %>
@@ -254,10 +254,10 @@ Commontator.configure do |config|
254
254
  # Returns: the address emails are sent "from" (String)
255
255
  # Important: If using subscriptions, change this to at least match your domain name
256
256
  # Default: ->(thread) do
257
- # "no-reply@#{Rails.application.class.parent.to_s.downcase}.com"
257
+ # "no-reply@#{Rails.application.class.module_parent.to_s.downcase}.com"
258
258
  # end
259
259
  config.email_from_proc = ->(thread) do
260
- "no-reply@#{Rails.application.class.parent.to_s.downcase}.com"
260
+ "no-reply@#{Rails.application.class.module_parent.to_s.downcase}.com"
261
261
  end
262
262
 
263
263
  # commontable_name_proc
@@ -1,4 +1,4 @@
1
- class InstallCommontator < ActiveRecord::Migration[5.2]
1
+ class InstallCommontator < ActiveRecord::Migration[6.0]
2
2
  def change
3
3
  create_table :commontator_threads do |t|
4
4
  t.references :commontable,
@@ -8,7 +8,7 @@ class InstallCommontator < ActiveRecord::Migration[5.2]
8
8
 
9
9
  t.datetime :closed_at
10
10
 
11
- t.timestamps null: false
11
+ t.timestamps
12
12
  end
13
13
 
14
14
  create_table :commontator_comments do |t|
@@ -24,7 +24,7 @@ class InstallCommontator < ActiveRecord::Migration[5.2]
24
24
  t.integer :cached_votes_up, default: 0, index: true
25
25
  t.integer :cached_votes_down, default: 0, index: true
26
26
 
27
- t.timestamps null: false
27
+ t.timestamps
28
28
  end
29
29
 
30
30
  add_index :commontator_comments, [ :creator_id, :creator_type, :thread_id ],
@@ -37,7 +37,7 @@ class InstallCommontator < ActiveRecord::Migration[5.2]
37
37
  }
38
38
  t.references :subscriber, polymorphic: true, null: false, index: false
39
39
 
40
- t.timestamps null: false
40
+ t.timestamps
41
41
  end
42
42
 
43
43
  add_index :commontator_subscriptions, [ :subscriber_id, :subscriber_type, :thread_id ],
@@ -1,4 +1,4 @@
1
- class AddReplyingToComments < ActiveRecord::Migration[5.2]
1
+ class AddReplyingToComments < ActiveRecord::Migration[6.0]
2
2
  def change
3
3
  add_reference :commontator_comments, :parent, foreign_key: {
4
4
  to_table: :commontator_comments, on_update: :restrict, on_delete: :cascade
@@ -21,10 +21,11 @@ module Commontator::ActsAsCommontable
21
21
  as: :commontable, class_name: 'Commontator::Thread'
22
22
  )
23
23
 
24
- validates :commontator_thread, presence: true
25
-
26
24
  prepend Commontator::BuildThread
27
25
 
26
+ # Support creating acts_as_commontable records without a commontator_thread when migrating
27
+ validates :commontator_thread, presence: true, if: -> { Commontator::Thread.table_exists? }
28
+
28
29
  self.is_commontable = true
29
30
  end
30
31
  end
@@ -33,4 +34,6 @@ module Commontator::ActsAsCommontable
33
34
  end
34
35
  end
35
36
 
36
- ActiveRecord::Base.send :include, Commontator::ActsAsCommontable
37
+ ActiveSupport.on_load :active_record do
38
+ include Commontator::ActsAsCommontable
39
+ end
@@ -33,4 +33,6 @@ module Commontator::ActsAsCommontator
33
33
  end
34
34
  end
35
35
 
36
- ActiveRecord::Base.send :include, Commontator::ActsAsCommontator
36
+ ActiveSupport.on_load :active_record do
37
+ include Commontator::ActsAsCommontator
38
+ end
@@ -31,4 +31,6 @@ module Commontator::Controllers
31
31
  end
32
32
  end
33
33
 
34
- ActionController::Base.send :include, Commontator::Controllers
34
+ ActiveSupport.on_load :action_controller do
35
+ include Commontator::Controllers
36
+ end
@@ -57,5 +57,7 @@ module Commontator::SharedHelper
57
57
  end
58
58
  end
59
59
 
60
- ActionController::Base.send :include, Commontator::SharedHelper
61
- ActionController::Base.helper Commontator::SharedHelper
60
+ ActiveSupport.on_load :action_controller do
61
+ include Commontator::SharedHelper
62
+ helper Commontator::SharedHelper
63
+ end
@@ -1 +1 @@
1
- COMMONTATOR_VERSION = '6.1.1'
1
+ COMMONTATOR_VERSION = '6.2.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commontator
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.1
4
+ version: 6.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dante Soares
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-08 00:00:00.000000000 Z
11
+ date: 2020-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -214,8 +214,8 @@ files:
214
214
  - config/locales/ru.yml
215
215
  - config/locales/zh.yml
216
216
  - config/routes.rb
217
- - db/migrate/0_install_commontator.rb
218
- - db/migrate/1_add_replying_to_comments.rb
217
+ - db/migrate/10_install_commontator.rb
218
+ - db/migrate/11_add_replying_to_comments.rb
219
219
  - lib/commontator.rb
220
220
  - lib/commontator/acts_as_commontable.rb
221
221
  - lib/commontator/acts_as_commontator.rb