talkie 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -4
- data/README.md +1 -0
- data/app/controllers/talkie/comments_controller.rb +4 -2
- data/config/locales/en.yml +5 -0
- data/config/locales/es.yml +5 -0
- data/lib/generators/talkie/templates/talkie.rb +17 -0
- data/lib/talkie/version.rb +3 -1
- data/lib/talkie.rb +14 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82f6715118d4b0022047d97dc002dba51f831e09da19bc374cc0d75ddc2a62aa
|
4
|
+
data.tar.gz: df4af0404f088395e42c5c92c5dfdd55624292dc0759dbb421d18a941a775e1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3dea24f754eb1f95328120601f284ef6530f798c1de001ff233963b8bff83becad84d98cf064741df7df74c3541887c11c7d3855f535785b6538b8be11a100cf
|
7
|
+
data.tar.gz: f52e51279684b0fa5266ed13d30d5a5ca29d4ff247f76b32012ffacb41549c0a3598d0de4ca2b6707b75538c08d3d76fecede184aa0afcba34755c1d56ebae47
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
talkie (0.
|
4
|
+
talkie (0.2.0)
|
5
5
|
awesome_nested_set (~> 3.1)
|
6
6
|
rails (~> 5.0)
|
7
7
|
sassc-rails (~> 2.1)
|
@@ -152,7 +152,7 @@ GEM
|
|
152
152
|
sassc (2.0.1)
|
153
153
|
ffi (~> 1.9)
|
154
154
|
rake
|
155
|
-
sassc-rails (2.1.
|
155
|
+
sassc-rails (2.1.2)
|
156
156
|
railties (>= 4.0.0)
|
157
157
|
sassc (>= 2.0)
|
158
158
|
sprockets (> 3.0)
|
@@ -178,9 +178,9 @@ GEM
|
|
178
178
|
tilt (2.0.9)
|
179
179
|
tzinfo (1.2.5)
|
180
180
|
thread_safe (~> 0.1)
|
181
|
-
websocket-driver (0.7.
|
181
|
+
websocket-driver (0.7.1)
|
182
182
|
websocket-extensions (>= 0.1.0)
|
183
|
-
websocket-extensions (0.1.
|
183
|
+
websocket-extensions (0.1.4)
|
184
184
|
|
185
185
|
PLATFORMS
|
186
186
|
ruby
|
data/README.md
CHANGED
@@ -89,6 +89,7 @@ Talkie, currently only offers 3 options for the `talkie_on` helper method:
|
|
89
89
|
| **nested** | Whether users are able to reply to comments or not. *Default: false* |
|
90
90
|
| **display_user_avatar** | Whether the helper should render an avatar. *Default: true* |
|
91
91
|
| **display_user_handler** | Whether the helper should render the user handler. *Default: false* |
|
92
|
+
| **deletable** | Whether the helper should render the delete link. *Default: false* |
|
92
93
|
|
93
94
|
Don't worry about those nasty N+1 queries, Talkie is smart enough to take care of them. You don't need to restart the server for chanes on this invokation.
|
94
95
|
|
@@ -9,10 +9,12 @@ module Talkie
|
|
9
9
|
respond_to do |format|
|
10
10
|
if @comment.save
|
11
11
|
make_child_comment if reply?
|
12
|
-
format.html { redirect_to
|
12
|
+
format.html { redirect_to Talkie.success_redirect_to.call(main_app, @comment.commentable),
|
13
|
+
notice: t('talkie.controllers.comments.flash.success') }
|
13
14
|
format.js
|
14
15
|
else
|
15
|
-
format.html {
|
16
|
+
format.html { redirect_back fallback_location: Talkie.fail_redirect_to.call(main_app),
|
17
|
+
notice: t('talkie.controllers.comments.flash.error') }
|
16
18
|
format.js
|
17
19
|
end
|
18
20
|
end
|
data/config/locales/en.yml
CHANGED
data/config/locales/es.yml
CHANGED
@@ -43,4 +43,21 @@ Talkie.configure do |config|
|
|
43
43
|
#
|
44
44
|
# The default looks like:
|
45
45
|
# config.creator_avatar_url = lambda { |user| "//api.adorable.io/avatars/40/abott@adorable.png" }
|
46
|
+
#
|
47
|
+
|
48
|
+
# ==> Redirect for comments controller
|
49
|
+
# There are sometimes you want to redirect to different locations
|
50
|
+
# for the app on success or failure of a comment post,
|
51
|
+
# you can easily achieve this through the following configurations
|
52
|
+
#
|
53
|
+
# The default value for success redirection is:
|
54
|
+
# config.success_redirect_to = lambda { |router, commentable| router.polymorphic_path(commentable) }
|
55
|
+
# You can override it to anything you want. Inside this lambda function
|
56
|
+
# you have access to the main router and the commentable object
|
57
|
+
#
|
58
|
+
# The default value for failure redirection is:
|
59
|
+
# config.fail_redirect_to = lambda { |router| router.url }
|
60
|
+
# Inside the comments controller, the redirection would be to go back
|
61
|
+
# to the page where the submit came, and if not, it will go to this
|
62
|
+
# lambda
|
46
63
|
end
|
data/lib/talkie/version.rb
CHANGED
data/lib/talkie.rb
CHANGED
@@ -6,17 +6,23 @@ require "awesome_nested_set"
|
|
6
6
|
|
7
7
|
module Talkie
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
mattr_accessor :default_comments_scope,
|
10
|
+
default: -> { order(created_at: :desc) }
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
mattr_accessor :comment_creator_handler,
|
13
|
+
default: :email
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
mattr_accessor :creator_path,
|
16
|
+
default: lambda { |_user, _router| "#" }
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
mattr_accessor :creator_avatar_url,
|
19
|
+
default: lambda { |_user| "//api.adorable.io/avatars/40/abott@adorable.png" }
|
20
|
+
|
21
|
+
mattr_accessor :success_redirect_to,
|
22
|
+
default: lambda { |router, commentable| router.polymorphic_path(commentable) }
|
23
|
+
|
24
|
+
mattr_accessor :fail_redirect_to,
|
25
|
+
default: lambda { |router| router.root_url }
|
20
26
|
|
21
27
|
def self.configure
|
22
28
|
yield self
|
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.
|
4
|
+
version: 0.2.0
|
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-
|
11
|
+
date: 2019-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ammeter
|