talkie 0.1.0 → 0.1.1

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: 387327deeaf25674ee27502bb4ed8b7b5b47f4041865cf5771cb14e74986531f
4
- data.tar.gz: b369f237e253df6fc52c061bb90ff24eb87f3f62b86067db12272635ee2594e0
3
+ metadata.gz: 515c6dccadc7671d553437edfa87bfc7eb191c87c912c41ef3c66e3a4a543240
4
+ data.tar.gz: 001e9c2acb8fadc073c36143e3c239b0511893e8783ff492b0353f01c86d596f
5
5
  SHA512:
6
- metadata.gz: 67cee7e1cedaca192c4288d89af9beee204705a7b5e4284ad68683fef1b10bc361dd2d6b3002e0c572d270783ac4be247d0cc6a2b0d3b52a68d84ece4d5ed0c3
7
- data.tar.gz: 4818916e347a23a29bd3583f1f17d6c1b95847f1794104bd33ce54fb67d36b8cb68c7421a55071c90c700163f28f6973346b189dc7572943e20afc9c2e372ee0
6
+ metadata.gz: 3c8b1bbd9ea4f991622db621ddbac930432a2e7e2525f2dd2d2a67aa9de7b7e78730962b804f39c6340ec03111c923a69b16736c8771f519e18368f8897d3c0c
7
+ data.tar.gz: c12375bdec3f5f319981b93088b797c1bf6b8d0fd408c03cfd99d6a82f114eeda827399313855d28d073c7ad3f5c9b8fe8a5b9fd9fa737fb99e0d83fbb0e828a
@@ -0,0 +1,7 @@
1
+ ### What does this PR do?
2
+
3
+ *
4
+
5
+ #### Merge Checklist:
6
+
7
+ - [ ] The branch is up-to-date (i.e. rebased) with the base branch
@@ -16,5 +16,15 @@ module Talkie
16
16
  def avatar_url(creator)
17
17
  Talkie.creator_avatar_url.call(creator)
18
18
  end
19
+
20
+ def deletable_and_allowed?(comment)
21
+ deletable? && allow?(:destroy, comment)
22
+ end
23
+
24
+ def link_to_delete_comment(comment)
25
+ link_to t('talkie.comment.delete'), [talkie, comment],
26
+ method: :delete,
27
+ class: 'talkie-comment-delete'
28
+ end
19
29
  end
20
30
  end
@@ -20,11 +20,15 @@
20
20
  </p>
21
21
 
22
22
  <div class="talkie-comment-footer">
23
+ <% if !nested_enabled? && deletable_and_allowed?(comment) %>
24
+ <%= link_to_delete_comment comment %>
25
+ <% end %>
26
+
23
27
  <% if nested_enabled? %>
24
28
  <div class="talkie-comment-reply">
25
29
  <a href="#" class="talkie-comment-reply-link"><%= t("talkie.comment.reply") %></a>
26
- <% if allow? :destroy, comment %>
27
- <%= link_to t("talkie.comment.delete"), [talkie, comment], method: :delete, class: "talkie-comment-delete" %>
30
+ <% if deletable_and_allowed? comment %>
31
+ <%= link_to_delete_comment comment %>
28
32
  <% end %>
29
33
  </div>
30
34
  <div class="talkie-comments-reply-form-container" style="display:none">
@@ -10,7 +10,6 @@ class CreateTalkieComments < ActiveRecord::Migration[5.0]
10
10
  t.integer :lft
11
11
  t.integer :rgt
12
12
  t.integer :children_count, default: 0
13
- t.datetime :deleted_at
14
13
 
15
14
  t.timestamps null: false
16
15
  end
@@ -18,6 +18,10 @@ module Talkie
18
18
  @options[:nested] || false
19
19
  end
20
20
 
21
+ def deletable?
22
+ @options[:deletable] || false
23
+ end
24
+
21
25
  def display_user_avatar?
22
26
  @options[:display_user_avatar].present?
23
27
  end
@@ -10,12 +10,14 @@ module Talkie
10
10
  root_comments
11
11
  nested_enabled?
12
12
  display_user_handler?
13
- display_user_avatar?].freeze
13
+ display_user_avatar?
14
+ deletable?].freeze
14
15
 
15
16
  HELPER_METHODS = %i[talkie_on
16
17
  nested_enabled?
17
18
  display_user_handler?
18
19
  display_user_avatar?
20
+ deletable?
19
21
  root_comments
20
22
  commentable].freeze
21
23
 
@@ -1,3 +1,3 @@
1
1
  module Talkie
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: talkie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abraham Kuri
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-04 00:00:00.000000000 Z
11
+ date: 2019-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ammeter
@@ -186,6 +186,7 @@ executables: []
186
186
  extensions: []
187
187
  extra_rdoc_files: []
188
188
  files:
189
+ - ".github/PULL_REQUEST_TEMPLATE.md"
189
190
  - ".gitignore"
190
191
  - ".rspec"
191
192
  - ".travis.yml"