fluxbit_view_components 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +10 -0
- data/app/assets/javascripts/fluxbit_view_components/assigner_controller.js +49 -0
- data/app/assets/javascripts/fluxbit_view_components/auto_submit_controller.js +39 -0
- data/app/assets/javascripts/fluxbit_view_components/drawer_controller.js +135 -0
- data/app/assets/javascripts/fluxbit_view_components/index.js +56 -0
- data/app/assets/javascripts/fluxbit_view_components/method_link_controller.js +143 -0
- data/app/assets/javascripts/fluxbit_view_components/modal_controller.js +118 -0
- data/app/assets/javascripts/fluxbit_view_components/password_controller.js +170 -0
- data/app/assets/javascripts/fluxbit_view_components/progress_controller.js +374 -0
- data/app/assets/javascripts/fluxbit_view_components/row_click_controller.js +32 -0
- data/app/assets/javascripts/fluxbit_view_components/select_all_controller.js +122 -0
- data/app/assets/javascripts/fluxbit_view_components/spinner_percent_controller.js +174 -0
- data/app/assets/javascripts/fluxbit_view_components/theme_button_controller.js +90 -0
- data/app/assets/javascripts/fluxbit_view_components.js +1175 -0
- data/app/components/fluxbit/accordion_component.rb +125 -0
- data/app/components/fluxbit/alert_component.rb +8 -8
- data/app/components/fluxbit/avatar_component.rb +11 -12
- data/app/components/fluxbit/avatar_group_component.rb +1 -1
- data/app/components/fluxbit/badge_component.rb +8 -7
- data/app/components/fluxbit/banner_component.rb +139 -0
- data/app/components/fluxbit/bottom_navigation_component.rb +437 -0
- data/app/components/fluxbit/breadcrumb_component.rb +66 -0
- data/app/components/fluxbit/button_component.rb +39 -11
- data/app/components/fluxbit/button_group_component.rb +1 -1
- data/app/components/fluxbit/card_component.rb +26 -23
- data/app/components/fluxbit/carousel_component.rb +154 -0
- data/app/components/fluxbit/component.rb +24 -3
- data/app/components/fluxbit/drawer_component.html.erb +30 -0
- data/app/components/fluxbit/drawer_component.rb +125 -0
- data/app/components/fluxbit/dropdown_component.rb +41 -0
- data/app/components/fluxbit/dropdown_item_component.rb +68 -0
- data/app/components/fluxbit/flex_component.rb +1 -1
- data/app/components/fluxbit/form/check_box_component.rb +56 -0
- data/app/components/fluxbit/form/component.rb +27 -26
- data/app/components/fluxbit/form/dropzone_component.html.erb +39 -0
- data/app/components/fluxbit/form/dropzone_component.rb +39 -0
- data/app/components/fluxbit/form/field_component.rb +28 -0
- data/app/components/fluxbit/form/form_builder_component.rb +1 -1
- data/app/components/fluxbit/form/{helper_text_component.rb → help_text_component.rb} +9 -4
- data/app/components/fluxbit/form/label_component.rb +40 -30
- data/app/components/fluxbit/form/password_component.rb +247 -0
- data/app/components/fluxbit/form/radio_group_button_component.rb +126 -0
- data/app/components/fluxbit/form/range_component.rb +52 -0
- data/app/components/fluxbit/form/select_component.rb +185 -0
- data/app/components/fluxbit/form/text_field_component.rb +185 -0
- data/app/components/fluxbit/form/toggle_component.html.erb +23 -0
- data/app/components/fluxbit/form/toggle_component.rb +81 -0
- data/app/components/fluxbit/form/upload_image_component.html.erb +50 -0
- data/app/components/fluxbit/form/upload_image_component.rb +61 -0
- data/app/components/fluxbit/gravatar_component.rb +7 -0
- data/app/components/fluxbit/icon_helpers.rb +167 -0
- data/app/components/fluxbit/link_component.rb +42 -0
- data/app/components/fluxbit/modal_component.rb +28 -31
- data/app/components/fluxbit/pagination_component.rb +206 -0
- data/app/components/fluxbit/popover_component.rb +14 -14
- data/app/components/fluxbit/progress_component.rb +196 -0
- data/app/components/fluxbit/skeleton_component.rb +237 -0
- data/app/components/fluxbit/speed_dial_action_component.html.erb +30 -0
- data/app/components/fluxbit/speed_dial_action_component.rb +59 -0
- data/app/components/fluxbit/speed_dial_component.html.erb +33 -0
- data/app/components/fluxbit/speed_dial_component.rb +73 -0
- data/app/components/fluxbit/spinner_component.rb +71 -0
- data/app/components/fluxbit/spinner_percent_component.rb +174 -0
- data/app/components/fluxbit/stepper_component.rb +223 -0
- data/app/components/fluxbit/tab_component.rb +44 -25
- data/app/components/fluxbit/table_component.rb +186 -0
- data/app/components/fluxbit/table_group_component.rb +28 -0
- data/app/components/fluxbit/theme_button_component.rb +64 -0
- data/app/components/fluxbit/timeline_component.rb +63 -0
- data/app/components/fluxbit/timeline_item_component.html.erb +64 -0
- data/app/components/fluxbit/timeline_item_component.rb +78 -0
- data/app/components/fluxbit/tooltip_component.rb +2 -2
- data/app/helpers/fluxbit/components_helper.rb +93 -51
- data/app/helpers/fluxbit/form_builder.rb +136 -0
- data/app/helpers/fluxbit/view_helper.rb +71 -0
- data/config/locales/en.yml +37 -4
- data/config/locales/pt-BR.yml +36 -0
- data/lib/fluxbit/config/accordion_component.rb +73 -0
- data/lib/fluxbit/config/avatar_component.rb +11 -11
- data/lib/fluxbit/config/badge_component.rb +14 -11
- data/lib/fluxbit/config/banner_component.rb +60 -0
- data/lib/fluxbit/config/bottom_navigation_component.rb +74 -0
- data/lib/fluxbit/config/breadcrumb_component.rb +24 -0
- data/lib/fluxbit/config/button_component.rb +6 -4
- data/lib/fluxbit/config/card_component.rb +23 -12
- data/lib/fluxbit/config/carousel_component.rb +33 -0
- data/lib/fluxbit/config/drawer_component.rb +48 -0
- data/lib/fluxbit/config/dropdown_component.rb +29 -0
- data/lib/fluxbit/config/form/check_box_component.rb +19 -0
- data/lib/fluxbit/config/form/dropzone_component.rb +20 -0
- data/lib/fluxbit/config/form/{helper_text_component.rb → help_text_component.rb} +2 -2
- data/lib/fluxbit/config/form/label_component.rb +31 -0
- data/lib/fluxbit/config/form/password_component.rb +19 -0
- data/lib/fluxbit/config/form/radio_group_button_component.rb +24 -0
- data/lib/fluxbit/config/form/range_component.rb +15 -0
- data/lib/fluxbit/config/form/text_field_component.rb +76 -0
- data/lib/fluxbit/config/form/toggle_component.rb +79 -0
- data/lib/fluxbit/config/link_component.rb +24 -0
- data/lib/fluxbit/config/modal_component.rb +1 -1
- data/lib/fluxbit/config/pagination_component.rb +31 -0
- data/lib/fluxbit/config/popover_component.rb +1 -1
- data/lib/fluxbit/config/progress_component.rb +63 -0
- data/lib/fluxbit/config/skeleton_component.rb +82 -0
- data/lib/fluxbit/config/speed_dial_component.rb +50 -0
- data/lib/fluxbit/config/spinner_component.rb +30 -0
- data/lib/fluxbit/config/spinner_percent_component.rb +61 -0
- data/lib/fluxbit/config/stepper_component.rb +299 -0
- data/lib/fluxbit/config/tab_component.rb +6 -0
- data/lib/fluxbit/config/table_component.rb +75 -0
- data/lib/fluxbit/config/theme_button_component.rb +19 -0
- data/lib/fluxbit/config/timeline_component.rb +77 -0
- data/lib/fluxbit/view_components/engine.rb +11 -3
- data/lib/fluxbit/view_components/version.rb +1 -1
- data/lib/fluxbit/view_components.rb +27 -1
- data/lib/generators/fluxbit/devise_views_generator.rb +116 -0
- data/lib/generators/fluxbit/pagy_generator.rb +39 -0
- data/lib/generators/fluxbit/scaffold_generator.rb +165 -0
- data/lib/generators/fluxbit/templates/_alert.html.erb.tt +1 -0
- data/lib/generators/fluxbit/templates/_flash.html.erb.tt +15 -0
- data/lib/generators/fluxbit/templates/_form.html.erb.tt +38 -0
- data/lib/generators/fluxbit/templates/_metadata.html.erb.tt +44 -0
- data/lib/generators/fluxbit/templates/controller.rb.tt +406 -0
- data/lib/generators/fluxbit/templates/create.turbo_stream.erb.tt +7 -0
- data/lib/generators/fluxbit/templates/destroy.turbo_stream.erb.tt +3 -0
- data/lib/generators/fluxbit/templates/destroy_all.turbo_stream.erb.tt +9 -0
- data/lib/generators/fluxbit/templates/devise_views/confirmations/new.html.erb +11 -0
- data/lib/generators/fluxbit/templates/devise_views/layouts/devise.html.erb +64 -0
- data/lib/generators/fluxbit/templates/devise_views/mailer/confirmation_instructions.html.erb +5 -0
- data/lib/generators/fluxbit/templates/devise_views/mailer/email_changed.html.erb +7 -0
- data/lib/generators/fluxbit/templates/devise_views/mailer/password_changed.html.erb +3 -0
- data/lib/generators/fluxbit/templates/devise_views/mailer/reset_password_instructions.html.erb +8 -0
- data/lib/generators/fluxbit/templates/devise_views/mailer/unlock_instructions.html.erb +7 -0
- data/lib/generators/fluxbit/templates/devise_views/passwords/edit.html.erb +29 -0
- data/lib/generators/fluxbit/templates/devise_views/passwords/new.html.erb +11 -0
- data/lib/generators/fluxbit/templates/devise_views/registrations/edit.html.erb +43 -0
- data/lib/generators/fluxbit/templates/devise_views/registrations/new.html.erb +34 -0
- data/lib/generators/fluxbit/templates/devise_views/sessions/new.html.erb +15 -0
- data/lib/generators/fluxbit/templates/devise_views/shared/_error_messages.html.erb +14 -0
- data/lib/generators/fluxbit/templates/devise_views/shared/_links.html.erb +25 -0
- data/lib/generators/fluxbit/templates/devise_views/unlocks/new.html.erb +11 -0
- data/lib/generators/fluxbit/templates/edit.html.erb.tt +47 -0
- data/lib/generators/fluxbit/templates/fluxbit_pagy.css +27 -0
- data/lib/generators/fluxbit/templates/i18n.en.yml.tt +121 -0
- data/lib/generators/fluxbit/templates/i18n.pt-BR.yml.tt +121 -0
- data/lib/generators/fluxbit/templates/index.html.erb.tt +254 -0
- data/lib/generators/fluxbit/templates/index.json.jbuilder.tt +33 -0
- data/lib/generators/fluxbit/templates/new.html.erb.tt +47 -0
- data/lib/generators/fluxbit/templates/partial.html.erb.tt +61 -0
- data/lib/generators/fluxbit/templates/policy.rb.tt +36 -0
- data/lib/generators/fluxbit/templates/send_alert_via_drawer.erb.tt +10 -0
- data/lib/generators/fluxbit/templates/show.html.erb.tt +44 -0
- data/lib/generators/fluxbit/templates/show.json.jbuilder.tt +6 -0
- data/lib/generators/fluxbit/templates/update.turbo_stream.erb.tt +10 -0
- data/lib/generators/fluxbit/templates/update_all.turbo_stream.erb.tt +20 -0
- data/lib/install/install.rb +61 -3
- metadata +127 -35
- data/LICENSE.txt +0 -20
- data/app/components/fluxbit/form/checkbox_input_component.rb +0 -61
- data/app/components/fluxbit/form/datepicker_component.rb +0 -7
- data/app/components/fluxbit/form/radio_input_component.rb +0 -21
- data/app/components/fluxbit/form/range_input_component.rb +0 -51
- data/app/components/fluxbit/form/select_free_input_component.rb +0 -77
- data/app/components/fluxbit/form/select_input_component.rb +0 -21
- data/app/components/fluxbit/form/spacer_input_component.rb +0 -12
- data/app/components/fluxbit/form/text_input_component.rb +0 -225
- data/app/components/fluxbit/form/textarea_input_component.rb +0 -57
- data/app/components/fluxbit/form/toggle_input_component.rb +0 -166
- data/app/components/fluxbit/form/upload_image_input_component.html.erb +0 -48
- data/app/components/fluxbit/form/upload_image_input_component.rb +0 -61
- data/app/components/fluxbit/form/upload_input_component.html.erb +0 -12
- data/app/components/fluxbit/form/upload_input_component.rb +0 -47
- data/app/helpers/fluxbit/classes_helper.rb +0 -9
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<% content_for(:header) do %>
|
|
2
|
+
<%= fx_heading with_content: "Log in", size: 2, class: "text-center mt-8" %>
|
|
3
|
+
<% end %>
|
|
4
|
+
|
|
5
|
+
<%= form_for(resource, as: resource_name, url: session_path(resource_name), builder: Fluxbit::FormBuilder) do |f| %>
|
|
6
|
+
<%= f.fx_email_field :email, autofocus: true, autocomplete: "email", helper_popover: false, help_text: false, wrapper_html: {class: "mb-6 field"} %>
|
|
7
|
+
<%= f.fx_password :password, autocomplete: "current-password", helper_popover: false, help_text: false, wrapper_html: {class: "mb-6 field"} %>
|
|
8
|
+
|
|
9
|
+
<% if devise_mapping.rememberable? %>
|
|
10
|
+
<%= f.fx_toggle :remember_me, wrapper_html: {class: "mb-6 field"} %>
|
|
11
|
+
<% end %>
|
|
12
|
+
<%= f.fx_submit "Log in" %>
|
|
13
|
+
<% end %>
|
|
14
|
+
|
|
15
|
+
<%= render "devise/shared/links" %>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<% if resource.errors.any? %>
|
|
2
|
+
<%= fx_alert(color: :danger, 'data-turbo-cache' => "false") do %>
|
|
3
|
+
<%= I18n.t("errors.messages.not_saved",
|
|
4
|
+
count: resource.errors.count,
|
|
5
|
+
resource: resource.class.model_name.human.downcase)
|
|
6
|
+
%>
|
|
7
|
+
|
|
8
|
+
<ul>
|
|
9
|
+
<% resource.errors.full_messages.each do |message| %>
|
|
10
|
+
<li><%= message %></li>
|
|
11
|
+
<% end %>
|
|
12
|
+
</ul>
|
|
13
|
+
<% end %>
|
|
14
|
+
<% end %>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<%- if controller_name != 'sessions' %>
|
|
2
|
+
<p><%= fx_link_to "Log in", new_session_path(resource_name) %></p>
|
|
3
|
+
<% end %>
|
|
4
|
+
|
|
5
|
+
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
|
|
6
|
+
<p><%= fx_link_to "Sign up", new_registration_path(resource_name) %></p>
|
|
7
|
+
<% end %>
|
|
8
|
+
|
|
9
|
+
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
|
|
10
|
+
<p><%= fx_link_to "Forgot your password?", new_password_path(resource_name) %></p>
|
|
11
|
+
<% end %>
|
|
12
|
+
|
|
13
|
+
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
|
14
|
+
<p><%= fx_link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %></p>
|
|
15
|
+
<% end %>
|
|
16
|
+
|
|
17
|
+
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
|
18
|
+
<p><%= fx_link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %></p>
|
|
19
|
+
<% end %>
|
|
20
|
+
|
|
21
|
+
<%- if devise_mapping.omniauthable? %>
|
|
22
|
+
<%- resource_class.omniauth_providers.each do |provider| %>
|
|
23
|
+
<p><%= fx_link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider), data: { turbo: false } %></p>
|
|
24
|
+
<% end %>
|
|
25
|
+
<% end %>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<% content_for(:header) do %>
|
|
2
|
+
<%= fx_heading with_content: "Resend unlock instructions", size: 2, class: 'text-center' %>
|
|
3
|
+
<% end %>
|
|
4
|
+
|
|
5
|
+
<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }, builder: Fluxbit::FormBuilder) do |f| %>
|
|
6
|
+
<%= render "devise/shared/error_messages", resource: resource %>
|
|
7
|
+
<%= f.fx_email_field :email, autofocus: true, autocomplete: "email", wrapper_html: {class: "mb-6 field"} %>
|
|
8
|
+
<%= f.fx_submit "Resend unlock instructions" %>
|
|
9
|
+
<% end %>
|
|
10
|
+
|
|
11
|
+
<%= render "devise/shared/links" %>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<% singular = file_name.singularize; plural = file_name.pluralize -%>
|
|
2
|
+
<% if options[:ui] == "drawer" -%>
|
|
3
|
+
<% if options[:turbo] -%>
|
|
4
|
+
<%% if turbo_frame_request? %>
|
|
5
|
+
<turbo-frame id="drawer">
|
|
6
|
+
<%%= fx_drawer(id: "edit-drawer", placement: :right, sizing: :xl, data: {controller: "fx-drawer"}) do |drawer| %>
|
|
7
|
+
<%% drawer.with_header { t("<%= plural %>.titles.edit") } %>
|
|
8
|
+
<%%= render "form", <%= singular %>: @<%= singular %> %>
|
|
9
|
+
<%% end %>
|
|
10
|
+
<script>document.dispatchEvent(new CustomEvent("showDrawer:edit-drawer"));</script>
|
|
11
|
+
</turbo-frame>
|
|
12
|
+
<%% else %>
|
|
13
|
+
<%%= fx_heading(class: "m-4", size: 2) { t("<%= plural %>.titles.edit") } %>
|
|
14
|
+
<%%= fx_card(class: "m-4") do |card| %>
|
|
15
|
+
<%% card.with_section do %>
|
|
16
|
+
<%%= render "form", <%= singular %>: @<%= singular %> %>
|
|
17
|
+
<%% end %>
|
|
18
|
+
<%% end %>
|
|
19
|
+
<%% end %>
|
|
20
|
+
<% end -%>
|
|
21
|
+
<% elsif options[:ui] == "modal" -%>
|
|
22
|
+
<% if options[:turbo] -%>
|
|
23
|
+
<%% if turbo_frame_request? %>
|
|
24
|
+
<turbo-frame id="modal">
|
|
25
|
+
<%%= fx_modal(id: "edit-modal", size: :xl, data: {controller: "fx-modal"}) do |modal| %>
|
|
26
|
+
<%% modal.with_header { t("<%= plural %>.titles.edit") } %>
|
|
27
|
+
<%%= render "form", <%= singular %>: @<%= singular %> %>
|
|
28
|
+
<%% end %>
|
|
29
|
+
<script>document.dispatchEvent(new CustomEvent("showModal:edit-modal"));</script>
|
|
30
|
+
</turbo-frame>
|
|
31
|
+
<%% else %>
|
|
32
|
+
<%%= fx_heading(class: "m-4", size: 2) { t("<%= plural %>.titles.edit") } %>
|
|
33
|
+
<%%= fx_card(class: "m-4") do |card| %>
|
|
34
|
+
<%% card.with_section do %>
|
|
35
|
+
<%%= render "form", <%= singular %>: @<%= singular %> %>
|
|
36
|
+
<%% end %>
|
|
37
|
+
<%% end %>
|
|
38
|
+
<%% end %>
|
|
39
|
+
<% end -%>
|
|
40
|
+
<% else -%>
|
|
41
|
+
<%%= fx_heading(class: "m-4", size: 2) { t("<%= plural %>.titles.edit") } %>
|
|
42
|
+
<%%= fx_card(class: "m-4") do |card| %>
|
|
43
|
+
<%% card.with_section do %>
|
|
44
|
+
<%%= render "form", <%= singular %>: @<%= singular %> %>
|
|
45
|
+
<%% end %>
|
|
46
|
+
<%% end %>
|
|
47
|
+
<% end -%>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
.pagy.info {
|
|
2
|
+
@apply text-sm text-slate-600 dark:text-slate-400;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.pagy.nav {
|
|
6
|
+
@apply inline-flex -space-x-px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.pagy.nav a {
|
|
10
|
+
@apply flex items-center justify-center px-3 h-8 leading-tight text-slate-500 bg-white border border-slate-300 hover:bg-slate-100 hover:text-slate-700 dark:bg-slate-800 dark:border-slate-700 dark:text-slate-400 dark:hover:bg-slate-700 dark:hover:text-white;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.pagy.nav a[aria-label="previous"] {
|
|
14
|
+
@apply ms-0 border-e-0 rounded-s-lg;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.pagy.nav a[aria-label="next"] {
|
|
18
|
+
@apply rounded-e-lg;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.pagy.nav a[aria-disabled="true"] {
|
|
22
|
+
@apply px-3 py-1 text-slate-400 cursor-default;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.pagy.nav a.current {
|
|
26
|
+
@apply text-blue-600 bg-blue-50 hover:bg-blue-100 hover:text-blue-700 dark:bg-slate-700 dark:border-slate-700 dark:text-white;
|
|
27
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
<% singular = file_name.singularize; plural = file_name.pluralize -%>
|
|
2
|
+
en:
|
|
3
|
+
<%= plural %>:
|
|
4
|
+
class_name:
|
|
5
|
+
one: <%= singular.titlecase %>
|
|
6
|
+
other: <%= plural.titlecase %>
|
|
7
|
+
titles:
|
|
8
|
+
index: <%= plural.titlecase %>
|
|
9
|
+
new: New <%= singular.titlecase %>
|
|
10
|
+
edit: Edit <%= singular.titlecase %>
|
|
11
|
+
show: <%= singular.titlecase %> Details
|
|
12
|
+
index_name: Index
|
|
13
|
+
fields:
|
|
14
|
+
id: Record ID
|
|
15
|
+
<% attributes.reject { |attr| attr.type == :password_digest }.each do |attr| -%>
|
|
16
|
+
<%= attr.name %><%= ['references','belongs_to'].include?(attr.type) ? '_id' : '' %>: <%= attr.name.titlecase %>
|
|
17
|
+
<% end -%>
|
|
18
|
+
created_at: Created
|
|
19
|
+
updated_at: Last Updated
|
|
20
|
+
help_text:
|
|
21
|
+
<% attributes.reject { |attr| attr.type == :password_digest }.each do |attr| -%>
|
|
22
|
+
<%= attr.name %><%= ['references','belongs_to'].include?(attr.type) ? '_id' : '' %>: Help for <%= attr.name.titlecase %>
|
|
23
|
+
<% end -%>
|
|
24
|
+
helper_popover:
|
|
25
|
+
<% attributes.reject { |attr| attr.type == :password_digest }.each do |attr| -%>
|
|
26
|
+
<%= attr.name %><%= ['references','belongs_to'].include?(attr.type) ? '_id' : '' %>: Helper Popover for <%= attr.name.titlecase %>
|
|
27
|
+
<% end -%>
|
|
28
|
+
placeholders:
|
|
29
|
+
<% attributes.reject { |attr| attr.type == :password_digest }.each do |attr| -%>
|
|
30
|
+
<%= attr.name %><%= ['references','belongs_to'].include?(attr.type) ? '_id' : '' %>: Placeholder for <%= attr.name.titlecase %>
|
|
31
|
+
<% end -%>
|
|
32
|
+
prompts:
|
|
33
|
+
<% attributes.select { |attr| ['references','belongs_to'].include?(attr.type) }.each do |attr| -%>
|
|
34
|
+
<%= attr.name %>_id: Select a <%= attr.name.titlecase %>
|
|
35
|
+
<% end -%>
|
|
36
|
+
messages:
|
|
37
|
+
not_found: "<%= singular.titlecase %> not found."
|
|
38
|
+
not_selected_for_action: "No <%= plural %> selected for action."
|
|
39
|
+
not_authorized: "You are not authorized to perform this action."
|
|
40
|
+
no_records: "No <%= plural %> found."
|
|
41
|
+
no_records_sub: "Try adjusting your search or filters."
|
|
42
|
+
create_success: "<%= singular.titlecase %> was successfully created."
|
|
43
|
+
update_success: "<%= singular.titlecase %> was successfully updated."
|
|
44
|
+
destroy_success: "<%= singular.titlecase %> was successfully destroyed."
|
|
45
|
+
destroy_failure: "Failed to delete <%= singular %>."
|
|
46
|
+
bulk_update_success:
|
|
47
|
+
one: "The <%= singular %> were successfully updated."
|
|
48
|
+
other: "%{count} <%= plural %> were successfully updated."
|
|
49
|
+
bulk_update_failure: "Failed to update some <%= plural %>. %{errors}"
|
|
50
|
+
bulk_destroy_success:
|
|
51
|
+
one: "The <%= singular %> were successfully deleted."
|
|
52
|
+
other: "%{count} <%= plural %> were successfully deleted."
|
|
53
|
+
bulk_destroy_failure: "Failed to delete some <%= plural %>. %{errors}"
|
|
54
|
+
order_error: "Invalid order parameter."
|
|
55
|
+
confirm_destroy: "Are you sure you want to delete this item?"
|
|
56
|
+
confirm_bulk_destroy: "Are you sure you want to delete <span id=\"mass-deletion-count\" data-fx-select-all-target=\"count\">0</span> item(s)?"
|
|
57
|
+
pagination_info: "Showing <b>%{start}</b> to <b>%{end}</b> of <b>%{total}</b> <%= plural %>"
|
|
58
|
+
errors_message:
|
|
59
|
+
one: "%{count} error prevented this <%= singular %> from being saved:"
|
|
60
|
+
other: "%{count} errors prevented this <%= singular %> from being saved:"
|
|
61
|
+
<% attributes
|
|
62
|
+
.select { |a| %i[boolean].include?(a.type) }
|
|
63
|
+
.each do |attr|
|
|
64
|
+
-%>
|
|
65
|
+
click_to_change<%= attr.name %>: Click to change <%= attr.name %>
|
|
66
|
+
<% end -%>
|
|
67
|
+
actions:
|
|
68
|
+
new: "New <%= singular.titlecase %>"
|
|
69
|
+
actions: "Actions (<span data-fx-select-all-target=\"count\">0</span>)"
|
|
70
|
+
edit: "Edit"
|
|
71
|
+
show: "Show"
|
|
72
|
+
back: "Back"
|
|
73
|
+
save: "Save"
|
|
74
|
+
cancel: "Cancel"
|
|
75
|
+
create: "Create"
|
|
76
|
+
update: "Update"
|
|
77
|
+
destroy: "Destroy"
|
|
78
|
+
export: "Export"
|
|
79
|
+
<% attributes
|
|
80
|
+
.select { |a| %i[boolean].include?(a.type) }
|
|
81
|
+
.each do |attr|
|
|
82
|
+
-%>
|
|
83
|
+
activate_<%= attr.name %>_selected: Activate <%= attr.name %> selected
|
|
84
|
+
deactivate_<%= attr.name %>_selected: Deactivate <%= attr.name %> selected
|
|
85
|
+
<% end -%>
|
|
86
|
+
delete_selected: "Delete Selected"
|
|
87
|
+
remove_filters: "Remove filters"
|
|
88
|
+
bulk_destroy: "Destroy Selected"
|
|
89
|
+
cancel_destroy: "No, cancel"
|
|
90
|
+
confirm_destroy: "Yes, I'm sure"
|
|
91
|
+
per_page: "%{count} per page"
|
|
92
|
+
helpers:
|
|
93
|
+
search: "Search <%= plural %>..."
|
|
94
|
+
sort: "Sort <%= plural %>..."
|
|
95
|
+
export: "Export to CSV"
|
|
96
|
+
filter: "Filter"
|
|
97
|
+
<% attributes
|
|
98
|
+
.select { |a| %i[integer decimal text string].include?(a.type) }
|
|
99
|
+
.each do |attr|
|
|
100
|
+
-%>
|
|
101
|
+
filter_<%= attr.name %>: "Filter by <%= attr.name %>"
|
|
102
|
+
<% end -%>
|
|
103
|
+
click_to_edit: "Click to edit"
|
|
104
|
+
<% attributes
|
|
105
|
+
.select { |a| %i[boolean].include?(a.type) }
|
|
106
|
+
.each do |attr|
|
|
107
|
+
-%>
|
|
108
|
+
click_to_change_<%= attr.name %>: "Click to change <%= attr.name %>"
|
|
109
|
+
<% end -%>
|
|
110
|
+
click_to_destroy_selected: "Click to destroy selected"
|
|
111
|
+
submits_with: "Saving..."
|
|
112
|
+
values:
|
|
113
|
+
no_value: "-"
|
|
114
|
+
<% attributes
|
|
115
|
+
.select { |a| %i[boolean].include?(a.type) }
|
|
116
|
+
.each do |attr|
|
|
117
|
+
-%>
|
|
118
|
+
<%= attr.name %>:
|
|
119
|
+
true: Active
|
|
120
|
+
false: Inactive
|
|
121
|
+
<% end -%>
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
<% singular = file_name.singularize; plural = file_name.pluralize -%>
|
|
2
|
+
pt-BR:
|
|
3
|
+
<%= plural %>:
|
|
4
|
+
class_name:
|
|
5
|
+
one: <%= singular.titlecase %>
|
|
6
|
+
other: <%= plural.titlecase %>
|
|
7
|
+
titles:
|
|
8
|
+
index: <%= plural.titlecase %>
|
|
9
|
+
new: Novo <%= singular.titlecase %>
|
|
10
|
+
edit: Editar <%= singular.titlecase %>
|
|
11
|
+
show: Detalhes de <%= singular.titlecase %>
|
|
12
|
+
index_name: Inicio
|
|
13
|
+
fields:
|
|
14
|
+
id: Identificador
|
|
15
|
+
<% attributes.reject { |attr| attr.type == :password_digest }.each do |attr| -%>
|
|
16
|
+
<%= attr.name %><%= ['references','belongs_to'].include?(attr.type) ? '_id' : '' %>: <%= attr.name.titlecase %>
|
|
17
|
+
<% end -%>
|
|
18
|
+
created_at: Criado em
|
|
19
|
+
updated_at: Última Atualização
|
|
20
|
+
help_text:
|
|
21
|
+
<% attributes.reject { |attr| attr.type == :password_digest }.each do |attr| -%>
|
|
22
|
+
<%= attr.name %><%= ['references','belongs_to'].include?(attr.type) ? '_id' : '' %>: Ajuda para <%= attr.name.titlecase %>
|
|
23
|
+
<% end -%>
|
|
24
|
+
helper_popover:
|
|
25
|
+
<% attributes.reject { |attr| attr.type == :password_digest }.each do |attr| -%>
|
|
26
|
+
<%= attr.name %><%= ['references','belongs_to'].include?(attr.type) ? '_id' : '' %>: Ajuda no popover para <%= attr.name.titlecase %>
|
|
27
|
+
<% end -%>
|
|
28
|
+
placeholders:
|
|
29
|
+
<% attributes.reject { |attr| attr.type == :password_digest }.each do |attr| -%>
|
|
30
|
+
<%= attr.name %><%= ['references','belongs_to'].include?(attr.type) ? '_id' : '' %>: Placeholder para <%= attr.name.titlecase %>
|
|
31
|
+
<% end -%>
|
|
32
|
+
prompts:
|
|
33
|
+
<% attributes.select { |attr| ['references','belongs_to'].include?(attr.type) }.each do |attr| -%>
|
|
34
|
+
<%= attr.name %>_id: Selecione um <%= attr.name.titlecase %>
|
|
35
|
+
<% end -%>
|
|
36
|
+
messages:
|
|
37
|
+
not_found: "<%= singular.titlecase %> não encontrado."
|
|
38
|
+
not_selected_for_action: "Nenhum <%= plural %> selecionado para ação."
|
|
39
|
+
not_authorized: "Você não está autorizado a executar esta ação."
|
|
40
|
+
no_records: "Nenhum <%= plural %> encontrados."
|
|
41
|
+
no_records_sub: "Tente ajustar a sua busca ou filtros."
|
|
42
|
+
create_success: "<%= singular.titlecase %> foi criado com sucesso."
|
|
43
|
+
update_success: "<%= singular.titlecase %> foi atualizado com sucesso."
|
|
44
|
+
destroy_success: "<%= singular.titlecase %> foi apagado com sucesso."
|
|
45
|
+
destroy_failure: "Falha ao tentar apagar um <%= singular %>."
|
|
46
|
+
bulk_update_success:
|
|
47
|
+
one: "O <%= singular %> foi atualizado com sucesso."
|
|
48
|
+
other: "%{count} <%= plural %> foram atualizados com sucesso."
|
|
49
|
+
bulk_update_failure: "Falha ao tentar atualizar alguns <%= plural %>. %{errors}"
|
|
50
|
+
bulk_destroy_success:
|
|
51
|
+
one: "O <%= singular %> foi apagado com sucesso."
|
|
52
|
+
other: "%{count} <%= plural %> foram apagados com sucesso."
|
|
53
|
+
bulk_destroy_failure: "Falha ao tentar apagar alguns <%= plural %>. %{errors}"
|
|
54
|
+
order_error: "Parâmetro de ordenamento inválido."
|
|
55
|
+
confirm_destroy: "Você tem certeza de que quer apagar este item?"
|
|
56
|
+
confirm_bulk_destroy: "Você tem certeza de que quer apagar <span id=\"mass-deletion-count\" data-fx-select-all-target=\"count\">0</span> item(s)?"
|
|
57
|
+
pagination_info: "Mostrando <b>%{start}</b> à <b>%{end}</b> de <b>%{total}</b> <%= plural %>"
|
|
58
|
+
errors_message:
|
|
59
|
+
one: "%{count} erro impediu que este <%= singular %> fosse salvo:"
|
|
60
|
+
other: "%{count} erros impediram que este <%= singular %> fosse salvo:"
|
|
61
|
+
<% attributes
|
|
62
|
+
.select { |a| %i[boolean].include?(a.type) }
|
|
63
|
+
.each do |attr|
|
|
64
|
+
-%>
|
|
65
|
+
click_to_change<%= attr.name %>: Clique para modificar <%= attr.name %>
|
|
66
|
+
<% end -%>
|
|
67
|
+
actions:
|
|
68
|
+
new: "Novo <%= singular.titlecase %>"
|
|
69
|
+
actions: "Ações (<span data-fx-select-all-target=\"count\">0</span>)"
|
|
70
|
+
edit: "Editar"
|
|
71
|
+
show: "Ver"
|
|
72
|
+
back: "Voltar"
|
|
73
|
+
save: "Salvar"
|
|
74
|
+
cancel: "Cancelar"
|
|
75
|
+
create: "Criar"
|
|
76
|
+
update: "Atualizar"
|
|
77
|
+
destroy: "Apagar"
|
|
78
|
+
export: "Exportar"
|
|
79
|
+
<% attributes
|
|
80
|
+
.select { |a| %i[boolean].include?(a.type) }
|
|
81
|
+
.each do |attr|
|
|
82
|
+
-%>
|
|
83
|
+
activate_<%= attr.name %>_selected: Ativar <%= attr.name %> selecionado
|
|
84
|
+
deactivate_<%= attr.name %>_selected: Desativar <%= attr.name %> selecionado
|
|
85
|
+
<% end -%>
|
|
86
|
+
delete_selected: "Apagar selecionado"
|
|
87
|
+
remove_filters: "Remover filtros"
|
|
88
|
+
bulk_destroy: "Apagar selecionados"
|
|
89
|
+
cancel_destroy: "Não, cancelar"
|
|
90
|
+
confirm_destroy: "Sim, Tenho certeza"
|
|
91
|
+
per_page: "%{count} por página"
|
|
92
|
+
helpers:
|
|
93
|
+
search: "Procurar <%= plural %>..."
|
|
94
|
+
sort: "Ordenar <%= plural %>..."
|
|
95
|
+
export: "Exportar para CSV"
|
|
96
|
+
filter: "Filtrar"
|
|
97
|
+
<% attributes
|
|
98
|
+
.select { |a| %i[integer decimal text string].include?(a.type) }
|
|
99
|
+
.each do |attr|
|
|
100
|
+
-%>
|
|
101
|
+
filter_<%= attr.name %>: "Filtrar por <%= attr.name %>"
|
|
102
|
+
<% end -%>
|
|
103
|
+
click_to_edit: "Clique para editar"
|
|
104
|
+
<% attributes
|
|
105
|
+
.select { |a| %i[boolean].include?(a.type) }
|
|
106
|
+
.each do |attr|
|
|
107
|
+
-%>
|
|
108
|
+
click_to_change_<%= attr.name %>: "Clique para mudar <%= attr.name %>"
|
|
109
|
+
<% end -%>
|
|
110
|
+
click_to_destroy_selected: "Clique para apagar selecionados"
|
|
111
|
+
submits_with: "Salvando..."
|
|
112
|
+
values:
|
|
113
|
+
no_value: "-"
|
|
114
|
+
<% attributes
|
|
115
|
+
.select { |a| %i[boolean].include?(a.type) }
|
|
116
|
+
.each do |attr|
|
|
117
|
+
-%>
|
|
118
|
+
<%= attr.name %>:
|
|
119
|
+
true: Ativo
|
|
120
|
+
false: Inativo
|
|
121
|
+
<% end -%>
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
<% singular = file_name.singularize; plural = file_name.pluralize -%>
|
|
2
|
+
<div data-controller="fx-select-all">
|
|
3
|
+
<div id="notice" class="fixed top-4 right-4 z-50 max-w-md w-auto">
|
|
4
|
+
<%%= render "shared/flash" %>
|
|
5
|
+
</div>
|
|
6
|
+
<% if options[:turbo] -%>
|
|
7
|
+
<% if options[:ui] == "drawer" -%>
|
|
8
|
+
<turbo-frame id="drawer"></turbo-frame>
|
|
9
|
+
<% elsif options[:ui] == "modal" -%>
|
|
10
|
+
<turbo-frame id="modal"></turbo-frame>
|
|
11
|
+
<% end -%>
|
|
12
|
+
<% end -%>
|
|
13
|
+
<%%= fx_heading(class: "m-4", size: 2) { t("<%= plural %>.titles.index") } %>
|
|
14
|
+
|
|
15
|
+
<%%= fx_breadcrumb(class: "m-4") do |breadcrumb| %>
|
|
16
|
+
<%% breadcrumb.with_item(href: root_path, icon: "heroicons_solid:home") %>
|
|
17
|
+
<% if namespaced? -%>
|
|
18
|
+
<% namespace_path.split("/").each do |ns| -%>
|
|
19
|
+
<%% breadcrumb.with_item { "<%= ns.camelize %>" } %>
|
|
20
|
+
<% end -%>
|
|
21
|
+
<% end -%>
|
|
22
|
+
<%% breadcrumb.with_item(href: <%= path_prefix %><%= plural %>_path) { t("<%= plural %>.titles.index") } %>
|
|
23
|
+
<%% breadcrumb.with_item(current_page: true) { t("<%= plural %>.titles.index_name") } %>
|
|
24
|
+
<%% end %>
|
|
25
|
+
|
|
26
|
+
<%%= fx_card(class: "m-4") do |card| %>
|
|
27
|
+
<%% card.with_section do %>
|
|
28
|
+
<%%= form_with(id: "<%= singular %>_index", url: <%= path_prefix %><%= plural %>_path, method: :get, local: true,
|
|
29
|
+
data: { controller: "fx-auto-submit" }) do |form| %>
|
|
30
|
+
<div class="flex justify-between">
|
|
31
|
+
<div class="flex gap-2 items-end">
|
|
32
|
+
<% if options[:paginator] -%>
|
|
33
|
+
<input type="hidden" id="perPageParam" name="per_page" value="<%%= params["per_page"] %>">
|
|
34
|
+
<% end -%>
|
|
35
|
+
<%%= fx_text_field name: :q, value: params[:q], type: :search,
|
|
36
|
+
placeholder: t("<%= plural %>.helpers.search"),
|
|
37
|
+
addon: "heroicons_solid:magnifying-glass",
|
|
38
|
+
data: { action: 'keydown.enter->fx-auto-submit#submit' } %>
|
|
39
|
+
<%% if @has_filters %>
|
|
40
|
+
<%%= fx_button as: :a, href: <%= path_prefix %><%= plural %>_path(<% if options[:paginator] %>per_page: params["per_page"]<% end %>),
|
|
41
|
+
color: :light, class: "w-auto px-4 h-[42px]", remove_class: "w-full",
|
|
42
|
+
title: t("<%= plural %>.actions.remove_filters") do %>
|
|
43
|
+
<%%= anyicon("heroicons_solid:x-mark", class: "size-3") %>
|
|
44
|
+
<%% end #button %>
|
|
45
|
+
<%% end %>
|
|
46
|
+
</div>
|
|
47
|
+
<div class="flex gap-2">
|
|
48
|
+
<%%= fx_button as: :a, href: new_<%= path_prefix %><%= singular %>_path,
|
|
49
|
+
class: "w-auto px-4", remove_class: "w-full"<% if options[:turbo] && options[:ui] != "none" %>, data: { turbo_frame: "<%= options[:ui] == "modal" ? "modal" : "drawer" %>" }<% end %> do %>
|
|
50
|
+
<%%= anyicon("heroicons_solid:plus", class: "size-4") %>
|
|
51
|
+
<span class="pl-2 pr-4 hidden md:inline"><%%= t("<%= plural %>.actions.new") %></span>
|
|
52
|
+
<%% end #button %>
|
|
53
|
+
|
|
54
|
+
<%%= fx_button id: "actionButton", as: :button, type: "button", color: :light, class: "w-auto px-4",
|
|
55
|
+
title: "Actions", data: { "fx-select-all-target": "showOnEmptySelect" },
|
|
56
|
+
remove_class: "w-full" do |actions_button| %>
|
|
57
|
+
<%%= anyicon("heroicons_solid:ellipsis-vertical", class: "size-4") %>
|
|
58
|
+
<span class="pl-2 pr-4 hidden md:inline">
|
|
59
|
+
<%%== t("<%= plural %>.actions.actions") %>
|
|
60
|
+
</span>
|
|
61
|
+
<%% actions_button.with_dropdown(id: "dropdownActionButton") do |dropdown| %>
|
|
62
|
+
<% attributes
|
|
63
|
+
.select { |a| %i[boolean].include?(a.type) }
|
|
64
|
+
.each do |attr|
|
|
65
|
+
-%>
|
|
66
|
+
<%% dropdown.with_item do %>
|
|
67
|
+
<%%= link_to "#",
|
|
68
|
+
class: "inline-flex px-2",
|
|
69
|
+
data: {
|
|
70
|
+
controller: "fx-method-link",
|
|
71
|
+
fx_method_link_method_value: "patch",
|
|
72
|
+
fx_method_link_url_value: update_all_<%= path_prefix %><%= plural %>_path,
|
|
73
|
+
fx_method_link_params_value: { <%= singular %>: { <%= attr.name %>: true } },
|
|
74
|
+
fx_method_link_form_data_id_value: "<%= singular %>_edit"
|
|
75
|
+
},
|
|
76
|
+
title: t("<%= plural %>.messages.click_to_change_<%= attr.name %>") do %>
|
|
77
|
+
<%%= anyicon("heroicons_solid:check-circle", class: "size-5") %>
|
|
78
|
+
<%%= t("<%= plural %>.actions.activate_<%= attr.name %>_selected") %>
|
|
79
|
+
<%% end # link_to %>
|
|
80
|
+
<%% end # dropdown item %>
|
|
81
|
+
|
|
82
|
+
<%% dropdown.with_item do %>
|
|
83
|
+
<%%= link_to "#",
|
|
84
|
+
class: "inline-flex px-2",
|
|
85
|
+
data: {
|
|
86
|
+
controller: "fx-method-link",
|
|
87
|
+
fx_method_link_method_value: "patch",
|
|
88
|
+
fx_method_link_url_value: update_all_<%= path_prefix %><%= plural %>_path,
|
|
89
|
+
fx_method_link_params_value: { <%= singular %>: { <%= attr.name %>: false } },
|
|
90
|
+
fx_method_link_form_data_id_value: "<%= singular %>_edit"
|
|
91
|
+
},
|
|
92
|
+
title: t("<%= plural %>.messages.click_to_change_<%= attr.name %>") do %>
|
|
93
|
+
<%%= anyicon("heroicons_solid:x-circle", class: "size-5") %>
|
|
94
|
+
<%%= t("<%= plural %>.actions.deactivate_<%= attr.name %>_selected") %>
|
|
95
|
+
<%% end # link_to %>
|
|
96
|
+
<%% end # dropdown item %>
|
|
97
|
+
<% end -%>
|
|
98
|
+
<%% dropdown.with_item do %>
|
|
99
|
+
<%%= link_to "#",
|
|
100
|
+
onclick: "event.preventDefault();",
|
|
101
|
+
class: "inline-flex px-2",
|
|
102
|
+
data: {
|
|
103
|
+
"modal-target": "confirm-mass-deletion-modal",
|
|
104
|
+
"modal-toggle": "confirm-mass-deletion-modal"
|
|
105
|
+
},
|
|
106
|
+
title: t("<%= plural %>.messages.click_to_destroy_selected") do %>
|
|
107
|
+
<%%= anyicon("heroicons_solid:trash", class: "size-5") %>
|
|
108
|
+
<%%= t("<%= plural %>.actions.delete_selected") %>
|
|
109
|
+
<%% end # link_to %>
|
|
110
|
+
<%% end # dropdown item %>
|
|
111
|
+
<%% end # dropdown %>
|
|
112
|
+
<%% end # button %>
|
|
113
|
+
|
|
114
|
+
<%%= fx_button id: "filterButton", as: :button, type: "button", color: :light, class: "w-auto px-4",
|
|
115
|
+
title: t("<%= plural %>.helpers.filter"), remove_class: "w-full" do |filter_button| %>
|
|
116
|
+
<%%= anyicon("heroicons_solid:funnel", class: "size-4") %>
|
|
117
|
+
<span class="pl-2 pr-4 hidden md:inline"><%%= t("<%= plural %>.helpers.filter") %></span>
|
|
118
|
+
<%% filter_button.with_dropdown(id: "dropdownFilterButton") do |dropdown| %>
|
|
119
|
+
<div class="px-2">
|
|
120
|
+
<% attributes
|
|
121
|
+
.select { |a| %i[integer decimal text string].include?(a.type) }
|
|
122
|
+
.first(5)
|
|
123
|
+
.each do |attr|
|
|
124
|
+
-%>
|
|
125
|
+
<%%= fx_text_field id: "<%= attr.name %>Filter", label: t("<%= plural %>.fields.<%= attr.name -%>"), name: "<%= attr.name -%>",
|
|
126
|
+
value: @<%= attr.name %>, placeholder: t("<%= plural %>.helpers.filter_<%= attr.name -%>"), class: "mb-2",
|
|
127
|
+
data: { action: "keydown.enter->fx-auto-submit#submit" }
|
|
128
|
+
%>
|
|
129
|
+
<% end -%>
|
|
130
|
+
<%% if @has_filters %>
|
|
131
|
+
<%%= fx_link href: <%= path_prefix %><%= plural -%>_path(<% if options[:paginator] %>per_page: params["per_page"]<% end %>) { t("<%= plural -%>.actions.remove_filters") } %>
|
|
132
|
+
<%% end %>
|
|
133
|
+
</div>
|
|
134
|
+
<%% end #dropdown %>
|
|
135
|
+
<%% end # button %>
|
|
136
|
+
|
|
137
|
+
<%%= fx_button as: :a, href: <%= path_prefix %><%= plural -%>_path(request.query_parameters.merge(format: :csv)), type: "button",
|
|
138
|
+
color: :light, class: "w-auto px-4", title: t("<%= plural %>.helpers.export"), remove_class: "w-full" do %>
|
|
139
|
+
<%%= anyicon("heroicons_solid:arrow-down-tray", class: "size-4") %>
|
|
140
|
+
<span class="pl-2 pr-4 hidden md:inline"><%%= t("<%= plural %>.actions.export") %></span>
|
|
141
|
+
<%% end # button %>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
<%% end #form %>
|
|
145
|
+
<%% end # section %>
|
|
146
|
+
|
|
147
|
+
<%% card.with_section(no_class: true) do %>
|
|
148
|
+
<%%= form_with(id: "<%= singular %>_edit", name: "<%= singular %>_edit", url: <%= path_prefix %><%= plural %>_path, method: :get, local: true) do |form| %>
|
|
149
|
+
<%%= fx_table(striped: true, bordered: true, hover: true, tbody_html: {id: "<%= plural %>"}) do |table| %>
|
|
150
|
+
<%% table.with_header do |header| %>
|
|
151
|
+
<%% header.with_cell(title: "Select All/Deselect All") {
|
|
152
|
+
fx_checkbox(id: "<%= singular %>_select_all", data: { "fx-select-all-target": "selectAll" }) } %>
|
|
153
|
+
<% attributes.reject { |attr| attr.type == :password_digest }.first(5).each do |attr| -%>
|
|
154
|
+
<%% header.with_cell { fx_sort_field(:<%= attr.name %>, :<%= path_prefix %><%= plural %>_path, t("<%= plural %>.fields.<%= attr.name %>")) } %>
|
|
155
|
+
<% end -%>
|
|
156
|
+
<%% header.with_cell { "" } %>
|
|
157
|
+
<%% end %>
|
|
158
|
+
<%% if @<%= plural %>.count > 0 %>
|
|
159
|
+
<%% render "<%= plural %>", <%= plural %>: @<%= plural %> %>
|
|
160
|
+
<%% else %>
|
|
161
|
+
<tr id="not_found"><td colspan=7>
|
|
162
|
+
<div class="text-center text-gray-500 dark:text-gray-400 py-20 flex flex-col items-center justify-center">
|
|
163
|
+
<%%= anyicon("heroicons_solid:exclamation-circle", class: "size-12 mb-2") %>
|
|
164
|
+
<p><%%= t("<%= plural %>.messages.no_records") %></p>
|
|
165
|
+
<p><%%= t("<%= plural %>.messages.no_records_sub") %></p>
|
|
166
|
+
</div>
|
|
167
|
+
</td></tr>
|
|
168
|
+
<%% end %>
|
|
169
|
+
<%% end # table %>
|
|
170
|
+
<%% end # form %>
|
|
171
|
+
<%% end #section %>
|
|
172
|
+
|
|
173
|
+
<% if options[:paginator] -%>
|
|
174
|
+
<%% if @<%= plural %>.count > 1 %>
|
|
175
|
+
<%% card.with_section do %>
|
|
176
|
+
<%%= fx_flex(gap: 2, align_items: :center, justify_content: :space_between) do %>
|
|
177
|
+
<div class="text-sm text-gray-700 dark:text-gray-400 m-0 p-2">
|
|
178
|
+
<%%== t("<%= plural %>.messages.pagination_info", start: @pagy.from, end: @pagy.to, total: @pagy.count) %>
|
|
179
|
+
</div>
|
|
180
|
+
<%%= fx_flex(gap: 2, align_items: :center) do %>
|
|
181
|
+
<%%= fx_pagination(@pagy, id: 'nav', sizing: 1, show_first_last: true) if @<%= plural %>.count > @page_size%>
|
|
182
|
+
<%%= fx_select id: "perPage", name:"per_page", class: "pr-4", data: {
|
|
183
|
+
controller: "fx-assigner fx-auto-submit",
|
|
184
|
+
fx_assigner_change_param: {
|
|
185
|
+
"#perPageParam" => {
|
|
186
|
+
"value": { element: "#per_page", attribute: "value" }
|
|
187
|
+
}
|
|
188
|
+
}.to_json,
|
|
189
|
+
fx_assigner_prevent_default_param: "true",
|
|
190
|
+
fx_auto_submit_form_id_param: "<%= singular %>_index",
|
|
191
|
+
action: "change->fx-assigner#assign change->fx-auto-submit#submit",
|
|
192
|
+
},
|
|
193
|
+
options: options_for_select([
|
|
194
|
+
[t("<%= plural %>.actions.per_page", count: 5), "5"],
|
|
195
|
+
[t("<%= plural %>.actions.per_page", count: 10), "10"],
|
|
196
|
+
[t("<%= plural %>.actions.per_page", count: 20), "20"],
|
|
197
|
+
[t("<%= plural %>.actions.per_page", count: 50), "50"],
|
|
198
|
+
[t("<%= plural %>.actions.per_page", count: 100), "100"]
|
|
199
|
+
], selected: params["per_page"] || "5") %>
|
|
200
|
+
<%% end # flex %>
|
|
201
|
+
<%% end # flex %>
|
|
202
|
+
<%% end # section %>
|
|
203
|
+
<%% end # if count %>
|
|
204
|
+
<% end -%>
|
|
205
|
+
<%% end # card %>
|
|
206
|
+
|
|
207
|
+
<%%= fx_modal id: "confirm-deletion-modal", size: 1 do |modal| %>
|
|
208
|
+
<%%= fx_flex(vertical: true, align_items: :center) do %>
|
|
209
|
+
<%%= anyicon("heroicons_solid:trash", class: "size-11 text-red-600 pb-2") %>
|
|
210
|
+
<%%= t("<%= plural %>.messages.confirm_destroy") %>
|
|
211
|
+
<%%= fx_flex(gap: 2, class: "mt-4") do %>
|
|
212
|
+
<%%= fx_button(as: :button, color: :light, class: "w-auto px-4", remove_class: "w-full",
|
|
213
|
+
data: {
|
|
214
|
+
"modal-target": "confirm-deletion-modal",
|
|
215
|
+
"modal-toggle": "confirm-deletion-modal"
|
|
216
|
+
}) { t("<%= plural %>.actions.cancel_destroy") } %>
|
|
217
|
+
<%%= fx_button(as: :a, href: "#", id: "confirm-deletion-button",
|
|
218
|
+
color: :danger, class: "w-auto text-nowrap px-4", remove_class: "w-full",
|
|
219
|
+
data: {
|
|
220
|
+
controller: "fx-method-link",
|
|
221
|
+
fx_method_link_method_value: "delete",
|
|
222
|
+
fx_method_link_url_value: <%= path_prefix %><%= singular %>_path(0),
|
|
223
|
+
"modal-target": "confirm-deletion-modal",
|
|
224
|
+
"modal-toggle": "confirm-deletion-modal"
|
|
225
|
+
}) { t("<%= plural %>.actions.confirm_destroy") } %>
|
|
226
|
+
<%% end #flex %>
|
|
227
|
+
<%% end #flex %>
|
|
228
|
+
<%% end # modal %>
|
|
229
|
+
|
|
230
|
+
<%%= fx_modal id: "confirm-mass-deletion-modal", size: 1 do |modal| %>
|
|
231
|
+
<%%= fx_flex(vertical: true, align_items: :center) do %>
|
|
232
|
+
<%%= anyicon("heroicons_solid:trash", class: "size-11 text-red-600 pb-2") %>
|
|
233
|
+
<div><%%== t("<%= plural %>.messages.confirm_bulk_destroy") %></div>
|
|
234
|
+
<%%= fx_flex(gap: 2, class: "mt-4") do %>
|
|
235
|
+
<%%= fx_button(as: :button, color: :light, class: "w-auto px-4", remove_class: "w-full",
|
|
236
|
+
data: {
|
|
237
|
+
"modal-target": "confirm-mass-deletion-modal",
|
|
238
|
+
"modal-toggle": "confirm-mass-deletion-modal"
|
|
239
|
+
}) { t("<%= plural %>.actions.cancel_destroy") } %>
|
|
240
|
+
<%%= fx_button(as: :a, href: "#", id: "confirm-deletion-button",
|
|
241
|
+
color: :danger, class: "w-auto text-nowrap px-4", remove_class: "w-full",
|
|
242
|
+
data: {
|
|
243
|
+
"modal-target": "confirm-mass-deletion-modal",
|
|
244
|
+
"modal-toggle": "confirm-mass-deletion-modal",
|
|
245
|
+
|
|
246
|
+
controller: "fx-method-link",
|
|
247
|
+
fx_method_link_method_value: "delete",
|
|
248
|
+
fx_method_link_url_value: destroy_all_<%= path_prefix %><%= plural %>_path,
|
|
249
|
+
fx_method_link_form_data_id_value: "<%= singular %>_edit"
|
|
250
|
+
}) { t("<%= plural %>.actions.confirm_destroy") } %>
|
|
251
|
+
<%% end #flex %>
|
|
252
|
+
<%% end #flex %>
|
|
253
|
+
<%% end # modal %>
|
|
254
|
+
</div>
|