five-two-nw-olivander 0.1.2.22 → 0.1.2.23

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: cf9c0144387ec2d459f02dadea4b96402dac9698093cc3fd897de95fc787ba7d
4
- data.tar.gz: 84c801572bdec84621c76e8c34c0b640dcbc0f9b106edf4c0425d683455e7673
3
+ metadata.gz: 4e1ff112f4d4b249ab0810df0cec13e2dceddddafcaf228de4caa4d7009fbba5
4
+ data.tar.gz: 471a085a13daf8ab6468d95999663351a07f761636fd559081dae664b459d11f
5
5
  SHA512:
6
- metadata.gz: e2cae3668e04550b11d6514e73cd914d29aab621e3b63b3ddaf1d0f79af52bb1d6b92e24d9a1747f0cf8af5e043ccc6a288b4e64a5fc4c960893db417e37d932
7
- data.tar.gz: a6dd96121cec897f2639f147fca0737fdb20fc4dab3e8879635b6d41bf385dfe9303ece99333687c9e51041d383a051bca081f1896c640eafb73e201ca3ef1de
6
+ metadata.gz: a4aa345359703da27fcbf09077638bba6c8e229ca43b9792b5da97725af1439da746784496152796bc3a2e603bf4a85cf6efc199746130c09d391d98b2f65d07
7
+ data.tar.gz: 5fab915b6c4e2cd4fd5a4560ee3cb44b3198d52fc16f78fb47fe8c05a3f21724e6f00a2d84cff83d37468e497022951a0076c803d0fb62759e3069f1ff8d847c
@@ -4,7 +4,8 @@
4
4
  .row
5
5
  - section.fields.each do |field|
6
6
  %div{ class: section.column_class }
7
- - if field.type == :association
8
- = @f.association field.sym, disabled: !field.editable
7
+ - case field.type
8
+ - when :association
9
+ = @f.association field.sym, disabled: !field.editable, input_html: { data: { controller: "input-control-#{field.type}" } }
9
10
  - else
10
- = @f.input field.sym, disabled: !field.editable
11
+ = @f.input field.sym, disabled: !field.editable, as: field.type.to_sym, input_html: { data: { controller: "input-control-#{field.type}" } }
@@ -0,0 +1,38 @@
1
+ class DateTimeInput < SimpleForm::Inputs::Base
2
+ def input(wrapper_options)
3
+ date_format = options[:date_format] || '%m/%d/%Y'
4
+ raw_value = object.public_send(attribute_name)
5
+ raw_value = raw_value.strftime(date_format) if raw_value.present?
6
+
7
+ disabled = options[:disabled] || false
8
+
9
+ field = @builder.text_field(attribute_name, id: "#{attribute_name}_datetimepicker", class: 'form-control', value: raw_value, disabled: disabled, 'data-toggle': 'datetimepicker', 'data-target': "##{attribute_name}_datetimepicker")
10
+
11
+ add_on_class = options[:add_on_class] || "fa fa-calendar"
12
+
13
+ add_on = template.content_tag(:div, class: "input-group-prepend") do
14
+ add_on = template.content_tag(:div, class: "input-group-text") do
15
+ template.content_tag(:i, '', :class => add_on_class, 'data-toggle': 'datetimepicker', 'data-target': "##{attribute_name}_datetimepicker")
16
+ end
17
+ end
18
+
19
+ all = content_tag(:div, add_on + field, class: 'input-group')
20
+
21
+ script = "".html_safe
22
+ unless disabled then
23
+ picker_options = options[:picker_options] || { "format" => "MM/DD/YYYY" }
24
+
25
+ script = """
26
+ <script>
27
+ $(document).ready(function() {
28
+ $('##{attribute_name}_datetimepicker').datetimepicker(
29
+ #{picker_options.to_json}
30
+ );
31
+ });
32
+ </script>
33
+ """.html_safe
34
+ end
35
+
36
+ all + script
37
+ end
38
+ end
@@ -18,6 +18,8 @@
18
18
  .card-header
19
19
  %h3.card-title= I18n.t([@datatable.class.name.underscore, 'charts', k].join('.'))
20
20
  .card-tools.text-right
21
+ %button.btn.btn-tool{ type: :button, 'data-card-widget': :collapse }
22
+ %i.fas.fa-minus
21
23
  %button.btn.btn-tool{ type: :button, 'data-card-widget': :maximize }
22
24
  %i.fas.fa-expand
23
25
  .card-body{ style: 'height: 220px' }
@@ -0,0 +1,3 @@
1
+ json.items @resources do |resource|
2
+ json.id resource.id
3
+ end
@@ -13,7 +13,7 @@ SimpleForm.setup do |config|
13
13
  # wrapper, change the order or even add your own to the
14
14
  # stack. The options given below are used to wrap the
15
15
  # whole input.
16
- config.wrappers :default, class: :input,
16
+ config.wrappers :default, class: "form-group",
17
17
  hint_class: :field_with_hint, error_class: :field_with_errors, valid_class: :field_without_errors do |b|
18
18
  ## Extensions enabled by default
