kono_utils_bootstrap_view4 0.1.0 → 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
  SHA256:
3
- metadata.gz: 7e54f4cbc61c0d98ae9d1b58fbf27d17a96b739d3f63d481281aadee542936be
4
- data.tar.gz: df5d2ffcefd20dc75bd3a6dba4b148cb79c872c2ace672057f7f917fdfd670b2
3
+ metadata.gz: 064dc913cd0495e59ac918f94ba761533d861d2b0cfd47f2509aed226650721c
4
+ data.tar.gz: 984f63537e0648d1351c243629623f21dfcc5be2f98f2b514a0e7f707c24080e
5
5
  SHA512:
6
- metadata.gz: a8095d99d28f25bb6fdcf700ae217f922c066498b6f4b96bed7da48d17dcf5be23b85baf799357978aadd5cd30016c7aea5458f6d339ccb7b1e8e7c1bbe92cba
7
- data.tar.gz: 41c9f248d01a5313b7739aaec6f2d6ad7f34a3c42c86911dd60e41a392aed0702e99a53acf06cda674265edbdff0c2edb5709c16416b18ab3b0066226f5a5d4a
6
+ metadata.gz: db0c13fcd34b188fe04b0e49a4d7079c0c2b77b7e068d8e4514056a77b489e8cfa80e455ae4d00a2ade8c2af5b02202d23990bb2fea964dd0bf8ab129e04e53e
7
+ data.tar.gz: b880b9ffe28d1667e24fac3b9167f754850a1faf26f018d8488cc2f3f77cd223d4de1eb177eed0c4b38f62314a094606cfa8bc82edd1c1c46fb48a559dbc8538
@@ -33,6 +33,10 @@ module KonoUtils
33
33
  parent_controller.send(:destroy_custom_polymorphic_path, *rec)
34
34
  end
35
35
 
36
+ def show_custom_polymorphic_path(*rec)
37
+ parent_controller.send(:show_custom_polymorphic_path, *rec)
38
+ end
39
+
36
40
  ##
37
41
  # Registra il contenuto con una chiave, e lo renderizza poi dove è più necessario
38
42
  # @param [String] name
@@ -0,0 +1,23 @@
1
+ module KonoUtils
2
+ module Object
3
+ module Cell
4
+ module Buttons # namespace
5
+ class Show < Base
6
+
7
+ def url_to
8
+ options[:url_to] || show_custom_polymorphic_path(model)
9
+ end
10
+
11
+ def specific_button_class
12
+ 'btn-info'
13
+ end
14
+
15
+ def button_content
16
+ options.fetch(:content, fa_icon("eye"))
17
+ end
18
+
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -24,6 +24,13 @@ module KonoUtils
24
24
  [model, _form_options]
25
25
  end
26
26
 
27
+ ##
28
+ # Elenco di concept di bottoni da generare nella form per il submit
29
+ # @param [SimpleForm::FormBuilder] form_builder
30
+ def submit_buttons(form_builder:)
31
+ [concept("cell/forms/submit", nil, context: {form: form_builder})]
32
+ end
33
+
27
34
  protected
28
35
 
29
36
  def form_id
@@ -5,6 +5,7 @@ module KonoUtils
5
5
  # ha sempre un metodo form che viene ricevuto dal contesto della form
6
6
  class Forms::Base < Base
7
7
 
8
+ # @return [SimpleForm::FormBuilder]
8
9
  def form
9
10
  context[:form]
10
11
  end
@@ -8,7 +8,7 @@ module KonoUtils
8
8
 
9
9
  def show(&block)
10
10
 
11
- bf = bf = ActiveSupport::SafeBuffer.new
11
+ bf = ActiveSupport::SafeBuffer.new
12
12
  bf << form.input(attribute_name, field_options)
13
13
 
14
14
  bf << content_tag(:script, :type => "text/javascript") do
@@ -32,7 +32,7 @@ module KonoUtils
32
32
  #
33
33
  def input_value
34
34
  value = form.object.send(attribute_name)
35
- value.is_a?(DateTime) ? "date: moment('#{value&.rfc2822}')," : ''
35
+ value.respond_to?(:rfc2822) ? "date: moment('#{value.rfc2822}')," : ''
36
36
  end
