diff --git a/Gemfile b/Gemfile index 5daa252..22af2e4 100644 --- a/Gemfile +++ b/Gemfile @@ -43,7 +43,7 @@ gem 'bootstrap', '~> 5.3', '>= 5.3.2' gem 'dartsass-rails', '~> 0.5.0' gem 'dartsass-sprockets', '~> 3.1' gem 'simple_form' -gem 'activeadmin' +gem 'activeadmin', "4.0.0.beta5" gem 'base64' gem 'redcarpet' diff --git a/Gemfile.lock b/Gemfile.lock index 0f45092..ee0cbc1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -50,12 +50,11 @@ GEM erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activeadmin (3.2.0) - arbre (~> 1.2, >= 1.2.1) + activeadmin (4.0.0.beta5) + arbre (~> 2.0) formtastic (>= 3.1) formtastic_i18n (>= 0.4) inherited_resources (~> 1.7) - jquery-rails (>= 4.2) kaminari (>= 1.2.1) railties (>= 6.1) ransack (>= 4.0) @@ -87,7 +86,7 @@ GEM addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) altcha-rails (0.0.5) - arbre (1.7.0) + arbre (2.0.0) activesupport (>= 3.0.0) ruby2_keywords (>= 0.0.2) autoprefixer-rails (10.4.16.0) @@ -169,10 +168,6 @@ GEM irb (1.12.0) rdoc reline (>= 0.4.2) - jquery-rails (4.6.0) - rails-dom-testing (>= 1, < 3) - railties (>= 4.2.0) - thor (>= 0.14, < 2.0) kaminari (1.2.2) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.2) @@ -341,7 +336,7 @@ PLATFORMS x86_64-linux DEPENDENCIES - activeadmin + activeadmin (= 4.0.0.beta5) altcha-rails base64 bootsnap diff --git a/app/admin/dashboard.rb b/app/admin/dashboard.rb index 6c192ab..1b2ca52 100644 --- a/app/admin/dashboard.rb +++ b/app/admin/dashboard.rb @@ -34,12 +34,10 @@ end end - columns do - column do - panel "Currently active" do - para "Events: #{Event.confirmed.count}" - para "Entries: #{Entry.confirmed.count}" - end + div do + panel "Currently active" do + para "Events: #{Event.confirmed.count}" + para "Entries: #{Entry.confirmed.count}" end end end diff --git a/app/admin/entries.rb b/app/admin/entries.rb index c57b689..539fd59 100644 --- a/app/admin/entries.rb +++ b/app/admin/entries.rb @@ -8,7 +8,7 @@ end action_item :unconfirm, only: :show do - link_to "Unconfirm", unconfirm_admin_entry_path(entry), method: :post + link_to "Unconfirm", unconfirm_admin_entry_path(resource), method: :post, class: "action-item-button" end member_action :resend_confirmation, method: :post do @@ -18,7 +18,7 @@ end action_item :resend_confirmation, only: :show do - link_to "Resend confirmation", resend_confirmation_admin_entry_path(entry), method: :post + link_to "Resend confirmation", resend_confirmation_admin_entry_path(resource), method: :post, class: "action-item-button" end diff --git a/app/admin/events.rb b/app/admin/events.rb index 7f764c6..10cd9d3 100644 --- a/app/admin/events.rb +++ b/app/admin/events.rb @@ -8,7 +8,7 @@ end action_item :unconfirm, only: :show do - link_to "Unconfirm", unconfirm_admin_event_path(event), method: :post + link_to "Unconfirm", unconfirm_admin_event_path(resource), method: :post, class: "action-item-button" end member_action :resend_confirmation, method: :post do @@ -18,7 +18,7 @@ end action_item :resend_confirmation, only: :show do - link_to "Resend confirmation", resend_confirmation_admin_event_path(event), method: :post + link_to "Resend confirmation", resend_confirmation_admin_event_path(resource), method: :post, class: "action-item-button" end sidebar "Details", only: :show do diff --git a/app/assets/javascripts/active_admin.js b/app/assets/javascripts/active_admin.js deleted file mode 100644 index d2b66c5..0000000 --- a/app/assets/javascripts/active_admin.js +++ /dev/null @@ -1 +0,0 @@ -//= require active_admin/base diff --git a/app/assets/stylesheets/active_admin.css b/app/assets/stylesheets/active_admin.css new file mode 100644 index 0000000..b5c61c9 --- /dev/null +++ b/app/assets/stylesheets/active_admin.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; diff --git a/app/views/active_admin/_flash_messages.html.erb b/app/views/active_admin/_flash_messages.html.erb new file mode 100644 index 0000000..d291236 --- /dev/null +++ b/app/views/active_admin/_flash_messages.html.erb @@ -0,0 +1,22 @@ +<% if flash_messages.present? %> +
+ <% flash_messages.each do |type, message| %> + <% if type == "error" %> +
+ + <%= message %> +
+ <% elsif type == "alert" %> +
+ + <%= message %> +
+ <% elsif type == "notice" %> +
+ + <%= message %> +
+ <% end %> + <% end %> +
+<% end %> diff --git a/app/views/active_admin/_html_head.html.erb b/app/views/active_admin/_html_head.html.erb new file mode 100644 index 0000000..afbfd32 --- /dev/null +++ b/app/views/active_admin/_html_head.html.erb @@ -0,0 +1,13 @@ +<%= stylesheet_link_tag "active_admin" %> + +<%= csrf_meta_tags %> +<%= csp_meta_tag %> +<% # On page load or when changing themes, best to add inline in `head` to avoid FOUC %> +<%= javascript_tag nonce: true do %> + if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) { + document.documentElement.classList.add('dark') + } else { + document.documentElement.classList.remove('dark') + } +<% end %> +<%= javascript_importmap_tags "active_admin", importmap: ActiveAdmin.importmap %> diff --git a/app/views/active_admin/_main_navigation.html.erb b/app/views/active_admin/_main_navigation.html.erb new file mode 100644 index 0000000..40c4e5c --- /dev/null +++ b/app/views/active_admin/_main_navigation.html.erb @@ -0,0 +1,28 @@ + diff --git a/app/views/active_admin/_page_header.html.erb b/app/views/active_admin/_page_header.html.erb new file mode 100644 index 0000000..2b8abab --- /dev/null +++ b/app/views/active_admin/_page_header.html.erb @@ -0,0 +1,27 @@ +
+
+ <% breadcrumb_links = build_breadcrumb_links(request.path, class: "text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 no-underline") %> + <% if breadcrumb_links.present? %> + + <% end %> +

<%= title %>

+
+ <% if action_items_for_action.present? %> +
+ <%= render "active_admin/shared/action_items" %> +
+ <% end %> +
diff --git a/app/views/active_admin/_sidebar.html.erb b/app/views/active_admin/_sidebar.html.erb new file mode 100644 index 0000000..eef67b7 --- /dev/null +++ b/app/views/active_admin/_sidebar.html.erb @@ -0,0 +1,5 @@ +<% unless skip_sidebar? || sidebar_sections_for_action.blank? %> +
+ <%= render "active_admin/shared/sidebar_sections" %> +
+<% end %> diff --git a/app/views/active_admin/_site_footer.html.erb b/app/views/active_admin/_site_footer.html.erb new file mode 100644 index 0000000..39b8b77 --- /dev/null +++ b/app/views/active_admin/_site_footer.html.erb @@ -0,0 +1,7 @@ +
+ <%= I18n.t( + "active_admin.powered_by", + active_admin: link_to("Active Admin", "https://activeadmin.info", class: "text-gray-500 dark:text-gray-500 hover:text-gray-900 dark:hover:text-gray-400 no-underline"), + version: ActiveAdmin::VERSION + ).html_safe %> +
diff --git a/app/views/active_admin/_site_header.html.erb b/app/views/active_admin/_site_header.html.erb new file mode 100644 index 0000000..99e40bb --- /dev/null +++ b/app/views/active_admin/_site_header.html.erb @@ -0,0 +1,30 @@ +
+ + +
+

+ <%= title %> +

+
+ + + + + + + +
diff --git a/app/views/active_admin/devise/confirmations/new.html.erb b/app/views/active_admin/devise/confirmations/new.html.erb new file mode 100644 index 0000000..7dfdf58 --- /dev/null +++ b/app/views/active_admin/devise/confirmations/new.html.erb @@ -0,0 +1,17 @@ +
+

+ <%= active_admin_application.site_title(self) %> <%= set_page_title t('active_admin.devise.resend_confirmation_instructions.title') %> +

