effective_posts 0.2.1 → 0.2.2
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.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f8a7b714450d6c5ef6b143ed8c630ce1be57bf03
|
|
4
|
+
data.tar.gz: ec7d574956c2193546e4e49b0fef336542b0bf7e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6df907b059d575cf342d816d2326cb9c5e5170d4810010e1d0ee3d7d94132409c46479ffa3c09cc9255c47aae2799e8eeed118bb4dc4b030a0ff28c59394fa89
|
|
7
|
+
data.tar.gz: d6e301314ca5adc1c667a7c405bda69739d3649fef01686f41948b31bebc50145752a64b9ecf55b035df8edc3350c816f73b0d7a2a5754e1cb585db28e8cdd80
|
|
@@ -23,13 +23,16 @@ module Effective
|
|
|
23
23
|
def show
|
|
24
24
|
@posts = (Rails::VERSION::MAJOR > 3 ? Effective::Post.all : Effective::Post.scoped)
|
|
25
25
|
|
|
26
|
-
@posts = @posts.for_role(current_user.try(:roles)) if defined?(EffectiveRoles)
|
|
27
26
|
@posts = @posts.with_category(params[:category]) if params[:category]
|
|
28
27
|
@posts = @posts.published if params[:edit].to_s != 'true'
|
|
29
28
|
@posts = @posts.includes(:regions)
|
|
30
29
|
|
|
31
30
|
@post = @posts.find(params[:id])
|
|
32
31
|
|
|
32
|
+
if defined?(EffectiveRoles)
|
|
33
|
+
raise Effective::AccessDenied unless @post.roles_permit?(current_user)
|
|
34
|
+
end
|
|
35
|
+
|
|
33
36
|
EffectivePosts.authorized?(self, :show, @post)
|
|
34
37
|
|
|
35
38
|
@page_title = @post.title
|
|
@@ -30,10 +30,9 @@ module Effective
|
|
|
30
30
|
"#{id}-#{title.parameterize}"
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
+
# 3.333 words/second is the default reading speed.
|
|
34
|
+
def time_to_read_in_seconds(reading_speed = 3.333)
|
|
35
|
+
(regions.to_a.sum { |region| (region.content || '').scan(/\w+/).size } / reading_speed).seconds
|
|
36
|
+
end
|
|
33
37
|
end
|
|
34
|
-
|
|
35
38
|
end
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: effective_posts
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Code and Effect
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-03-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|