19
19
  # Any of these extensions can be disabled for a
@@ -52,16 +52,49 @@ SimpleForm.setup do |config|
52
52
  b.optional :readonly
53
53
 
54
54
  ## Inputs
55
- # b.use :input, class: 'input', error_class: 'is-invalid', valid_class: 'is-valid'
56
- b.use :label_input
55
+ # b.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid'
56
+ b.use :label #, class: 'form-control'
57
+ b.use :input, class: 'form-control'
57
58
  b.use :hint, wrap_with: { tag: :span, class: :hint }
58
- b.use :error, wrap_with: { tag: :span, class: :error }
59
+ b.use :error, wrap_with: { tag: :span, class: "text-danger" }
59
60
 
60
61
  ## full_messages_for
61
62
  # If you want to display the full error message for the attribute, you can
62
63
  # use the component :full_error, like:
63
64
  #
64
65
  # b.use :full_error, wrap_with: { tag: :span, class: :error }
66
+
67
+ # b.wrapper
68
+ end
69
+
70
+ config.wrappers :checkbox, class: "form-check",
71
+ hint_class: :field_with_hint, error_class: :field_with_errors, valid_class: :field_without_errors do |b|
72
+ b.use :html5
73
+ b.use :placeholder
74
+ b.optional :maxlength
75
+ b.optional :minlength
76
+ b.optional :pattern
77
+ b.optional :min_max
78
+ b.optional :readonly
79
+ b.use :input, class: 'form-check-input'
80
+ b.use :label #, class: 'form-control'
81
+ b.use :hint, wrap_with: { tag: :span, class: :hint }
82
+ b.use :error, wrap_with: { tag: :span, class: "text-danger" }
83
+ end
84
+
85
+ config.wrappers :switch, class: "custom-control custom-switch",
86
+ hint_class: :field_with_hint, error_class: :field_with_errors, valid_class: :field_without_errors do |b|
87
+ b.use :html5
88
+ b.use :placeholder
89
+ b.optional :maxlength
90
+ b.optional :minlength
91
+ b.optional :pattern
92
+ b.optional :min_max
93
+ b.optional :readonly
94
+ b.use :input, class: 'custom-control-input'
95
+ #b.use :label, class: 'custom-control-label'
96
+ b.use :hint, wrap_with: { tag: :span, class: :hint }
97
+ b.use :error, wrap_with: { tag: :span, class: "text-danger" }
65
98
  end
66
99
 
67
100
  # The default wrapper to be used by the FormBuilder.
@@ -71,7 +104,7 @@ SimpleForm.setup do |config|
71
104
  # Defaults to :nested for bootstrap config.
72
105
  # inline: input + label
73
106
  # nested: label > input
74
- config.boolean_style = :nested
107
+ config.boolean_style = :inline
75
108
 
76
109
  # Default class for buttons
77
110
  config.button_class = 'btn'
@@ -1,3 +1,3 @@
1
1
  module Olivander
2
- VERSION = "0.1.2.22"
2
+ VERSION = "0.1.2.23"
3
3
  end
@@ -0,0 +1,15 @@
1
+ <%# frozen_string_literal: true %>
2
+ <%%= simple_form_for(@<%= singular_table_name %>) do |f| %>
3
+ <%%= f.error_notification %>
4
+ <%%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %>
5
+
6
+ <div class="form-inputs">
7
+ <%- attributes.each do |attribute| -%>
8
+ <%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
9
+ <%- end -%>
10
+ </div>
11
+
12
+ <div class="form-actions">
13
+ <%%= f.button :submit %>
14
+ </div>
15
+ <%% end %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: five-two-nw-olivander
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2.22
4
+ version: 0.1.2.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Dennis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-19 00:00:00.000000000 Z
11
+ date: 2023-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chartkick
@@ -194,6 +194,7 @@ files:
194
194
  - app/controllers/olivander/application_controller.rb
195
195
  - app/datatables/olivander/datatable.rb
196
196
  - app/helpers/olivander/application_helper.rb
197
+ - app/inputs/date_time_input.rb
197
198
  - app/jobs/olivander/application_job.rb
198
199
  - app/mailers/olivander/application_mailer.rb
199
200
  - app/models/olivander/application_record.rb
@@ -201,6 +202,7 @@ files:
201
202
  - app/views/application/_resource_form_actions.html.haml
202
203
  - app/views/application/edit.html.haml
203
204
  - app/views/application/index.html.haml
205
+ - app/views/application/index.json.jbuilder
204
206
  - app/views/application/new.html.haml
205
207
  - app/views/application/show.html.haml
206
208
  - app/views/effective/resource/_actions_dropleft.html.haml
@@ -228,6 +230,7 @@ files:
228
230
  - lib/olivander/menus/menu_item.rb
229
231
  - lib/olivander/version.rb
230
232
  - lib/tasks/olivander_tasks.rake
233
+ - lib/templates/erb/scaffold/_form.html.erb
231
234
  - lib/templates/erb/scaffold/_form.html.haml
232
235
  homepage: https://rubygems.org/gems/olivander
233
236
  licenses: