ack_rails_admin_settings 1.1.5 → 1.2.0.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
  SHA1:
3
- metadata.gz: 1939049fc8ee3a45380834fb5a189636d1edc9ac
4
- data.tar.gz: 20a4e16a772ba5050eae5eaa7cd0664ec332a38f
3
+ metadata.gz: 09bb3fe9edf0872d0d56881a50a7a7a6f18b4a0b
4
+ data.tar.gz: 99c870b54f86b4101334d659092f1b43381abab3
5
5
  SHA512:
6
- metadata.gz: 372df93203fef4b55af2eaf404e942d3475f9a07d3c455884c9af377b7babaaac50f5ab374fe6a723cfe293b03ea8b41e0eb0e0834bad73dc574a420c434aa54
7
- data.tar.gz: 4a9ebaccdd75eda63ac802986a755d8eb75607288520b814efa4ea6b5f700dbd7f0b722235601214362c9f9f0c7b254b2030c8ddf3353b7219ee45ca238b09cc
6
+ metadata.gz: 03bf3e5b6c51ee5de9a840320ef22621e4132624114e3ba0e804b0e4da084defbf33a83e30b004ad0e504918be3f0bb6635a0870186a550cf3521f65df7b665f
7
+ data.tar.gz: b4452f40f596c265688475bdb877e768e02cedbacb165af2dee63c119a8b0e516fe913c91fe2650d3e14671086a64c199b38083164acac3af3bdd6c0a8ca461f
@@ -1,3 +1,16 @@
1
+ ## 1.2.0
2
+
3
+ - Default cache key is underscored namespace. Not work for default namespace without {cache: true}.
4
+
5
+ ## 1.1.5
6
+
7
+ - HancockCMS support.
8
+ - Caching.
9
+
10
+ ## 1.1.4
11
+
12
+ - Fork from rs-pro repo.
13
+
1
14
  ## 1.1.3
2
15
 
3
16
  - Fix for namespace tabs when database table does not exist yet.