37
37
 
38
38
  def input_picker_format
@@ -11,6 +11,12 @@ module KonoUtils
11
11
  :search_buttons_container
12
12
  end
13
13
 
14
+ # @param [SimpleForm::FormBuilder] form_builder
15
+ # @return [Array<Concept>]
16
+ def submit_buttons(form_builder:)
17
+ super + [concept("cell/buttons/reset_search", model.search_form_builder.to_model)]
18
+ end
19
+
14
20
  end
15
21
  end
16
22
  end
@@ -1,9 +1,11 @@
1
1
  <%= simple_form_for(*forms_options) do |f| %>
2
2
 
3
- <%= concept("cell/forms/container", model, context: {form: f}, layout: container_layout) %>
3
+ <%= concept("cell/forms/container", model, context: { form: f }, layout: container_layout) %>
4
4
 
5
5
  <%= hidden_field_tag "kono_utils[form_id]", form_id %>
6
6
 
7
- <%= concept("cell/forms/submit", nil, context: {form: f}) %>
7
+ <% submit_buttons(form_builder:f).each do |btn| %>
8
+ <%= btn %>
9
+ <% end %>
8
10
 
9
11
  <% end %>
@@ -1,2 +1,3 @@
1
+ <%= concept("cell/buttons/show", model) if policy(model).show? %>
1
2
  <%= concept("cell/buttons/edit", model) if policy(model).edit? %>
2
- <%= concept("cell/buttons/delete", model) if policy(model).destroy? %>
3
+ <%= concept("cell/buttons/delete", model) if policy(model).destroy? %>
@@ -7,8 +7,9 @@
7
7
  <div class="row">
8
8
  <div class="col-md">
9
9
  <div class="float-right">
10
- <%= concept("cell/forms/submit", nil, context: {form: f}) %>
11
- <%= concept("cell/buttons/reset_search", model.search_form_builder.to_model) %>
10
+ <% submit_buttons(form_builder:f).each do |btn| %>
11
+ <%= btn %>
12
+ <% end %>
12
13
  </div>
13
14
  </div>
14
15
  </div>
@@ -1,11 +1,11 @@
1
1
  class TempusDominusInput < SimpleForm::Inputs::Base
2
2
  def input(wrapper_options)
3
3
 
4
- template.content_tag(:div, class: 'input-group date', data: {target_input: 'nearest'}, id: options[:date_time_picker_identifier]) do
4
+ template.content_tag(:div, class: "input-group date #{ has_errors? ? 'is-invalid' : ''}", data: { target_input: 'nearest'}, id: options[:date_time_picker_identifier]) do
5
5
 
6
6
  tmp = ActiveSupport::SafeBuffer.new
7
-
8
- tmp << @builder.text_field(attribute_name, input_html_options)
7
+ merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
8
+ tmp << @builder.text_field(attribute_name, merged_input_options)
9
9
  tmp << div_button
10
10
 
11
11
  tmp
@@ -1,3 +1,3 @@
1
1
  module KonoUtilsBootstrapView4
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.2'
3
3
  end
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.1.0
4
+ version: 0.2.2
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-02-10 00:00:00.000000000 Z
11
+ date: 2021-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -39,7 +39,7 @@ dependencies:
39
39
  version: '1.1'
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 1.1.2
42
+ version: 1.1.4
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,7 +49,7 @@ dependencies:
49
49
  version: '1.1'
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: 1.1.2
52
+ version: 1.1.4
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: kaminari
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -185,6 +185,7 @@ files:
185
185
  - app/concepts/kono_utils/object/cell/buttons/edit.rb
186
186
  - app/concepts/kono_utils/object/cell/buttons/list.rb
187
187
  - app/concepts/kono_utils/object/cell/buttons/reset_search.rb
188
+ - app/concepts/kono_utils/object/cell/buttons/show.rb
188
189
  - app/concepts/kono_utils/object/cell/create/base.rb
189
190
  - app/concepts/kono_utils/object/cell/create/page_title.rb
190
191
  - app/concepts/kono_utils/object/cell/create/side_title.rb