headmin 0.5.1 → 0.5.2

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.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +2 -2
  3. data/Gemfile +14 -0
  4. data/Gemfile.lock +77 -0
  5. data/app/assets/javascripts/headmin/controllers/media_controller.js +237 -0
  6. data/app/assets/javascripts/headmin/controllers/media_modal_controller.js +110 -0
  7. data/app/assets/javascripts/headmin/controllers/remote_modal_controller.js +10 -0
  8. data/app/assets/javascripts/headmin/controllers/textarea_controller.js +34 -0
  9. data/app/assets/javascripts/headmin/index.js +8 -0
  10. data/app/assets/javascripts/headmin.js +294 -0
  11. data/app/assets/stylesheets/headmin/forms/file.scss +40 -5
  12. data/app/assets/stylesheets/headmin/forms/media.scss +10 -0
  13. data/app/assets/stylesheets/headmin/forms/repeater.scss +4 -0
  14. data/app/assets/stylesheets/headmin/forms.scss +7 -0
  15. data/app/assets/stylesheets/headmin/layout/sidebar.scss +0 -1
  16. data/app/assets/stylesheets/headmin/media/index.scss +9 -0
  17. data/app/assets/stylesheets/headmin/media.scss +1 -0
  18. data/app/assets/stylesheets/headmin/table.scss +8 -0
  19. data/app/assets/stylesheets/headmin.css +64 -7
  20. data/app/assets/stylesheets/headmin.scss +1 -0
  21. data/app/controllers/headmin/media_controller.rb +52 -0
  22. data/app/controllers/headmin_controller.rb +2 -0
  23. data/app/models/concerns/headmin/field.rb +0 -1
  24. data/app/models/concerns/headmin/fieldable.rb +10 -1
  25. data/app/models/concerns/headmin/form/hintable.rb +6 -1
  26. data/app/models/headmin/filter/date.rb +49 -1
  27. data/app/models/headmin/form/media_view.rb +113 -0
  28. data/app/models/headmin/form/textarea_view.rb +6 -1
  29. data/app/views/examples/admin.html.erb +13 -13
  30. data/app/views/examples/auth.html.erb +1 -1
  31. data/app/views/headmin/_blocks.html.erb +2 -2
  32. data/app/views/headmin/_breadcrumbs.html.erb +1 -1
  33. data/app/views/headmin/_dropdown.html.erb +1 -1
  34. data/app/views/headmin/_filters.html.erb +3 -3
  35. data/app/views/headmin/_form.html.erb +2 -2
  36. data/app/views/headmin/_heading.html.erb +1 -1
  37. data/app/views/headmin/_index.html.erb +1 -1
  38. data/app/views/headmin/_notifications.html.erb +1 -1
  39. data/app/views/headmin/_pagination.html.erb +1 -1
  40. data/app/views/headmin/_popup.html.erb +2 -2
  41. data/app/views/headmin/_table.html.erb +1 -1
  42. data/app/views/headmin/dropdown/_devise.html.erb +8 -8
  43. data/app/views/headmin/dropdown/_list.html.erb +1 -1
  44. data/app/views/headmin/dropdown/_locale.html.erb +4 -4
  45. data/app/views/headmin/filters/_base.html.erb +20 -20
  46. data/app/views/headmin/filters/_boolean.html.erb +4 -4
  47. data/app/views/headmin/filters/_date.html.erb +4 -4
  48. data/app/views/headmin/filters/_flatpickr.html.erb +4 -4
  49. data/app/views/headmin/filters/_number.html.erb +4 -4
  50. data/app/views/headmin/filters/_options.html.erb +4 -4
  51. data/app/views/headmin/filters/_search.html.erb +3 -3
  52. data/app/views/headmin/filters/_text.html.erb +4 -4
  53. data/app/views/headmin/filters/filter/_button.html.erb +1 -1
  54. data/app/views/headmin/forms/_autocomplete.html.erb +2 -2
  55. data/app/views/headmin/forms/_blocks.html.erb +4 -4
  56. data/app/views/headmin/forms/_checkbox.html.erb +5 -5
  57. data/app/views/headmin/forms/_color.html.erb +5 -5
  58. data/app/views/headmin/forms/_date.html.erb +8 -8
  59. data/app/views/headmin/forms/_date_range.html.erb +3 -3
  60. data/app/views/headmin/forms/_datetime.html.erb +8 -8
  61. data/app/views/headmin/forms/_datetime_range.html.erb +3 -3
  62. data/app/views/headmin/forms/_email.html.erb +9 -9
  63. data/app/views/headmin/forms/_file.html.erb +12 -12
  64. data/app/views/headmin/forms/_flatpickr.html.erb +2 -2
  65. data/app/views/headmin/forms/_flatpickr_range.html.erb +8 -8
  66. data/app/views/headmin/forms/_hidden.html.erb +1 -1
  67. data/app/views/headmin/forms/_hint.html.erb +7 -2
  68. data/app/views/headmin/forms/_label.html.erb +1 -1
  69. data/app/views/headmin/forms/_media.html.erb +58 -0
  70. data/app/views/headmin/forms/_number.html.erb +8 -8
  71. data/app/views/headmin/forms/_password.html.erb +7 -7
  72. data/app/views/headmin/forms/_redactorx.html.erb +2 -2
  73. data/app/views/headmin/forms/_repeater.html.erb +12 -12
  74. data/app/views/headmin/forms/_search.html.erb +9 -9
  75. data/app/views/headmin/forms/_select.html.erb +8 -8
  76. data/app/views/headmin/forms/_switch.html.erb +2 -2
  77. data/app/views/headmin/forms/_text.html.erb +9 -9
  78. data/app/views/headmin/forms/_textarea.html.erb +7 -7
  79. data/app/views/headmin/forms/_url.html.erb +9 -9
  80. data/app/views/headmin/forms/_validation.html.erb +1 -1
  81. data/app/views/headmin/forms/_wysiwyg.html.erb +2 -2
  82. data/app/views/headmin/forms/fields/_base.html.erb +2 -2
  83. data/app/views/headmin/forms/fields/_file.html.erb +3 -3
  84. data/app/views/headmin/forms/fields/_files.html.erb +3 -3
  85. data/app/views/headmin/forms/fields/_group.html.erb +7 -7
  86. data/app/views/headmin/forms/fields/_list.html.erb +5 -5
  87. data/app/views/headmin/forms/fields/_text.html.erb +3 -3
  88. data/app/views/headmin/forms/media/_item.html.erb +32 -0
  89. data/app/views/headmin/forms/media/_validation.html.erb +10 -0
  90. data/app/views/headmin/forms/repeater/_row.html.erb +12 -11
  91. data/app/views/headmin/layout/_main.html.erb +3 -1
  92. data/app/views/headmin/layout/_remote_modal.html.erb +1 -0
  93. data/app/views/headmin/layout/_sidebar.html.erb +1 -1
  94. data/app/views/headmin/media/_item.html.erb +17 -0
  95. data/app/views/headmin/media/_media_item_modal.html.erb +51 -0
  96. data/app/views/headmin/media/_modal.html.erb +35 -0
  97. data/app/views/headmin/media/create.turbo_stream.erb +5 -0
  98. data/app/views/headmin/media/index.html.erb +3 -0
  99. data/app/views/headmin/media/show.html.erb +9 -0
  100. data/app/views/headmin/media/update.turbo_stream.erb +3 -0
  101. data/app/views/headmin/nav/_dropdown.html.erb +3 -3
  102. data/app/views/headmin/nav/_item.html.erb +2 -2
  103. data/app/views/headmin/nav/item/_devise.html.erb +6 -6
  104. data/app/views/headmin/nav/item/_locale.html.erb +4 -4
  105. data/app/views/headmin/table/_actions.html.erb +2 -2
  106. data/app/views/headmin/table/actions/_action.html.erb +3 -3
  107. data/app/views/headmin/table/actions/_delete.html.erb +2 -2
  108. data/app/views/headmin/table/actions/_export.html.erb +2 -2
  109. data/app/views/headmin/table/body/_image.html.erb +18 -0
  110. data/app/views/headmin/table/body/_row.html.erb +3 -3
  111. data/app/views/headmin/table/foot/_cell.html.erb +1 -1
  112. data/app/views/headmin/views/devise/confirmations/_new.html.erb +3 -3
  113. data/app/views/headmin/views/devise/passwords/_edit.html.erb +4 -4
  114. data/app/views/headmin/views/devise/passwords/_new.html.erb +3 -3
  115. data/app/views/headmin/views/devise/registrations/_edit.html.erb +5 -5
  116. data/app/views/headmin/views/devise/registrations/_new.html.erb +5 -5
  117. data/app/views/headmin/views/devise/sessions/_new.html.erb +4 -4
  118. data/app/views/headmin/views/devise/unlocks/_new.html.erb +3 -3
  119. data/config/locales/devise/nl.yml +1 -1
  120. data/config/locales/headmin/forms/en.yml +8 -0
  121. data/config/locales/headmin/forms/nl.yml +8 -0
  122. data/config/locales/headmin/media/en.yml +23 -0
  123. data/config/locales/headmin/media/nl.yml +22 -0
  124. data/config/locales/headmin/table/en.yml +2 -0
  125. data/config/locales/headmin/table/nl.yml +2 -0
  126. data/config/routes.rb +10 -0
  127. data/lib/generators/templates/views/auth/confirmations/new.html.erb +1 -1
  128. data/lib/generators/templates/views/auth/mailer/confirmation_instructions.html.erb +1 -1
  129. data/lib/generators/templates/views/auth/mailer/email_changed.html.erb +1 -1
  130. data/lib/generators/templates/views/auth/mailer/password_change.html.erb +1 -1
  131. data/lib/generators/templates/views/auth/mailer/reset_password_instructions.html.erb +1 -1
  132. data/lib/generators/templates/views/auth/mailer/unlock_instructions.html.erb +1 -1
  133. data/lib/generators/templates/views/auth/passwords/edit.html.erb +1 -1
  134. data/lib/generators/templates/views/auth/passwords/new.html.erb +1 -1
  135. data/lib/generators/templates/views/auth/registrations/edit.html.erb +1 -1
  136. data/lib/generators/templates/views/auth/registrations/new.html.erb +1 -1
  137. data/lib/generators/templates/views/auth/sessions/new.html.erb +1 -1
  138. data/lib/generators/templates/views/auth/unlocks/new.html.erb +1 -1
  139. data/lib/generators/templates/views/layouts/auth.html.erb +1 -1
  140. data/lib/headmin/version.rb +1 -1
  141. metadata +27 -3
  142. data/.lock-487e157d270f3062a98b7b2a012753708-1272821827 +0 -0