@@ -1,17 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ack_rails_admin_settings (1.1.5)
4
+ ack_rails_admin_settings (1.2.0.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- actionmailer (3.2.22.4)
10
- actionpack (= 3.2.22.4)
9
+ actionmailer (3.2.22.5)
10
+ actionpack (= 3.2.22.5)
11
11
  mail (~> 2.5.4)
12
- actionpack (3.2.22.4)
13
- activemodel (= 3.2.22.4)
14
- activesupport (= 3.2.22.4)
12
+ actionpack (3.2.22.5)
13
+ activemodel (= 3.2.22.5)
14
+ activesupport (= 3.2.22.5)
15
15
  builder (~> 3.0.0)
16
16
  erubis (~> 2.7.0)
17
17
  journey (~> 1.0.4)
@@ -19,18 +19,18 @@ GEM
19
19
  rack-cache (~> 1.2)
20
20
  rack-test (~> 0.6.1)
21
21
  sprockets (~> 2.2.1)
22
- activemodel (3.2.22.4)
23
- activesupport (= 3.2.22.4)
22
+ activemodel (3.2.22.5)
23
+ activesupport (= 3.2.22.5)
24
24
  builder (~> 3.0.0)
25
- activerecord (3.2.22.4)
26
- activemodel (= 3.2.22.4)
27
- activesupport (= 3.2.22.4)
25
+ activerecord (3.2.22.5)
26
+ activemodel (= 3.2.22.5)
27
+ activesupport (= 3.2.22.5)
28
28
  arel (~> 3.0.2)
29
29
  tzinfo (~> 0.3.29)
30
- activeresource (3.2.22.4)
31
- activemodel (= 3.2.22.4)
32
- activesupport (= 3.2.22.4)
33
- activesupport (3.2.22.4)
30
+ activeresource (3.2.22.5)
31
+ activemodel (= 3.2.22.5)
32
+ activesupport (= 3.2.22.5)
33
+ activesupport (3.2.22.5)
34
34
  i18n (~> 0.6, >= 0.6.4)
35
35
  multi_json (~> 1.0)
36
36
  addressable (2.4.0)
@@ -82,9 +82,8 @@ GEM
82
82
  rspec (~> 3.1)
83
83
  moped (1.5.3)
84
84
  multi_json (1.12.1)
85
- nokogiri (1.6.8)
85
+ nokogiri (1.6.8.1)
86
86
  mini_portile2 (~> 2.1.0)
87
- pkg-config (~> 1.1.7)
88
87
  nokogumbo (1.4.9)
89
88
  nokogiri
90
89
  origin (1.1.0)
@@ -94,7 +93,6 @@ GEM
94
93
  cocaine (~> 0.5.5)
95
94
  mime-types
96
95
  mimemagic (= 0.3.0)
97
- pkg-config (1.1.7)
98
96
  polyglot (0.3.5)
99
97
  pry (0.10.4)
100
98
  coderay (~> 1.1.0)
@@ -107,29 +105,29 @@ GEM
107
105
  rack
108
106
  rack-test (0.6.3)
109
107
  rack (>= 1.0)
110
- rails (3.2.22.4)
111
- actionmailer (= 3.2.22.4)
112
- actionpack (= 3.2.22.4)
113
- activerecord (= 3.2.22.4)
114
- activeresource (= 3.2.22.4)
115
- activesupport (= 3.2.22.4)
108
+ rails (3.2.22.5)
109
+ actionmailer (= 3.2.22.5)
110
+ actionpack (= 3.2.22.5)
111
+ activerecord (= 3.2.22.5)
112
+ activeresource (= 3.2.22.5)
113
+ activesupport (= 3.2.22.5)
116
114
  bundler (~> 1.0)
117
- railties (= 3.2.22.4)
118
- railties (3.2.22.4)
119
- actionpack (= 3.2.22.4)
120
- activesupport (= 3.2.22.4)
115
+ railties (= 3.2.22.5)
116
+ railties (3.2.22.5)
117
+ actionpack (= 3.2.22.5)
118
+ activesupport (= 3.2.22.5)
121
119
  rack-ssl (~> 1.3.2)
122
120
  rake (>= 0.8.7)
123
121
  rdoc (~> 3.4)
124
122
  thor (>= 0.14.6, < 2.0)
125
- rake (11.2.2)
123
+ rake (11.3.0)
126
124
  rdoc (3.12.2)
127
125
  json (~> 1.4)
128
126
  rspec (3.5.0)
129
127
  rspec-core (~> 3.5.0)
130
128
  rspec-expectations (~> 3.5.0)
131
129
  rspec-mocks (~> 3.5.0)
132
- rspec-core (3.5.3)
130
+ rspec-core (3.5.4)
133
131
  rspec-support (~> 3.5.0)
134
132
  rspec-expectations (3.5.0)
135
133
  diff-lcs (>= 1.2.0, < 2.0)
@@ -140,7 +138,7 @@ GEM
140
138
  rspec-support (3.5.0)
141
139
  russian_phone (0.5.3)
142
140
  safe_yaml (1.0.4)
143
- sanitize (4.2.0)
141
+ sanitize (4.4.0)
144
142
  crass (~> 1.0.2)
145
143
  nokogiri (>= 1.4.4)
146
144
  nokogumbo (~> 1.4.1)
@@ -10,15 +10,40 @@ module RailsAdminSettings
10
10
  #binding.pry
11
11
  if RailsAdminSettings.mongoid?
12
12
  include RailsAdminSettings::Mongoid
13
+
14
+ if defined?(RailsAdminComments)
15
+ include RailsAdminComments::Commentable
16
+ include RailsAdminComments::ModelCommentable
17
+ end
13
18
  end
14
19
 
15
20
  if defined?(Hancock)
16
- include Hancock::RailsAdminPatch
17
- def self.manager_can_default_actions
18
- [:show, :read, :edit, :update]
21
+ if defined?(Hancock::RailsAdminPatch)
22
+ include Hancock::RailsAdminPatch
23
+
24
+ def self.manager_can_default_actions
25
+ [:show, :read, :edit, :update]
26
+ end
27
+ def self.manager_can_add_actions
28
+ ret = []
29
+ ret << :model_accesses if defined?(RailsAdminUserAbilities)
30
+ ret += [:comments, :model_comments] if defined?(RailsAdminComments)
31
+ ret.freeze
32
+ end
33
+ def self.manager_cannot_actions
34
+ [:new, :create, :delete, :destroy]
35
+ end
36
+
37
+ def self.rails_admin_add_visible_actions
38
+ ret = []
39
+ ret << :model_accesses if defined?(RailsAdminUserAbilities)
40
+ ret += [:comments, :model_comments] if defined?(RailsAdminComments)
41
+ ret.freeze
42
+ end
19
43
  end
20
- def manager_cannot_actions
21
- [:new, :create, :delete, :destroy]
44
+
45
+ if defined?(Hancock::Cacheable)
46
+ include Hancock::Cacheable
22
47
  end
23
48
  end
24
49
 
@@ -53,32 +53,32 @@ module RailsAdminSettings
53
53
 
54
54
  if mongoid?
55
55
  if ::Mongoid.const_defined?('History')
56
- RailsAdminSettings::Setting.send(:include, ::Mongoid::History::Trackable)
57
- RailsAdminSettings::Setting.send(:track_history, {track_create: true, track_destroy: true})
58
- if Gem::Version.new(Rails.version) >= Gem::Version.new('5.0.0')
59
- RailsAdminSettings::Setting.send(:belongs_to,
60
- :modifier,
61
- class_name: ::Mongoid::History.modifier_class_name,
62
- optional: true
63
- )
64
- end
56
+ # RailsAdminSettings::Setting.send(:include, ::Mongoid::History::Trackable)
57
+ # RailsAdminSettings::Setting.send(:track_history, {track_create: true, track_destroy: true})
58
+ # if Gem::Version.new(Rails.version) >= Gem::Version.new('5.0.0')
59
+ # RailsAdminSettings::Setting.send(:belongs_to,
60
+ # :modifier,
61
+ # class_name: ::Mongoid::History.modifier_class_name,
62
+ # optional: true
63
+ # )
64
+ # end
65
65
  else
66
66
  puts "[rails_admin_settings] WARN unable to track_history: Mongoid::History not loaded!".freeze
67
67
  end
68
68
  if ::Mongoid.const_defined?('Userstamp')
69
- RailsAdminSettings::Setting.send(:include, ::Mongoid::Userstamp)
70
- if Gem::Version.new(Rails.version) >= Gem::Version.new('5.0.0')
71
- RailsAdminSettings::Setting.send(:belongs_to,
72
- ::Mongoid::Userstamp.config.creator_field,
73
- class_name: ::Mongoid::Userstamp.config.user_model_name,
74
- optional: true
75
- )
76
- RailsAdminSettings::Setting.send(:belongs_to,
77
- ::Mongoid::Userstamp.config.updater_field,
78
- class_name: ::Mongoid::Userstamp.config.user_model_name,
79
- optional: true
80
- )
81
- end
69
+ # RailsAdminSettings::Setting.send(:include, ::Mongoid::Userstamp)
70
+ # if Gem::Version.new(Rails.version) >= Gem::Version.new('5.0.0')
71
+ # RailsAdminSettings::Setting.send(:belongs_to,
72
+ # ::Mongoid::Userstamp.config.creator_field,
73
+ # class_name: ::Mongoid::Userstamp.config.user_model_name,
74
+ # optional: true
75
+ # )
76
+ # RailsAdminSettings::Setting.send(:belongs_to,
77
+ # ::Mongoid::Userstamp.config.updater_field,
78
+ # class_name: ::Mongoid::Userstamp.config.user_model_name,
79
+ # optional: true
80
+ # )
81
+ # end
82
82
  else
83
83
  puts "[rails_admin_settings] WARN unable to track_history: Mongoid::Userstamp not loaded!".freeze
84
84
  end
@@ -14,15 +14,18 @@ module RailsAdminSettings
14
14
  field :label, type: String
15
15
  index({ns: 1, key: 1}, {unique: true, sparse: true})
16
16
 
17
- field :cache_keys_str, type: String, default: ""
18
- def cache_keys
19
- cache_keys_str.split(/\s+/).map { |k| k.strip }.reject { |k| k.blank? }
20
- end
17
+ unless defined?(Hancock::Cacheable)
18
+ field :cache_keys_str, type: String, default: ""
19
+ def cache_keys
20
+ cache_keys_str.split(/\s+/).map { |k| k.strip }.reject { |k| k.blank? }
21
+ end
21
22
 
22
- after_save :clear_cache
23
- def clear_cache
24
- cache_keys.each do |k|
25
- Rails.cache.delete(k)
23
+ after_save :clear_cache
24
+ after_destroy :clear_cache
25
+ def clear_cache
26
+ cache_keys.each do |k|
27
+ Rails.cache.delete(k)
28
+ end
26
29
  end
27
30
  end
28
31
 
@@ -74,6 +74,12 @@ module RailsAdminSettings
74
74
  load! unless @locked
75
75
  key = key.to_s
76
76
  options.symbolize_keys!
77
+ if options[:cache].present?
78
+ _cache = options.delete(:cache)
79
+ else
80
+ _cache = (name != ::Settings.ns_default)
81
+ end
82
+
77
83
 
78
84
  if !options[:type].nil? && options[:type] == 'yaml' && !value.nil?
79
85
  if value.class.name != 'String'
@@ -81,7 +87,11 @@ module RailsAdminSettings
81
87
  end
82
88
  end
83
89
 
84
- unless options[:cache_keys].nil?
90
+ if options[:cache_keys].nil?
91
+ if _cache
92
+ options[:cache_keys_str] = name.underscore
93
+ end
94
+ else
85
95
  if options[:cache_keys].class.name == 'String'
86
96
  options[:cache_keys_str] = options.delete(:cache_keys)
87
97
  elsif options[:cache_keys].class.name == 'Array'
@@ -1,3 +1,3 @@
1
1
  module RailsAdminSettings
2
- VERSION = "1.1.5".freeze
2
+ VERSION = "1.2.0.1".freeze
3
3
  end
data/release.sh CHANGED
@@ -2,5 +2,5 @@
2
2
  bundle update
3
3
  git add --all .
4
4
  git commit -am "${*:1}"
5
- git push
5
+ git push -u origin master
6
6
  rake release
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ack_rails_admin_settings
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Kiseliev
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-09-09 00:00:00.000000000 Z
12
+ date: 2016-10-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mongoid