headmin 0.1.2 → 0.2.0
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/.gitignore +1 -15
- data/Gemfile +1 -1
- data/Gemfile.lock +24 -2
- data/README.md +5 -34
- data/app/controllers/concerns/headmin/authentication.rb +0 -8
- data/app/controllers/concerns/headmin/pagination.rb +1 -1
- data/app/helpers/headmin/admin_helper.rb +4 -4
- data/app/models/concerns/headmin/block.rb +11 -0
- data/app/models/concerns/headmin/blockable.rb +10 -0
- data/app/models/concerns/headmin/field.rb +17 -0
- data/app/models/concerns/headmin/fieldable.rb +44 -0
- data/app/services/block_service.rb +68 -0
- data/app/views/{layouts → examples}/admin.html.erb +0 -0
- data/app/views/{layouts/admin → examples}/auth.html.erb +0 -0
- data/app/views/headmin/_blocks.html.erb +24 -0
- data/app/views/headmin/_breadcrumbs.html.erb +9 -5
- data/app/views/headmin/_card.html.erb +48 -0
- data/app/views/headmin/_dropdown.html.erb +18 -0
- data/app/views/headmin/_filters.html.erb +56 -34
- data/app/views/headmin/_form.html.erb +60 -6
- data/app/views/headmin/_heading.html.erb +8 -4
- data/app/views/headmin/_index.html.erb +9 -8
- data/app/views/headmin/_notifications.html.erb +8 -0
- data/app/views/headmin/_pagination.html.erb +11 -7
- data/app/views/headmin/_popup.html.erb +26 -0
- data/app/views/headmin/_table.html.erb +11 -4
- data/app/views/headmin/dropdown/_button.html.erb +13 -0
- data/app/views/headmin/dropdown/_devise.html.erb +21 -0
- data/app/views/headmin/{layout/dropdown → dropdown}/_divider.html.erb +1 -1
- data/app/views/headmin/dropdown/_item.html.erb +18 -0
- data/app/views/headmin/dropdown/_list.html.erb +11 -0
- data/app/views/headmin/dropdown/_locale.html.erb +17 -0
- data/app/views/headmin/filters/_date.html.erb +21 -16
- data/app/views/headmin/filters/_search.html.erb +18 -18
- data/app/views/headmin/filters/_select.html.erb +28 -23
- data/app/views/headmin/filters/filter/_button.html.erb +15 -6
- data/app/views/headmin/filters/filter/_menu_item.html.erb +2 -2
- data/app/views/headmin/filters/filter/_template.html.erb +2 -2
- data/app/views/headmin/forms/_actions.html.erb +4 -8
- data/app/views/headmin/forms/_base.html.erb +60 -0
- data/app/views/headmin/forms/_blocks.html.erb +32 -0
- data/app/views/headmin/forms/_checkbox.html.erb +39 -0
- data/app/views/headmin/forms/_ckeditor.html.erb +42 -0
- data/app/views/headmin/forms/_date.html.erb +45 -0
- data/app/views/headmin/forms/_email.html.erb +39 -0
- data/app/views/headmin/forms/_file.html.erb +40 -0
- data/app/views/headmin/forms/_image.html.erb +55 -0
- data/app/views/headmin/forms/_label.html.erb +24 -0
- data/app/views/headmin/forms/_number.html.erb +50 -0
- data/app/views/headmin/forms/_password.html.erb +69 -0
- data/app/views/headmin/forms/_redactorx.html.erb +49 -0
- data/app/views/headmin/forms/_repeater.html.erb +133 -0
- data/app/views/headmin/forms/_select.html.erb +70 -0
- data/app/views/headmin/forms/_text.html.erb +62 -0
- data/app/views/headmin/forms/_textarea.html.erb +39 -0
- data/app/views/headmin/forms/_url.html.erb +39 -0
- data/app/views/headmin/forms/_validation.html.erb +21 -0
- data/app/views/headmin/forms/actions/_destroy.html.erb +13 -0
- data/app/views/headmin/forms/actions/_save.html.erb +12 -0
- data/app/views/headmin/forms/actions/_view.html.erb +15 -0
- data/app/views/headmin/forms/fields/_base.html.erb +25 -0
- data/app/views/headmin/forms/fields/_file.html.erb +15 -22
- data/app/views/headmin/forms/fields/_group.html.erb +38 -0
- data/app/views/headmin/forms/fields/_image.html.erb +15 -35
- data/app/views/headmin/forms/fields/_list.html.erb +26 -0
- data/app/views/headmin/forms/fields/_text.html.erb +15 -37
- data/app/views/headmin/forms/repeater/_row.html.erb +51 -0
- 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 +2 -2
- data/app/views/headmin/layout/_sidebar.html.erb +1 -1
- data/app/views/headmin/layout/sidebar/{_menu.html.erb → _nav.html.erb} +1 -1
- data/app/views/headmin/nav/_item.html.erb +21 -0
- data/app/views/headmin/nav/item/_devise.html.erb +21 -0
- data/app/views/headmin/nav/item/_locale.html.erb +17 -0
- data/app/views/headmin/pagination/_per_page.html.erb +18 -0
- data/app/views/headmin/{kaminari → pagination/kaminari}/_first_page.html.erb +0 -0
- data/app/views/headmin/{kaminari → pagination/kaminari}/_gap.html.erb +0 -0
- data/app/views/headmin/{kaminari → pagination/kaminari}/_last_page.html.erb +0 -0
- data/app/views/headmin/{kaminari → pagination/kaminari}/_next_page.html.erb +0 -0
- data/app/views/headmin/{kaminari → pagination/kaminari}/_page.html.erb +1 -1
- data/app/views/headmin/{kaminari → pagination/kaminari}/_paginator.html.erb +0 -0
- data/app/views/headmin/{kaminari → pagination/kaminari}/_prev_page.html.erb +0 -0
- data/app/views/headmin/table/_actions.html.erb +24 -17
- data/app/views/headmin/table/_body.html.erb +12 -10
- data/app/views/headmin/table/_foot.html.erb +8 -4
- data/app/views/headmin/table/_footer.html.erb +3 -7
- data/app/views/headmin/table/_head.html.erb +3 -1
- data/app/views/headmin/table/_header.html.erb +3 -7
- data/app/views/headmin/table/actions/_action.html.erb +26 -9
- data/app/views/headmin/table/actions/_delete.html.erb +11 -7
- data/app/views/headmin/table/actions/_export.html.erb +11 -7
- data/app/views/headmin/table/body/_association.html.erb +1 -1
- data/app/views/headmin/table/body/_boolean.erb +1 -1
- data/app/views/headmin/table/body/_currency.html.erb +1 -1
- data/app/views/headmin/table/body/_date.html.erb +1 -1
- data/app/views/headmin/table/body/_id.html.erb +2 -2
- data/app/views/headmin/table/body/_row.html.erb +1 -1
- data/app/views/headmin/table/body/_string.html.erb +1 -1
- data/app/views/headmin/table/body/_text.html.erb +1 -1
- data/app/views/headmin/table/foot/_cell.html.erb +1 -1
- data/app/views/headmin/table/foot/_id.html.erb +2 -2
- data/app/views/headmin/table/head/_cell.html.erb +1 -1
- data/app/views/headmin/table/head/_id.html.erb +3 -3
- data/app/views/headmin/views/devise/confirmations/_new.html.erb +9 -0
- data/app/views/headmin/views/devise/passwords/_edit.html.erb +12 -0
- data/app/views/headmin/views/devise/passwords/_new.html.erb +9 -0
- data/app/views/{admin/users/registrations/edit.html.erb → headmin/views/devise/registrations/_edit.html.erb} +5 -5
- data/app/views/headmin/views/devise/registrations/_new.html.erb +11 -0
- data/app/views/headmin/views/devise/sessions/_new.html.erb +13 -0
- data/app/views/{admin/users → headmin/views/devise}/shared/_error_messages.html.erb +0 -0
- data/app/views/{admin/users → headmin/views/devise}/shared/_links.html.erb +0 -0
- data/app/views/headmin/views/devise/unlocks/_new.html.erb +10 -0
- data/config/initializers/customize_input_error.rb +9 -0
- data/config/locales/devise/en.yml +65 -0
- data/config/locales/en.yml +2 -134
- data/config/locales/headmin/filters/en.yml +13 -0
- data/config/locales/headmin/filters/nl.yml +13 -0
- data/config/locales/headmin/forms/en.yml +34 -0
- data/config/locales/headmin/forms/nl.yml +33 -0
- data/config/locales/headmin/heading/en.yml +5 -0
- data/config/locales/headmin/heading/nl.yml +5 -0
- data/config/locales/headmin/layout/en.yml +14 -0
- data/config/locales/headmin/layout/nl.yml +14 -0
- data/config/locales/headmin/pagination/en.yml +21 -0
- data/config/locales/headmin/pagination/nl.yml +21 -0
- data/config/locales/headmin/table/en.yml +23 -0
- data/config/locales/headmin/table/nl.yml +23 -0
- data/config/locales/headmin/views/en.yml +58 -0
- data/config/locales/headmin/views/nl.yml +58 -0
- data/config/locales/nl.yml +2 -135
- data/dist/css/headmin.css +3182 -743
- data/dist/js/headmin.js +729 -33
- data/docs/README.md +2 -1
- data/docs/blocks.md +70 -85
- data/docs/devise.md +1 -60
- data/docs/fields.md +57 -0
- data/lib/generators/headmin/blocks_generator.rb +19 -0
- data/lib/generators/headmin/fields_generator.rb +19 -0
- data/lib/generators/templates/migrations/create_blocks.rb +10 -0
- data/lib/generators/templates/migrations/create_fields.rb +13 -0
- data/lib/generators/templates/models/block.rb +3 -0
- data/lib/generators/templates/models/field.rb +3 -0
- data/lib/headmin/version.rb +1 -1
- data/package.json +6 -6
- data/src/js/headmin/controllers/blocks_controller.js +103 -0
- data/src/js/headmin/controllers/filters_controller.js +23 -12
- data/src/js/headmin/controllers/popup_controller.js +68 -0
- data/src/js/headmin/controllers/repeater_controller.js +117 -11
- data/src/js/headmin/controllers/table_actions_controller.js +16 -5
- data/src/js/headmin/controllers/table_controller.js +84 -1
- data/src/js/headmin/headmin.js +29 -56
- data/src/scss/headmin/filters.scss +0 -14
- data/src/scss/headmin/form.scss +43 -3
- data/src/scss/headmin/popup.scss +17 -0
- data/src/scss/headmin/table.scss +9 -6
- data/src/scss/headmin.scss +7 -4
- data/src/scss/vendor/redactorx/override.css +3 -0
- data/src/scss/vendor/redactorx/redactorx.css +1460 -0
- data/yarn.lock +105 -2210
- metadata +93 -61
- data/app/controllers/admin/users/confirmations_controller.rb +0 -31
- data/app/controllers/admin/users/omniauth_callbacks_controller.rb +0 -31
- data/app/controllers/admin/users/passwords_controller.rb +0 -35
- data/app/controllers/admin/users/registrations_controller.rb +0 -63
- data/app/controllers/admin/users/sessions_controller.rb +0 -28
- data/app/controllers/admin/users/unlocks_controller.rb +0 -31
- data/app/views/admin/users/confirmations/new.html.erb +0 -9
- data/app/views/admin/users/mailer/confirmation_instructions.html.erb +0 -5
- data/app/views/admin/users/mailer/email_changed.html.erb +0 -7
- data/app/views/admin/users/mailer/password_change.html.erb +0 -3
- data/app/views/admin/users/mailer/reset_password_instructions.html.erb +0 -8
- data/app/views/admin/users/mailer/unlock_instructions.html.erb +0 -7
- data/app/views/admin/users/passwords/edit.html.erb +0 -12
- data/app/views/admin/users/passwords/new.html.erb +0 -9
- data/app/views/admin/users/registrations/new.html.erb +0 -11
- data/app/views/admin/users/sessions/new.html.erb +0 -13
- data/app/views/admin/users/unlocks/new.html.erb +0 -10
- data/app/views/headmin/forms/_group.html.erb +0 -36
- data/app/views/headmin/forms/fields/_checkbox.html.erb +0 -23
- data/app/views/headmin/forms/fields/_ckeditor.html.erb +0 -28
- data/app/views/headmin/forms/fields/_currency.html.erb +0 -24
- data/app/views/headmin/forms/fields/_date.html.erb +0 -36
- data/app/views/headmin/forms/fields/_email.html.erb +0 -39
- data/app/views/headmin/forms/fields/_label.html.erb +0 -9
- data/app/views/headmin/forms/fields/_multiple_select.html.erb +0 -37
- data/app/views/headmin/forms/fields/_password.html.erb +0 -39
- data/app/views/headmin/forms/fields/_repeater.html.erb +0 -48
- data/app/views/headmin/forms/fields/_select.html.erb +0 -36
- data/app/views/headmin/forms/fields/_select_tags.html.erb +0 -32
- data/app/views/headmin/forms/fields/_textarea.html.erb +0 -29
- data/app/views/headmin/forms/fields/_url.html.erb +0 -38
- data/app/views/headmin/forms/fields/_validation.html.erb +0 -12
- data/app/views/headmin/forms/fields/repeater/_row.html.erb +0 -16
- data/app/views/headmin/layout/dropdown/_item.html.erb +0 -17
- data/app/views/headmin/layout/header/_account.html.erb +0 -25
- data/app/views/headmin/layout/header/_locale.html.erb +0 -19
- data/app/views/headmin/layout/sidebar/menu/_account.html.erb +0 -25
- data/app/views/headmin/layout/sidebar/menu/_item.html.erb +0 -16
- data/app/views/headmin/layout/sidebar/menu/_locale.html.erb +0 -18
- data/src/js/headmin/controllers/index_controller.js +0 -79
- data/src/js/headmin/controllers/repeater_row_controller.js +0 -54
- data/src/scss/vendor/choices/cross-inverse.svg +0 -6
- data/src/scss/vendor/choices/cross.svg +0 -6
- data/src/scss/vendor/choices/custom.scss +0 -28
- data/src/scss/vendor/choices/variables.scss +0 -16
@@ -1,28 +0,0 @@
|
|
1
|
-
<%#
|
2
|
-
name: headmin/fields/ckeditor
|
3
|
-
accepts block: no
|
4
|
-
parameters:
|
5
|
-
form: Form object
|
6
|
-
attribute: (string) Name of the attribute of the form model
|
7
|
-
label: (bool) Label will not be displayed if value is false
|
8
|
-
class: (string) Space-separated string of html class names
|
9
|
-
toolbar: (Array[]) Array contanining the toolbar items to display
|
10
|
-
upload_path: (string) URL to upload images to
|
11
|
-
%>
|
12
|
-
|
13
|
-
<% label = local_assigns.has_key?(:label) ? label : true %>
|
14
|
-
<% required = local_assigns.has_key?(:required) ? required : false %>
|
15
|
-
<% class_names = local_assigns.has_key?(:class) ? local_assigns[:class] : false %>
|
16
|
-
<% toolbar = local_assigns.has_key?(:toolbar) ? toolbar : nil %>
|
17
|
-
<% upload_path = local_assigns.has_key?(:upload_path) ? upload_path : admin_wysiwyg_upload_path %>
|
18
|
-
<%= render 'headmin/forms/fields/textarea',
|
19
|
-
form: form,
|
20
|
-
attribute: :content,
|
21
|
-
required: required,
|
22
|
-
class: "ckeditor #{class_names}",
|
23
|
-
label: label,
|
24
|
-
data: {
|
25
|
-
'ckeditor-toolbar': toolbar,
|
26
|
-
'ckeditor-upload-path': upload_path
|
27
|
-
}
|
28
|
-
%>
|
@@ -1,24 +0,0 @@
|
|
1
|
-
<%#
|
2
|
-
name: headmin/fields/currency
|
3
|
-
accepts block: no
|
4
|
-
parameters:
|
5
|
-
form: Form object
|
6
|
-
attribute: Name of the attribute of the form model
|
7
|
-
label: (bool) Label will not be displayed if value is false
|
8
|
-
%>
|
9
|
-
|
10
|
-
<% label = local_assigns.has_key?(:label) ? label : true %>
|
11
|
-
<% required = local_assigns.has_key?(:required) ? required : false %>
|
12
|
-
<div class="<%= ('mb-3' if label) %>">
|
13
|
-
<%= render 'headmin/forms/fields/label', form: form, attribute: attribute, required: required if label %>
|
14
|
-
<div class="input-group">
|
15
|
-
<span class="input-group-text">€</span>
|
16
|
-
<%= form.text_field(
|
17
|
-
attribute,
|
18
|
-
class: "form-control #{form_field_validation_class(form, attribute)}",
|
19
|
-
required: required,
|
20
|
-
'aria-describedby': form_field_validation_id(form, attribute))
|
21
|
-
%>
|
22
|
-
<%= render 'headmin/forms/fields/validation', form: form, attribute: attribute %>
|
23
|
-
</div>
|
24
|
-
</div>
|
@@ -1,36 +0,0 @@
|
|
1
|
-
<%#
|
2
|
-
name: headmin/fields/date
|
3
|
-
accepts block: no
|
4
|
-
parameters:
|
5
|
-
form: Form object
|
6
|
-
attribute: (string) Name of the attribute of the form model
|
7
|
-
label: (bool) Label will not be displayed if value is false
|
8
|
-
min: (string) Earliest available timestamp in options
|
9
|
-
max: (string) Last available timestamp in options
|
10
|
-
%>
|
11
|
-
|
12
|
-
<% label = local_assigns.has_key?(:label) ? label : true %>
|
13
|
-
<% disabled = local_assigns.has_key?(:disabled) ? disabled : false %>
|
14
|
-
<% required = local_assigns.has_key?(:required) ? required : false %>
|
15
|
-
<% readonly = local_assigns.has_key?(:readonly) ? readonly : false %>
|
16
|
-
<% class_names = local_assigns.has_key?(:class) ? local_assigns[:class] : false %>
|
17
|
-
<% datepicker = local_assigns.has_key?(:datepicker) ? local_assigns[:datepicker] : false %>
|
18
|
-
<% datepicker_class = datepicker ? 'flatpickr' : nil %>
|
19
|
-
<% validation_class = form_field_validation_class(form, attribute) %>
|
20
|
-
<div class="<%= ('mb-3' if label) %>">
|
21
|
-
<%= render 'headmin/forms/fields/label', form: form, attribute: attribute, required: required if label %>
|
22
|
-
<div class="input-group">
|
23
|
-
<span class="input-group-text"><%= bootstrap_icon('calendar') %></span>
|
24
|
-
<%= form.date_field(
|
25
|
-
attribute,
|
26
|
-
placeholder: 'dd/mm/yyyy',
|
27
|
-
class: "form-control #{validation_class} #{datepicker_class} #{class_names}",
|
28
|
-
disabled: disabled,
|
29
|
-
required: required,
|
30
|
-
readonly: readonly,
|
31
|
-
'aria-describedby': form_field_validation_id(form, attribute)
|
32
|
-
)
|
33
|
-
%>
|
34
|
-
</div>
|
35
|
-
<%= render 'headmin/forms/fields/validation', form: form, attribute: attribute %>
|
36
|
-
</div>
|
@@ -1,39 +0,0 @@
|
|
1
|
-
<%#
|
2
|
-
name: headmin/fields/text
|
3
|
-
accepts block: no
|
4
|
-
parameters:
|
5
|
-
form: Form object
|
6
|
-
attribute: (string) Name of the attribute of the form model
|
7
|
-
label: (bool | string) Label will not be displayed if value is false or accepts a string 'float' to get a "floating label"
|
8
|
-
%>
|
9
|
-
|
10
|
-
<% label = local_assigns.has_key?(:label) ? label : true %>
|
11
|
-
<% float_label = label == :float %>
|
12
|
-
<% disabled = local_assigns.has_key?(:disabled) ? disabled : false %>
|
13
|
-
<% required = local_assigns.has_key?(:required) ? required : false %>
|
14
|
-
<% readonly = local_assigns.has_key?(:readonly) ? readonly : false %>
|
15
|
-
<% class_names = local_assigns.has_key?(:class) ? local_assigns[:class] : false %>
|
16
|
-
<% has_list = local_assigns.has_key?(:collection) %>
|
17
|
-
<div class="<%= 'form-floating' if float_label %> <%= ('mb-3 text-start' if label) %> ">
|
18
|
-
<%= render 'headmin/forms/fields/label', form: form, attribute: attribute, required: required if label && !float_label %>
|
19
|
-
<%= form.email_field(
|
20
|
-
attribute,
|
21
|
-
class: "form-control #{form_field_validation_class(form, attribute)} #{class_names}",
|
22
|
-
list: has_list ? attribute : nil,
|
23
|
-
disabled: disabled,
|
24
|
-
placeholder: attribute,
|
25
|
-
required: required,
|
26
|
-
readonly: readonly,
|
27
|
-
'aria-describedby': form_field_validation_id(form, attribute)
|
28
|
-
)
|
29
|
-
%>
|
30
|
-
<%= render 'headmin/forms/fields/label', form: form, attribute: attribute, required: required if label && float_label %>
|
31
|
-
<% if has_list %>
|
32
|
-
<datalist id="<%= attribute %>">
|
33
|
-
<% collection.each do |key, value| %>
|
34
|
-
<option value="<%= value %>"><%= key %></option>
|
35
|
-
<% end %>
|
36
|
-
</datalist>
|
37
|
-
<% end %>
|
38
|
-
<%= render 'headmin/forms/fields/validation', form: form, attribute: attribute %>
|
39
|
-
</div>
|
@@ -1,37 +0,0 @@
|
|
1
|
-
<%#
|
2
|
-
name: headmin/fields/multiple_select
|
3
|
-
accepts block: no
|
4
|
-
parameters:
|
5
|
-
form: Form object
|
6
|
-
required: Define if the attribute is required or not
|
7
|
-
attribute: (string) Name of the attribute of the form model
|
8
|
-
label: (bool) Label will not be displayed if value is false
|
9
|
-
collection: (array) List of options to select from
|
10
|
-
%>
|
11
|
-
|
12
|
-
<% label = local_assigns.has_key?(:label) ? label : true %>
|
13
|
-
<% required = local_assigns.has_key?(:required) ? required : false %>
|
14
|
-
<% disabled = local_assigns.has_key?(:disabled) ? disabled : false %>
|
15
|
-
<% include_blank = local_assigns.has_key?(:include_blank) || required ? t('.blank') : nil %>
|
16
|
-
<% data_attributes = local_assigns.select { |key, value| key.to_s.include?("data-") } %>
|
17
|
-
<% options = options_for_select(collection, form.object.send(attribute)) %>
|
18
|
-
<% select_config = { include_blank: include_blank, disabled: disabled } %>
|
19
|
-
<% html_attributes = {
|
20
|
-
multiple: true,
|
21
|
-
class: "multiple-select form-select #{form_field_validation_class(form, attribute)}",
|
22
|
-
required: required,
|
23
|
-
'aria-describedby': form_field_validation_id(form, attribute)
|
24
|
-
}.merge(data_attributes) %>
|
25
|
-
|
26
|
-
<div class="<%= ('mb-3' if label) %>">
|
27
|
-
<%= render 'headmin/forms/fields/label', form: form, attribute: attribute, required: required if label %>
|
28
|
-
<%= form.select(
|
29
|
-
attribute,
|
30
|
-
options,
|
31
|
-
select_config,
|
32
|
-
html_attributes
|
33
|
-
)
|
34
|
-
%>
|
35
|
-
<%= yield if block_given? %>
|
36
|
-
<%= render 'headmin/forms/fields/validation', form: form, attribute: attribute %>
|
37
|
-
</div>
|
@@ -1,39 +0,0 @@
|
|
1
|
-
<%#
|
2
|
-
name: headmin/fields/text
|
3
|
-
accepts block: no
|
4
|
-
parameters:
|
5
|
-
form: Form object
|
6
|
-
attribute: (string) Name of the attribute of the form model
|
7
|
-
label: (bool | string) Label will not be displayed if value is false or accepts a string 'float' to get a "floating label"
|
8
|
-
%>
|
9
|
-
|
10
|
-
<% label = local_assigns.has_key?(:label) ? label : true %>
|
11
|
-
<% float_label = label == :float %>
|
12
|
-
<% disabled = local_assigns.has_key?(:disabled) ? disabled : false %>
|
13
|
-
<% required = local_assigns.has_key?(:required) ? required : false %>
|
14
|
-
<% readonly = local_assigns.has_key?(:readonly) ? readonly : false %>
|
15
|
-
<% class_names = local_assigns.has_key?(:class) ? local_assigns[:class] : false %>
|
16
|
-
<% has_list = local_assigns.has_key?(:collection) %>
|
17
|
-
<div class="<%= 'form-floating' if float_label %> <%= ('mb-3 text-start' if label) %>">
|
18
|
-
<%= render 'headmin/forms/fields/label', form: form, attribute: attribute, required: required if label && !float_label %>
|
19
|
-
<%= form.password_field(
|
20
|
-
attribute,
|
21
|
-
class: "form-control #{form_field_validation_class(form, attribute)} #{class_names}",
|
22
|
-
list: has_list ? attribute : nil,
|
23
|
-
disabled: disabled,
|
24
|
-
placeholder: attribute,
|
25
|
-
required: required,
|
26
|
-
readonly: readonly,
|
27
|
-
'aria-describedby': form_field_validation_id(form, attribute)
|
28
|
-
)
|
29
|
-
%>
|
30
|
-
<%= render 'headmin/forms/fields/label', form: form, attribute: attribute, required: required if label && float_label %>
|
31
|
-
<% if has_list %>
|
32
|
-
<datalist id="<%= attribute %>">
|
33
|
-
<% collection.each do |key, value| %>
|
34
|
-
<option value="<%= value %>"><%= key %></option>
|
35
|
-
<% end %>
|
36
|
-
</datalist>
|
37
|
-
<% end %>
|
38
|
-
<%= render 'headmin/forms/fields/validation', form: form, attribute: attribute %>
|
39
|
-
</div>
|
@@ -1,48 +0,0 @@
|
|
1
|
-
<%#
|
2
|
-
name: headmin/fields/repeater
|
3
|
-
accepts block: no
|
4
|
-
parameters:
|
5
|
-
form: Form object
|
6
|
-
attribute: (string) Name of the attribute of the form model
|
7
|
-
title: (string) Title of the field group
|
8
|
-
description: (string) Description of the field group
|
9
|
-
%>
|
10
|
-
|
11
|
-
<% object_model = form.object.class %>
|
12
|
-
<% association_model = object_model.reflect_on_association(attribute).class_name.constantize %>
|
13
|
-
<% repeater_id = form.object_id %>
|
14
|
-
<div class="repeater" data-controller="repeater" data-repeater-id-value="<%= repeater_id %>">
|
15
|
-
|
16
|
-
<% if defined?(title) && title.present? %>
|
17
|
-
<h5><%= title %></h5>
|
18
|
-
<p><%= description %></p>
|
19
|
-
<% end %>
|
20
|
-
|
21
|
-
<ul class="list-group list-group-flush">
|
22
|
-
<template data-repeater-target="template">
|
23
|
-
<%= form.fields_for attribute, association_model.new, child_index: repeater_id do |ff| %>
|
24
|
-
<%= render 'headmin/forms/fields/repeater/row', form: form do %>
|
25
|
-
<%= render template, form: ff %>
|
26
|
-
<% end %>
|
27
|
-
<% end %>
|
28
|
-
</template>
|
29
|
-
|
30
|
-
<% if defined?(header_template) && header_template.present? %>
|
31
|
-
<li class="list-group-item">
|
32
|
-
<%= render header_template %>
|
33
|
-
</li>
|
34
|
-
<% end %>
|
35
|
-
|
36
|
-
<%= form.fields_for attribute do |ff| %>
|
37
|
-
<%= render 'headmin/forms/fields/repeater/row', form: form do %>
|
38
|
-
<%= render template, form: ff %>
|
39
|
-
<% end %>
|
40
|
-
<% end %>
|
41
|
-
<li class="list-group-item d-flex justify-content-end" data-repeater-target="links">
|
42
|
-
<a href="#" class="btn btn-sm h-btn-outline-light" data-action="click->repeater#add_association">
|
43
|
-
<%= bootstrap_icon('plus') %>
|
44
|
-
<%= t('.add', name: association_model.model_name.human) %>
|
45
|
-
</a>
|
46
|
-
</li>
|
47
|
-
</ul>
|
48
|
-
</div>
|
@@ -1,36 +0,0 @@
|
|
1
|
-
<%#
|
2
|
-
name: headmin/fields/select
|
3
|
-
accepts block: no
|
4
|
-
parameters:
|
5
|
-
form: Form object
|
6
|
-
required: Define if the attribute is required or not
|
7
|
-
attribute: (string) Name of the attribute of the form model
|
8
|
-
label: (bool) Label will not be displayed if value is false
|
9
|
-
collection: (array) List of options to select from
|
10
|
-
%>
|
11
|
-
|
12
|
-
<% label = local_assigns.has_key?(:label) ? label : true %>
|
13
|
-
<% required = local_assigns.has_key?(:required) ? required : false %>
|
14
|
-
<% disabled = local_assigns.has_key?(:disabled) ? disabled : false %>
|
15
|
-
<% include_blank = local_assigns.has_key?(:include_blank) || required ? t('.blank') : nil %>
|
16
|
-
<% data_attributes = local_assigns.select { |key, value| key.to_s.include?("data-") } %>
|
17
|
-
<% options = options_for_select(collection, form.object.send(attribute)) %>
|
18
|
-
<% select_config = { include_blank: include_blank, disabled: disabled } %>
|
19
|
-
<% html_attributes = {
|
20
|
-
class: "form-select #{form_field_validation_class(form, attribute)}",
|
21
|
-
required: required,
|
22
|
-
'aria-describedby': form_field_validation_id(form, attribute)
|
23
|
-
}.merge(data_attributes) %>
|
24
|
-
|
25
|
-
<div class="<%= ('mb-3' if label) %>">
|
26
|
-
<%= render 'headmin/forms/fields/label', form: form, attribute: attribute, required: required if label %>
|
27
|
-
<%= form.select(
|
28
|
-
attribute,
|
29
|
-
options,
|
30
|
-
select_config,
|
31
|
-
html_attributes
|
32
|
-
)
|
33
|
-
%>
|
34
|
-
<%= yield if block_given? %>
|
35
|
-
<%= render 'headmin/forms/fields/validation', form: form, attribute: attribute %>
|
36
|
-
</div>
|
@@ -1,32 +0,0 @@
|
|
1
|
-
<%#
|
2
|
-
name: headmin/fields/select_tags
|
3
|
-
accepts block: no
|
4
|
-
parameters:
|
5
|
-
form: Form object
|
6
|
-
required: Define if the attribute is required or not
|
7
|
-
attribute: (string) Name of the attribute of the form model
|
8
|
-
label: (bool) Label will not be displayed if value is false
|
9
|
-
collection: (array) List of options to select from
|
10
|
-
%>
|
11
|
-
|
12
|
-
<% label = local_assigns.has_key?(:label) ? label : true %>
|
13
|
-
<% required = local_assigns.has_key?(:required) ? required : false %>
|
14
|
-
<% disabled = local_assigns.has_key?(:disabled) ? disabled : false %>
|
15
|
-
<% multiple = local_assigns.has_key?(:multiple) ? multiple : true %>
|
16
|
-
<% include_blank = local_assigns.has_key?(:include_blank) || required ? t('.blank') : nil %>
|
17
|
-
<% data_attributes = local_assigns.select { |key, value| key.to_s.include?("data-") } %>
|
18
|
-
<% options = options_for_select(collection, form.object.send(attribute)) %>
|
19
|
-
<% select_config = { include_blank: include_blank, disabled: disabled } %>
|
20
|
-
<% html_attributes = {
|
21
|
-
multiple: multiple,
|
22
|
-
class: "select-tags form-select #{form_field_validation_class(form, attribute)}",
|
23
|
-
required: required,
|
24
|
-
'aria-describedby': form_field_validation_id(form, attribute)
|
25
|
-
}.merge(data_attributes) %>
|
26
|
-
|
27
|
-
<div class="<%= ('mb-3' if label) %>">
|
28
|
-
<%= render 'headmin/forms/fields/label', form: form, attribute: attribute, required: required if label %>
|
29
|
-
<%= form.select attribute, options, select_config, html_attributes %>
|
30
|
-
<%= yield if block_given? %>
|
31
|
-
<%= render 'headmin/forms/fields/validation', form: form, attribute: attribute %>
|
32
|
-
</div>
|
@@ -1,29 +0,0 @@
|
|
1
|
-
<%#
|
2
|
-
name: headmin/fields/textarea
|
3
|
-
accepts block: no
|
4
|
-
parameters:
|
5
|
-
form: Form object
|
6
|
-
attribute: (string) Name of the attribute of the form model
|
7
|
-
label: (bool | string) Label will not be displayed if value is false or accepts a string 'float' to get a "floating label"
|
8
|
-
|
9
|
-
%>
|
10
|
-
|
11
|
-
<% label = local_assigns.has_key?(:label) ? label : true %>
|
12
|
-
<% float_label = label == :float %>
|
13
|
-
<% required = local_assigns.has_key?(:required) ? required : false %>
|
14
|
-
<% class_names = local_assigns.has_key?(:class) ? local_assigns[:class] : false %>
|
15
|
-
<% data = local_assigns.has_key?(:data) ? data : nil %>
|
16
|
-
<div class="<%= 'form-floating' if float_label %> <%= ('mb-3 text-start' if label) %>">
|
17
|
-
<%= render 'headmin/forms/fields/label', form: form, attribute: attribute, required: required if label && !float_label %>
|
18
|
-
<%= form.text_area(
|
19
|
-
attribute,
|
20
|
-
class: "form-control #{class_names} #{form_field_validation_class(form, attribute)}",
|
21
|
-
required: required,
|
22
|
-
placeholder: attribute,
|
23
|
-
'aria-describedby': form_field_validation_id(form, attribute),
|
24
|
-
data: data
|
25
|
-
)
|
26
|
-
%>
|
27
|
-
<%= render 'headmin/forms/fields/label', form: form, attribute: attribute, required: required if label && float_label %>
|
28
|
-
<%= render 'headmin/forms/fields/validation', form: form, attribute: attribute %>
|
29
|
-
</div>
|
@@ -1,38 +0,0 @@
|
|
1
|
-
<%#
|
2
|
-
name: headmin/fields/url
|
3
|
-
accepts block: no
|
4
|
-
parameters:
|
5
|
-
form: Form object
|
6
|
-
attribute: (string) Name of the attribute of the form model
|
7
|
-
label: (bool) Label will not be displayed if value is false
|
8
|
-
%>
|
9
|
-
|
10
|
-
<% label = local_assigns.has_key?(:label) ? label : true %>
|
11
|
-
<% disabled = local_assigns.has_key?(:disabled) ? disabled : false %>
|
12
|
-
<% required = local_assigns.has_key?(:required) ? required : false %>
|
13
|
-
<% readonly = local_assigns.has_key?(:readonly) ? readonly : false %>
|
14
|
-
<% class_names = local_assigns.has_key?(:class) ? local_assigns[:class] : false %>
|
15
|
-
<% has_list = local_assigns.has_key?(:collection) %>
|
16
|
-
<div class="<%= ('mb-3' if label) %>">
|
17
|
-
<%= render 'headmin/forms/fields/label', form: form, attribute: attribute, required: required if label %>
|
18
|
-
<div class="input-group">
|
19
|
-
<span class="input-group-text"><%= bootstrap_icon('globe') %></span>
|
20
|
-
<%= form.url_field(
|
21
|
-
attribute,
|
22
|
-
class: "form-control #{form_field_validation_class(form, attribute)} #{class_names}",
|
23
|
-
list: has_list ? attribute : nil,
|
24
|
-
disabled: disabled,
|
25
|
-
required: required,
|
26
|
-
readonly: readonly,
|
27
|
-
'aria-describedby': form_field_validation_id(form, attribute))
|
28
|
-
%>
|
29
|
-
<% if has_list %>
|
30
|
-
<datalist id="<%= attribute %>">
|
31
|
-
<% collection.each do |key, value| %>
|
32
|
-
<option value="<%= value %>"><%= key %></option>
|
33
|
-
<% end %>
|
34
|
-
</datalist>
|
35
|
-
<% end %>
|
36
|
-
<%= render 'headmin/forms/fields/validation', form: form, attribute: attribute %>
|
37
|
-
</div>
|
38
|
-
</div>
|
@@ -1,12 +0,0 @@
|
|
1
|
-
<%#
|
2
|
-
name: headmin/fields/validation
|
3
|
-
accepts block: no
|
4
|
-
parameters:
|
5
|
-
form: Form object
|
6
|
-
%>
|
7
|
-
|
8
|
-
<% if form.object && !form_field_valid?(form, attribute) %>
|
9
|
-
<div class="invalid-feedback" id="<%= form_field_validation_id(form, attribute) %>">
|
10
|
-
<%= form.object.errors[attribute].join(', ') %>
|
11
|
-
</div>
|
12
|
-
<% end %>
|
@@ -1,16 +0,0 @@
|
|
1
|
-
<%#
|
2
|
-
name: headmin/fields/repeater/row
|
3
|
-
accepts block: no
|
4
|
-
parameters:
|
5
|
-
form: Form object
|
6
|
-
%>
|
7
|
-
|
8
|
-
<div class="repeater-row list-group-item pe-3" data-new-record="<%= form.object.new_record? %>" data-repeater-row-target="row" data-controller="repeater-row">
|
9
|
-
<%= yield if block_given? %>
|
10
|
-
<a href="#" class="repeater-row-remove btn btn-link" data-action="click->repeater-row#remove_association" title="<%= t('.remove') %>">
|
11
|
-
<%= bootstrap_icon('dash-circle') %>
|
12
|
-
</a>
|
13
|
-
<a href="#" class="repeater-row-add btn btn-link" data-action="click->repeater-row#add_association" title="<%= t('.add') %>">
|
14
|
-
<%= bootstrap_icon('plus-circle') %>
|
15
|
-
</a>
|
16
|
-
</div>
|
@@ -1,17 +0,0 @@
|
|
1
|
-
<%#
|
2
|
-
name: headmin/dropdown/item
|
3
|
-
accepts block: no
|
4
|
-
parameters:
|
5
|
-
name: Name of the link in the dropdown menu
|
6
|
-
url: Url of the link in the dropdown menu
|
7
|
-
method: Sets data-method of url
|
8
|
-
%>
|
9
|
-
|
10
|
-
<%
|
11
|
-
method = defined?(method) ? method : false
|
12
|
-
%>
|
13
|
-
<li>
|
14
|
-
<a class="dropdown-item" href="<%= url %>" <%= method ? "data-method=#{method}" : "" %>>
|
15
|
-
<%= name %>
|
16
|
-
</a>
|
17
|
-
</li>
|
@@ -1,25 +0,0 @@
|
|
1
|
-
<%#
|
2
|
-
name: headmin/layout/header/account
|
3
|
-
accepts block: yes
|
4
|
-
parameters: none
|
5
|
-
%>
|
6
|
-
|
7
|
-
<div class="btn-group dropdown">
|
8
|
-
<button class="btn dropdown-toggle d-flex align-items-center" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false">
|
9
|
-
<% if current_user.avatar.attached? %>
|
10
|
-
<img src="<%= url_for(current_user.avatar.variant(resize_to_limit: [30, 30], quality: 70)) %>" height="30" width="30" class="rounded-circle border border-2 me-2">
|
11
|
-
<% else %>
|
12
|
-
<div class="header-account-avatar rounded-circle border border-2 me-2"></div>
|
13
|
-
<% end %>
|
14
|
-
<%= current_user %>
|
15
|
-
</button>
|
16
|
-
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton1">
|
17
|
-
<% if block_given? && yield.present? %>
|
18
|
-
<%= yield %>
|
19
|
-
<% else %>
|
20
|
-
<%= render 'headmin/layout/dropdown/item', name: t('.edit_profile'), url: edit_admin_registration_path %>
|
21
|
-
<% end %>
|
22
|
-
<%= render 'headmin/layout/dropdown/divider' %>
|
23
|
-
<%= render 'headmin/layout/dropdown/item', name: t('.log_out'), url: destroy_user_session_path, method: :delete %>
|
24
|
-
</ul>
|
25
|
-
</div>
|
@@ -1,19 +0,0 @@
|
|
1
|
-
<%#
|
2
|
-
name: headmin/layout/header/locale
|
3
|
-
accepts block: yes
|
4
|
-
parameters: none
|
5
|
-
%>
|
6
|
-
|
7
|
-
<div class="btn-group dropdown">
|
8
|
-
<button class="btn dropdown-toggle d-flex align-items-center" type="button" id="locale-dropdown" data-bs-toggle="dropdown" aria-expanded="false">
|
9
|
-
<%= bootstrap_icon('globe', class: 'me-2') %>
|
10
|
-
<%= t('language_name', locale: ::I18n.locale) %>
|
11
|
-
</button>
|
12
|
-
<ul class="dropdown-menu" aria-labelledby="locale-dropdown">
|
13
|
-
<% I18n.available_locales.each do |locale| %>
|
14
|
-
<li>
|
15
|
-
<%= link_to t('language_name', locale: locale), { locale: locale.to_s }, class: 'dropdown-item' %>
|
16
|
-
<li>
|
17
|
-
<% end %>
|
18
|
-
</ul>
|
19
|
-
</div>
|
@@ -1,25 +0,0 @@
|
|
1
|
-
<%#
|
2
|
-
name: headmin/layout/sidebar/menu/account
|
3
|
-
accepts block: yes
|
4
|
-
parameters: none
|
5
|
-
%>
|
6
|
-
|
7
|
-
<li class="nav-item dropdown">
|
8
|
-
<a class="nav-link dropdown-toggle d-flex align-items-center" href="#" id="dropdownSidebarMenuAccount" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
9
|
-
<% if current_user.avatar.attached? %>
|
10
|
-
<img src="<%= url_for(current_user.avatar.variant(resize_to_limit: [20, 20], quality: 70)) %>" height="20" width="20" class="rounded-circle border border-2 me-2">
|
11
|
-
<% else %>
|
12
|
-
<div class="header-account-avatar rounded-circle border border-2 me-2"></div>
|
13
|
-
<% end %>
|
14
|
-
<%= current_user %>
|
15
|
-
</a>
|
16
|
-
<ul class="dropdown-menu" aria-labelledby="dropdownSidebarMenuAccount">
|
17
|
-
<% if block_given? && yield.present? %>
|
18
|
-
<%= yield %>
|
19
|
-
<% else %>
|
20
|
-
<%= render 'headmin/layout/dropdown/item', name: t('.edit_profile'), url: edit_admin_registration_path %>
|
21
|
-
<% end %>
|
22
|
-
<%= render 'headmin/layout/dropdown/divider' %>
|
23
|
-
<%= render 'headmin/layout/dropdown/item', name: t('.log_out'), url: destroy_user_session_path, method: :delete %>
|
24
|
-
</ul>
|
25
|
-
</li>
|
@@ -1,16 +0,0 @@
|
|
1
|
-
<%#
|
2
|
-
name: headmin/layout/sidebar/menu/item
|
3
|
-
accepts block: yes
|
4
|
-
parameters:
|
5
|
-
link: (string) Url to be used as anchor in link tag
|
6
|
-
name: (string) Name to be displayed inside link
|
7
|
-
%>
|
8
|
-
|
9
|
-
<li class="nav-item">
|
10
|
-
<a class="nav-link d-flex align-items-center <%= 'active' if menu_item_active?(link) %>" aria-current="page" href="<%= link %>">
|
11
|
-
<%= bootstrap_icon(icon, class: 'me-2') %>
|
12
|
-
<span class="d-block d-md-none d-lg-block">
|
13
|
-
<%= name %>
|
14
|
-
</span>
|
15
|
-
</a>
|
16
|
-
</li>
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<%#
|
2
|
-
name: headmin/layout/sidebar/menu/locale
|
3
|
-
accepts block: no
|
4
|
-
parameters: none
|
5
|
-
%>
|
6
|
-
<li class="nav-item dropdown">
|
7
|
-
<a class="nav-link dropdown-toggle" href="#" id="dropdownSidebarMenuLocale" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
8
|
-
<%= bootstrap_icon('globe', class: 'me-2') %>
|
9
|
-
<%= t('language_name', locale: ::I18n.locale) %>
|
10
|
-
</a>
|
11
|
-
<ul class="dropdown-menu" aria-labelledby="dropdownSidebarMenuLocale">
|
12
|
-
<% I18n.available_locales.each do |locale| %>
|
13
|
-
<li>
|
14
|
-
<%= link_to t('language_name', locale: locale), {locale: locale.to_s}, class: 'dropdown-item' %>
|
15
|
-
<li>
|
16
|
-
<% end %>
|
17
|
-
</ul>
|
18
|
-
</li>
|
@@ -1,79 +0,0 @@
|
|
1
|
-
import {Controller} from "stimulus"
|
2
|
-
|
3
|
-
export default class extends Controller {
|
4
|
-
static get targets() {
|
5
|
-
return ["actions", "idCheckbox", "idsCheckbox"]
|
6
|
-
}
|
7
|
-
|
8
|
-
toggleIds(event) {
|
9
|
-
const checkbox = event.target
|
10
|
-
this.toggleIdsCheckboxes(checkbox.checked)
|
11
|
-
this.toggleIdCheckboxes(checkbox.checked)
|
12
|
-
this.syncFields()
|
13
|
-
}
|
14
|
-
|
15
|
-
toggleId(event) {
|
16
|
-
this.toggleIdsCheckboxes(false)
|
17
|
-
this.syncFields()
|
18
|
-
}
|
19
|
-
|
20
|
-
toggleIdsCheckboxes(checked) {
|
21
|
-
this.idsCheckboxTargets.forEach((checkbox) => {
|
22
|
-
checkbox.checked = checked
|
23
|
-
});
|
24
|
-
}
|
25
|
-
|
26
|
-
toggleIdCheckboxes(checked) {
|
27
|
-
this.idCheckboxTargets.forEach((checkbox) => {
|
28
|
-
checkbox.checked = checked
|
29
|
-
});
|
30
|
-
}
|
31
|
-
|
32
|
-
syncFields() {
|
33
|
-
this.removeIds()
|
34
|
-
if(this.idsCheckboxTarget.checked) {
|
35
|
-
this.addId('')
|
36
|
-
} else {
|
37
|
-
this.idCheckboxTargets.forEach((checkbox) => {
|
38
|
-
if(checkbox.checked) {
|
39
|
-
this.addId(checkbox.value)
|
40
|
-
}
|
41
|
-
});
|
42
|
-
}
|
43
|
-
}
|
44
|
-
|
45
|
-
addId(id) {
|
46
|
-
let field = this.getIdField(id)
|
47
|
-
if (!field) {
|
48
|
-
field = this.newIdField(id)
|
49
|
-
this.actionsTarget.insertAdjacentHTML('afterbegin', field)
|
50
|
-
}
|
51
|
-
}
|
52
|
-
|
53
|
-
removeIds() {
|
54
|
-
const fields = this.getIdFields()
|
55
|
-
fields.forEach((field) => {
|
56
|
-
this.actionsTarget.removeChild(field)
|
57
|
-
});
|
58
|
-
}
|
59
|
-
|
60
|
-
removeId(id) {
|
61
|
-
const field = this.getIdField(id)
|
62
|
-
if (field) {
|
63
|
-
this.actionsTarget.removeChild(field)
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
|
-
newIdField(id) {
|
68
|
-
const template = this.actionsTarget.querySelector('[data-index-target="idFieldTemplate"]')
|
69
|
-
return template.innerHTML.replace(/ID/g, id)
|
70
|
-
}
|
71
|
-
|
72
|
-
getIdFields() {
|
73
|
-
return this.actionsTarget.querySelectorAll(`input[name="ids[]"]`);
|
74
|
-
}
|
75
|
-
|
76
|
-
getIdField(id) {
|
77
|
-
return this.actionsTarget.querySelector(`input[name="ids[]"][value="${id}"]`);
|
78
|
-
}
|
79
|
-
}
|