headmin 0.2.7 → 0.2.9

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 (33) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/app/views/examples/admin.html.erb +1 -1
  4. data/app/views/headmin/_card.html.erb +3 -1
  5. data/app/views/headmin/_filters.html.erb +2 -2
  6. data/app/views/headmin/_pagination.html.erb +2 -4
  7. data/app/views/headmin/_table.html.erb +9 -3
  8. data/app/views/headmin/filters/_date.html.erb +5 -3
  9. data/app/views/headmin/filters/_flatpickr.html.erb +57 -0
  10. data/app/views/headmin/forms/_base.html.erb +12 -11
  11. data/app/views/headmin/forms/_blocks.html.erb +1 -1
  12. data/app/views/headmin/forms/_date.html.erb +24 -12
  13. data/app/views/headmin/forms/_date_range.html.erb +84 -0
  14. data/app/views/headmin/forms/_flatpickr.html.erb +55 -0
  15. data/app/views/headmin/forms/_flatpickr_range.html.erb +61 -0
  16. data/app/views/headmin/forms/_hidden.html.erb +23 -0
  17. data/app/views/headmin/forms/_label.html.erb +3 -1
  18. data/app/views/headmin/forms/_select.html.erb +14 -11
  19. data/app/views/headmin/forms/_text.html.erb +7 -9
  20. data/app/views/headmin/layout/_main.html.erb +11 -5
  21. data/app/views/headmin/table/_actions.html.erb +1 -3
  22. data/app/views/headmin/table/body/_row.html.erb +14 -6
  23. data/dist/css/headmin.css +4 -1
  24. data/dist/js/headmin.js +40 -5
  25. data/lib/headmin/version.rb +1 -1
  26. data/src/js/headmin/controllers/date_range_controller.js +34 -0
  27. data/src/js/headmin/controllers/flatpickr_controller.js +38 -0
  28. data/src/js/headmin/controllers/repeater_controller.js +0 -1
  29. data/src/js/headmin/controllers/table_actions_controller.js +7 -37
  30. data/src/js/headmin/controllers/table_controller.js +23 -3
  31. data/src/js/headmin/headmin.js +36 -19
  32. data/src/scss/headmin/form.scss +4 -0
  33. metadata +10 -3
@@ -1,10 +1,16 @@
1
- <%#
2
- headmin/layout/main
3
- accepts block: yes
4
- parameters: none
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? %>
@@ -9,7 +9,6 @@
9
9
  # <%= render 'headmin/table/actions/delete', url: destroy_admin_pages_path %#>
10
10
  # <% end %#>
11
11
 
12
- selection_count = content_for(:collection_total_count).to_i || 0
13
12
  %>
14
13
 
15
14
  <% content_for :table_actions do %>
@@ -28,12 +27,11 @@
28
27
  <div class="d-flex align-items-center gap-3">
29
28
  <label class="text-nowrap"
30
29
  data-table-actions-target="counter"
31
- data-total-count="<%= selection_count %>"
32
30
  data-items-zero="<%= t('.items_html', count: 0) %>"
33
31
  data-items-one="<%= t('.items_html', count: 1) %>"
34
32
  data-items-other="<%= t('.items_html', count: 2) %>"
35
33
  >
36
- <%= t('.items_html', count: selection_count) %>
34
+ <%= t('.items_html', count: 0) %>
37
35
  </label>
38
36
  <select class="form-select me-1" data-table-actions-target="select" data-action="change->table-actions#update">
39
37
  <option disabled selected="selected"><%= t('.selection') %></option>
@@ -1,9 +1,17 @@
1
- <%#
2
- headmin/table/body/row
3
- accepts block: yes
4
- parameters: none
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
- <tr>
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>