@@ -17,10 +17,19 @@ module Headmin
17
17
  @fields_hash = hash
18
18
  end
19
19
 
20
+ def include_tables
21
+ []
22
+ end
23
+
24
+ def default_include_tables
25
+ [files_attachments: :blob]
26
+ end
27
+
20
28
  private
21
29
 
22
30
  def parse_fields
23
- fields.where(parent: nil).order(position: :asc).map { |field| parse_hash_tree(field.hash_tree) }.reduce({}, :merge)
31
+ hash_tree = fields.includes(default_include_tables | include_tables).order(position: :asc).hash_tree
32
+ parse_hash_tree(hash_tree)
24
33
  end
25
34
 
26
35
  def build_fields
@@ -8,9 +8,14 @@ module Headmin
8
8
  hint.present?
9
9
  end
10
10
 
11
+ def maxlength?
12
+ maxlength.present?
13
+ end
14
+
11
15
  def hint_options
12
16
  {
13
- content: hint
17
+ content: hint,
18
+ maxlength: maxlength
14
19
  }
15
20
  end
16
21
  end
@@ -3,16 +3,64 @@ module Headmin
3
3
  class Date < Headmin::Filter::Base
4
4
  OPERATORS = %w[eq not_eq gt gteq lt lteq between not_between in not_in is_null is_not_null]
5
5
 
6
+ QUERY_OPERATOR_CONVERT_TO = {
7
+ between: %w[eq],
8
+ not_between: %w[not_eq]
9
+ }
10
+
11
+ OPERATORS_CONVERT_TO = {
12
+ convert_to_range: %w[between not_between],
13
+ convert_to_array: %w[in not_in],
14
+ convert_to_value: %w[matches does_not_match is_null is_not_null starts_with ends_with],
15
+ convert_to_datetime_equals: %w[eq not_eq],
16
+ convert_to_datetime_begin: %w[lt gteq],
17
+ convert_to_datetime_end: %w[gt lteq]
18
+ }
19
+
6
20
  def cast_value(value)
7
21
  value.present? ? value.to_date : ::Date.current
8
22
  rescue
9
23
  raise TypeError, "The value that was passed to this filter is not a date"
10
24
  end
11
25
 
26
+ def values
27
+ @instructions.map { |instruction| output_value(instruction) }.compact
28
+ end
29
+
30
+ def output_value(instruction)
31
+ if %w[eq not_eq].include?(instruction[:operator])
32
+ instruction[:value].last.to_date
33
+ elsif %w[lt lteq gt gteq].include?(instruction[:operator])
34
+ instruction[:value].to_date
35
+ else
36
+ instruction[:value]
37
+ end
38
+ end
39
+
40
+ def convert_to_datetime_equals(value)
41
+ casted_date = cast_value(value)
42
+
43
+ (casted_date - 1.day).end_of_day..casted_date.end_of_day
44
+ end
45
+
46
+ def convert_to_datetime_begin(value)
47
+ casted_date = cast_value(value)
48
+ casted_date.beginning_of_day
49
+ end
50
+
51
+ def convert_to_datetime_end(value)
52
+ casted_date = cast_value(value)
53
+ casted_date.end_of_day
54
+ end
55
+
12
56
  def display_value(value)
13
57
  # This uses the default date format of headmin.
14
58
  # Can be overwritten by setting default date format of the application.
15
- I18n.l(value)
59
+ if value.class.to_s == "Range"
60
+ I18n.l(value.last.to_date)
61
+ else
62
+ I18n.l(value.to_date)
63
+ end
16
64
  end
17
65
  end
18
66
  end
