effective_regions 1.10.0 → 1.10.1
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52769c5ca1c6e16d0564381fd6c4049bf2adf1b38baf0a082bbf62b7d589cce0
|
4
|
+
data.tar.gz: a2ef266ab5a1af1f976ce2a70ee8c19fb2f2f5e6fc13329dfa81cc7c2dcccdf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 265070e6d1431bf65eadfe85a11d67e4f254d77d65d63aa9c7705aa36db112cb74aa964f621294a0025cef053ffc8025b70b1105ea7dd9ffe7fa3aa4589fd19b
|
7
|
+
data.tar.gz: 15268d17dbcb2b84a02f09a89008cc0e36e9040d8dfc33e7e8ab39f2e77aa72c638f75b8324dc118840c81b6879f07322e2883bc1910b836e8222246bbe82fb4
|
@@ -0,0 +1,37 @@
|
|
1
|
+
if defined?(EffectiveAssets)
|
2
|
+
module Effective
|
3
|
+
module Snippets
|
4
|
+
class EffectiveAsset < Snippet
|
5
|
+
# attr_accessor :asset_id #, Integer
|
6
|
+
# attr_accessor :html_class #, String
|
7
|
+
# attr_accessor :link_title #, String
|
8
|
+
# attr_accessor :private_url # , Boolean
|
9
|
+
|
10
|
+
def snippet_attributes
|
11
|
+
super + [:asset_id, :html_class, :link_title, :private_url]
|
12
|
+
end
|
13
|
+
|
14
|
+
def asset
|
15
|
+
@asset ||= (Effective::Asset.where(:id => asset_id).first if asset_id)
|
16
|
+
end
|
17
|
+
|
18
|
+
def snippet_tag
|
19
|
+
:span
|
20
|
+
end
|
21
|
+
|
22
|
+
def private_url
|
23
|
+
super || aws_private?
|
24
|
+
end
|
25
|
+
|
26
|
+
def is_private?
|
27
|
+
[true, 'true', '1'].include?(private_url)
|
28
|
+
end
|
29
|
+
|
30
|
+
def aws_private?
|
31
|
+
(asset.try(:aws_acl) == EffectiveAssets::AWS_PRIVATE)
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -6,17 +6,21 @@ module EffectiveRegions
|
|
6
6
|
|
7
7
|
# Include Helpers to base application
|
8
8
|
initializer 'effective_regions.action_controller' do |app|
|
9
|
-
|
10
|
-
|
9
|
+
app.config.to_prepare do
|
10
|
+
ActiveSupport.on_load :action_controller_base do
|
11
|
+
helper EffectiveRegionsHelper
|
11
12
|
|
12
|
-
|
13
|
+
ActionController::Base.send(:include, ::EffectiveRegionsControllerHelper)
|
14
|
+
end
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
16
18
|
# Include acts_as_addressable concern and allow any ActiveRecord object to call it
|
17
19
|
initializer 'effective_regions.active_record' do |app|
|
18
|
-
|
19
|
-
|
20
|
+
app.config.to_prepare do
|
21
|
+
ActiveSupport.on_load :active_record do
|
22
|
+
ActiveRecord::Base.extend(ActsAsRegionable::Base)
|
23
|
+
end
|
20
24
|
end
|
21
25
|
end
|
22
26
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_regions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.10.
|
4
|
+
version: 1.10.1
|
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:
|
11
|
+
date: 2022-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- app/models/effective/snippets/current_date_time.rb
|
96
96
|
- app/models/effective/snippets/current_user_info.rb
|
97
97
|
- app/models/effective/snippets/drop_cap.rb
|
98
|
+
- app/models/effective/snippets/effective_asset.rb
|
98
99
|
- app/models/effective/snippets/snippet.rb
|
99
100
|
- app/models/effective/templates/image_and_title.rb
|
100
101
|
- app/models/effective/templates/template.rb
|