five-two-nw-olivander 0.1.2.21 → 0.1.2.23

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 539b6791367e3d96d805c01c479594b8df38866f9c15641cce69e9523d9556e7
4
- data.tar.gz: fc09874c9cd028c1e477db9fd5c448a77334f8c777b607a7527c2793328d03f8
3
+ metadata.gz: 4e1ff112f4d4b249ab0810df0cec13e2dceddddafcaf228de4caa4d7009fbba5
4
+ data.tar.gz: 471a085a13daf8ab6468d95999663351a07f761636fd559081dae664b459d11f
5
5
  SHA512:
6
- metadata.gz: 88815b3f90b87c1dd9ea1312cbc6b41d2f8c99c503f9c37e4d3850ea6427e5031af6a8e06dd3fd016baf2c5cde5fec6372126e8a1a26008528b6ba14af570132
7
- data.tar.gz: a73c30e128514624507f6ce823088a8d30fa97b9fa3831c8a919e246339e69fe5d518f022226b04181ccba0dd751a384f349052d03b0605900d5ba2f8656ec32
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
@@ -1,5 +1,7 @@
1
1
  - resource = (@_effective_resource || Effective::Resource.new(controller_path))
2
2
 
3
+ = render_optional_partial 'index_before'
4
+
3
5
  - if @datatable
4
6
  - content_for :datatable do
5
7
  = render_datatable(@datatable, charts: false)
@@ -7,18 +9,21 @@
7
9
  - keys = @datatable._charts.keys
8
10
  - ks = keys.size
9
11
  - if ks.positive?
10
- %br
11
- .row
12
- - @datatable._charts.keys.each do |k|
12
+ %br.foo
13
+ .row{ data: { controller: 'datatable-index-charts' }}
14
+ - keys.each do |k|
15
+ - chart = @datatable._charts[k]
13
16
  %div{ class: "#{col_class_num('xl', ks, 3)} #{col_class_num('lg', ks, 2)} #{col_class_num('md', ks, 6)} #{col_class_num('sm', ks, 6)}"}
14
- .card.card-primary
17
+ .card.card-primary{ data: { controller: 'datatable-expandable-chart' } }
15
18
  .card-header
16
19
  %h3.card-title= I18n.t([@datatable.class.name.underscore, 'charts', k].join('.'))
17
20
  .card-tools.text-right
21
+ %button.btn.btn-tool{ type: :button, 'data-card-widget': :collapse }
22
+ %i.fas.fa-minus
18
23
  %button.btn.btn-tool{ type: :button, 'data-card-widget': :maximize }
19
24
  %i.fas.fa-expand
20
- .card-body{ style: 'min-height: 220px' }
21
- = render_datatable_chart(@datatable, k)
25
+ .card-body{ style: 'height: 220px' }
26
+ = send(chart[:as].underscore, @datatable.to_json[:charts][k][:data], id: chart[:name], height: '90%', adapter: 'google')
22
27
 
23
28
  = content_for :datatable_charts
24
29
 
@@ -45,7 +50,4 @@
45
50
  %p or include Effective::CrudController in your controller
46
51
  -# .card-footer
47
52
 
48
- - begin
49
- = render partial: 'index_additional'
50
- - rescue ActionView::MissingTemplate
51
- - Rails.logger.debug "did not find additional index partial"
53
+ = render_optional_partial 'index_after'
@@ -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.21"
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.21
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: