headmin 0.2.8 → 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/CHANGELOG.md +29 -3
- data/Gemfile.lock +12 -1
- data/README.md +64 -57
- data/app/assets/config/headmin_manifest.js +2 -0
- data/app/assets/javascripts/headmin/config/i18n.js +11 -0
- data/{src/js → app/assets/javascripts}/headmin/controllers/blocks_controller.js +0 -1
- data/{src/js → app/assets/javascripts}/headmin/controllers/date_range_controller.js +0 -2
- data/app/assets/javascripts/headmin/controllers/dropzone_controller.js +33 -0
- data/app/assets/javascripts/headmin/controllers/file_preview_controller.js +244 -0
- data/{src/js → app/assets/javascripts}/headmin/controllers/filter_controller.js +12 -6
- data/{src/js → app/assets/javascripts}/headmin/controllers/filters_controller.js +0 -0
- data/{src/js → app/assets/javascripts}/headmin/controllers/flatpickr_controller.js +2 -1
- data/app/assets/javascripts/headmin/controllers/hello_controller.js +7 -0
- data/app/assets/javascripts/headmin/controllers/notification_controller.js +8 -0
- data/{src/js → app/assets/javascripts}/headmin/controllers/popup_controller.js +0 -1
- data/app/assets/javascripts/headmin/controllers/redactorx_controller.js +13 -0
- data/{src/js → app/assets/javascripts}/headmin/controllers/repeater_controller.js +0 -0
- data/app/assets/javascripts/headmin/controllers/select_controller.js +48 -0
- data/{src/js → app/assets/javascripts}/headmin/controllers/table_actions_controller.js +0 -0
- data/{src/js → app/assets/javascripts}/headmin/controllers/table_controller.js +1 -1
- data/app/assets/javascripts/headmin/index.js +41 -0
- data/app/assets/javascripts/headmin.js +15934 -0
- data/{src/scss → app/assets/stylesheets}/headmin/filter.scss +0 -0
- data/{src/scss → app/assets/stylesheets}/headmin/filters.scss +0 -0
- data/{src/scss → app/assets/stylesheets}/headmin/form.scss +51 -2
- data/{src/scss → app/assets/stylesheets}/headmin/general.scss +0 -0
- data/{src/scss → app/assets/stylesheets}/headmin/layout/body.scss +0 -0
- data/{src/scss → app/assets/stylesheets}/headmin/layout/sidebar.scss +0 -0
- data/{src/scss → app/assets/stylesheets}/headmin/layout.scss +0 -0
- data/{src/scss → app/assets/stylesheets}/headmin/login.scss +0 -0
- data/{src/scss/vendor/bootstrap/variables.scss → app/assets/stylesheets/headmin/overrides/bootstrap.scss} +0 -0
- data/{src/scss/vendor/redactorx/override.css → app/assets/stylesheets/headmin/overrides/redactorx.css} +0 -0
- data/{src/scss → app/assets/stylesheets}/headmin/popup.scss +0 -0
- data/app/assets/stylesheets/headmin/syntax.scss +349 -0
- data/{src/scss → app/assets/stylesheets}/headmin/table.scss +0 -0
- data/app/assets/stylesheets/headmin/thumbnail.scss +20 -0
- data/app/assets/stylesheets/headmin/utilities.scss +68 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_accordion.scss +118 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_alert.scss +57 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_badge.scss +29 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_breadcrumb.scss +28 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_button-group.scss +139 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_buttons.scss +111 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_card.scss +216 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_carousel.scss +229 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_close.scss +40 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_containers.scss +41 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_dropdown.scss +240 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_forms.scss +9 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_functions.scss +302 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_grid.scss +33 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_helpers.scss +9 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_images.scss +42 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_list-group.scss +174 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_mixins.scss +43 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_modal.scss +209 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_nav.scss +139 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_navbar.scss +335 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_offcanvas.scss +83 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_pagination.scss +64 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_placeholders.scss +51 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_popover.scss +158 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_progress.scss +48 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_reboot.scss +625 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_root.scss +54 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_spinners.scss +69 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_tables.scss +155 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_toasts.scss +51 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_tooltip.scss +115 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_transitions.scss +27 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_type.scss +104 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_utilities.scss +630 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/_variables.scss +1641 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/bootstrap-grid.scss +67 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/bootstrap-reboot.scss +13 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/bootstrap-utilities.scss +18 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/bootstrap.scss +53 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_floating-labels.scss +63 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_form-check.scss +152 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_form-control.scss +219 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_form-range.scss +91 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_form-select.scss +72 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_form-text.scss +11 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_input-group.scss +121 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_labels.scss +36 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/forms/_validation.scss +12 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_clearfix.scss +3 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_colored-links.scss +12 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_position.scss +30 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_ratio.scss +26 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_stacks.scss +15 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_stretched-link.scss +15 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_text-truncation.scss +7 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_visually-hidden.scss +8 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/helpers/_vr.scss +8 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_alert.scss +11 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_backdrop.scss +14 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_border-radius.scss +78 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_box-shadow.scss +18 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_breakpoints.scss +127 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_buttons.scss +133 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_caret.scss +64 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_clearfix.scss +9 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_color-scheme.scss +7 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_container.scss +9 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_deprecate.scss +10 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_forms.scss +144 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_gradients.scss +47 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_grid.scss +151 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_image.scss +16 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_list-group.scss +24 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_lists.scss +7 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_pagination.scss +31 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_reset-text.scss +17 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_resize.scss +6 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_table-variants.scss +21 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_text-truncate.scss +8 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_transition.scss +26 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_utilities.scss +89 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/mixins/_visually-hidden.scss +29 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/utilities/_api.scss +47 -0
- data/app/assets/stylesheets/headmin/vendor/bootstrap/scss/vendor/_rfs.scss +354 -0
- data/app/assets/stylesheets/headmin/vendor/flatpickr.css +903 -0
- data/{src/scss/vendor/redactorx → app/assets/stylesheets/headmin/vendor}/redactorx.css +0 -0
- data/app/assets/stylesheets/headmin/vendor/tom-select-bootstrap.css +537 -0
- data/app/assets/stylesheets/headmin.css +13454 -0
- data/app/assets/stylesheets/headmin.scss +65 -0
- data/app/helpers/headmin/admin_helper.rb +1 -0
- data/app/helpers/headmin/bootstrap_helper.rb +25 -3
- data/app/helpers/headmin/documentation_helper.rb +35 -0
- data/app/helpers/headmin/form_helper.rb +4 -0
- data/app/helpers/headmin/request_helper.rb +3 -8
- data/app/models/headmin/documentation_renderer.rb +32 -0
- data/app/models/headmin/form/base.rb +79 -0
- data/app/models/headmin/form/text.rb +53 -0
- data/app/services/block_service.rb +1 -1
- data/app/views/examples/admin.html.erb +1 -1
- data/app/views/headmin/_blocks.html.erb +2 -2
- data/app/views/headmin/_breadcrumbs.html.erb +1 -1
- data/app/views/headmin/_card.html.erb +8 -6
- data/app/views/headmin/_dropdown.html.erb +1 -1
- data/app/views/headmin/_filters.html.erb +20 -8
- data/app/views/headmin/_form.html.erb +14 -14
- data/app/views/headmin/_heading.html.erb +1 -1
- data/app/views/headmin/_notifications.html.erb +1 -1
- data/app/views/headmin/_pagination.html.erb +1 -1
- data/app/views/headmin/_popup.html.erb +10 -4
- data/app/views/headmin/_table.html.erb +2 -2
- data/app/views/headmin/_thumbnail.html.erb +47 -0
- data/app/views/headmin/dropdown/_devise.html.erb +2 -2
- data/app/views/headmin/dropdown/_list.html.erb +3 -6
- data/app/views/headmin/filters/_date.html.erb +4 -10
- data/app/views/headmin/filters/_flatpickr.html.erb +5 -5
- data/app/views/headmin/filters/_search.html.erb +5 -5
- data/app/views/headmin/filters/_select.html.erb +6 -6
- data/app/views/headmin/filters/filter/_button.html.erb +7 -7
- data/app/views/headmin/filters/filter/_template.html.erb +1 -1
- data/app/views/headmin/forms/_actions.html.erb +1 -1
- data/app/views/headmin/forms/_base.html.erb +98 -45
- data/app/views/headmin/forms/_blocks.html.erb +4 -4
- data/app/views/headmin/forms/_checkbox.html.erb +3 -3
- data/app/views/headmin/forms/_date.html.erb +29 -45
- data/app/views/headmin/forms/_date_range.html.erb +24 -66
- data/app/views/headmin/forms/_email.html.erb +35 -26
- data/app/views/headmin/forms/_file.html.erb +186 -34
- data/app/views/headmin/forms/_flatpickr.html.erb +18 -39
- data/app/views/headmin/forms/_flatpickr_range.html.erb +34 -45
- data/app/views/headmin/forms/_hidden.html.erb +13 -12
- data/app/views/headmin/forms/_image.html.erb +11 -45
- data/app/views/headmin/forms/_label.html.erb +18 -14
- data/app/views/headmin/forms/_number.html.erb +40 -37
- data/app/views/headmin/forms/_password.html.erb +37 -58
- data/app/views/headmin/forms/_redactorx.html.erb +8 -7
- data/app/views/headmin/forms/_repeater.html.erb +6 -6
- data/app/views/headmin/forms/_select.html.erb +43 -48
- data/app/views/headmin/forms/_text.html.erb +95 -58
- data/app/views/headmin/forms/_textarea.html.erb +37 -26
- data/app/views/headmin/forms/_url.html.erb +35 -26
- data/app/views/headmin/forms/_validation.html.erb +3 -3
- data/app/views/headmin/forms/_video.html.erb +21 -0
- data/app/views/headmin/forms/fields/_base.html.erb +3 -3
- data/app/views/headmin/forms/fields/_file.html.erb +2 -2
- data/app/views/headmin/forms/fields/_group.html.erb +3 -3
- data/app/views/headmin/forms/fields/_image.html.erb +2 -2
- data/app/views/headmin/forms/fields/_list.html.erb +3 -3
- data/app/views/headmin/forms/fields/_text.html.erb +2 -2
- data/app/views/headmin/forms/repeater/_row.html.erb +1 -1
- data/app/views/headmin/heading/_title.html.erb +1 -1
- data/app/views/headmin/layout/_body.html.erb +1 -1
- data/app/views/headmin/layout/_content.html.erb +1 -1
- data/app/views/headmin/layout/_footer.html.erb +1 -1
- data/app/views/headmin/layout/_header.html.erb +1 -1
- data/app/views/headmin/layout/_main.html.erb +1 -1
- data/app/views/headmin/layout/_sidebar.html.erb +3 -3
- data/app/views/headmin/layout/sidebar/_bottom.html.erb +1 -1
- data/app/views/headmin/layout/sidebar/_nav.html.erb +1 -1
- data/app/views/headmin/nav/_dropdown.html.erb +34 -0
- data/app/views/headmin/nav/_item.html.erb +22 -13
- data/app/views/headmin/table/_actions.html.erb +1 -1
- data/app/views/headmin/table/_body.html.erb +1 -1
- data/app/views/headmin/table/_foot.html.erb +1 -1
- data/app/views/headmin/table/_footer.html.erb +1 -1
- data/app/views/headmin/table/_head.html.erb +1 -1
- data/app/views/headmin/table/_header.html.erb +1 -1
- data/app/views/headmin/table/actions/_action.html.erb +4 -4
- data/app/views/headmin/table/actions/_delete.html.erb +1 -1
- data/app/views/headmin/table/actions/_export.html.erb +1 -1
- data/app/views/headmin/table/body/_row.html.erb +2 -2
- data/config/importmap.rb +2 -0
- data/config/locales/en.yml +0 -3
- data/config/locales/headmin/forms/en.yml +5 -0
- data/config/locales/headmin/forms/nl.yml +5 -0
- data/config/locales/headmin/popup/en.yml +4 -0
- data/config/locales/headmin/popup/nl.yml +4 -0
- data/config/locales/headmin/thumbnail/en.yml +4 -0
- data/config/locales/headmin/thumbnail/nl.yml +4 -0
- data/config/locales/nl.yml +0 -3
- data/esbuild-css.js +25 -0
- data/esbuild-js.js +11 -0
- data/headmin.gemspec +4 -1
- data/lib/headmin/engine.rb +15 -0
- data/lib/headmin/version.rb +1 -1
- data/lib/headmin.rb +1 -1
- data/package.json +18 -34
- data/src/js/headmin.js +1 -1
- data/src/scss/headmin.scss +1 -61
- data/yarn.lock +393 -5177
- metadata +182 -32
- data/.nvmrc +0 -1
- data/app/controllers/concerns/headmin/ckeditor.rb +0 -27
- data/app/views/headmin/forms/_ckeditor.html.erb +0 -42
- data/dist/css/headmin.css +0 -12357
- data/dist/js/headmin.js +0 -1115
- data/src/js/headmin/headmin.js +0 -158
- data/src/scss/headmin/utilities.scss +0 -19
- data/webpack.config.js +0 -30
@@ -2,15 +2,12 @@
|
|
2
2
|
# headmin/dropdown/list
|
3
3
|
#
|
4
4
|
# ==== Options
|
5
|
-
# *
|
6
|
-
# *
|
5
|
+
# * +id</tt> - unique identifier for the dropdown
|
6
|
+
# * +class</tt> - Custom class names to put on the dropdown menu
|
7
7
|
#
|
8
8
|
# ==== Examples
|
9
9
|
# Basic version
|
10
|
-
# <%= render "headmin/dropdown/
|
11
|
-
#
|
12
|
-
# Custom scope
|
13
|
-
# <%= render "headmin/dropdown/devise", scope: :admins %#>
|
10
|
+
# <%= render "headmin/dropdown/list", id: 'dropdown-1' %#>
|
14
11
|
|
15
12
|
class_names = local_assigns.has_key?(:class) ? local_assigns[:class] : ''
|
16
13
|
id = local_assigns.has_key?(:id) ? id : 'dropdown-1'
|
@@ -2,15 +2,15 @@
|
|
2
2
|
# headmin/filters/date
|
3
3
|
#
|
4
4
|
# ==== Options
|
5
|
-
# *
|
6
|
-
# *
|
5
|
+
# * +name</tt> - Name of the filter parameter
|
6
|
+
# * +label</tt> - Display name
|
7
7
|
#
|
8
8
|
# ==== Examples
|
9
9
|
# Basic version
|
10
10
|
# <%= render "headmin/filters/date", name: :created_at, label: 'Created at' %#>
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
name = local_assigns.has_key?(:name) ? name.to_sym : nil
|
13
|
+
label = local_assigns.has_key?(:label) ? label : name.to_s.humanize
|
14
14
|
|
15
15
|
input_options = {
|
16
16
|
placeholder: 'dd/mm/yyyy',
|
@@ -30,9 +30,6 @@
|
|
30
30
|
<%= content_for :filters_templates do %>
|
31
31
|
<%= render 'headmin/filters/filter/template', name: name, label: label do %>
|
32
32
|
<div class="input-group">
|
33
|
-
<span class="input-group-text">
|
34
|
-
<%= bootstrap_icon('calendar') %>
|
35
|
-
</span>
|
36
33
|
<%= date_field_tag(name, nil, input_options) %>
|
37
34
|
</div>
|
38
35
|
<% end %>
|
@@ -43,9 +40,6 @@
|
|
43
40
|
<% value_formatted = Date.parse(params[name]).strftime('%d/%m/%Y') %>
|
44
41
|
<%= render 'headmin/filters/filter/button', name: name, label: label, value: value_formatted do %>
|
45
42
|
<div class="input-group">
|
46
|
-
<span class="input-group-text">
|
47
|
-
<%= bootstrap_icon('calendar') %>
|
48
|
-
</span>
|
49
43
|
<%= date_field_tag(name, params[name], input_options) %>
|
50
44
|
</div>
|
51
45
|
<% end %>
|
@@ -2,15 +2,15 @@
|
|
2
2
|
# headmin/filters/flatpickr
|
3
3
|
#
|
4
4
|
# ==== Options
|
5
|
-
# *
|
6
|
-
# *
|
5
|
+
# * +name</tt> - Name of the filter parameter
|
6
|
+
# * +label</tt> - Display name
|
7
7
|
#
|
8
8
|
# ==== Examples
|
9
9
|
# Basic version
|
10
10
|
# <%= render "headmin/filters/flatpickr", name: :created_at, label: 'Created at' %#>
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
name = local_assigns.has_key?(:name) ? name.to_sym : nil
|
13
|
+
label = local_assigns.has_key?(:label) ? label : name.to_s.humanize
|
14
14
|
|
15
15
|
input_options = {
|
16
16
|
placeholder: 'dd/mm/yyyy',
|
@@ -45,7 +45,7 @@
|
|
45
45
|
<%= content_for :filters_buttons do %>
|
46
46
|
<% if filter_param_exists?(name) %>
|
47
47
|
<% value_formatted = Date.parse(params[name]).strftime('%d/%m/%Y') %>
|
48
|
-
<%= render 'headmin/filters/filter/button',
|
48
|
+
<%= render 'headmin/filters/filter/button', name: name, label: label, value: value_formatted do %>
|
49
49
|
<div class="input-group" data-controller="flatpickr">
|
50
50
|
<span class="input-group-text">
|
51
51
|
<%= bootstrap_icon('calendar') %>
|
@@ -2,16 +2,16 @@
|
|
2
2
|
# headmin/filters/search
|
3
3
|
#
|
4
4
|
# ==== Options
|
5
|
-
# *
|
6
|
-
# *
|
7
|
-
# *
|
5
|
+
# * +name</tt> - Name of the filter parameter
|
6
|
+
# * +label</tt> - Name of the resource to be used in the placeholder (search in ...)
|
7
|
+
# * +placeholder</tt> - Placeholder in the search field
|
8
8
|
#
|
9
9
|
# ==== Examples
|
10
10
|
# Basic version.
|
11
11
|
# <%= render 'headmin/filters/search', name: :search, label: Poll.model_name.human(count: 2) %#>
|
12
12
|
|
13
13
|
name = local_assigns.has_key?(:name) ? name : :search
|
14
|
-
label = local_assigns.has_key?(:label) ? label :
|
14
|
+
label = local_assigns.has_key?(:label) ? label : name.to_s.humanize
|
15
15
|
placeholder = local_assigns.has_key?(:placeholder) ? placeholder : t('.placeholder', resource: label)
|
16
16
|
|
17
17
|
value = filter_param_exists?(name) ? params[name] : nil
|
@@ -19,4 +19,4 @@
|
|
19
19
|
|
20
20
|
<% content_for :filters_search do %>
|
21
21
|
<input class="form-control" type="search" placeholder="<%= raw placeholder.capitalize %>" aria-label="Search" name="<%= name %>" value="<%= value %>">
|
22
|
-
<% end %>
|
22
|
+
<% end %>
|
@@ -2,16 +2,16 @@
|
|
2
2
|
# headmin/filters/select
|
3
3
|
#
|
4
4
|
# ==== Options
|
5
|
-
# *
|
6
|
-
# *
|
7
|
-
# *
|
5
|
+
# * +name</tt> - Name of the filter parameter
|
6
|
+
# * +label</tt> - Display name
|
7
|
+
# * +options</tt> - List of options to select from
|
8
8
|
#
|
9
9
|
# ==== Examples
|
10
10
|
# Basic version
|
11
11
|
# <%= render "headmin/filters/select", name: :poll_type, label: 'Type', options: [["General", "general", "Fun", "fun"]] %#>
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
name = local_assigns.has_key?(:name) ? name.to_sym : nil
|
14
|
+
label = local_assigns.has_key?(:label) ? label : name.to_s.humanize
|
15
15
|
options = local_assigns.has_key?(:options) ? options : []
|
16
16
|
|
17
17
|
select_options = {
|
@@ -38,7 +38,7 @@
|
|
38
38
|
<% (params[name] || []).each_with_index do |param, index| %>
|
39
39
|
<% selected_option = options.detect { |value, key, config| (key.present? ? key : value) == param } %>
|
40
40
|
<% selected_value = selected_option.is_a?(Array) ? selected_option.first : selected_option %>
|
41
|
-
<%= render 'headmin/filters/filter/button', name: name, label: label, value: selected_value, id: "#{name}_#{index}" do %>
|
41
|
+
<%= render 'headmin/filters/filter/button', name: name, label: label, value: selected_value, id: "#{name}_#{index}_#{SecureRandom.hex}" do %>
|
42
42
|
<%= select_tag("#{name}[]", options_for_select(options, param), select_options) %>
|
43
43
|
<% end %>
|
44
44
|
<% end %>
|
@@ -6,15 +6,16 @@
|
|
6
6
|
label: (string) Display name
|
7
7
|
value: (string) Value of the parameter
|
8
8
|
%>
|
9
|
-
<% id = local_assigns.has_key?(:id) ? id :
|
10
|
-
<% name = local_assigns.has_key?(:name) ? name : nil %>
|
11
|
-
<% label = local_assigns.has_key?(:label) ? label :
|
9
|
+
<% id = local_assigns.has_key?(:id) ? id : SecureRandom.hex %>
|
10
|
+
<% name = local_assigns.has_key?(:name) ? name.to_sym : nil %>
|
11
|
+
<% label = local_assigns.has_key?(:label) ? label : name.to_s.humanize %>
|
12
12
|
<% value = local_assigns.has_key?(:value) ? value : nil %>
|
13
13
|
|
14
|
-
<div class="h-filter me-1 my-1" data-filter-name="<%= name %>">
|
14
|
+
<div class="h-filter me-1 my-1" data-controller="filter" data-filter-name="<%= name %>">
|
15
15
|
<button
|
16
16
|
type="button"
|
17
17
|
class="h-filter-button btn h-btn-outline-transparent"
|
18
|
+
data-filter-target="button"
|
18
19
|
data-popup-target="button"
|
19
20
|
data-popup-id="<%= id %>"
|
20
21
|
data-action="click->popup#open"
|
@@ -23,8 +24,7 @@
|
|
23
24
|
<span class="h-filter-remove" data-action="click->filters#remove"><%= bootstrap_icon('x-lg') %></span>
|
24
25
|
</button>
|
25
26
|
|
26
|
-
<%= render 'headmin/popup', id: "#{id}" do %>
|
27
|
-
<%= yield
|
27
|
+
<%= render 'headmin/popup', id: "#{id}", data: {'filter-target': 'popup'} do %>
|
28
|
+
<%= yield %>
|
28
29
|
<% end %>
|
29
|
-
|
30
30
|
</div>
|
@@ -1,61 +1,114 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
#
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
#
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
1
|
+
<!--
|
2
|
+
<% documentation do %>
|
3
|
+
# Base
|
4
|
+
This serves as a wrapper around most form views. It allows defining everything that happens outside the input field.
|
5
|
+
The main purpose of this view is to coordinate labels and appendages.
|
6
|
+
|
7
|
+
```erbx
|
8
|
+
<%= form_with do |form| %>
|
9
|
+
<%= render "headmin/forms/base", form: form, attribute: "basic_example" do |form| %>
|
10
|
+
<%= form.text_field("attribute", class: 'form-control') %>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
13
|
+
```
|
14
|
+
|
15
|
+
# Parameters
|
16
|
+
| Name | Required | Type | Description |
|
17
|
+
| ------------ | -------- | ---------------- | ----------- |
|
18
|
+
| form | yes | Object | Form object |
|
19
|
+
| attribute | yes | String, Symbol | Name of the attribute of the form model |
|
20
|
+
| append | no | Boolean | Text or icon to be shown on the left hand side of the input, Doesn't work with float |
|
21
|
+
| class | no | String | A space separated string of HTML class names |
|
22
|
+
| float | no | Boolean | Set to true if you want to show floating labels |
|
23
|
+
| id | no | String | Input identifier to be used as "for" in the label |
|
24
|
+
| label | no | Hash | Text to show as label. Label will be hidden if value is false |
|
25
|
+
| prepend | no | Boolean | Text or icon to be shown on the right hand side of the input, Doesn't work with float |
|
26
|
+
|
27
|
+
## Examples
|
28
|
+
|
29
|
+
### Sizing
|
30
|
+
```erbx
|
31
|
+
<%= form_with do |form| %>
|
32
|
+
<%= render "headmin/forms/base", form: form, attribute: "small", class: 'input-group-sm' do |form| %>
|
33
|
+
<%= form.text_field("attribute", class: 'form-control', placeholder: '.input-group-sm') %>
|
34
|
+
<% end %>
|
35
|
+
<%= render "headmin/forms/base", form: form, attribute: "medium" do |form| %>
|
36
|
+
<%= form.text_field("attribute", class: 'form-control', placeholder: 'Default size') %>
|
37
|
+
<% end %>
|
38
|
+
<%= render "headmin/forms/base", form: form, attribute: "large", class: 'input-group-lg' do |form| %>
|
39
|
+
<%= form.text_field("attribute", class: 'form-control', placeholder: '.input-group-lg') %>
|
40
|
+
<% end %>
|
41
|
+
<% end %>
|
42
|
+
```
|
43
|
+
|
44
|
+
### Labels
|
45
|
+
```erbx
|
46
|
+
<%= form_with do |form| %>
|
47
|
+
<%= render "headmin/forms/base", form: form, attribute: "no_label", label: false do |form| %>
|
48
|
+
<%= form.text_field("attribute", class: 'form-control', placeholder: 'Without label') %>
|
49
|
+
<% end %>
|
50
|
+
<%= render "headmin/forms/base", form: form, attribute: "floating_label", float: true do |form| %>
|
51
|
+
<%= form.text_field("attribute", class: 'form-control', placeholder: 'Default size') %>
|
52
|
+
<% end %>
|
53
|
+
<%= render "headmin/forms/base", form: form, attribute: "custom_label", label: 'Custom label' do |form| %>
|
54
|
+
<%= form.text_field("attribute", class: 'form-control') %>
|
55
|
+
<% end %>
|
56
|
+
<% end %>
|
57
|
+
```
|
58
|
+
|
59
|
+
### Appendages
|
60
|
+
```erbx
|
61
|
+
<%= form_with do |form| %>
|
62
|
+
<%= render "headmin/forms/base", form: form, attribute: "prepend", prepend: "€" do |form| %>
|
63
|
+
<%= form.text_field("attribute", class: 'form-control') %>
|
64
|
+
<% end %>
|
65
|
+
<%= render "headmin/forms/base", form: form, attribute: "append", append: "m²" do |form| %>
|
66
|
+
<%= form.text_field("attribute", class: 'form-control') %>
|
67
|
+
<% end %>
|
68
|
+
<%= render "headmin/forms/base", form: form, attribute: "prepend_and_append", prepend: "€", append: "m²" do |form| %>
|
69
|
+
<%= form.text_field("attribute", class: 'form-control') %>
|
70
|
+
<% end %>
|
71
|
+
<% end %>
|
72
|
+
```
|
73
|
+
<% end %>
|
74
|
+
-->
|
75
|
+
|
76
|
+
<% base = Headmin::Form::Base.new(local_assigns) %>
|
77
|
+
|
78
|
+
<%= tag.div(class: base.class_names, data: base.data) do %>
|
79
|
+
<% if base.label != false && !base.float %>
|
80
|
+
<%= render 'headmin/forms/label', base.label_options %>
|
81
|
+
<% end %>
|
82
|
+
|
83
|
+
<% if base.append || base.prepend %>
|
37
84
|
<div class="input-group w-100">
|
38
|
-
<% if prepend %>
|
85
|
+
<% if base.prepend %>
|
39
86
|
<span class="input-group-text">
|
40
|
-
<%= prepend %>
|
87
|
+
<%= base.prepend %>
|
41
88
|
</span>
|
42
89
|
<% end %>
|
43
90
|
|
44
91
|
<%= yield form %>
|
45
|
-
<%= render 'headmin/forms/validation',
|
92
|
+
<%= render 'headmin/forms/validation', base.validation_options if form.object.respond_to?(:errors) %>
|
46
93
|
|
47
|
-
<% if append %>
|
94
|
+
<% if base.append %>
|
48
95
|
<span class="input-group-text">
|
49
|
-
<%= append %>
|
96
|
+
<%= base.append %>
|
50
97
|
</span>
|
51
98
|
<% end %>
|
52
99
|
</div>
|
53
100
|
<% else %>
|
54
101
|
<%= yield form %>
|
55
|
-
<%= render 'headmin/forms/validation',
|
102
|
+
<%= render 'headmin/forms/validation', base.validation_options if form.object.respond_to?(:errors) %>
|
103
|
+
<% end %>
|
104
|
+
|
105
|
+
<% if base.label != false && base.float %>
|
106
|
+
<%= render 'headmin/forms/label', base.label_options %>
|
56
107
|
<% end %>
|
57
108
|
|
58
|
-
<% if
|
59
|
-
<%=
|
109
|
+
<% if base.list %>
|
110
|
+
<datalist id="<%= base.list_id %>">
|
111
|
+
<%= options_for_select(base.list) %>
|
112
|
+
</datalist>
|
60
113
|
<% end %>
|
61
|
-
|
114
|
+
<% end %>
|
@@ -2,9 +2,9 @@
|
|
2
2
|
# headmin/forms/blocks
|
3
3
|
#
|
4
4
|
# ==== Options
|
5
|
-
# *
|
6
|
-
# *
|
7
|
-
# *
|
5
|
+
# * +form</tt> - Form object
|
6
|
+
# * +path</tt> - Directory where to look for block templates
|
7
|
+
# * +allow</tt> - Names of block templates that can be added
|
8
8
|
#
|
9
9
|
# ==== Examples
|
10
10
|
# Basic version. This will only look for blocks in 'admin/blocks'
|
@@ -29,7 +29,7 @@
|
|
29
29
|
<%= block_form.hidden_field :name, value: name %>
|
30
30
|
|
31
31
|
<!-- Render block form fields -->
|
32
|
-
<% view_path = BlockService.form_view(name, path: path).gsub('/_', '/') %>
|
32
|
+
<% view_path = BlockService.form_view(name, path: path).gsub('/_', '/').split('.')[0] %>
|
33
33
|
<%= render view_path, form: block_form %>
|
34
34
|
|
35
35
|
<!-- Label -->
|
@@ -2,9 +2,9 @@
|
|
2
2
|
# headmin/forms/checkbox
|
3
3
|
#
|
4
4
|
# ==== Options
|
5
|
-
# *
|
6
|
-
# *
|
7
|
-
# *
|
5
|
+
# * +form+ - Form object
|
6
|
+
# * +attribute+ - Name of the attribute of the form model
|
7
|
+
# * +label+ - Text to show as label. Label will be hidden if value is false
|
8
8
|
#
|
9
9
|
# ==== Examples
|
10
10
|
# Basic version
|
@@ -1,57 +1,41 @@
|
|
1
1
|
<%
|
2
2
|
# headmin/forms/date
|
3
3
|
#
|
4
|
-
# ====
|
5
|
-
# *
|
6
|
-
# *
|
7
|
-
#
|
8
|
-
#
|
9
|
-
# *
|
10
|
-
# *
|
11
|
-
# *
|
12
|
-
# *
|
13
|
-
# *
|
14
|
-
# *
|
15
|
-
# *
|
16
|
-
# *
|
4
|
+
# ==== Required parameters
|
5
|
+
# * +form+ - Form object
|
6
|
+
# * +attribute+ - Name of the attribute of the form model
|
7
|
+
#
|
8
|
+
# ==== Optional parameters
|
9
|
+
# * +aria+ - Provide a hash to define all aria attributes
|
10
|
+
# * +autocomplete+ - Value to be autofilled by the browser
|
11
|
+
# * +autofocus+ - Set to true to focus on this field when the page renders
|
12
|
+
# * +data+ - Optional HTML data attributes
|
13
|
+
# * +disabled+ - Set to true if the input should be shown as disabled
|
14
|
+
# * +id+ - Input identifier
|
15
|
+
# * +list+ - Add array of options to show in a data list
|
16
|
+
# * +readonly+ - Set to true if the value of the field can only be read and not be modified
|
17
|
+
# * +required+ - Set to true to mark as required
|
18
|
+
# * +step+ - The acceptable value granularity
|
19
|
+
# * +value+ - Overrides the value of the form
|
20
|
+
#
|
21
|
+
# ==== Extra parameters
|
22
|
+
# Listed in 'headmin/forms/base'
|
23
|
+
#
|
24
|
+
# ==== References
|
25
|
+
# https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date
|
26
|
+
# https://apidock.com/rails/ActionView/Helpers/FormHelper/date_field
|
17
27
|
#
|
18
28
|
# ==== Examples
|
19
29
|
# Basic version
|
20
30
|
# <%= render 'headmin/forms/date', form: form, attribute: :date %#>
|
21
31
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
label = local_assigns.has_key?(:label) ? label : nil
|
28
|
-
prepend = local_assigns.has_key?(:prepend) ? prepend : nil
|
29
|
-
readonly = local_assigns.has_key?(:readonly) ? readonly : false
|
30
|
-
required = local_assigns.has_key?(:required) ? required : false
|
31
|
-
|
32
|
-
options = {
|
33
|
-
'aria-describedby': form_field_validation_id(form, attribute),
|
34
|
-
class: "form-control #{form_field_validation_class(form, attribute)} #{class_names}",
|
35
|
-
data: data,
|
36
|
-
disabled: disabled,
|
37
|
-
placeholder: label ? label.to_s.humanize : nil,
|
38
|
-
readonly: readonly,
|
39
|
-
required: required,
|
40
|
-
}
|
41
|
-
|
42
|
-
options[:name] = name if local_assigns.has_key?(:name)
|
43
|
-
|
44
|
-
template_locals = {
|
45
|
-
append: append,
|
46
|
-
attribute: attribute,
|
47
|
-
float: float,
|
48
|
-
form: form,
|
49
|
-
label: label,
|
50
|
-
prepend: prepend,
|
51
|
-
required: required
|
52
|
-
}
|
32
|
+
option_keys = %i(aria autocomplete autofocus data disabled id list readonly required step value)
|
33
|
+
options = local_assigns.slice(*option_keys).merge(
|
34
|
+
aria: { describedby: form_field_validation_id(form, attribute) },
|
35
|
+
class: ['form-control', form_field_validation_class(form, attribute)].join(' '),
|
36
|
+
)
|
53
37
|
%>
|
54
38
|
|
55
|
-
<%= render 'headmin/forms/base',
|
39
|
+
<%= render 'headmin/forms/base', local_assigns do |form| %>
|
56
40
|
<%= form.date_field(attribute, options) %>
|
57
41
|
<% end %>
|
@@ -1,21 +1,18 @@
|
|
1
1
|
<%
|
2
2
|
# headmin/forms/date_range
|
3
3
|
#
|
4
|
-
# ====
|
5
|
-
# *
|
6
|
-
# *
|
7
|
-
# *
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# *
|
11
|
-
# *
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
# * <tt>single<tt> - Set to true if only one field should be displayed
|
17
|
-
# * <tt>start_attribute<tt> - Name of the start date attribute of the form model
|
18
|
-
# * <tt>start_label<tt> - Label for the start attribute
|
4
|
+
# ==== Required parameters
|
5
|
+
# * +form+ - Form object
|
6
|
+
# * +start_attribute+ - Name of the start date attribute of the form model
|
7
|
+
# * +end_attribute+ - Name of the end date attribute of the form model
|
8
|
+
#
|
9
|
+
# ==== Optional parameters
|
10
|
+
# * +end_label+ - Label for the end attribute
|
11
|
+
# * +start_label+ - Label for the start attribute
|
12
|
+
#
|
13
|
+
# ==== Extra parameters
|
14
|
+
# Listed in 'headmin/forms/date'
|
15
|
+
# Listed in 'headmin/forms/base'
|
19
16
|
#
|
20
17
|
# ==== Examples
|
21
18
|
# Basic version
|
@@ -24,61 +21,22 @@
|
|
24
21
|
# With custom labels
|
25
22
|
# <%= render 'headmin/forms/date_range', form: form, start_attribute: :start_date_2, start_label: :start_date, end_attribute: :end_date_2, end_label: :end_date %#>
|
26
23
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
disabled = local_assigns.has_key?(:disabled) ? disabled : false
|
31
|
-
end_attribute = local_assigns.has_key?(:end_attribute) ? end_attribute : nil
|
32
|
-
end_label = local_assigns.has_key?(:end_label) ? end_label : nil
|
33
|
-
float = local_assigns.has_key?(:float) ? float : false
|
34
|
-
label = local_assigns.has_key?(:label) ? label : nil
|
35
|
-
prepend = local_assigns.has_key?(:prepend) ? prepend : nil
|
36
|
-
readonly = local_assigns.has_key?(:readonly) ? readonly : false
|
37
|
-
required = local_assigns.has_key?(:required) ? required : false
|
38
|
-
start_attribute = local_assigns.has_key?(:start_attribute) ? start_attribute : nil
|
39
|
-
start_label = local_assigns.has_key?(:start_label) ? start_label : nil
|
40
|
-
single = local_assigns.has_key?(:single) ? single : false
|
41
|
-
|
42
|
-
template_locals = {
|
43
|
-
form: form,
|
44
|
-
append: append,
|
45
|
-
prepend: prepend,
|
46
|
-
float: float,
|
47
|
-
label: label,
|
48
|
-
class: class_names,
|
49
|
-
data: data.merge(action: 'change->date-range#update'),
|
50
|
-
disabled: disabled,
|
51
|
-
readonly: readonly,
|
52
|
-
required: required
|
53
|
-
}
|
54
|
-
|
55
|
-
start_template_locals = template_locals.merge(
|
56
|
-
attribute: start_attribute,
|
57
|
-
placeholder: start_attribute,
|
58
|
-
label: start_label
|
24
|
+
start_date_options = local_assigns.merge(
|
25
|
+
attribute: local_assigns[:start_attribute],
|
26
|
+
label: local_assigns[:start_label]
|
59
27
|
)
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
placeholder: end_attribute,
|
64
|
-
label: end_label
|
28
|
+
end_date_options = local_assigns.merge(
|
29
|
+
attribute: local_assigns[:end_attribute],
|
30
|
+
label: local_assigns[:end_label]
|
65
31
|
)
|
66
32
|
%>
|
67
33
|
|
68
|
-
|
69
|
-
<div
|
70
|
-
<%= render 'headmin/forms/
|
71
|
-
<%= render 'headmin/forms/hidden', end_template_locals.merge(class: nil, data: { 'date-range-target': 'endDateInput' }) %>
|
72
|
-
<%= render 'headmin/forms/date', template_locals.merge(attribute: :date, name: nil) %>
|
34
|
+
<div class="row">
|
35
|
+
<div class="col">
|
36
|
+
<%= render 'headmin/forms/date', start_date_options %>
|
73
37
|
</div>
|
74
|
-
|
75
|
-
|
76
|
-
<div class="col">
|
77
|
-
<%= render 'headmin/forms/date', start_template_locals %>
|
78
|
-
</div>
|
79
|
-
<div class="col">
|
80
|
-
<%= render 'headmin/forms/date', end_template_locals %>
|
81
|
-
</div>
|
38
|
+
<div class="col">
|
39
|
+
<%= render 'headmin/forms/date', end_date_options %>
|
82
40
|
</div>
|
83
|
-
|
41
|
+
</div>
|
84
42
|
|