headmin 0.5.0 → 0.5.3

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 (113) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +2 -2
  3. data/Gemfile +14 -0
  4. data/Gemfile.lock +79 -2
  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 +15 -0
  19. data/app/assets/stylesheets/headmin.css +70 -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/helpers/headmin/form_helper.rb +2 -2
  24. data/app/models/concerns/headmin/field.rb +1 -1
  25. data/app/models/concerns/headmin/fieldable.rb +19 -10
  26. data/app/models/concerns/headmin/form/hintable.rb +6 -1
  27. data/app/models/headmin/blocks_view.rb +1 -1
  28. data/app/models/headmin/filter/date.rb +49 -1
  29. data/app/models/headmin/form/color_view.rb +48 -0
  30. data/app/models/headmin/form/media_view.rb +113 -0
  31. data/app/models/headmin/form/textarea_view.rb +6 -1
  32. data/app/views/examples/admin.html.erb +8 -8
  33. data/app/views/examples/auth.html.erb +2 -2
  34. data/app/views/headmin/_blocks.html.erb +1 -1
  35. data/app/views/headmin/_breadcrumbs.html.erb +2 -2
  36. data/app/views/headmin/_dropdown.html.erb +1 -1
  37. data/app/views/headmin/_filters.html.erb +5 -5
  38. data/app/views/headmin/_pagination.html.erb +2 -2
  39. data/app/views/headmin/_popup.html.erb +4 -4
  40. data/app/views/headmin/_table.html.erb +1 -1
  41. data/app/views/headmin/_thumbnail.html.erb +1 -1
  42. data/app/views/headmin/dropdown/_button.html.erb +2 -2
  43. data/app/views/headmin/dropdown/_item.html.erb +2 -2
  44. data/app/views/headmin/dropdown/_list.html.erb +3 -3
  45. data/app/views/headmin/dropdown/_locale.html.erb +5 -5
  46. data/app/views/headmin/filters/filter/_button.html.erb +2 -2
  47. data/app/views/headmin/filters/filter/_null_select.html.erb +2 -2
  48. data/app/views/headmin/forms/_color.html.erb +32 -0
  49. data/app/views/headmin/forms/_errors.html.erb +1 -1
  50. data/app/views/headmin/forms/_file.html.erb +7 -7
  51. data/app/views/headmin/forms/_hint.html.erb +6 -1
  52. data/app/views/headmin/forms/_media.html.erb +58 -0
  53. data/app/views/headmin/forms/_repeater.html.erb +9 -9
  54. data/app/views/headmin/forms/_textarea.html.erb +1 -1
  55. data/app/views/headmin/forms/media/_item.html.erb +32 -0
  56. data/app/views/headmin/forms/media/_validation.html.erb +10 -0
  57. data/app/views/headmin/forms/repeater/_row.html.erb +15 -14
  58. data/app/views/headmin/heading/_title.html.erb +2 -2
  59. data/app/views/headmin/layout/_main.html.erb +2 -0
  60. data/app/views/headmin/layout/_remote_modal.html.erb +1 -0
  61. data/app/views/headmin/layout/_sidebar.html.erb +1 -1
  62. data/app/views/headmin/media/_item.html.erb +17 -0
  63. data/app/views/headmin/media/_media_item_modal.html.erb +51 -0
  64. data/app/views/headmin/media/_modal.html.erb +35 -0
  65. data/app/views/headmin/media/create.turbo_stream.erb +5 -0
  66. data/app/views/headmin/media/index.html.erb +3 -0
  67. data/app/views/headmin/media/show.html.erb +9 -0
  68. data/app/views/headmin/media/update.turbo_stream.erb +3 -0
  69. data/app/views/headmin/nav/_dropdown.html.erb +7 -7
  70. data/app/views/headmin/nav/_item.html.erb +5 -5
  71. data/app/views/headmin/nav/item/_locale.html.erb +6 -6
  72. data/app/views/headmin/pagination/_per_page.html.erb +7 -7
  73. data/app/views/headmin/pagination/kaminari/_first_page.html.erb +2 -2
  74. data/app/views/headmin/pagination/kaminari/_gap.html.erb +1 -1
  75. data/app/views/headmin/pagination/kaminari/_last_page.html.erb +2 -2
  76. data/app/views/headmin/pagination/kaminari/_next_page.html.erb +3 -3
  77. data/app/views/headmin/pagination/kaminari/_page.html.erb +2 -2
  78. data/app/views/headmin/pagination/kaminari/_paginator.html.erb +1 -1
  79. data/app/views/headmin/pagination/kaminari/_prev_page.html.erb +2 -2
  80. data/app/views/headmin/table/_actions.html.erb +9 -9
  81. data/app/views/headmin/table/_body.html.erb +1 -1
  82. data/app/views/headmin/table/actions/_action.html.erb +4 -4
  83. data/app/views/headmin/table/actions/_export.html.erb +1 -1
  84. data/app/views/headmin/table/body/_association.html.erb +1 -1
  85. data/app/views/headmin/table/body/_boolean.erb +4 -4
  86. data/app/views/headmin/table/body/_color.html.erb +10 -0
  87. data/app/views/headmin/table/body/_date.html.erb +2 -2
  88. data/app/views/headmin/table/body/_image.html.erb +18 -0
  89. data/app/views/headmin/table/body/_string.html.erb +1 -1
  90. data/app/views/headmin/table/head/_cell.html.erb +1 -1
  91. data/app/views/headmin/table/head/cell/_asc.html.erb +2 -2
  92. data/app/views/headmin/table/head/cell/_default.html.erb +1 -1
  93. data/app/views/headmin/table/head/cell/_desc.html.erb +1 -1
  94. data/app/views/headmin/views/devise/confirmations/_new.html.erb +1 -1
  95. data/app/views/headmin/views/devise/passwords/_edit.html.erb +1 -1
  96. data/app/views/headmin/views/devise/passwords/_new.html.erb +1 -1
  97. data/app/views/headmin/views/devise/registrations/_edit.html.erb +5 -5
  98. data/app/views/headmin/views/devise/registrations/_new.html.erb +1 -1
  99. data/app/views/headmin/views/devise/sessions/_new.html.erb +1 -1
  100. data/app/views/headmin/views/devise/shared/_links.html.erb +11 -11
  101. data/app/views/headmin/views/devise/unlocks/_new.html.erb +1 -1
  102. data/config/locales/devise/nl.yml +1 -1
  103. data/config/locales/headmin/forms/en.yml +8 -0
  104. data/config/locales/headmin/forms/nl.yml +8 -0
  105. data/config/locales/headmin/media/en.yml +23 -0
  106. data/config/locales/headmin/media/nl.yml +22 -0
  107. data/config/locales/headmin/table/en.yml +2 -0
  108. data/config/locales/headmin/table/nl.yml +2 -0
  109. data/config/routes.rb +10 -0
  110. data/lib/generators/templates/views/layouts/auth.html.erb +2 -2
  111. data/lib/headmin/version.rb +1 -1
  112. data/package.json +1 -1
  113. metadata +30 -2
