headmin 0.2.4 → 0.2.8
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/Gemfile.lock +2 -2
- data/app/helpers/headmin/admin_helper.rb +3 -59
- data/app/helpers/headmin/bootstrap_helper.rb +9 -0
- data/app/helpers/headmin/filter_helper.rb +7 -3
- data/app/helpers/headmin/form_helper.rb +36 -0
- data/app/helpers/headmin/request_helper.rb +39 -0
- data/app/models/concerns/headmin/fieldable.rb +3 -1
- data/app/services/block_service.rb +8 -4
- data/app/views/examples/admin.html.erb +1 -1
- data/app/views/headmin/_blocks.html.erb +1 -1
- data/app/views/headmin/_card.html.erb +3 -1
- data/app/views/headmin/_filters.html.erb +3 -3
- data/app/views/headmin/_pagination.html.erb +2 -1
- data/app/views/headmin/_table.html.erb +9 -3
- data/app/views/headmin/dropdown/_devise.html.erb +20 -10
- data/app/views/headmin/dropdown/_list.html.erb +17 -7
- data/app/views/headmin/filters/_date.html.erb +5 -3
- data/app/views/headmin/filters/_flatpickr.html.erb +57 -0
- data/app/views/headmin/forms/_base.html.erb +12 -11
- data/app/views/headmin/forms/_blocks.html.erb +11 -4
- data/app/views/headmin/forms/_date.html.erb +24 -12
- data/app/views/headmin/forms/_date_range.html.erb +84 -0
- data/app/views/headmin/forms/_flatpickr.html.erb +55 -0
- data/app/views/headmin/forms/_flatpickr_range.html.erb +61 -0
- data/app/views/headmin/forms/_hidden.html.erb +23 -0
- data/app/views/headmin/forms/_label.html.erb +4 -2
- data/app/views/headmin/forms/_repeater.html.erb +5 -8
- data/app/views/headmin/forms/_select.html.erb +14 -11
- data/app/views/headmin/forms/_text.html.erb +7 -9
- data/app/views/headmin/layout/_main.html.erb +11 -5
- data/app/views/headmin/table/_actions.html.erb +35 -11
- data/app/views/headmin/table/body/_row.html.erb +14 -6
- data/app/views/headmin/views/devise/confirmations/_new.html.erb +1 -1
- data/app/views/headmin/views/devise/passwords/_edit.html.erb +2 -2
- data/app/views/headmin/views/devise/passwords/_new.html.erb +1 -1
- data/app/views/headmin/views/devise/registrations/_edit.html.erb +4 -4
- data/app/views/headmin/views/devise/registrations/_new.html.erb +3 -3
- data/app/views/headmin/views/devise/shared/_links.html.erb +7 -7
- data/app/views/headmin/views/devise/unlocks/_new.html.erb +1 -1
- data/config/locales/activerecord/en.yml +9 -0
- data/config/locales/activerecord/nl.yml +9 -0
- data/config/locales/headmin/table/en.yml +5 -1
- data/config/locales/headmin/table/nl.yml +5 -1
- data/config/locales/headmin/views/en.yml +1 -1
- data/config/locales/headmin/views/nl.yml +14 -14
- data/dist/css/headmin.css +57 -13
- data/dist/js/headmin.js +81 -514
- data/docs/blocks.md +0 -7
- data/lib/generators/headmin/blocks_generator.rb +4 -1
- data/lib/generators/headmin/devise_generator.rb +6 -2
- data/lib/generators/headmin/fields_generator.rb +4 -1
- data/lib/generators/templates/controllers/auth/confirmations_controller.rb +31 -0
- data/lib/generators/templates/controllers/auth/omniauth_callbacks_controller.rb +31 -0
- data/lib/generators/templates/controllers/auth/passwords_controller.rb +35 -0
- data/lib/generators/templates/controllers/auth/registrations_controller.rb +63 -0
- data/lib/generators/templates/controllers/auth/sessions_controller.rb +28 -0
- data/lib/generators/templates/controllers/auth/unlocks_controller.rb +31 -0
- data/lib/headmin/version.rb +1 -1
- data/package.json +3 -2
- data/src/js/headmin/controllers/blocks_controller.js +1 -1
- data/src/js/headmin/controllers/date_range_controller.js +34 -0
- data/src/js/headmin/controllers/filter_controller.js +1 -1
- data/src/js/headmin/controllers/filters_controller.js +1 -1
- data/src/js/headmin/controllers/flatpickr_controller.js +38 -0
- data/src/js/headmin/controllers/popup_controller.js +1 -1
- data/src/js/headmin/controllers/repeater_controller.js +8 -9
- data/src/js/headmin/controllers/table_actions_controller.js +74 -9
- data/src/js/headmin/controllers/table_controller.js +49 -58
- data/src/js/headmin/headmin.js +38 -21
- data/src/scss/headmin/form.scss +4 -0
- data/src/scss/headmin/table.scss +1 -0
- data/yarn.lock +940 -1058
- metadata +20 -2
@@ -0,0 +1,84 @@
|
|
1
|
+
<%
|
2
|
+
# headmin/forms/date_range
|
3
|
+
#
|
4
|
+
# ==== Options
|
5
|
+
# * <tt>append<tt> - Text or icon to be shown on the left hand side of the input, Doesn't work with float
|
6
|
+
# * <tt>class<tt> - Optional HTML class attribute
|
7
|
+
# * <tt>data<tt> - Optional HTML data attributes
|
8
|
+
# * <tt>end_attribute<tt> - Name of the end date attribute of the form model
|
9
|
+
# * <tt>end_label<tt> - Label for the end attribute
|
10
|
+
# * <tt>float<tt> - Set to true if you want to show floating labels
|
11
|
+
# * <tt>form<tt> - Form object
|
12
|
+
# * <tt>label<tt> - Text to show as label. Label will be hidden if value is false
|
13
|
+
# * <tt>prepend<tt> - Text or icon to be shown on the right hand side of the input, Doesn't work with float
|
14
|
+
# * <tt>readonly<tt> - Set to true if the value of the field can only be read and not be modified
|
15
|
+
# * <tt>required<tt> - Set to true to show a HTML5 validation message when left blank
|
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
|
19
|
+
#
|
20
|
+
# ==== Examples
|
21
|
+
# Basic version
|
22
|
+
# <%= render 'headmin/forms/date_range', form: form, start_attribute: :start_date, end_attribute: :end_date %#>
|
23
|
+
#
|
24
|
+
# With custom labels
|
25
|
+
# <%= 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
|
+
|
27
|
+
append = local_assigns.has_key?(:append) ? append : nil
|
28
|
+
class_names = local_assigns.has_key?(:class) ? local_assigns[:class] : false
|
29
|
+
data = local_assigns.has_key?(:data) ? data : {}
|
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
|
59
|
+
)
|
60
|
+
|
61
|
+
end_template_locals = template_locals.merge(
|
62
|
+
attribute: end_attribute,
|
63
|
+
placeholder: end_attribute,
|
64
|
+
label: end_label
|
65
|
+
)
|
66
|
+
%>
|
67
|
+
|
68
|
+
<% if single %>
|
69
|
+
<div data-controller="date-range">
|
70
|
+
<%= render 'headmin/forms/hidden', start_template_locals.merge(class: nil, data: { 'date-range-target': 'startDateInput' }) %>
|
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) %>
|
73
|
+
</div>
|
74
|
+
<% else %>
|
75
|
+
<div class="row">
|
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>
|
82
|
+
</div>
|
83
|
+
<% end %>
|
84
|
+
|
@@ -0,0 +1,55 @@
|
|
1
|
+
<%
|
2
|
+
# headmin/forms/flatpickr
|
3
|
+
#
|
4
|
+
# ==== Options
|
5
|
+
# * <tt>append<tt> - Text or icon to be shown on the left hand side of the input, Doesn't work with float
|
6
|
+
# * <tt>attribute<tt> - Name of the attribute of the form model
|
7
|
+
# * <tt>class<tt> - Optional HTML class attribute
|
8
|
+
# * <tt>data<tt> - Optional HTML data attributes
|
9
|
+
# * <tt>disabled<tt> - Set to true if the input should be shown as disabled
|
10
|
+
# * <tt>float<tt> - Set to true if you want to show floating labels
|
11
|
+
# * <tt>form<tt> - Form object
|
12
|
+
# * <tt>label<tt> - Text to show as label. Label will be hidden if value is false
|
13
|
+
# * <tt>name<tt> - The name of the field
|
14
|
+
# * <tt>prepend<tt> - Text or icon to be shown on the right hand side of the input, Doesn't work with float
|
15
|
+
# * <tt>readonly<tt> - Set to true if the value of the field can only be read and not be modified
|
16
|
+
# * <tt>required<tt> - Set to true to show a HTML5 validation message when left blank
|
17
|
+
#
|
18
|
+
# ==== Examples
|
19
|
+
# Basic version
|
20
|
+
# <%= render 'headmin/forms/flatpickr', form: form, attribute: :date %#>
|
21
|
+
|
22
|
+
append = local_assigns.has_key?(:append) ? append : nil
|
23
|
+
class_names = local_assigns.has_key?(:class) ? local_assigns[:class] : false
|
24
|
+
data = local_assigns.has_key?(:data) ? data : {}
|
25
|
+
disabled = local_assigns.has_key?(:disabled) ? disabled : false
|
26
|
+
float = local_assigns.has_key?(:float) ? float : false
|
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
|
+
template_locals = {
|
33
|
+
form: form,
|
34
|
+
append: append,
|
35
|
+
prepend: prepend,
|
36
|
+
float: float,
|
37
|
+
label: label,
|
38
|
+
class: class_names,
|
39
|
+
disabled: disabled,
|
40
|
+
readonly: readonly,
|
41
|
+
required: required,
|
42
|
+
attribute: attribute,
|
43
|
+
data: data.merge(
|
44
|
+
'flatpickr-target': 'input',
|
45
|
+
'flatpickr-options': {
|
46
|
+
defaultDate: form.object&.send(attribute)&.strftime('%d/%m/%Y')
|
47
|
+
}
|
48
|
+
),
|
49
|
+
}
|
50
|
+
|
51
|
+
%>
|
52
|
+
|
53
|
+
<div data-controller="flatpickr">
|
54
|
+
<%= render 'headmin/forms/date', template_locals %>
|
55
|
+
</div>
|
@@ -0,0 +1,61 @@
|
|
1
|
+
<%
|
2
|
+
# headmin/forms/flatpickr_range
|
3
|
+
#
|
4
|
+
# ==== Options
|
5
|
+
# * <tt>append<tt> - Text or icon to be shown on the left hand side of the input, Doesn't work with float
|
6
|
+
# * <tt>class<tt> - Optional HTML class attribute
|
7
|
+
# * <tt>data<tt> - Optional HTML data attributes
|
8
|
+
# * <tt>end_attribute<tt> - Name of the end date attribute of the form model
|
9
|
+
# * <tt>float<tt> - Set to true if you want to show floating labels
|
10
|
+
# * <tt>form<tt> - Form object
|
11
|
+
# * <tt>label<tt> - Text to show as label. Label will be hidden if value is false
|
12
|
+
# * <tt>prepend<tt> - Text or icon to be shown on the right hand side of the input, Doesn't work with float
|
13
|
+
# * <tt>readonly<tt> - Set to true if the value of the field can only be read and not be modified
|
14
|
+
# * <tt>required<tt> - Set to true to show a HTML5 validation message when left blank
|
15
|
+
# * <tt>start_attribute<tt> - Name of the start date attribute of the form model
|
16
|
+
#
|
17
|
+
# ==== Examples
|
18
|
+
# Basic version
|
19
|
+
# <%= render 'headmin/forms/flatpickr_range', form: form, start_attribute: :start_date, end_attribute: :end_date %#>
|
20
|
+
|
21
|
+
append = local_assigns.has_key?(:append) ? append : nil
|
22
|
+
class_names = local_assigns.has_key?(:class) ? local_assigns[:class] : false
|
23
|
+
data = local_assigns.has_key?(:data) ? data : {}
|
24
|
+
disabled = local_assigns.has_key?(:disabled) ? disabled : false
|
25
|
+
end_attribute = local_assigns.has_key?(:end_attribute) ? end_attribute : nil
|
26
|
+
float = local_assigns.has_key?(:float) ? float : false
|
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
|
+
start_attribute = local_assigns.has_key?(:start_attribute) ? start_attribute : nil
|
32
|
+
|
33
|
+
start_date = form.object&.send(start_attribute)&.strftime('%d/%m/%Y')
|
34
|
+
end_date = form.object&.send(end_attribute)&.strftime('%d/%m/%Y')
|
35
|
+
|
36
|
+
template_locals = {
|
37
|
+
form: form,
|
38
|
+
append: append,
|
39
|
+
prepend: prepend,
|
40
|
+
float: float,
|
41
|
+
label: label,
|
42
|
+
class: class_names,
|
43
|
+
disabled: disabled,
|
44
|
+
readonly: readonly,
|
45
|
+
required: required,
|
46
|
+
start_attribute: start_attribute,
|
47
|
+
end_attribute: end_attribute,
|
48
|
+
data: data.merge(
|
49
|
+
'flatpickr-target': 'input',
|
50
|
+
'flatpickr-options': {
|
51
|
+
mode: 'range',
|
52
|
+
defaultDate: [start_date, end_date]
|
53
|
+
}
|
54
|
+
),
|
55
|
+
single: true
|
56
|
+
}
|
57
|
+
%>
|
58
|
+
|
59
|
+
<div data-controller="flatpickr">
|
60
|
+
<%= render 'headmin/forms/date_range', template_locals %>
|
61
|
+
</div>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<%
|
2
|
+
# headmin/forms/hidden
|
3
|
+
#
|
4
|
+
# ==== Options
|
5
|
+
# * <tt>form<tt> - Form object
|
6
|
+
# * <tt>attribute<tt> - Name of the attribute of the form model
|
7
|
+
# * <tt>data<tt> - Optional HTML data attributes
|
8
|
+
# * <tt>class<tt> - Optional HTML class attribute
|
9
|
+
#
|
10
|
+
# ==== Examples
|
11
|
+
# Basic version
|
12
|
+
# <%= render 'headmin/forms/hidden', form: form, attribute: :title %#>
|
13
|
+
|
14
|
+
data = local_assigns.has_key?(:data) ? data : nil
|
15
|
+
class_names = local_assigns.has_key?(:class) ? local_assigns[:class] : false
|
16
|
+
|
17
|
+
options = {
|
18
|
+
data: data,
|
19
|
+
class: class_names,
|
20
|
+
}
|
21
|
+
%>
|
22
|
+
|
23
|
+
<%= form.hidden_field(attribute, options) %>
|
@@ -12,13 +12,15 @@
|
|
12
12
|
# <%= render 'headmin/forms/label', form: form, attribute: :image %#>
|
13
13
|
|
14
14
|
class_names = local_assigns.has_key?(:class) ? local_assigns[:class] : false
|
15
|
-
|
15
|
+
custom_name = local_assigns.has_key?(:name) && name ? t("attributes.#{name}") : nil
|
16
16
|
required = local_assigns.has_key?(:required) ? required : false
|
17
|
+
form_id = form.options.has_key?(:id) ? form.options[:id] : nil
|
17
18
|
|
18
19
|
options = {
|
19
20
|
class: "form-label #{class_names}",
|
21
|
+
form: form_id,
|
20
22
|
required: required,
|
21
23
|
}
|
22
24
|
%>
|
23
25
|
|
24
|
-
<%= form.label
|
26
|
+
<%= form.label attribute, custom_name, options %>
|
@@ -41,7 +41,8 @@
|
|
41
41
|
template_names = template_names.any? ? template_names : ['new']
|
42
42
|
object_model = form.object.class
|
43
43
|
association_model = object_model.reflect_on_association(attribute).class_name.constantize
|
44
|
-
|
44
|
+
association_object = association_model.new
|
45
|
+
with_positions = association_object.attributes.keys.include?('position')
|
45
46
|
associations = form.object.send(attribute)
|
46
47
|
associations = with_positions ? associations.order(:position) : associations
|
47
48
|
repeater_id = form.object_id
|
@@ -114,15 +115,11 @@
|
|
114
115
|
|
115
116
|
<!-- Templates -->
|
116
117
|
<% template_names.each do |name| %>
|
117
|
-
<template data-repeater-target="template" data-template-name="<%= name %>">
|
118
|
-
<%= form.fields_for attribute,
|
118
|
+
<template data-repeater-target="template" data-template-name="<%= name %>" data-template-id-regex="<%= association_object.object_id %>">
|
119
|
+
<%= form.fields_for attribute, association_object, child_index: association_object.object_id do |ff| %>
|
119
120
|
<%= render 'headmin/forms/repeater/row', form: ff, pass_thru: pass_thru, repeater_id: repeater_id do %>
|
120
121
|
<% template = templates.detect { |t| t.include?("/#{name}.") } %>
|
121
|
-
<%
|
122
|
-
<%= render(template.gsub('/_', '/'), form: ff) %>
|
123
|
-
<% else %>
|
124
|
-
<% yield(ff) %>
|
125
|
-
<% end %>
|
122
|
+
<% yield(ff, template&.gsub('/_', '/')) %>
|
126
123
|
<% end %>
|
127
124
|
<% end %>
|
128
125
|
</template>
|
@@ -2,18 +2,22 @@
|
|
2
2
|
# headmin/forms/select
|
3
3
|
#
|
4
4
|
# ==== Options
|
5
|
-
# * <tt>
|
5
|
+
# * <tt>append<tt> - Text or icon to be shown on the left hand side of the input, Doesn't work with float
|
6
6
|
# * <tt>attribute<tt> - Name of the attribute of the form model
|
7
|
+
# * <tt>class<tt> - Optional HTML class attribute
|
7
8
|
# * <tt>collection<tt> - Values to create option tags for
|
8
|
-
# * <tt>
|
9
|
-
# * <tt>tags<tt> - Set to true if new options are allowed to be created
|
9
|
+
# * <tt>data<tt> - Optional HTML data attributes
|
10
10
|
# * <tt>disabled<tt> - One or more values to be disabled in the option tags
|
11
|
-
# * <tt>
|
11
|
+
# * <tt>float<tt> - Set to true if you want to show floating labels
|
12
|
+
# * <tt>form<tt> - Form object
|
12
13
|
# * <tt>include_blank<tt> - Set to true or prompt string if the first option tag is a blank
|
13
14
|
# * <tt>label<tt> - Text to show as label. Label will be hidden if value is false
|
14
|
-
# * <tt>
|
15
|
-
# * <tt>append<tt> - Text or icon to be shown on the left hand side of the input, Doesn't work with float
|
15
|
+
# * <tt>multiple<tt> - Set to true if multiple selections are allowed
|
16
16
|
# * <tt>prepend<tt> - Text or icon to be shown on the right hand side of the input, Doesn't work with float
|
17
|
+
# * <tt>readonly<tt> - Set to true if the value of the field can only be read and not be modified
|
18
|
+
# * <tt>required<tt> - Set to true to show a HTML5 validation message when left blank
|
19
|
+
# * <tt>selected<tt> - Value to be marked as "selected"
|
20
|
+
# * <tt>tags<tt> - Set to true if new options are allowed to be created
|
17
21
|
#
|
18
22
|
# ==== Examples
|
19
23
|
# Basic version
|
@@ -41,19 +45,17 @@
|
|
41
45
|
float = local_assigns.has_key?(:float) ? float : false
|
42
46
|
include_blank = local_assigns.has_key?(:include_blank) ? include_blank : nil
|
43
47
|
label = local_assigns.has_key?(:label) ? label : nil
|
44
|
-
prepend = local_assigns.has_key?(:prepend) ? prepend : nil
|
45
48
|
multiple = local_assigns.has_key?(:multiple) ? multiple : false
|
49
|
+
prepend = local_assigns.has_key?(:prepend) ? prepend : nil
|
46
50
|
required = local_assigns.has_key?(:required) ? required : false
|
47
|
-
selected = local_assigns.has_key?(:selected) ? selected :
|
51
|
+
selected = local_assigns.has_key?(:selected) ? selected : form.object&.send(attribute)
|
48
52
|
tags = local_assigns.has_key?(:tags) ? tags : false
|
49
53
|
|
50
54
|
data = data.merge({ tags: true }) if tags
|
51
55
|
|
52
|
-
choices = options_for_select(collection,
|
56
|
+
choices = options_for_select(collection, selected: selected, disabled: disabled)
|
53
57
|
options = {
|
54
58
|
include_blank: include_blank,
|
55
|
-
disabled: disabled,
|
56
|
-
selected: selected
|
57
59
|
}
|
58
60
|
html_options = {
|
59
61
|
'aria-describedby': form_field_validation_id(form, attribute),
|
@@ -61,6 +63,7 @@
|
|
61
63
|
data: data,
|
62
64
|
multiple: tags ? true : multiple,
|
63
65
|
required: required,
|
66
|
+
disabled: disabled == true,
|
64
67
|
}
|
65
68
|
|
66
69
|
%>
|
@@ -42,8 +42,8 @@
|
|
42
42
|
class: "form-control #{form_field_validation_class(form, attribute)} #{class_names}",
|
43
43
|
data: data,
|
44
44
|
disabled: disabled,
|
45
|
-
list: collection ? attribute : nil,
|
46
|
-
placeholder:
|
45
|
+
list: collection ? "#{attribute}_list" : nil,
|
46
|
+
placeholder: label ? label.to_s.humanize : nil,
|
47
47
|
readonly: readonly,
|
48
48
|
required: required,
|
49
49
|
}
|
@@ -51,12 +51,10 @@
|
|
51
51
|
|
52
52
|
<%= render 'headmin/forms/base', form: form, attribute: attribute, append: append, prepend: prepend, float: float, label: label, required: required do |form| %>
|
53
53
|
<%= form.text_field(attribute, options) %>
|
54
|
-
<% end %>
|
55
54
|
|
56
|
-
<% if collection %>
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
</datalist>
|
55
|
+
<% if collection %>
|
56
|
+
<datalist id="<%= "#{attribute}_list" %>">
|
57
|
+
<%= options_for_select(collection) %>
|
58
|
+
</datalist>
|
59
|
+
<% end %>
|
62
60
|
<% end %>
|
@@ -1,10 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
<%
|
2
|
+
# headmin/layout/main
|
3
|
+
#
|
4
|
+
# ==== Examples
|
5
|
+
# Basic version
|
6
|
+
# <%= render 'headmin/layout/main' do %#>
|
7
|
+
# ...
|
8
|
+
# <% end %#>
|
9
|
+
|
10
|
+
class_names = local_assigns.has_key?(:class) ? local_assigns[:class] : false
|
5
11
|
%>
|
6
12
|
|
7
|
-
<div class="main" data-controller="popup">
|
13
|
+
<div class="main <%= class_names %>" data-controller="popup">
|
8
14
|
<div class="container-fluid">
|
9
15
|
<div class="row">
|
10
16
|
<%= yield if block_given? %>
|
@@ -1,19 +1,43 @@
|
|
1
|
+
<%
|
2
|
+
# headmin/table/actions
|
3
|
+
#
|
4
|
+
# The form action url is dynamically set when switching between actions.
|
5
|
+
#
|
6
|
+
# ==== Examples
|
7
|
+
# Basic version
|
8
|
+
# <%= render 'headmin/table/actions' do %#>
|
9
|
+
# <%= render 'headmin/table/actions/delete', url: destroy_admin_pages_path %#>
|
10
|
+
# <% end %#>
|
11
|
+
|
12
|
+
%>
|
13
|
+
|
1
14
|
<% content_for :table_actions do %>
|
2
|
-
<th class="h-table-actions d-none" data-controller="table-actions" data-table-target="actions">
|
3
|
-
|
4
|
-
<%=
|
5
|
-
<%=
|
15
|
+
<th class="h-table-actions d-none" data-controller="table-actions" data-table-actions-target="wrapper" data-table-target="actions">
|
16
|
+
<%= form_with url: '', data: { 'table-actions-target': 'form' } do |form| %>
|
17
|
+
<%= form.hidden_field :authenticity_token, value: form_authenticity_token %>
|
18
|
+
<%= form.hidden_field :_method, value: 'POST', 'data-table-actions-target': 'method' %>
|
19
|
+
<%= query_parameter_fields(form) %>
|
6
20
|
|
7
|
-
<template data-table-target="
|
8
|
-
<%=
|
21
|
+
<template data-table-actions-target="idInputTemplate">
|
22
|
+
<%= form.hidden_field :ids, value: 'ID', multiple: true, 'data-table-actions-target': 'id' %>
|
9
23
|
</template>
|
10
24
|
|
11
25
|
<div class="row g-1">
|
12
26
|
<div class="col-6 col-sm-auto">
|
13
|
-
<
|
14
|
-
<
|
15
|
-
|
16
|
-
|
27
|
+
<div class="d-flex align-items-center gap-3">
|
28
|
+
<label class="text-nowrap"
|
29
|
+
data-table-actions-target="counter"
|
30
|
+
data-items-zero="<%= t('.items_html', count: 0) %>"
|
31
|
+
data-items-one="<%= t('.items_html', count: 1) %>"
|
32
|
+
data-items-other="<%= t('.items_html', count: 2) %>"
|
33
|
+
>
|
34
|
+
<%= t('.items_html', count: 0) %>
|
35
|
+
</label>
|
36
|
+
<select class="form-select me-1" data-table-actions-target="select" data-action="change->table-actions#update">
|
37
|
+
<option disabled selected="selected"><%= t('.selection') %></option>
|
38
|
+
<%= yield if block_given? %>
|
39
|
+
</select>
|
40
|
+
</div>
|
17
41
|
</div>
|
18
42
|
<div class="col-6 col-sm-auto">
|
19
43
|
<button class="btn h-btn-outline-light w-100" type="submit" data-table-actions-target="button" disabled>
|
@@ -21,6 +45,6 @@
|
|
21
45
|
</button>
|
22
46
|
</div>
|
23
47
|
</div>
|
24
|
-
|
48
|
+
<% end %>
|
25
49
|
</th>
|
26
50
|
<% end %>
|
@@ -1,9 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
<%
|
2
|
+
# headmin/table/body/row
|
3
|
+
#
|
4
|
+
# ==== Options
|
5
|
+
# * <tt>class</tt> - Custom class names to add to the table row
|
6
|
+
#
|
7
|
+
# ==== Examples
|
8
|
+
# <%= render 'headmin/table/body/row' do %#>
|
9
|
+
# <%= render 'headmin/table/body/id', value: page.id %#>
|
10
|
+
# <%= render 'headmin/table/body/string', value: page.title %#>
|
11
|
+
# <% end %#>
|
6
12
|
|
7
|
-
|
13
|
+
class_names = local_assigns.has_key?(:class) ? local_assigns[:class] : false
|
14
|
+
%>
|
15
|
+
<tr class="<%= class_names %>" data-table-target="row">
|
8
16
|
<%= yield if block_given? %>
|
9
17
|
</tr>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: {method: :post}) do |f| %>
|
2
2
|
<%= render "headmin/views/devise/shared/error_messages", resource: resource %>
|
3
3
|
|
4
|
-
<%= render 'headmin/forms/email', form: f, attribute: :email, required: true,
|
4
|
+
<%= render 'headmin/forms/email', form: f, attribute: :email, required: true, float: true %>
|
5
5
|
|
6
6
|
<%= f.submit t('.resend'), class: 'btn btn-lg btn-primary w-100' %>
|
7
7
|
|
@@ -3,8 +3,8 @@
|
|
3
3
|
|
4
4
|
<%= f.hidden_field :reset_password_token %>
|
5
5
|
|
6
|
-
<%= render 'headmin/forms/password', form: f, attribute: :password, required: true,
|
7
|
-
<%= render 'headmin/forms/password', form: f, attribute: :password_confirmation, required: true,
|
6
|
+
<%= render 'headmin/forms/password', form: f, attribute: :password, required: true, float: true %>
|
7
|
+
<%= render 'headmin/forms/password', form: f, attribute: :password_confirmation, required: true, float: true %>
|
8
8
|
|
9
9
|
<%= f.submit t('.change_password'), class: 'btn btn-lg btn-primary w-100' %>
|
10
10
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: {method: :post}) do |f| %>
|
2
2
|
<%= render "headmin/views/devise/shared/error_messages", resource: resource %>
|
3
3
|
|
4
|
-
<%= render 'headmin/forms/email', form: f, attribute: :email, required: true,
|
4
|
+
<%= render 'headmin/forms/email', form: f, attribute: :email, required: true, float: true %>
|
5
5
|
|
6
6
|
<%= f.submit t('.send_instructions'), class: 'btn btn-lg btn-primary w-100' %>
|
7
7
|
|
@@ -2,15 +2,15 @@
|
|
2
2
|
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: {method: :put}) do |f| %>
|
3
3
|
<%= render "headmin/views/devise/shared/error_messages", resource: resource %>
|
4
4
|
|
5
|
-
<%= render 'headmin/forms/email', form: f, attribute: :email, required: true,
|
5
|
+
<%= render 'headmin/forms/email', form: f, attribute: :email, required: true, float: true %>
|
6
6
|
|
7
7
|
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
|
8
8
|
<div><%= t('.waiting_confirmation', email: resource.unconfirmed_email) %></div>
|
9
9
|
<% end %>
|
10
10
|
|
11
|
-
<%= render 'headmin/forms/password', form: f, attribute: :password, required: true,
|
12
|
-
<%= render 'headmin/forms/password', form: f, attribute: :password_confirmation, required: true,
|
13
|
-
<%= render 'headmin/forms/password', form: f, attribute: :current_password, required: true,
|
11
|
+
<%= render 'headmin/forms/password', form: f, attribute: :password, required: true, float: true %>
|
12
|
+
<%= render 'headmin/forms/password', form: f, attribute: :password_confirmation, required: true, float: true %>
|
13
|
+
<%= render 'headmin/forms/password', form: f, attribute: :current_password, required: true, float: true %>
|
14
14
|
|
15
15
|
<%= f.submit t('.change'), class: 'btn btn-lg btn-primary w-100' %>
|
16
16
|
<% end %>
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
|
2
2
|
<%= render "headmin/views/devise/shared/error_messages", resource: resource %>
|
3
3
|
|
4
|
-
<%= render 'headmin/forms/email', form: f, attribute: :email, required: true,
|
5
|
-
<%= render 'headmin/forms/password', form: f, attribute: :password, required: true,
|
6
|
-
<%= render 'headmin/forms/password', form: f, attribute: :password_confirmation, required: true,
|
4
|
+
<%= render 'headmin/forms/email', form: f, attribute: :email, required: true, float: true %>
|
5
|
+
<%= render 'headmin/forms/password', form: f, attribute: :password, required: true, float: true %>
|
6
|
+
<%= render 'headmin/forms/password', form: f, attribute: :password_confirmation, required: true, float: true %>
|
7
7
|
|
8
8
|
<%= f.submit t('.sign_up'), class: 'btn btn-lg btn-primary w-100' %>
|
9
9
|
|
@@ -1,27 +1,27 @@
|
|
1
|
-
<div class="bg-light mt-5 text-
|
1
|
+
<div class="bg-light mt-5 text-center">
|
2
2
|
<%- if controller_name != 'sessions' %>
|
3
|
-
<%= link_to
|
3
|
+
<%= link_to t('.sign_in'), new_session_path(resource_name) %><br />
|
4
4
|
<% end %>
|
5
5
|
|
6
6
|
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
|
7
|
-
<%= link_to
|
7
|
+
<%= link_to t('.sign_up'), new_registration_path(resource_name) %><br />
|
8
8
|
<% end %>
|
9
9
|
|
10
10
|
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
|
11
|
-
<%= link_to
|
11
|
+
<%= link_to t('.forgot_password'), new_password_path(resource_name) %><br />
|
12
12
|
<% end %>
|
13
13
|
|
14
14
|
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
15
|
-
<%= link_to
|
15
|
+
<%= link_to t('.confirmation'), new_confirmation_path(resource_name) %><br />
|
16
16
|
<% end %>
|
17
17
|
|
18
18
|
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
19
|
-
<%= link_to
|
19
|
+
<%= link_to t('.unlock'), new_unlock_path(resource_name) %><br />
|
20
20
|
<% end %>
|
21
21
|
|
22
22
|
<%- if devise_mapping.omniauthable? %>
|
23
23
|
<%- resource_class.omniauth_providers.each do |provider| %>
|
24
|
-
<%= link_to
|
24
|
+
<%= link_to t('.omniauth', provider: OmniAuth::Utils.camelize(provider)), omniauth_authorize_path(resource_name, provider), method: :post %><br />
|
25
25
|
<% end %>
|
26
26
|
<% end %>
|
27
27
|
</div>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: {method: :post}) do |f| %>
|
2
2
|
<%= render "headmin/views/devise/shared/error_messages", resource: resource %>
|
3
3
|
|
4
|
-
<%= render 'headmin/forms/email', form: f, attribute: :email, required: true,
|
4
|
+
<%= render 'headmin/forms/email', form: f, attribute: :email, required: true, float: true %>
|
5
5
|
|
6
6
|
<%= f.submit t('.resend'), class: 'btn btn-lg btn-primary w-100' %>
|
7
7
|
|