kono_utils_bootstrap_view4 0.3 → 0.3.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 +4 -4
- data/app/concepts/kono_utils/object/cell/index/row_buttons.rb +5 -0
- data/app/concepts/kono_utils/object/view/index/row_buttons.erb +3 -3
- data/lib/kono_utils_bootstrap_view4.rb +1 -0
- data/lib/kono_utils_bootstrap_view4/base_class_concept_ns.rb +4 -14
- data/lib/kono_utils_bootstrap_view4/concept_cacher.rb +38 -0
- data/lib/kono_utils_bootstrap_view4/configuration.rb +7 -0
- data/lib/kono_utils_bootstrap_view4/engine.rb +5 -0
- data/lib/kono_utils_bootstrap_view4/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa0a2f1125771c5f72660fb327ededb8c2262eb4f036618f3bafdd78a3e54c5c
|
4
|
+
data.tar.gz: 56914dcf749aa2959aca53d809c2045b37cc0c0cc432047c351b48c689fdd7de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4318dbe3a8f1ef499fdc36748a446a6ef947a220151da1800542975c4894cf093f8178abf04d6b9c8d3e893ea45bb2765f894a0a11c25bfb97ac08f536db0d4
|
7
|
+
data.tar.gz: aadf01fb29d8bf9c424dd5296272e5926bb9e078ad966526c00fa33cf929e28019df2dcc0c4a1710b2d0b25a17dca47b1a06ace59a9d6de76a38a183493391b6
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<%= concept("cell/buttons/show", model) if
|
2
|
-
<%= concept("cell/buttons/edit", model) if
|
3
|
-
<%= concept("cell/buttons/delete", model) if
|
1
|
+
<%= concept("cell/buttons/show", model) if cached_policy.show? %>
|
2
|
+
<%= concept("cell/buttons/edit", model) if cached_policy.edit? %>
|
3
|
+
<%= concept("cell/buttons/delete", model) if cached_policy.destroy? %>
|
@@ -14,26 +14,16 @@ module KonoUtilsBootstrapView4
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def concept_ns(view)
|
17
|
-
@_memo_concept ||= {}
|
18
17
|
ns = "#{tableize(self.name)}/#{view}"
|
19
|
-
|
20
|
-
unless @_memo_concept.key?(ns)
|
18
|
+
KonoUtilsBootstrapView4.configuration.concept_cacher.get(ns) do |cache|
|
21
19
|
if safe_constantize(ns.camelize)
|
22
20
|
KonoUtilsBootstrapView4.configuration.logger.info { "TROVATA CLASSE PER : #{ns.camelize} --->>>" }
|
23
|
-
|
21
|
+
cache.store(ns, ns)
|
24
22
|
else
|
25
|
-
|
23
|
+
KonoUtilsBootstrapView4.configuration.logger.debug { "CLASSE OVERRIDE NON TROVATA PER : #{ns.camelize}" }
|
24
|
+
cache.store(ns, "kono_utils/object/#{view}")
|
26
25
|
end
|
27
26
|
end
|
28
|
-
|
29
|
-
if @_memo_concept[ns]
|
30
|
-
return @_memo_concept[ns]
|
31
|
-
else
|
32
|
-
KonoUtilsBootstrapView4.configuration.logger.debug { "CLASSE OVERRIDE NON TROVATA PER : #{ns.camelize}" }
|
33
|
-
|
34
|
-
"kono_utils/object/#{view}"
|
35
|
-
end
|
36
|
-
|
37
27
|
end
|
38
28
|
|
39
29
|
##
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module KonoUtilsBootstrapView4
|
2
|
+
##
|
3
|
+
# PORO per l'esecuzione della cache a livello di istanza applicazione dei nomi di classe da utilizzare per i vari
|
4
|
+
# componenti dei modelli
|
5
|
+
class ConceptCacher
|
6
|
+
#@return [Hash]
|
7
|
+
attr_reader :_cache
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@_cache = {}
|
11
|
+
end
|
12
|
+
|
13
|
+
def clear
|
14
|
+
Rails.logger.debug {"PULIZIA CACHE"}
|
15
|
+
@_cache = {}
|
16
|
+
end
|
17
|
+
|
18
|
+
##
|
19
|
+
# Ritorna il valore cachato, se non è presente, allora verrà dato in pasto allo yield l'istanza di cache, e sarà
|
20
|
+
# chi la utilizzerà che si occuperà di salvare o meno il dato richiamato il metodo store passando il relativo valore da
|
21
|
+
# salvare
|
22
|
+
# @param [String] key
|
23
|
+
# @return [Object] Cached result
|
24
|
+
# @yieldparam [KonoUtilsBootstrapView4::ConceptCacher]
|
25
|
+
def get(key)
|
26
|
+
return @_cache[key] if @_cache.key?(key)
|
27
|
+
yield(self)
|
28
|
+
@_cache[key]
|
29
|
+
end
|
30
|
+
|
31
|
+
##
|
32
|
+
# Store del valore
|
33
|
+
def store(key, value)
|
34
|
+
@_cache[key] = value
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
@@ -10,8 +10,15 @@ class KonoUtilsBootstrapView4::Configuration
|
|
10
10
|
#@return [Boolean]
|
11
11
|
attr_accessor :cell_metrics
|
12
12
|
|
13
|
+
##
|
14
|
+
# Cache delle classi del concept
|
15
|
+
# Nell'inizializzazione di rails aggiungiamo un ascoltatore alla cartella standard dei concepts per
|
16
|
+
# controllare se i files sono stati modificati, nel caso puliamo completamente la cartella
|
17
|
+
attr_reader :concept_cacher
|
18
|
+
|
13
19
|
def initialize
|
14
20
|
@moment_js_locales = I18n.available_locales
|
21
|
+
@concept_cacher = KonoUtilsBootstrapView4::ConceptCacher.new
|
15
22
|
|
16
23
|
@cell_metrics = false
|
17
24
|
# inizializzo logger, come quello che mi verrebbe passato
|
@@ -44,6 +44,11 @@ module KonoUtilsBootstrapView4
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
+
initializer 'kono_utils_bootstrap_view4.configure_auto_clear_concept_cache', :group => :all do |app|
|
48
|
+
app.reloader.to_prepare do
|
49
|
+
KonoUtilsBootstrapView4.configuration.concept_cacher.clear
|
50
|
+
end
|
51
|
+
end
|
47
52
|
##
|
48
53
|
# Abbiamo rimosso possibili JS, lasciamo per documentazione
|
49
54
|
initializer 'kono_utils_bootstrap_view4.append_cell_assets', :group => :all do |app|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kono_utils_bootstrap_view4
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marino Bonetti
|
@@ -350,6 +350,7 @@ files:
|
|
350
350
|
- lib/kono_utils_bootstrap_view4/application_icon_helper.rb
|
351
351
|
- lib/kono_utils_bootstrap_view4/base_class_concept_ns.rb
|
352
352
|
- lib/kono_utils_bootstrap_view4/base_search.rb
|
353
|
+
- lib/kono_utils_bootstrap_view4/concept_cacher.rb
|
353
354
|
- lib/kono_utils_bootstrap_view4/configuration.rb
|
354
355
|
- lib/kono_utils_bootstrap_view4/editable_field.rb
|
355
356
|
- lib/kono_utils_bootstrap_view4/engine.rb
|