@@ -0,0 +1,113 @@
1
+ module Headmin
2
+ module Form
3
+ class MediaView < ViewModel
4
+ include Rails.application.routes.url_helpers
5
+ include Headmin::Form::Hintable
6
+ include Headmin::Form::Labelable
7
+ include Headmin::Form::Placeholderable
8
+ include Headmin::Form::Validatable
9
+ include Headmin::Form::Wrappable
10
+
11
+ def input_group_options
12
+ default_input_group_options
13
+ .deep_merge(label_input_group_options)
14
+ .deep_merge(@input_group || {})
15
+ end
16
+
17
+ def wrapper_options
18
+ default_wrapper_options.deep_merge({
19
+ class: ["mb-3", ("form-floating" if float)],
20
+ data: {
21
+ controller: "media",
22
+ name: "#{attribute}_#{object_id}",
23
+ min: min,
24
+ max: max,
25
+ sort: sort,
26
+ required: required.nil? ? 0 : required
27
+ }
28
+ }).deep_merge(@wrapper || {})
29
+ end
30
+
31
+ def custom_validation_options
32
+ {
33
+ form: form,
34
+ attribute: attribute,
35
+ min: min,
36
+ max: max
37
+ }
38
+ end
39
+
40
+ def association_object
41
+ if attached.is_a?(ActiveStorage::Attached::Many)
42
+ result = form.object.send(nested_attribute)
43
+ result = result.order(position: :asc) if sort
44
+ result
45
+ else
46
+ form.object.send(nested_attribute)
47
+ end
48
+ end
49
+
50
+ def attachments
51
+ if attached.is_a?(ActiveStorage::Attached::Many)
52
+ result = form.object.send(nested_attribute)
53
+ result = result.order(position: :asc) if sort
54
+ result.to_a.compact
55
+ else
56
+ [form.object.send(nested_attribute)].compact
57
+ end
58
+ end
59
+
60
+ def attached
61
+ form.object.send(attribute)
62
+ end
63
+
64
+ def build_nested_attribute
65
+ if attached.is_a?(ActiveStorage::Attached::Many)
66
+ form.object.send(nested_attribute).build
67
+ else
68
+ form.object.send("build_#{nested_attribute}")
69
+ end
70
+ end
71
+
72
+ def nested_attribute
73
+ if attached.is_a?(ActiveStorage::Attached::Many)
74
+ :"#{attribute}_attachments"
75
+ else
76
+ :"#{attribute}_attachment"
77
+ end
78
+ end
79
+
80
+ def min
81
+ if @required
82
+ @min.to_i < 1 ? 1 : @min.to_i
83
+ else
84
+ @min.to_i < 1 ? 0 : @min.to_i
85
+ end
86
+ end
87
+
88
+ def max
89
+ if attached.is_a?(ActiveStorage::Attached::Many)
90
+ @max
91
+ else
92
+ 1
93
+ end
94
+ end
95
+
96
+ def required
97
+ @required ? 1 : nil
98
+ end
99
+
100
+ def blob_ids
101
+ attachments.map { |attachment| attachment.blob_id }
102
+ end
103
+
104
+ def media_modal_url
105
+ headmin_media_url(name: "#{attribute}_#{object_id}", ids: blob_ids, min: min, max: max)
106
+ end
107
+
108
+ def sort
109
+ @sort == true
110
+ end
111
+ end
112
+ end
113
+ end
@@ -22,7 +22,8 @@ module Headmin
22
22
 
23
23
  def wrapper_options
24
24
  default_wrapper_options.deep_merge({
25
- class: ["mb-3", ("form-floating" if float)]
25
+ class: ["mb-3", ("form-floating" if float)],
26
+ data: {controller: :textarea}
26
27
  }).deep_merge(@wrapper || {})
27
28
  end
28
29
 
@@ -32,6 +33,10 @@ module Headmin
32
33
  {
33
34
  aria: {describedby: validation_id},
34
35
  class: [form_control_class, validation_class],
36
+ data: {
37
+ textarea_target: :textarea,
38
+ action: "input->textarea#update"
39
+ },
35
40
  placeholder: placeholder
36
41
  }
37
42
  end
@@ -11,26 +11,26 @@
11
11
  </head>
12
12
 
13
13
  <body>
14
- <%= render "headmin/layout/main" do %>
15
- <%= render "headmin/layout/sidebar", logo: inline_svg_tag('logo.svg') do %>
16
- <%= render "headmin/layout/sidebar/menu" do %>
17
- <%= render "headmin/layout/sidebar/menu/item", name: t('.dashboard'), link: admin_root_path, icon: 'speedometer' %>
14
+ <%= render 'headmin/layout/main' do %>
15
+ <%= render 'headmin/layout/sidebar', logo: inline_svg_tag('logo.svg') do %>
16
+ <%= render 'headmin/layout/sidebar/menu' do %>
17
+ <%= render 'headmin/layout/sidebar/menu/item', name: t('.dashboard'), link: admin_root_path, icon: 'speedometer' %>
18
18
  <div class="d-block d-md-none">
