kono_utils_bootstrap_view4 0.2.1 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/concepts/kono_utils/object/cell/base.rb +6 -0
- data/app/concepts/kono_utils/object/cell/forms/fields/date_time_field.rb +1 -1
- data/app/concepts/kono_utils/object/cell/index/row_buttons.rb +5 -0
- data/app/concepts/kono_utils/object/view/forms/fields/nested_wrappers/forms_containers/table_layout.erb +1 -1
- 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 +15 -0
- data/lib/kono_utils_bootstrap_view4/engine.rb +15 -1
- data/lib/kono_utils_bootstrap_view4/version.rb +1 -1
- metadata +3 -2
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
|
@@ -37,6 +37,12 @@ module KonoUtils
|
|
37
37
|
parent_controller.send(:show_custom_polymorphic_path, *rec)
|
38
38
|
end
|
39
39
|
|
40
|
+
def show(&block)
|
41
|
+
ActiveSupport::Notifications.instrument "kono_utils_bootstrap_view4.#{self.class.name.underscore.gsub("/", ".")}", this: :data do
|
42
|
+
super
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
40
46
|
##
|
41
47
|
# Registra il contenuto con una chiave, e lo renderizza poi dove è più necessario
|
42
48
|
# @param [String] name
|
@@ -32,7 +32,7 @@ module KonoUtils
|
|
32
32
|
#
|
33
33
|
def input_value
|
34
34
|
value = form.object.send(attribute_name)
|
35
|
-
value.
|
35
|
+
value.respond_to?(:rfc2822) ? "date: moment('#{value.rfc2822}')," : ''
|
36
36
|
end
|
37
37
|
|
38
38
|
def input_picker_format
|
@@ -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
|
@@ -4,8 +4,23 @@ class KonoUtilsBootstrapView4::Configuration
|
|
4
4
|
#@return [ActiveSupport::TaggedLogging] log di kono utils bootstrap, default estende quello di rails
|
5
5
|
attr_reader :logger
|
6
6
|
|
7
|
+
##
|
8
|
+
# Se attivo, abilitiamo le metriche con un un ActiveSupport::Notifications.instrument
|
9
|
+
# durante la show della cella
|
10
|
+
#@return [Boolean]
|
11
|
+
attr_accessor :cell_metrics
|
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
|
+
|
7
19
|
def initialize
|
8
20
|
@moment_js_locales = I18n.available_locales
|
21
|
+
@concept_cacher = KonoUtilsBootstrapView4::ConceptCacher.new
|
22
|
+
|
23
|
+
@cell_metrics = false
|
9
24
|
# inizializzo logger, come quello che mi verrebbe passato
|
10
25
|
self.logger = ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new(STDOUT))
|
11
26
|
end
|
@@ -34,6 +34,21 @@ module KonoUtilsBootstrapView4
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
+
initializer 'kono_utils_bootstrap_view4.append_instrumentation', :group => :all do |app|
|
38
|
+
if KonoUtilsBootstrapView4.configuration.cell_metrics
|
39
|
+
app.config.after_initialize do
|
40
|
+
ActiveSupport::Notifications.subscribe /kono_utils_bootstrap_view4/ do |event|
|
41
|
+
Rails.logger.info "[KUBV4] #{event.name} - #{event.duration} ms - (#{event.allocations} allocations)"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
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
|
37
52
|
##
|
38
53
|
# Abbiamo rimosso possibili JS, lasciamo per documentazione
|
39
54
|
initializer 'kono_utils_bootstrap_view4.append_cell_assets', :group => :all do |app|
|
@@ -51,7 +66,6 @@ module KonoUtilsBootstrapView4
|
|
51
66
|
end
|
52
67
|
end
|
53
68
|
|
54
|
-
|
55
69
|
Rails.logger.warn { "config.assets.initialize_on_precompile should be true" } unless app.config.assets.initialize_on_precompile == true
|
56
70
|
end
|
57
71
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kono_utils_bootstrap_view4
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marino Bonetti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -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
|