+ + <%= render partial: "active_admin/devise/shared/error_messages", resource: resource %> + <%= active_admin_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| + f.inputs do + f.input :email + end + f.actions do + f.action :submit, label: t('active_admin.devise.resend_confirmation_instructions.submit'), button_html: { class: "w-full", value: t('active_admin.devise.resend_confirmation_instructions.submit') } + end + end %> + + <%= render partial: "active_admin/devise/shared/links" %> +
diff --git a/app/views/active_admin/devise/mailer/reset_password_instructions.html.erb b/app/views/active_admin/devise/mailer/reset_password_instructions.html.erb new file mode 100644 index 0000000..7913e88 --- /dev/null +++ b/app/views/active_admin/devise/mailer/reset_password_instructions.html.erb @@ -0,0 +1,8 @@ +

Hello <%= @resource.email %>!

+ +

Someone has requested a link to change your password, and you can do this through the link below.

+ +

<%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %>

+ +

If you didn't request this, please ignore this email.

+

Your password won't change until you access the link above and create a new one.

diff --git a/app/views/active_admin/devise/mailer/unlock_instructions.html.erb b/app/views/active_admin/devise/mailer/unlock_instructions.html.erb new file mode 100644 index 0000000..41e148b --- /dev/null +++ b/app/views/active_admin/devise/mailer/unlock_instructions.html.erb @@ -0,0 +1,7 @@ +

Hello <%= @resource.email %>!

+ +

Your account has been locked due to an excessive number of unsuccessful sign in attempts.

+ +

Click the link below to unlock your account:

+ +

<%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %>

diff --git a/app/views/active_admin/devise/passwords/edit.html.erb b/app/views/active_admin/devise/passwords/edit.html.erb new file mode 100644 index 0000000..f8c9708 --- /dev/null +++ b/app/views/active_admin/devise/passwords/edit.html.erb @@ -0,0 +1,20 @@ +
+

+ <%= active_admin_application.site_title(self) %> <%= set_page_title t('active_admin.devise.change_password.title') %> +

+ + <%= render partial: "active_admin/devise/shared/error_messages", resource: resource %> + <%= active_admin_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| + f.inputs do + f.input :password + f.input :password_confirmation + f.input :reset_password_token, as: :hidden, input_html: { value: resource.reset_password_token } + end + f.actions do + f.action :submit, label: t('active_admin.devise.change_password.submit'), button_html: { class: "w-full", value: t('active_admin.devise.change_password.submit') } + end + end + %> + + <%= render 'active_admin/devise/shared/links' %> +
diff --git a/app/views/active_admin/devise/passwords/new.html.erb b/app/views/active_admin/devise/passwords/new.html.erb new file mode 100644 index 0000000..73bdb9d --- /dev/null +++ b/app/views/active_admin/devise/passwords/new.html.erb @@ -0,0 +1,16 @@ +
+

+ <%= active_admin_application.site_title(self) %> <%= set_page_title t('active_admin.devise.reset_password.title') %> +

+ + <%= active_admin_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| + f.inputs do + f.input :email + end + f.actions do + f.action :submit, label: t('active_admin.devise.reset_password.submit'), button_html: { class: "w-full", value: t('active_admin.devise.reset_password.submit') } + end + end %> + + <%= render partial: "active_admin/devise/shared/links" %> +
diff --git a/app/views/active_admin/devise/registrations/new.html.erb b/app/views/active_admin/devise/registrations/new.html.erb new file mode 100644 index 0000000..189e97a --- /dev/null +++ b/app/views/active_admin/devise/registrations/new.html.erb @@ -0,0 +1,23 @@ +
+

+ <%= active_admin_application.site_title(self) %> <%= set_page_title t('active_admin.devise.sign_up.title') %> +

+ + <% scope = Devise::Mapping.find_scope!(resource_name) %> + <%= render partial: "active_admin/devise/shared/error_messages", resource: resource %> + <%= active_admin_form_for(resource, as: resource_name, url: main_app.send(:"#{scope}_registration_path"), html: { id: "registration_new" }) do |f| + f.inputs do + resource.class.authentication_keys.each_with_index { |key, index| + f.input key, label: t('active_admin.devise.'+key.to_s+'.title'), input_html: { autofocus: index.zero? } + } + f.input :password, label: t('active_admin.devise.password.title') + f.input :password_confirmation, label: t('active_admin.devise.password_confirmation.title') + end + f.actions do + f.action :submit, label: t('active_admin.devise.login.submit'), button_html: { class: "w-full", value: t('active_admin.devise.sign_up.submit') } + end + end + %> + + <%= render partial: "active_admin/devise/shared/links" %> +
diff --git a/app/views/active_admin/devise/sessions/new.html.erb b/app/views/active_admin/devise/sessions/new.html.erb new file mode 100644 index 0000000..ba7edf5 --- /dev/null +++ b/app/views/active_admin/devise/sessions/new.html.erb @@ -0,0 +1,22 @@ +
+