19
- <%= render "headmin/layout/sidebar/menu/locale" do end %>
20
- <%= render "headmin/layout/sidebar/menu/account" do end %>
19
+ <%= render 'headmin/layout/sidebar/menu/locale' do end %>
20
+ <%= render 'headmin/layout/sidebar/menu/account' do end %>
21
21
  </div>
22
22
  <% end %>
23
23
  <% end %>
24
- <%= render "headmin/layout/body" do %>
25
- <%= render "headmin/layout/header" do %>
26
- <%= render "headmin/layout/header/locale" do end %>
27
- <%= render "headmin/layout/header/account" do end %>
24
+ <%= render 'headmin/layout/body' do %>
25
+ <%= render 'headmin/layout/header' do %>
26
+ <%= render 'headmin/layout/header/locale' do end %>
27
+ <%= render 'headmin/layout/header/account' do end %>
28
28
  <% end %>
29
- <%= render "headmin/layout/content" do %>
30
- <%= render "headmin/notifications" %>
29
+ <%= render 'headmin/layout/content' do %>
30
+ <%= render 'headmin/notifications' %>
31
31
  <%= yield %>
32
32
  <% end %>
33
- <%= render "headmin/layout/footer", class: 'text-secondary' do %>
33
+ <%= render 'headmin/layout/footer', class: 'text-secondary' do %>
34
34
  <%= bootstrap_icon('question-circle') %>
35
35
  <a class="text-secondary" href="mailto:info@insiting.com" title="<%= t('.help') %>">
36
36
  <%= t('.help') %>
@@ -10,7 +10,7 @@
10
10
  </head>
11
11
  <body class="bg-light w-100 vh-100">
12
12
 
13
- <%= render "headmin/notifications" %>
13
+ <%= render 'headmin/notifications' %>
14
14
 
15
15
  <main class="d-flex justify-content-center align-items-center w-100 vh-100 p-3">
16
16
  <%= yield %>
@@ -9,10 +9,10 @@
9
9
  #
10
10
  # ==== Examples
11
11
  # Basic version. (looks in views/website/blocks, views/blocks or views directory )
12
- # <%= render "headmin/blocks", blockable: @page %#>
12
+ # <%= render 'headmin/blocks', blockable: @page %#>
13
13
  #
14
14
  # Define one ore more path where the templates could be located:
15
- # <%= render "headmin/blocks", blockable: @page, paths: %w(website/pages/blocks) %#>
15
+ # <%= render 'headmin/blocks', blockable: @page, paths: %w(website/pages/blocks) %#>
16
16
 
17
17
  blocks = Headmin::BlocksView.new(local_assigns)
18
18
  @lookup_context.prefixes = blocks.prefixes + @lookup_context.prefixes
@@ -6,7 +6,7 @@
6
6
  #
7
7
  # ==== Examples
8
8
  # Basic version. This will use the publicly available `breadcrumbs` variable
9
- # <%= render "headmin/breadcrumbs" %#>
9
+ # <%= render 'headmin/breadcrumbs' %#>
10
10
  %>
11
11
 
12
12
  <nav aria-label="breadcrumb">
@@ -6,7 +6,7 @@
6
6
  #
7
7
  # ==== Examples
8
8
  # Basic version
9
- # <%= render "headmin/dropdown" do %#>
9
+ # <%= render 'headmin/dropdown' do %#>
10
10
  # Your content
11
11
  # <% end %#>
12
12
 
@@ -6,12 +6,12 @@
6
6
  #
7
7
  # ==== Examples
8
8
  # Basic version
9
- # <%= render "headmin/filters" do %#>
10
- # <%= render "headmin/filters/select", name: 'color', options: ['red', 'green', 'blue'] %#>
9
+ # <%= render 'headmin/filters' do %#>
10
+ # <%= render 'headmin/filters/select', name: 'color', options: ['red', 'green', 'blue'] %#>
11
11
  # <% end %#>
12
12
  #
13
13
  # With custom URL
14
- # <%= render "headmin/filters", url: admin_polls_path %#>
14
+ # <%= render 'headmin/filters', url: admin_polls_path %#>
15
15
 
16
16
  action = local_assigns.has_key?(:url) ? url : request.path
17
17
  %>
@@ -19,12 +19,12 @@
19
19
  #
20
20
  # === Examples
21
21
  # Basic version
22
- # <%= render "headmin/form", model: @product do |form| %#>
22
+ # <%= render 'headmin/form', model: @product do |form| %#>
23
23
  # Form content
24
24
  # <% end %#>
25
25
  #
26
26
  # Specify URL to post to
27
- # <%= render "headmin/form", model: @product, url: admin_products_path do |form| %#>
27
+ # <%= render 'headmin/form', model: @product, url: admin_products_path do |form| %#>
28
28
  # Form content
29
29
  # <% end %#>
30
30
 
@@ -9,7 +9,7 @@
9
9
  #
10
10
  # ==== Examples
11
11
  # Basic version
12
- # <%= render "headmin/heading" do %#>
12
+ # <%= render 'headmin/heading' do %#>
13
13
  # Title
14
14
  # <% end %#>
15
15
  %>
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # === Examples
5
5
  # Basic version
6
- # <%= render "headmin/index" do %#>
6
+ # <%= render 'headmin/index' do %#>
7
7
  # Index content
8
8
  # <% end %#>
9
9
  %>
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # ==== Examples
5
5
  # Basic version
6
- # <%= render "headmin/notifications" %#>
6
+ # <%= render 'headmin/notifications' %#>
7
7
  %>
8
8
 
9
9
  <div class="toast-container position-absolute top-0 end-0 p-3">
@@ -6,7 +6,7 @@
6
6
  #
7
7
  # ==== Examples
8
8
  # Basic version
9
- # <%= render "headmin/pagination, collection: @pages" %#>
9
+ # <%= render 'headmin/pagination, collection: @pages' %#>
10
10
  %>
11
11
 
12
12
  <div class="d-flex flex-row-reverse flex-md-row align-items-center justify-content-between justify-content-md-end my-1">
@@ -8,7 +8,7 @@
8
8
  # To trigger this popup create an element with a data attribute like this
9
9
  #
10
10
  # <button data-popup-id="popupId">open Popup</button>
11
- # <%= render "headmin/popup", id: 'popupId' do %#>
11
+ # <%= render 'headmin/popup', id: 'popupId' do %#>
12
12
  # popup Content
13
13
  # <% end %#>
14
14
  #
@@ -16,7 +16,7 @@
16
16
  # "data-popup-pass-thru" attribute.
17
17
  #
18
18
  # <button data-popup-id="popupId" data-popup-pass-thru="#link">open Popup</button>
19
- # <%= render "headmin/popup", id: 'popupId' do %#>
19
+ # <%= render 'headmin/popup', id: 'popupId' do %#>
20
20
  # <a href="https://example.com" id="link">
21
21
  # <% end %#>
22
22
  data = local_assigns.has_key?(:data) ? data : {}
@@ -5,7 +5,7 @@
5
5
  # * +sort_url</tt> - Url to post object ids to in the order of positions
6
6
  #
7
7
  # ==== Examples
8
- # <%= render "headmin/table", sort_url: positions_admin_categories_path do %#>
8
+ # <%= render 'headmin/table', sort_url: positions_admin_categories_path do %#>
9
9
  # table content here
10
10
  # <% end %#>
11
11
 
@@ -7,10 +7,10 @@
7
7
  #
8
8
  # ==== Examples
9
9
  # Basic version
10
- # <%= render "headmin/dropdown/devise" %#>
10
+ # <%= render 'headmin/dropdown/devise' %#>
11
11
  #
12
12
  # Custom scope
13
- # <%= render "headmin/dropdown/devise", scope: :admins %#>
13
+ # <%= render 'headmin/dropdown/devise', scope: :admins %#>
14
14
 
15
15
  class_names = local_assigns.has_key?(:class) ? local_assigns[:class] : ""
16
16
  scope = local_assigns.has_key?(:scope) ? scope : :users
@@ -19,13 +19,13 @@
19
19
  %>
20
20
 
21
21
 
22
- <%= render "headmin/dropdown", class: class_names do %>
23
- <%= render "headmin/dropdown/button" do %>
22
+ <%= render 'headmin/dropdown', class: class_names do %>
23
+ <%= render 'headmin/dropdown/button' do %>
24
24
  <%= user.to_s %>
25
25
  <% end %>
26
- <%= render "headmin/dropdown/list", class: "dropdown-menu-end" do %>
27
- <%= render "headmin/dropdown/item", name: t("headmin.dropdown.devise.edit_profile"), url: polymorphic_path([:edit, :admin, user]) %>
28
- <%= render "headmin/dropdown/divider" %>
29
- <%= render "headmin/dropdown/item", name: t("headmin.dropdown.devise.log_out"), url: polymorphic_path([:destroy, singular, :session]), method: :delete %>
26
+ <%= render 'headmin/dropdown/list', class: "dropdown-menu-end" do %>
27
+ <%= render 'headmin/dropdown/item', name: t("headmin.dropdown.devise.edit_profile"), url: polymorphic_path([:edit, :admin, user]) %>
28
+ <%= render 'headmin/dropdown/divider' %>
29
+ <%= render 'headmin/dropdown/item', name: t("headmin.dropdown.devise.log_out"), url: polymorphic_path([:destroy, singular, :session]), method: :delete %>
30
30
  <% end %>
31
31
  <% end %>
@@ -7,7 +7,7 @@
7
7
  #
8
8
  # ==== Examples
9
9
  # Basic version
10
- # <%= render "headmin/dropdown/list", id: 'dropdown-1' %#>
10
+ # <%= render 'headmin/dropdown/list', id: 'dropdown-1' %#>
11
11
 
12
12
  class_names = local_assigns.has_key?(:class) ? local_assigns[:class] : ''