@@ -6,6 +6,6 @@
6
6
  per_page: number of items to fetch per page
7
7
  remote: data-remote
8
8
  -%>
9
- <li class="page-item <%= ('disabled' if current_page.first?) %>">
10
- <%= link_to raw(t '.button'), url, rel: 'prev', remote: remote, class: 'page-link' %>
9
+ <li class="page-item <%= ("disabled" if current_page.first?) %>">
10
+ <%= link_to raw(t ".button"), url, rel: "prev", remote: remote, class: "page-link" %>
11
11
  </li>
@@ -13,10 +13,10 @@
13
13
 
14
14
  <% content_for :table_actions do %>
15
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 :id, value: '', 'data-table-actions-target': 'idInput' %>
16
+ <%= form_with url: "", data: { "table-actions-target": "form" } do |form| %>
17
+ <%= form.hidden_field :id, value: "", "data-table-actions-target": "idInput" %>
18
18
  <%= form.hidden_field :authenticity_token, value: form_authenticity_token %>
19
- <%= form.hidden_field :_method, value: 'POST', 'data-table-actions-target': 'method' %>
19
+ <%= form.hidden_field :_method, value: "POST", "data-table-actions-target": "method" %>
20
20
  <%= query_parameter_fields(form) %>
21
21
 
22
22
  <div class="row g-1">
@@ -24,21 +24,21 @@
24
24
  <div class="d-flex align-items-center gap-3">
25
25
  <label class="text-nowrap"
26
26
  data-table-actions-target="counter"
27
- data-items-zero="<%= t('.items_html', count: 0) %>"
28
- data-items-one="<%= t('.items_html', count: 1) %>"
29
- data-items-other="<%= t('.items_html', count: 2) %>"
27
+ data-items-zero="<%= t(".items_html", count: 0) %>"
28
+ data-items-one="<%= t(".items_html", count: 1) %>"
29
+ data-items-other="<%= t(".items_html", count: 2) %>"
30
30
  >
31
- <%= t('.items_html', count: 0) %>
31
+ <%= t(".items_html", count: 0) %>
32
32
  </label>
33
33
  <select class="form-select me-1" data-table-actions-target="select" data-action="change->table-actions#update">
34
- <option disabled selected="selected"><%= t('.selection') %></option>
34
+ <option disabled selected="selected"><%= t(".selection") %></option>
35
35
  <%= yield %>
36
36
  </select>
37
37
  </div>
38
38
  </div>
39
39
  <div class="col-6 col-sm-auto">
40
40
  <button class="btn h-btn-outline-light w-100" type="submit" data-table-actions-target="button" disabled>
41
- <%= t('.apply') %>
41
+ <%= t(".apply") %>
42
42
  </button>
43
43
  </div>
44
44
  </div>
@@ -14,7 +14,7 @@
14
14
  <% else %>
15
15
  <tr>
16
16
  <td colspan="100%">
17
- <%= t('.empty') %>
17
+ <%= t(".empty") %>
18
18
  </td>
19
19
  </tr>
20
20
  <% end %>
@@ -9,16 +9,16 @@
9
9
  #
10
10
  # ==== Examples
11
11
  # Basic version.
12
- # <%= render "headmin/table/actions/action", name: 'export', url: export_admin_products_path %#>
12
+ # <%= render "headmin/table/actions/action", name: "export", url: export_admin_products_path %#>
13
13
  #
14
14
  # Use a different HTTP method
15
- # <%= render "headmin/table/actions/action", name: 'export', url: export_admin_products_path, method: :post %#>
15
+ # <%= render "headmin/table/actions/action", name: "export", url: export_admin_products_path, method: :post %#>
16
16
  #
17
17
  # Show a confirm dialog before submitting.
18
- # <%= render "headmin/table/actions/action", name: 'delete', url: destroy_admin_products_path, confirm: 'Are you sure you want to delete these products?' %#>
18
+ # <%= render "headmin/table/actions/action", name: "delete", url: destroy_admin_products_path, confirm: "Are you sure you want to delete these products?" %#>
19
19
 
20
20
  url = local_assigns.has_key?(:url) ? local_assigns[:url] : request.path
21
- method = local_assigns.has_key?(:method) ? local_assigns[:method] : 'GET'
21
+ method = local_assigns.has_key?(:method) ? local_assigns[:method] : "GET"
22
22
  confirm = local_assigns.has_key?(:confirm) ? local_assigns[:confirm] : nil
23
23
  turbo = confirm ? true : false
24
24
  %>
@@ -9,4 +9,4 @@
9
9
  # <%= render "headmin/table/actions/export", url: export_admin_products_path %#>
10
10
  %>
11
11
 
12
- <%= render "headmin/table/actions/action", name: t('.button'), url: url %>
12
+ <%= render "headmin/table/actions/action", name: t(".button"), url: url %>
@@ -7,5 +7,5 @@
7
7
  %>
8
8
 
9
9
  <td>
10
- <%= t('.items', count: object.send(attribute).count) %>
10
+ <%= t(".items", count: object.send(attribute).count) %>
11
11
  </td>
@@ -7,10 +7,10 @@
7
7
 
8
8
  <td>
9
9
  <% if value %>
10
- <%= bootstrap_icon('check-circle-fill', class: 'text-success') %>&nbsp;
11
- <%= t('.true') %>
10
+ <%= bootstrap_icon("check-circle-fill", class: "text-success") %>&nbsp;
11
+ <%= t(".true") %>
12
12
  <% else %>
13
- <%= bootstrap_icon('x-circle-fill', class: 'text-secondary') %>&nbsp;
14
- <%= t('.false') %>
13
+ <%= bootstrap_icon("x-circle-fill", class: "text-secondary") %>&nbsp;
14
+ <%= t(".false") %>
15
15
  <% end %>
16
16
  </td>
@@ -0,0 +1,10 @@
1
+ <%#
2
+ headmin/table/body/color
3
+ accepts block: no
4
+ parameters:
5
+ value: (hexadecimal) Color value
6
+ %>
7
+
8
+ <td>
9
+ <div class="h-table-cell-color" style="--cell-color: <%= value %>" title="<%= value %>"></div>
10
+ </td>
@@ -5,7 +5,7 @@
5
5
  value: (DateTime) Date to be displayed
6
6
  %>
7
7
 
8
- <% format = defined?(format) && format ? format : t('.format') %>
8
+ <% format = defined?(format) && format ? format : t(".format") %>
9
9
  <td>
10
- <%= value ? l(value, format: format) : t('.empty') %>
10
+ <%= value ? l(value, format: format) : t(".empty") %>
11
11
  </td>
@@ -0,0 +1,18 @@
1
+ <%#
2
+ headmin/table/body/text
3
+ accepts block: no
4
+ parameters:
5
+ value: (activestorage) image
6
+ %>
7
+
8
+ <td class="h-table-cell-image">
9
+ <% if value&.attached? %>
10
+ <% if defined?(url) && url %>
11
+ <%= link_to url, title: t(".open") do %>
12
+ <%= image_tag value.variant(resize_to_fill: [34, 34]), width: 34, height: 34, alt: value.filename, title: value.filename %>
13
+ <% end %>
14
+ <% else %>
15
+ <%= image_tag value.variant(resize_to_fill: [34, 34]), width: 34, height: 34, alt: value.filename, title: value.filename %>
16
+ <% end %>
17
+ <% end %>
18
+ </td>
@@ -7,7 +7,7 @@
7
7
 
8
8
  <td>
9
9
  <% if defined?(url) && url %>
10
- <a href="<%= url %>" title="<% t('.open') %>">
10
+ <a href="<%= url %>" title="<% t(".open") %>">
11
11
  <%= value %>
12
12
  </a>
13
13
  <% else %>
@@ -7,7 +7,7 @@
7
7
  %>
8
8
 
9
9
  <% sorting_param_key = local_assigns.has_key?(:sort) && sort ? "sort_#{sort}" : nil %>
10
- <% template_name = params[sorting_param_key] || 'default' %>
10
+ <% template_name = params[sorting_param_key] || "default" %>
11
11
  <th>
12
12
  <%= render "headmin/table/head/cell/#{template_name}", key: sorting_param_key, title: value %>
13
13
  </th>
@@ -1,4 +1,4 @@
1
- <a href="<%= url_for(params.merge(key => 'desc').permit!) %>">
1
+ <a href="<%= url_for(params.merge(key => "desc").permit!) %>">
2
2
  <%= title %>
3
- <%= bootstrap_icon('sort-down') %>
3
+ <%= bootstrap_icon("sort-down") %>
4
4
  </a>
@@ -1,5 +1,5 @@
1
1
  <% if key.present? %>
2
- <a href="<%= url_for(params.merge(key => 'asc').permit!) %>">
2
+ <a href="<%= url_for(params.merge(key => "asc").permit!) %>">
3
3
  <%= title %>
4
4
  </a>
5
5
  <% else %>
@@ -1,4 +1,4 @@
1
1
  <a href="<%= url_for(params.merge(key => nil).permit!) %>">
2
2
  <%= title %>
3
- <%= bootstrap_icon('sort-up') %>
3
+ <%= bootstrap_icon("sort-up") %>
4
4
  </a>
@@ -3,7 +3,7 @@
3
3
 
4
4
  <%= render "headmin/forms/email", form: f, attribute: :email, required: true, float: true %>
5
5
 
6
- <%= f.submit t('.resend'), class: 'btn btn-lg btn-primary w-100' %>
6
+ <%= f.submit t(".resend"), class: "btn btn-lg btn-primary w-100" %>
7
7
 
8
8
  <%= render "headmin/views/devise/shared/links" %>
9
9
  <% end %>
@@ -6,7 +6,7 @@
6
6
  <%= render "headmin/forms/password", form: f, attribute: :password, required: true, float: true %>
7
7
  <%= render "headmin/forms/password", form: f, attribute: :password_confirmation, required: true, float: true %>
8
8
 
9
- <%= f.submit t('.change_password'), class: 'btn btn-lg btn-primary w-100' %>
9
+ <%= f.submit t(".change_password"), class: "btn btn-lg btn-primary w-100" %>
10
10
 
11
11
  <%= render "headmin/views/devise/shared/links" %>
12
12
  <% end %>
@@ -3,7 +3,7 @@
3
3
 
4
4
  <%= render "headmin/forms/email", form: f, attribute: :email, required: true, float: true %>
5
5
 
6
- <%= f.submit t('.send_instructions'), class: 'btn btn-lg btn-primary w-100' %>
6
+ <%= f.submit t(".send_instructions"), class: "btn btn-lg btn-primary w-100" %>
7
7
 
8
8
  <%= render "headmin/views/devise/shared/links" %>
9
9
  <% end %>
@@ -5,20 +5,20 @@
5
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
- <div><%= t('.waiting_confirmation', email: resource.unconfirmed_email) %></div>
8
+ <div><%= t(".waiting_confirmation", email: resource.unconfirmed_email) %></div>
9
9
  <% end %>
10
10
 
11
11
  <%= render "headmin/forms/password", form: f, attribute: :password, required: true, float: true %>
12
12
  <%= render "headmin/forms/password", form: f, attribute: :password_confirmation, required: true, float: true %>
13
13
  <%= render "headmin/forms/password", form: f, attribute: :current_password, required: true, float: true %>
14
14
 
15
- <%= f.submit t('.change'), class: 'btn btn-lg btn-primary w-100' %>
15
+ <%= f.submit t(".change"), class: "btn btn-lg btn-primary w-100" %>
16
16
  <% end %>
17
17
 
18
18
  <div class="mt-5">
19
- <h4><%= t('.cancel') %></h4>
19
+ <h4><%= t(".cancel") %></h4>
20
20
 
21
- <p><%= t('.unhappy') %></p>
22
- <%= button_to t('.cancel'), registration_path(resource_name), class: 'btn btn-lg btn-danger w-100', "data-turbo-confirm": "Are you sure?", "data-turbo-method": "delete" %>
21
+ <p><%= t(".unhappy") %></p>
22
+ <%= button_to t(".cancel"), registration_path(resource_name), class: "btn btn-lg btn-danger w-100", "data-turbo-confirm": "Are you sure?", "data-turbo-method": "delete" %>
23
23
  </div>
24
24
  </div>
@@ -5,7 +5,7 @@
5
5
  <%= render "headmin/forms/password", form: f, attribute: :password, required: true, float: true %>
6
6
  <%= render "headmin/forms/password", form: f, attribute: :password_confirmation, required: true, float: true %>
7
7
 
8
- <%= f.submit t('.sign_up'), class: 'btn btn-lg btn-primary w-100' %>
8
+ <%= f.submit t(".sign_up"), class: "btn btn-lg btn-primary w-100" %>
9
9
 
10
10
  <%= render "headmin/views/devise/shared/links" %>
11
11
  <% end %>
@@ -7,7 +7,7 @@
7
7
  <%= render "headmin/forms/checkbox", form: f, attribute: :remember_me %>
8
8
  <% end %>
9
9
 
10
- <%= f.submit t('.login'), class: 'btn btn-lg btn-primary w-100' %>
10
+ <%= f.submit t(".login"), class: "btn btn-lg btn-primary w-100" %>
11
11
 
12
12
  <%= render "headmin/views/devise/shared/links" %>
13
13
  <% end %>
@@ -1,27 +1,27 @@
1
1
  <div class="bg-light mt-5 text-center">
2
- <%- if controller_name != 'sessions' %>
3
- <%= link_to t('.sign_in'), new_session_path(resource_name) %><br />
2
+ <%- if controller_name != "sessions" %>
3
+ <%= link_to t(".sign_in"), new_session_path(resource_name) %><br />
4
4
  <% end %>
5
5
 
6
- <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
7
- <%= link_to t('.sign_up'), new_registration_path(resource_name) %><br />
6
+ <%- if devise_mapping.registerable? && controller_name != "registrations" %>
7
+ <%= link_to t(".sign_up"), new_registration_path(resource_name) %><br />
8
8
  <% end %>
9
9
 
10
- <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
11
- <%= link_to t('.forgot_password'), new_password_path(resource_name) %><br />
10
+ <%- if devise_mapping.recoverable? && controller_name != "passwords" && controller_name != "registrations" %>
11
+ <%= link_to t(".forgot_password"), new_password_path(resource_name) %><br />
12
12
  <% end %>
13
13
 
14
- <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
15
- <%= link_to t('.confirmation'), new_confirmation_path(resource_name) %><br />
14
+ <%- if devise_mapping.confirmable? && controller_name != "confirmations" %>
15
+ <%= link_to t(".confirmation"), new_confirmation_path(resource_name) %><br />
16
16
  <% end %>
17
17
 
18
- <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
19
- <%= link_to t('.unlock'), new_unlock_path(resource_name) %><br />
18
+ <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != "unlocks" %>
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 t('.omniauth', provider: OmniAuth::Utils.camelize(provider)), omniauth_authorize_path(resource_name, provider), method: :post %><br />
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>
@@ -3,7 +3,7 @@
3
3
 
4
4
  <%= render "headmin/forms/email", form: f, attribute: :email, required: true, float: true %>
5
5
 
6
- <%= f.submit t('.resend'), class: 'btn btn-lg btn-primary w-100' %>
6
+ <%= f.submit t(".resend"), class: "btn btn-lg btn-primary w-100" %>
7
7
 
8
8
  <%= render "headmin/views/devise/shared/links" %>
9
9
 
@@ -5,7 +5,7 @@
5
5
  # This includes the changes from Devise 4.5 and 4.6:
6
6
  # A new key was added in Devise 4.5: `updated_but_not_signed_in:`
7
7
  # In Devise 4.6, the old helper `<% devise_error_messages %>` was replaced with
8
- # `<%= render "devise/shared/error_messages", resource: resource %>`
8
+ # `<%= render 'devise/shared/error_messages', resource: resource %>`
9
9
 
10
10
  # Starting points for this translation:
11
11
  # * User-centered language: don't tell what the system knows, tell what the user should do or should expect
@@ -18,6 +18,14 @@ en:
18
18
  remove:
19
19
  title: Delete
20
20
  confirm: Are you sure you want to delete this?
21
+ media:
22
+ validation:
23
+ min:
24
+ one: "Please select at least 1 item"
25
+ other: "Please select at least %{count} items"
26
+ max:
27
+ one: "Please limit your selection to maximum 1 item"
28
+ other: "Please limit your selection to maximum %{count} items"
21
29
  select:
22
30
  blank: Make a choice
23
31
  repeater:
@@ -17,6 +17,14 @@ nl:
17
17
  remove:
18
18
  title: Verwijderen
19
19
  confirm: Ben je zeker dat je dit wil verwijderen?
20
+ media:
21
+ validation:
22
+ min:
23
+ one: "Gelieve minstens 1 item te selecteren"
24
+ other: "Gelieve minstens %{count} items te selecteren"
25
+ max:
26
+ one: "Gelieve maximum 1 item te selecteren"
27
+ other: "Gelieve maximum %{count} items te selecteren"
20
28
  select:
21
29
  blank: Maak een keuze
22
30
  repeater:
@@ -0,0 +1,23 @@
1
+ en:
2
+ headmin:
3
+ media:
4
+ modal:
5
+ close: Close
6
+ placeholder: Upload your first file to the media library
7
+ limits: "minimum: %{min} en maximum: %{max}"
8
+ select: Select
9
+ title:
10
+ one: Select at least 1 file
11
+ other: Select at least %{count} files
12
+ unlimited: unlimited
13
+ upload: Upload new files
14
+ maximum: " of %{count}"
15
+ media_item_modal:
16
+ close: Close
17
+ dimensions: Dimensions
18
+ edit: Edit Media item
19
+ not_analysed: Not yet analysed
20
+ size: Size
21
+ type: File type
22
+ update: Update
23
+ uploaded_at: Uploaded at
@@ -0,0 +1,22 @@
1
+ nl:
2
+ headmin:
3
+ media:
4
+ modal:
5
+ close: Sluiten
6
+ placeholder: Upload je eerste bestand naar de mediabibliotheek
7
+ limits: "minimum: %{min} and maximum: %{max}"
8
+ select: Selecteer
9
+ title:
10
+ one: Selecteer bestand
11
+ other: Selecteer bestanden
12
+ unlimited: onbeperkt
13
+ upload: Nieuwe bestanden uploaden
14
+ media_item_modal:
15
+ close: Sluiten
16
+ dimensions: Afmetingen
17
+ edit: Media item wijzigen
18
+ not_analysed: Nog niet geanalyseerd
19
+ size: Grootte
20
+ type: Bestandstype
21
+ update: Update
22
+ uploaded_at: Geüpload op
@@ -25,3 +25,5 @@ en:
25
25
  empty: N/A
26
26
  format: '%m-%d-%Y %H:%M'
27
27
  empty: No results found
28
+ image:
29
+ open: Open
@@ -25,3 +25,5 @@ nl:
25
25
  empty: Nvt.
26
26
  format: '%d-%m-%Y %H:%M'
27
27
  empty: Geen resultaten gevonden
28
+ image:
29
+ open: Openen
data/config/routes.rb ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ Rails.application.routes.draw do
4
+ namespace(:headmin) do
5
+ get "media", to: "media#index", as: :media
6
+ post "media", to: "media#create"
7
+ get "media/:id", to: "media#show", as: :media_item
8
+ patch "media/:id", to: "media#update"
9
+ end
10
+ end
@@ -5,8 +5,8 @@
5
5
  <meta name="viewport" content="width=device-width,initial-scale=1">
6
6
  <%= csrf_meta_tags %>
7
7
  <%= csp_meta_tag %>
8
- <%= stylesheet_pack_tag 'admin', media: 'all', 'data-turbolinks-track': 'reload' %>
9
- <%= javascript_pack_tag 'admin', 'data-turbolinks-track': 'reload' %>
8
+ <%= stylesheet_pack_tag "admin", media: "all", "data-turbolinks-track": "reload" %>
9
+ <%= javascript_pack_tag "admin", "data-turbolinks-track": "reload" %>
10
10
  </head>
11
11
  <body class="bg-light w-100 vh-100">
12
12
 
@@ -1,3 +1,3 @@
1
1
  module Headmin
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.3"
3
3
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "headmin",
3
- "version": "0.4.2",
3
+ "version": "0.5.2",
4
4
  "description": "Admin component library",
5
5
  "module": "app/assets/javascripts/headmin.js",
6
6
  "main": "app/assets/javascripts/headmin.js",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: headmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jef Vlamings
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-05 00:00:00.000000000 Z
11
+ date: 2022-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: closure_tree
@@ -105,13 +105,17 @@ files:
105
105
  - app/assets/javascripts/headmin/controllers/filters_controller.js
106
106
  - app/assets/javascripts/headmin/controllers/flatpickr_controller.js
107
107
  - app/assets/javascripts/headmin/controllers/hello_controller.js
108
+ - app/assets/javascripts/headmin/controllers/media_controller.js
109
+ - app/assets/javascripts/headmin/controllers/media_modal_controller.js
108
110
  - app/assets/javascripts/headmin/controllers/notification_controller.js
109
111
  - app/assets/javascripts/headmin/controllers/popup_controller.js
110
112
  - app/assets/javascripts/headmin/controllers/redactorx_controller.js
113
+ - app/assets/javascripts/headmin/controllers/remote_modal_controller.js
111
114
  - app/assets/javascripts/headmin/controllers/repeater_controller.js
112
115
  - app/assets/javascripts/headmin/controllers/select_controller.js
113
116
  - app/assets/javascripts/headmin/controllers/table_actions_controller.js
114
117
  - app/assets/javascripts/headmin/controllers/table_controller.js
118
+ - app/assets/javascripts/headmin/controllers/textarea_controller.js
115
119
  - app/assets/javascripts/headmin/index.js
116
120
  - app/assets/stylesheets/headmin.css
117
121
  - app/assets/stylesheets/headmin.scss
@@ -120,6 +124,7 @@ files:
120
124
  - app/assets/stylesheets/headmin/forms.scss
121
125
  - app/assets/stylesheets/headmin/forms/autocomplete.scss
122
126
  - app/assets/stylesheets/headmin/forms/file.scss
127
+ - app/assets/stylesheets/headmin/forms/media.scss
123
128
  - app/assets/stylesheets/headmin/forms/repeater.scss
124
129
  - app/assets/stylesheets/headmin/forms/search.scss
125
130
  - app/assets/stylesheets/headmin/general.scss
@@ -127,6 +132,8 @@ files:
127
132
  - app/assets/stylesheets/headmin/layout/body.scss
128
133
  - app/assets/stylesheets/headmin/layout/sidebar.scss
129
134
  - app/assets/stylesheets/headmin/login.scss
135
+ - app/assets/stylesheets/headmin/media.scss
136
+ - app/assets/stylesheets/headmin/media/index.scss
130
137
  - app/assets/stylesheets/headmin/overrides/bootstrap.scss
131
138
  - app/assets/stylesheets/headmin/overrides/redactorx.scss
132
139
  - app/assets/stylesheets/headmin/popup.scss
@@ -229,6 +236,8 @@ files:
229
236
  - app/controllers/concerns/headmin/filterable.rb
230
237
  - app/controllers/concerns/headmin/pagination.rb
231
238
  - app/controllers/concerns/headmin/sortable.rb
239
+ - app/controllers/headmin/media_controller.rb
240
+ - app/controllers/headmin_controller.rb
232
241
  - app/helpers/headmin/admin_helper.rb
233
242
  - app/helpers/headmin/bootstrap_helper.rb
234
243
  - app/helpers/headmin/filter_helper.rb
@@ -272,6 +281,7 @@ files:
272
281
  - app/models/headmin/filters.rb
273
282
  - app/models/headmin/form/blocks_view.rb
274
283
  - app/models/headmin/form/checkbox_view.rb
284
+ - app/models/headmin/form/color_view.rb
275
285
  - app/models/headmin/form/date_range_view.rb
276
286
  - app/models/headmin/form/date_view.rb
277
287
  - app/models/headmin/form/datetime_range_view.rb
@@ -284,6 +294,7 @@ files:
284
294
  - app/models/headmin/form/hint_view.rb
285
295
  - app/models/headmin/form/input_group_view.rb
286
296
  - app/models/headmin/form/label_view.rb
297
+ - app/models/headmin/form/media_view.rb
287
298
  - app/models/headmin/form/number_view.rb
288
299
  - app/models/headmin/form/password_view.rb
289
300
  - app/models/headmin/form/redactorx_view.rb
@@ -334,6 +345,7 @@ files:
334
345
  - app/views/headmin/forms/_autocomplete.html.erb
335
346
  - app/views/headmin/forms/_blocks.html.erb
336
347
  - app/views/headmin/forms/_checkbox.html.erb
348
+ - app/views/headmin/forms/_color.html.erb
337
349
  - app/views/headmin/forms/_datalist.html.erb
338
350
  - app/views/headmin/forms/_date.html.erb
339
351
  - app/views/headmin/forms/_date_range.html.erb
@@ -348,6 +360,7 @@ files:
348
360
  - app/views/headmin/forms/_hint.html.erb
349
361
  - app/views/headmin/forms/_input_group.html.erb
350
362
  - app/views/headmin/forms/_label.html.erb
363
+ - app/views/headmin/forms/_media.html.erb
351
364
  - app/views/headmin/forms/_number.html.erb
352
365
  - app/views/headmin/forms/_password.html.erb
353
366
  - app/views/headmin/forms/_redactorx.html.erb
@@ -369,6 +382,8 @@ files:
369
382
  - app/views/headmin/forms/fields/_group.html.erb
370
383
  - app/views/headmin/forms/fields/_list.html.erb
371
384
  - app/views/headmin/forms/fields/_text.html.erb
385
+ - app/views/headmin/forms/media/_item.html.erb
386
+ - app/views/headmin/forms/media/_validation.html.erb
372
387
  - app/views/headmin/forms/repeater/_row.html.erb
373
388
  - app/views/headmin/heading/_title.html.erb
374
389
  - app/views/headmin/layout/_body.html.erb
@@ -376,9 +391,17 @@ files:
376
391
  - app/views/headmin/layout/_footer.html.erb
377
392
  - app/views/headmin/layout/_header.html.erb
378
393
  - app/views/headmin/layout/_main.html.erb
394
+ - app/views/headmin/layout/_remote_modal.html.erb
379
395
  - app/views/headmin/layout/_sidebar.html.erb
380
396
  - app/views/headmin/layout/sidebar/_bottom.html.erb
381
397
  - app/views/headmin/layout/sidebar/_nav.html.erb
398
+ - app/views/headmin/media/_item.html.erb
399
+ - app/views/headmin/media/_media_item_modal.html.erb
400
+ - app/views/headmin/media/_modal.html.erb
401
+ - app/views/headmin/media/create.turbo_stream.erb
402
+ - app/views/headmin/media/index.html.erb
403
+ - app/views/headmin/media/show.html.erb
404
+ - app/views/headmin/media/update.turbo_stream.erb
382
405
  - app/views/headmin/nav/_dropdown.html.erb
383
406
  - app/views/headmin/nav/_item.html.erb
384
407
  - app/views/headmin/nav/item/_devise.html.erb
@@ -402,9 +425,11 @@ files:
402
425
  - app/views/headmin/table/actions/_export.html.erb
403
426
  - app/views/headmin/table/body/_association.html.erb
404
427
  - app/views/headmin/table/body/_boolean.erb
428
+ - app/views/headmin/table/body/_color.html.erb
405
429
  - app/views/headmin/table/body/_currency.html.erb
406
430
  - app/views/headmin/table/body/_date.html.erb
407
431
  - app/views/headmin/table/body/_id.html.erb
432
+ - app/views/headmin/table/body/_image.html.erb
408
433
  - app/views/headmin/table/body/_row.html.erb
409
434
  - app/views/headmin/table/body/_sort.html.erb
410
435
  - app/views/headmin/table/body/_string.html.erb
@@ -448,6 +473,8 @@ files:
448
473
  - config/locales/headmin/heading/nl.yml
449
474
  - config/locales/headmin/layout/en.yml
450
475
  - config/locales/headmin/layout/nl.yml
476
+ - config/locales/headmin/media/en.yml
477
+ - config/locales/headmin/media/nl.yml
451
478
  - config/locales/headmin/nav/en.yml
452
479
  - config/locales/headmin/nav/nl.yml
453
480
  - config/locales/headmin/pagination/en.yml
@@ -461,6 +488,7 @@ files:
461
488
  - config/locales/headmin/views/en.yml
462
489
  - config/locales/headmin/views/nl.yml
463
490
  - config/locales/nl.yml
491
+ - config/routes.rb
464
492
  - esbuild-css.js
465
493
  - esbuild-js.js
466
494
  - headmin.gemspec