+ <%= site_title %> <%= set_page_title t('active_admin.devise.login.title') %> +

+ + <% scope = Devise::Mapping.find_scope!(resource_name) %> + <%= active_admin_form_for(resource, as: resource_name, url: main_app.send(:"#{scope}_session_path")) do |f| + f.inputs do + resource.class.authentication_keys.each_with_index { |key, index| + f.input key, label: t("active_admin.devise.#{key}.title"), input_html: { autofocus: index.zero? } + } + f.input :password, label: t('active_admin.devise.password.title') + f.input :remember_me, label: t('active_admin.devise.login.remember_me'), as: :boolean if devise_mapping.rememberable? + end + f.actions do + f.action :submit, label: t('active_admin.devise.login.submit'), wrapper_html: { class: "grow" }, button_html: { class: "w-full", value: t('active_admin.devise.login.submit') } + end + end + %> + + <%= render partial: "active_admin/devise/shared/links" %> +
diff --git a/app/views/active_admin/devise/shared/_error_messages.html.erb b/app/views/active_admin/devise/shared/_error_messages.html.erb new file mode 100644 index 0000000..ba7ab88 --- /dev/null +++ b/app/views/active_admin/devise/shared/_error_messages.html.erb @@ -0,0 +1,15 @@ +<% if resource.errors.any? %> +
+

+ <%= I18n.t("errors.messages.not_saved", + count: resource.errors.count, + resource: resource.class.model_name.human.downcase) + %> +

+ +
+<% end %> diff --git a/app/views/active_admin/devise/shared/_links.erb b/app/views/active_admin/devise/shared/_links.erb new file mode 100644 index 0000000..e820abe --- /dev/null +++ b/app/views/active_admin/devise/shared/_links.erb @@ -0,0 +1,35 @@ +
+<%- if controller_name != 'sessions' %> + <% scope = Devise::Mapping.find_scope!(resource_name) %> + <%= link_to t('active_admin.devise.links.sign_in'), main_app.send(:"new_#{scope}_session_path") %> +
+<% end -%> + +<%- if devise_mapping.registerable? && controller_name != 'registrations' %> + <%= link_to t('active_admin.devise.links.sign_up'), new_registration_path(resource_name) %> +
+<% end -%> + +<%- if devise_mapping.recoverable? && controller_name != 'passwords' %> + <%= link_to t('active_admin.devise.links.forgot_your_password'), new_password_path(resource_name) %> +
+<% end -%> + +<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> + <%= link_to t('active_admin.devise.links.resend_confirmation_instructions'), new_confirmation_path(resource_name) %> +
+<% end -%> + +<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> + <%= link_to t('active_admin.devise.links.resend_unlock_instructions'), new_unlock_path(resource_name) %> +
+<% end -%> + +<%- if devise_mapping.omniauthable? %> + <%- resource_class.omniauth_providers.each do |provider| %> + <%= link_to t('active_admin.devise.links.sign_in_with_omniauth_provider', provider: provider.to_s.titleize), + omniauth_authorize_path(resource_name, provider), method: :post %> +
+ <% end -%> +<% end -%> +
diff --git a/app/views/active_admin/devise/unlocks/new.html.erb b/app/views/active_admin/devise/unlocks/new.html.erb new file mode 100644 index 0000000..6bd56a1 --- /dev/null +++ b/app/views/active_admin/devise/unlocks/new.html.erb @@ -0,0 +1,17 @@ +
+

+ <%= site_title %> <%= set_page_title t('active_admin.devise.unlock.title') %> +

+ + <%= render partial: "active_admin/devise/shared/error_messages", resource: resource %> + <%= active_admin_form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| + f.inputs do + f.input :email + end + f.actions do + f.action :submit, label: t('active_admin.devise.unlock.submit'), button_html: { class: "w-full", value: t('active_admin.devise.unlock.submit') } + end + end %> + + <%= render partial: "active_admin/devise/shared/links" %> +
diff --git a/app/views/active_admin/kaminari/_gap.html.erb b/app/views/active_admin/kaminari/_gap.html.erb new file mode 100644 index 0000000..fd1addd --- /dev/null +++ b/app/views/active_admin/kaminari/_gap.html.erb @@ -0,0 +1,10 @@ +<%# Non-link tag that stands for skipped pages... + - available local variables + current_page: a page object for the currently displayed page + total_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> + + <%= t('views.pagination.truncate').html_safe %> + diff --git a/app/views/active_admin/kaminari/_next_page.html.erb b/app/views/active_admin/kaminari/_next_page.html.erb new file mode 100644 index 0000000..97566c1 --- /dev/null +++ b/app/views/active_admin/kaminari/_next_page.html.erb @@ -0,0 +1,16 @@ +<%# Link to the "Next" page + - available local variables + url: url to the next page + current_page: a page object for the currently displayed page + total_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +<% unless current_page.last? %> + <%= link_to url, rel: 'next', remote: remote, class: "flex items-center justify-center px-2.5 py-3 h-8 leading-tight text-gray-500 dark:text-gray-400 hover:bg-gray-100 hover:text-gray-700 dark:hover:bg-gray-800 dark:hover:text-white rounded no-underline" do %> + <%= t('active_admin.pagination.next') %> + + <% end %> +<% end %> diff --git a/app/views/active_admin/kaminari/_page.html.erb b/app/views/active_admin/kaminari/_page.html.erb new file mode 100644 index 0000000..3b48ec6 --- /dev/null +++ b/app/views/active_admin/kaminari/_page.html.erb @@ -0,0 +1,14 @@ +<%# Link showing page number + - available local variables + page: a page object for "this" page + url: url to this page + current_page: a page object for the currently displayed page + total_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +<% if page.current? %> + <%= link_to page, url, { remote: remote, rel: page.rel, class: "flex items-center justify-center px-2.5 py-3 h-8 leading-tight text-white bg-blue-500 dark:text-white dark:bg-blue-600 hover:bg-blue-500 hover:text-white dark:hover:bg-blue-600 dark:hover:text-white rounded no-underline" } %> +<% else %> + <%= link_to page, url, { remote: remote, rel: page.rel, class: "flex items-center justify-center px-2.5 py-3 h-8 leading-tight text-gray-500 dark:text-gray-400 hover:bg-gray-100 hover:text-gray-700 dark:hover:bg-gray-800 dark:hover:text-white rounded no-underline" } %> +<% end %> diff --git a/app/views/active_admin/kaminari/_paginator.html.erb b/app/views/active_admin/kaminari/_paginator.html.erb new file mode 100644 index 0000000..ade78b2 --- /dev/null +++ b/app/views/active_admin/kaminari/_paginator.html.erb @@ -0,0 +1,23 @@ +<%# The container tag + - available local variables + current_page: a page object for the currently displayed page + total_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote + paginator: the paginator that renders the pagination tags inside +-%> +<%= paginator.render do -%> + +<% end -%> diff --git a/app/views/active_admin/kaminari/_prev_page.html.erb b/app/views/active_admin/kaminari/_prev_page.html.erb new file mode 100644 index 0000000..fad4ddf --- /dev/null +++ b/app/views/active_admin/kaminari/_prev_page.html.erb @@ -0,0 +1,16 @@ +<%# Link to the "Previous" page + - available local variables + url: url to the previous page + current_page: a page object for the currently displayed page + total_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +<% unless current_page.first? %> + <%= link_to url, rel: 'prev', remote: remote, class: "flex items-center justify-center px-2.5 py-3 h-8 leading-tight text-gray-500 dark:text-gray-400 hover:bg-gray-100 hover:text-gray-700 dark:hover:bg-gray-800 dark:hover:text-white rounded no-underline" do %> + <%= t('active_admin.pagination.previous') %> + + <% end %> +<% end %> diff --git a/app/views/active_admin/resource/_index_blank_slate.html.erb b/app/views/active_admin/resource/_index_blank_slate.html.erb new file mode 100644 index 0000000..826f6ad --- /dev/null +++ b/app/views/active_admin/resource/_index_blank_slate.html.erb @@ -0,0 +1,14 @@ +
+

+ <%= I18n.t("active_admin.blank_slate.content", resource_name: active_admin_config.plural_resource_label) %> +

+ <% if new_action_authorized?(active_admin_config.resource_class) %> + <%= if page_presenter.options.has_key?(:blank_slate_link) + link = page_presenter.options[:blank_slate_link] + instance_exec(&link) if link.is_a?(Proc) + else + link_to(I18n.t("active_admin.blank_slate.link"), new_resource_path) + end + %> + <% end %> +
diff --git a/app/views/active_admin/resource/_index_empty_results.html.erb b/app/views/active_admin/resource/_index_empty_results.html.erb new file mode 100644 index 0000000..425fe86 --- /dev/null +++ b/app/views/active_admin/resource/_index_empty_results.html.erb @@ -0,0 +1,5 @@ +
+