13
13
  id = local_assigns.has_key?(:id) ? id : 'dropdown-1'
@@ -4,14 +4,14 @@
4
4
  parameters: none
5
5
  %>
6
6
 
7
- <%= render "headmin/dropdown" do %>
8
- <%= render "headmin/dropdown/button", id: 'locale-dropdown' do %>
7
+ <%= render 'headmin/dropdown' do %>
8
+ <%= render 'headmin/dropdown/button', id: 'locale-dropdown' do %>
9
9
  <%= bootstrap_icon('globe', class: 'me-2') %>
10
10
  <%= t('language_name', locale: ::I18n.locale) %>
11
11
  <% end %>
12
- <%= render "headmin/dropdown/list", id: 'locale-dropdown' do %>
12
+ <%= render 'headmin/dropdown/list', id: 'locale-dropdown' do %>
13
13
  <% I18n.available_locales.each do |locale| %>
14
- <%= render "headmin/dropdown/item", name: t('language_name', locale: locale), url: url_for({locale: locale.to_s}) %>
14
+ <%= render 'headmin/dropdown/item', name: t('language_name', locale: locale), url: url_for({locale: locale.to_s}) %>
15
15
  <% end %>
16
16
  <% end %>
17
17
  <% end %>
@@ -11,8 +11,8 @@
11
11
  # ==== Examples
12
12
  # Basic version
13
13
  #
14
- # <%= render "headmin/filters/base", name: :title do |value| %#>
15
- # <%= render "headmin/forms/text", value: value %#>
14
+ # <%= render 'headmin/filters/base', name: :title do |value| %#>
15
+ # <%= render 'headmin/forms/text', value: value %#>
16
16
  # <% end %#>
17
17
  #
18
18
 
@@ -21,17 +21,17 @@
21
21
  %>
22
22
 
23
23
  <%= content_for :filters_menu do %>
24
- <%= render "headmin/filters/filter/menu_item", base.menu_item_options %>
24
+ <%= render 'headmin/filters/filter/menu_item', base.menu_item_options %>
25
25
  <% end %>
26
26
 
27
27
  <%= content_for :filters_templates do %>
28
28
  <template data-filter-name="<%= name %>" data-filters-target="template">
29
- <%= render "headmin/filters/filter/button", name: name, label: label, filter: nil, value: nil, id: "template_id" do %>
29
+ <%= render 'headmin/filters/filter/button', name: name, label: label, filter: nil, value: nil, id: "template_id" do %>
30
30
  <div class="h-filter-rows mb-3" data-filter-target="wrapper">
31
- <%= render "headmin/filters/filter/row" do %>
32
- <%= render "headmin/filters/filter/operator", base.filter_operator_options.merge({selected: nil}) %>
31
+ <%= render 'headmin/filters/filter/row' do %>
32
+ <%= render 'headmin/filters/filter/operator', base.filter_operator_options.merge({selected: nil}) %>
33
33
  <%= yield(nil) %>
34
- <%= render "headmin/filters/filter/null_select", value: nil %>
34
+ <%= render 'headmin/filters/filter/null_select', value: nil %>
35
35
  <% end %>
36
36
  </div>
37
37
 
@@ -45,11 +45,11 @@
45
45
 
46
46
  <!-- Filter template -->
47
47
  <template data-filter-target="template">
48
- <%= render "headmin/filters/filter/conditional" %>
49
- <%= render "headmin/filters/filter/row" do %>
50
- <%= render "headmin/filters/filter/operator", base.filter_operator_options.merge({selected: nil}) %>
48
+ <%= render 'headmin/filters/filter/conditional' %>
49
+ <%= render 'headmin/filters/filter/row' do %>
50
+ <%= render 'headmin/filters/filter/operator', base.filter_operator_options.merge({selected: nil}) %>
51
51
  <%= yield(nil) %>
52
- <%= render "headmin/filters/filter/null_select", value: nil %>
52
+ <%= render 'headmin/filters/filter/null_select', value: nil %>
53
53
  <% end %>
54
54
  </template>
55
55
  <% end %>
@@ -58,17 +58,17 @@
58
58
 
59
59
  <%= content_for :filters_buttons do %>
60
60
  <% if filter_param_exists?(name) %>
61
- <%= render "headmin/filters/filter/button", base.filter_button_options.merge({id: "#{name}_#{SecureRandom.hex}"}) do %>
61
+ <%= render 'headmin/filters/filter/button', base.filter_button_options.merge({id: "#{name}_#{SecureRandom.hex}"}) do %>
62
62
  <div class="h-filter-rows mb-3" data-filter-target="wrapper">
63
63
  <% filter.values.each_with_index do |value, index| %>
64
64
  <% if index > 0 %>
65
- <%= render "headmin/filters/filter/conditional", selected: filter.conditionals[index - 1] %>
65
+ <%= render 'headmin/filters/filter/conditional', selected: filter.conditionals[index - 1] %>
66
66
  <% end %>
67
67
 
68
- <%= render "headmin/filters/filter/row" do %>
69
- <%= render "headmin/filters/filter/operator", base.filter_operator_options.merge({selected: filter.operators[index]}) %>
68
+ <%= render 'headmin/filters/filter/row' do %>
69
+ <%= render 'headmin/filters/filter/operator', base.filter_operator_options.merge({selected: filter.operators[index]}) %>
70
70
  <%= yield(value) %>
71
- <%= render "headmin/filters/filter/null_select", value: value %>
71
+ <%= render 'headmin/filters/filter/null_select', value: value %>
72
72
  <% end %>
73
73
  <% end %>
74
74
  </div>
@@ -83,11 +83,11 @@
83
83
 
84
84
  <!-- Filter template -->
85
85
  <template data-filter-target="template">
86
- <%= render "headmin/filters/filter/conditional" %>
87
- <%= render "headmin/filters/filter/row" do %>
88
- <%= render "headmin/filters/filter/operator", base.filter_operator_options.merge({selected: nil}) %>
86
+ <%= render 'headmin/filters/filter/conditional' %>
87
+ <%= render 'headmin/filters/filter/row' do %>
88
+ <%= render 'headmin/filters/filter/operator', base.filter_operator_options.merge({selected: nil}) %>
89
89
  <%= yield(nil) %>
90
- <%= render "headmin/filters/filter/null_select", value: nil %>
90
+ <%= render 'headmin/filters/filter/null_select', value: nil %>
91
91
  <% end %>
92
92
  </template>
93
93
  <% end %>
@@ -11,13 +11,13 @@
11
11
  #
12
12
  # ==== Examples
13
13
  # Basic version
14
- # <%= render "headmin/filters", url: admin_orders_path do |form| %#>
15
- # <%= render "headmin/filters/boolean", form: form, attribute: :published %#>
14
+ # <%= render 'headmin/filters', url: admin_orders_path do |form| %#>
15
+ # <%= render 'headmin/filters/boolean', form: form, attribute: :published %#>
16
16
  # <% end %#>
17
17
 
18
18
  boolean = Headmin::Filter::BooleanView.new(local_assigns.merge(params: params))
19
19
  %>
20
20
 
21
- <%= render "headmin/filters/base", boolean.base_options do |value| %>
22
- <%= render "headmin/forms/select", boolean.input_options.merge(selected: value) %>
21
+ <%= render 'headmin/filters/base', boolean.base_options do |value| %>
22
+ <%= render 'headmin/forms/select', boolean.input_options.merge(selected: value) %>
23
23
  <% end %>
@@ -11,13 +11,13 @@
11
11
  #
12
12
  # ==== Examples
13
13
  # Basic version
14
- # <%= render "headmin/filters", url: admin_orders_path do |form| %#>
15
- # <%= render "headmin/filters/date", form: form, attribute: :created_at %#>
14
+ # <%= render 'headmin/filters', url: admin_orders_path do |form| %#>
15
+ # <%= render 'headmin/filters/date', form: form, attribute: :created_at %#>
16
16
  # <% end %#>
17
17
 
18
18
  date = Headmin::Filter::DateView.new(local_assigns.merge(params: params))
19
19
  %>
20
20
 
21
- <%= render "headmin/filters/base", date.base_options do |value| %>
22
- <%= render "headmin/forms/date", date.input_options.merge({value: value}) %>
21
+ <%= render 'headmin/filters/base', date.base_options do |value| %>
22
+ <%= render 'headmin/forms/date', date.input_options.merge({value: value}) %>
23
23
  <% end %>
@@ -11,14 +11,14 @@
11
11
  #
12
12
  # ==== Examples
13
13
  # Basic version
14
- # <%= render "headmin/filters", url: admin_orders_path do |form| %#>
15
- # <%= render "headmin/filters/flatpickr", form: form, attribute: :created_at %#>
14
+ # <%= render 'headmin/filters', url: admin_orders_path do |form| %#>
15
+ # <%= render 'headmin/filters/flatpickr', form: form, attribute: :created_at %#>
16
16
  # <% end %#>
17
17
 
18
18
  flatpickr = Headmin::Filter::FlatpickrView.new(local_assigns.merge(params: params))
19
19
  %>
20
20
 
21
- <%= render "headmin/filters/base", flatpickr.base_options do |value| %>
21
+ <%= render 'headmin/filters/base', flatpickr.base_options do |value| %>
22
22
  <% default_date = value != 1 && value != 0 ? value&.strftime("%d/%m/%Y") : value %>
23
- <%= render "headmin/forms/flatpickr", flatpickr.input_options.deep_merge({value: value, data: {flatpickr: {defaultDate: default_date}}}) %>
23
+ <%= render 'headmin/forms/flatpickr', flatpickr.input_options.deep_merge({value: value, data: {flatpickr: {defaultDate: default_date}}}) %>
24
24
  <% end %>