+ <%= I18n.t("active_admin.pagination.empty", model: active_admin_config.plural_resource_label) %> +

+
diff --git a/app/views/active_admin/shared/_resource_comments.html.erb b/app/views/active_admin/shared/_resource_comments.html.erb new file mode 100644 index 0000000..0be1703 --- /dev/null +++ b/app/views/active_admin/shared/_resource_comments.html.erb @@ -0,0 +1,51 @@ +
+
+ <%= ActiveAdmin::Comment.model_name.human(count: 2.1) %> +
+ <% if authorized?(ActiveAdmin::Auth::NEW, ActiveAdmin::Comment) %> + <%= active_admin_form_for(ActiveAdmin::Comment.new, url: comment_form_url, html: { class: "mb-12 max-w-[700px]", novalidate: false }) do |f| + f.inputs do + f.input :resource_type, as: :hidden, input_html: { value: ActiveAdmin::Comment.resource_type(resource) } + f.input :resource_id, as: :hidden, input_html: { value: resource.id } + f.input :body, label: false, input_html: { size: "80x4", required: true } + end + f.actions do + f.action :submit, label: I18n.t("active_admin.comments.add") + end + end + %> + <% end %> +
+ <%= I18n.t "active_admin.comments.title_content", count: comments.total_count %> +
+ <% if comments.any? %> + <% comments.each do |comment| %> +
+
+ + <%= comment.author ? auto_link(comment.author) : I18n.t("active_admin.comments.author_missing") %> + + + <%= pretty_format comment.created_at %> + +
+
+ <%= simple_format(comment.body) %> +
+ <% if authorized?(ActiveAdmin::Auth::DESTROY, comment) %> + <%= link_to I18n.t("active_admin.comments.delete"), url_for_comments(comment.id), method: :delete, data: { confirm: I18n.t("active_admin.comments.delete_confirmation") } %> + <% end %> +
+ <% end %> +
+
+ <%= page_entries_info(comments).html_safe %> +
+ <%= paginate(comments, views_prefix: :active_admin, outer_window: 1, window: 2) %> +
+ <% else %> +
+ <%= I18n.t("active_admin.comments.no_comments_yet") %> +
+ <% end %> +
diff --git a/app/views/layouts/active_admin.html.erb b/app/views/layouts/active_admin.html.erb new file mode 100644 index 0000000..113afbd --- /dev/null +++ b/app/views/layouts/active_admin.html.erb @@ -0,0 +1,20 @@ + + + + <%= html_head_site_title %> + <%= render "active_admin/html_head" %> + + + <%= render "active_admin/site_header", title: site_title %> +
+ <%= render "active_admin/main_navigation" %> + <%= render "active_admin/page_header", title: @page_title || page_title %> + <%= render "active_admin/flash_messages" %> +
+ <%= yield %> + <%= render "active_admin/sidebar" %> +
+ <%= render "active_admin/site_footer" %> +
+ + diff --git a/app/views/layouts/active_admin_logged_out.html.erb b/app/views/layouts/active_admin_logged_out.html.erb new file mode 100644 index 0000000..f1211e9 --- /dev/null +++ b/app/views/layouts/active_admin_logged_out.html.erb @@ -0,0 +1,13 @@ + + + + <%= html_head_site_title %> + <%= render "active_admin/html_head" %> + + +
+ <%= render "active_admin/flash_messages" %> + <%= yield %> +
+ + diff --git a/tailwind-active_admin.config.js b/tailwind-active_admin.config.js new file mode 100644 index 0000000..2bad9dc --- /dev/null +++ b/tailwind-active_admin.config.js @@ -0,0 +1,18 @@ +const execSync = require('child_process').execSync; +const activeAdminPath = execSync('bundle show activeadmin', { encoding: 'utf-8' }).trim(); + +module.exports = { + content: [ + `${activeAdminPath}/vendor/javascript/flowbite.js`, + `${activeAdminPath}/plugin.js`, + `${activeAdminPath}/app/views/**/*.{arb,erb,html,rb}`, + './app/admin/**/*.{arb,erb,html,rb}', + './app/views/active_admin/**/*.{arb,erb,html,rb}', + './app/views/admin/**/*.{arb,erb,html,rb}', + './app/javascript/**/*.js' + ], + darkMode: "class", + plugins: [ + require(`@activeadmin/activeadmin/plugin`) + ] +}