add activeadmin
This commit is contained in:
3
Gemfile
3
Gemfile
@@ -26,6 +26,9 @@ gem "bootsnap", require: false
|
|||||||
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
|
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
|
||||||
# gem "image_processing", "~> 1.2"
|
# gem "image_processing", "~> 1.2"
|
||||||
|
|
||||||
|
gem "activeadmin", "~> 2.13"
|
||||||
|
gem "sassc-rails"
|
||||||
|
|
||||||
gem "devise", "~> 4.8"
|
gem "devise", "~> 4.8"
|
||||||
gem "omniauth", "~> 1.9.1"
|
gem "omniauth", "~> 1.9.1"
|
||||||
gem "omniauth-google-oauth2", "~> 0.8.2"
|
gem "omniauth-google-oauth2", "~> 0.8.2"
|
||||||
|
|||||||
55
Gemfile.lock
55
Gemfile.lock
@@ -46,6 +46,15 @@ GEM
|
|||||||
erubi (~> 1.4)
|
erubi (~> 1.4)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
||||||
|
activeadmin (2.13.1)
|
||||||
|
arbre (~> 1.2, >= 1.2.1)
|
||||||
|
formtastic (>= 3.1, < 5.0)
|
||||||
|
formtastic_i18n (~> 0.4)
|
||||||
|
inherited_resources (~> 1.7)
|
||||||
|
jquery-rails (~> 4.2)
|
||||||
|
kaminari (~> 1.0, >= 1.2.1)
|
||||||
|
railties (>= 6.1, < 7.1)
|
||||||
|
ransack (>= 2.1.1, < 4)
|
||||||
activejob (7.0.3.1)
|
activejob (7.0.3.1)
|
||||||
activesupport (= 7.0.3.1)
|
activesupport (= 7.0.3.1)
|
||||||
globalid (>= 0.3.6)
|
globalid (>= 0.3.6)
|
||||||
@@ -69,6 +78,9 @@ GEM
|
|||||||
annotate (3.2.0)
|
annotate (3.2.0)
|
||||||
activerecord (>= 3.2, < 8.0)
|
activerecord (>= 3.2, < 8.0)
|
||||||
rake (>= 10.4, < 14.0)
|
rake (>= 10.4, < 14.0)
|
||||||
|
arbre (1.5.0)
|
||||||
|
activesupport (>= 3.0.0, < 7.1)
|
||||||
|
ruby2_keywords (>= 0.0.2, < 1.0)
|
||||||
bcrypt (3.1.18)
|
bcrypt (3.1.18)
|
||||||
bindex (0.8.1)
|
bindex (0.8.1)
|
||||||
bootsnap (1.12.0)
|
bootsnap (1.12.0)
|
||||||
@@ -101,21 +113,49 @@ GEM
|
|||||||
faraday-net_http (~> 2.0)
|
faraday-net_http (~> 2.0)
|
||||||
ruby2_keywords (>= 0.0.4)
|
ruby2_keywords (>= 0.0.4)
|
||||||
faraday-net_http (2.0.3)
|
faraday-net_http (2.0.3)
|
||||||
|
ffi (1.15.5)
|
||||||
|
formtastic (4.0.0)
|
||||||
|
actionpack (>= 5.2.0)
|
||||||
|
formtastic_i18n (0.7.0)
|
||||||
globalid (1.0.0)
|
globalid (1.0.0)
|
||||||
activesupport (>= 5.0)
|
activesupport (>= 5.0)
|
||||||
|
has_scope (0.8.0)
|
||||||
|
actionpack (>= 5.2)
|
||||||
|
activesupport (>= 5.2)
|
||||||
hashie (5.0.0)
|
hashie (5.0.0)
|
||||||
i18n (1.12.0)
|
i18n (1.12.0)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
importmap-rails (1.1.5)
|
importmap-rails (1.1.5)
|
||||||
actionpack (>= 6.0.0)
|
actionpack (>= 6.0.0)
|
||||||
railties (>= 6.0.0)
|
railties (>= 6.0.0)
|
||||||
|
inherited_resources (1.13.1)
|
||||||
|
actionpack (>= 5.2, < 7.1)
|
||||||
|
has_scope (~> 0.6)
|
||||||
|
railties (>= 5.2, < 7.1)
|
||||||
|
responders (>= 2, < 4)
|
||||||
io-console (0.5.11)
|
io-console (0.5.11)
|
||||||
irb (1.4.1)
|
irb (1.4.1)
|
||||||
reline (>= 0.3.0)
|
reline (>= 0.3.0)
|
||||||
jbuilder (2.11.5)
|
jbuilder (2.11.5)
|
||||||
actionview (>= 5.0.0)
|
actionview (>= 5.0.0)
|
||||||
activesupport (>= 5.0.0)
|
activesupport (>= 5.0.0)
|
||||||
|
jquery-rails (4.5.0)
|
||||||
|
rails-dom-testing (>= 1, < 3)
|
||||||
|
railties (>= 4.2.0)
|
||||||
|
thor (>= 0.14, < 2.0)
|
||||||
jwt (2.4.1)
|
jwt (2.4.1)
|
||||||
|
kaminari (1.2.2)
|
||||||
|
activesupport (>= 4.1.0)
|
||||||
|
kaminari-actionview (= 1.2.2)
|
||||||
|
kaminari-activerecord (= 1.2.2)
|
||||||
|
kaminari-core (= 1.2.2)
|
||||||
|
kaminari-actionview (1.2.2)
|
||||||
|
actionview
|
||||||
|
kaminari-core (= 1.2.2)
|
||||||
|
kaminari-activerecord (1.2.2)
|
||||||
|
activerecord
|
||||||
|
kaminari-core (= 1.2.2)
|
||||||
|
kaminari-core (1.2.2)
|
||||||
loofah (2.18.0)
|
loofah (2.18.0)
|
||||||
crass (~> 1.0.2)
|
crass (~> 1.0.2)
|
||||||
nokogiri (>= 1.5.9)
|
nokogiri (>= 1.5.9)
|
||||||
@@ -197,6 +237,10 @@ GEM
|
|||||||
thor (~> 1.0)
|
thor (~> 1.0)
|
||||||
zeitwerk (~> 2.5)
|
zeitwerk (~> 2.5)
|
||||||
rake (13.0.6)
|
rake (13.0.6)
|
||||||
|
ransack (3.2.1)
|
||||||
|
activerecord (>= 6.1.5)
|
||||||
|
activesupport (>= 6.1.5)
|
||||||
|
i18n
|
||||||
redis (4.7.1)
|
redis (4.7.1)
|
||||||
reline (0.3.1)
|
reline (0.3.1)
|
||||||
io-console (~> 0.5)
|
io-console (~> 0.5)
|
||||||
@@ -221,6 +265,14 @@ GEM
|
|||||||
rspec-support (~> 3.10)
|
rspec-support (~> 3.10)
|
||||||
rspec-support (3.11.0)
|
rspec-support (3.11.0)
|
||||||
ruby2_keywords (0.0.5)
|
ruby2_keywords (0.0.5)
|
||||||
|
sassc (2.4.0)
|
||||||
|
ffi (~> 1.9)
|
||||||
|
sassc-rails (2.1.2)
|
||||||
|
railties (>= 4.0.0)
|
||||||
|
sassc (>= 2.0)
|
||||||
|
sprockets (> 3.0)
|
||||||
|
sprockets-rails
|
||||||
|
tilt
|
||||||
sprockets (4.1.1)
|
sprockets (4.1.1)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
rack (> 1, < 3)
|
rack (> 1, < 3)
|
||||||
@@ -232,6 +284,7 @@ GEM
|
|||||||
railties (>= 6.0.0)
|
railties (>= 6.0.0)
|
||||||
strscan (3.0.3)
|
strscan (3.0.3)
|
||||||
thor (1.2.1)
|
thor (1.2.1)
|
||||||
|
tilt (2.0.10)
|
||||||
timeout (0.3.0)
|
timeout (0.3.0)
|
||||||
turbo-rails (1.1.1)
|
turbo-rails (1.1.1)
|
||||||
actionpack (>= 6.0.0)
|
actionpack (>= 6.0.0)
|
||||||
@@ -255,6 +308,7 @@ PLATFORMS
|
|||||||
x86_64-linux
|
x86_64-linux
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
|
activeadmin (~> 2.13)
|
||||||
annotate (~> 3.2)
|
annotate (~> 3.2)
|
||||||
bootsnap
|
bootsnap
|
||||||
debug
|
debug
|
||||||
@@ -270,6 +324,7 @@ DEPENDENCIES
|
|||||||
rails (~> 7.0.3, >= 7.0.3.1)
|
rails (~> 7.0.3, >= 7.0.3.1)
|
||||||
redis (~> 4.0)
|
redis (~> 4.0)
|
||||||
rspec-rails (~> 5.1)
|
rspec-rails (~> 5.1)
|
||||||
|
sassc-rails
|
||||||
sprockets-rails
|
sprockets-rails
|
||||||
stimulus-rails
|
stimulus-rails
|
||||||
turbo-rails
|
turbo-rails
|
||||||
|
|||||||
33
app/admin/dashboard.rb
Normal file
33
app/admin/dashboard.rb
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
ActiveAdmin.register_page "Dashboard" do
|
||||||
|
menu priority: 1, label: proc { I18n.t("active_admin.dashboard") }
|
||||||
|
|
||||||
|
content title: proc { I18n.t("active_admin.dashboard") } do
|
||||||
|
div class: "blank_slate_container", id: "dashboard_default_message" do
|
||||||
|
span class: "blank_slate" do
|
||||||
|
span I18n.t("active_admin.dashboard_welcome.welcome")
|
||||||
|
small I18n.t("active_admin.dashboard_welcome.call_to_action")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Here is an example of a simple dashboard with columns and panels.
|
||||||
|
#
|
||||||
|
# columns do
|
||||||
|
# column do
|
||||||
|
# panel "Recent Posts" do
|
||||||
|
# ul do
|
||||||
|
# Post.recent(5).map do |post|
|
||||||
|
# li link_to(post.title, admin_post_path(post))
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
|
# column do
|
||||||
|
# panel "Info" do
|
||||||
|
# para "Welcome to ActiveAdmin."
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
end # content
|
||||||
|
end
|
||||||
24
app/admin/users.rb
Normal file
24
app/admin/users.rb
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
ActiveAdmin.register User do
|
||||||
|
permit_params :email, :name
|
||||||
|
|
||||||
|
index do
|
||||||
|
selectable_column
|
||||||
|
id_column
|
||||||
|
column :email
|
||||||
|
column :name
|
||||||
|
column :created_at
|
||||||
|
actions
|
||||||
|
end
|
||||||
|
|
||||||
|
filter :email
|
||||||
|
filter :name
|
||||||
|
filter :created_at
|
||||||
|
|
||||||
|
form do |f|
|
||||||
|
f.inputs do
|
||||||
|
f.input :email
|
||||||
|
f.input :email
|
||||||
|
end
|
||||||
|
f.actions
|
||||||
|
end
|
||||||
|
end
|
||||||
1
app/assets/javascripts/active_admin.js
Normal file
1
app/assets/javascripts/active_admin.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
//= require active_admin/base
|
||||||
17
app/assets/stylesheets/active_admin.scss
Normal file
17
app/assets/stylesheets/active_admin.scss
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
// Sass variable overrides must be declared before loading up Active Admin's styles.
|
||||||
|
//
|
||||||
|
// To view the variables that Active Admin provides, take a look at
|
||||||
|
// `app/assets/stylesheets/active_admin/mixins/_variables.scss` in the
|
||||||
|
// Active Admin source.
|
||||||
|
//
|
||||||
|
// For example, to change the sidebar width:
|
||||||
|
// $sidebar-width: 242px;
|
||||||
|
|
||||||
|
// Active Admin's got SASS!
|
||||||
|
@import "active_admin/mixins";
|
||||||
|
@import "active_admin/base";
|
||||||
|
|
||||||
|
// Overriding any non-variable Sass must be done after the fact.
|
||||||
|
// For example, to change the default status-tag color:
|
||||||
|
//
|
||||||
|
// .status_tag { background: #6090DB; }
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
/*
|
|
||||||
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
||||||
* listed below.
|
|
||||||
*
|
|
||||||
* Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
|
|
||||||
* vendor/assets/stylesheets directory can be referenced here using a relative path.
|
|
||||||
*
|
|
||||||
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
|
||||||
* compiled file so the styles you add here take precedence over styles defined in any other CSS
|
|
||||||
* files in this directory. Styles in this file should be added after the last require_* statement.
|
|
||||||
* It is generally better to create a new file per style scope.
|
|
||||||
*
|
|
||||||
*= require_tree .
|
|
||||||
*= require_self
|
|
||||||
*/
|
|
||||||
|
|||||||
335
config/initializers/active_admin.rb
Normal file
335
config/initializers/active_admin.rb
Normal file
@@ -0,0 +1,335 @@
|
|||||||
|
ActiveAdmin.setup do |config|
|
||||||
|
# == Site Title
|
||||||
|
#
|
||||||
|
# Set the title that is displayed on the main layout
|
||||||
|
# for each of the active admin pages.
|
||||||
|
#
|
||||||
|
config.site_title = "Progress Test"
|
||||||
|
|
||||||
|
# Set the link url for the title. For example, to take
|
||||||
|
# users to your main site. Defaults to no link.
|
||||||
|
#
|
||||||
|
# config.site_title_link = "/"
|
||||||
|
|
||||||
|
# Set an optional image to be displayed for the header
|
||||||
|
# instead of a string (overrides :site_title)
|
||||||
|
#
|
||||||
|
# Note: Aim for an image that's 21px high so it fits in the header.
|
||||||
|
#
|
||||||
|
# config.site_title_image = "logo.png"
|
||||||
|
|
||||||
|
# == Default Namespace
|
||||||
|
#
|
||||||
|
# Set the default namespace each administration resource
|
||||||
|
# will be added to.
|
||||||
|
#
|
||||||
|
# eg:
|
||||||
|
# config.default_namespace = :hello_world
|
||||||
|
#
|
||||||
|
# This will create resources in the HelloWorld module and
|
||||||
|
# will namespace routes to /hello_world/*
|
||||||
|
#
|
||||||
|
# To set no namespace by default, use:
|
||||||
|
# config.default_namespace = false
|
||||||
|
#
|
||||||
|
# Default:
|
||||||
|
# config.default_namespace = :admin
|
||||||
|
#
|
||||||
|
# You can customize the settings for each namespace by using
|
||||||
|
# a namespace block. For example, to change the site title
|
||||||
|
# within a namespace:
|
||||||
|
#
|
||||||
|
# config.namespace :admin do |admin|
|
||||||
|
# admin.site_title = "Custom Admin Title"
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# This will ONLY change the title for the admin section. Other
|
||||||
|
# namespaces will continue to use the main "site_title" configuration.
|
||||||
|
|
||||||
|
# == User Authentication
|
||||||
|
#
|
||||||
|
# Active Admin will automatically call an authentication
|
||||||
|
# method in a before filter of all controller actions to
|
||||||
|
# ensure that there is a currently logged in admin user.
|
||||||
|
#
|
||||||
|
# This setting changes the method which Active Admin calls
|
||||||
|
# within the application controller.
|
||||||
|
config.authentication_method = :authenticate_user!
|
||||||
|
|
||||||
|
# == User Authorization
|
||||||
|
#
|
||||||
|
# Active Admin will automatically call an authorization
|
||||||
|
# method in a before filter of all controller actions to
|
||||||
|
# ensure that there is a user with proper rights. You can use
|
||||||
|
# CanCanAdapter or make your own. Please refer to documentation.
|
||||||
|
# config.authorization_adapter = ActiveAdmin::CanCanAdapter
|
||||||
|
|
||||||
|
# In case you prefer Pundit over other solutions you can here pass
|
||||||
|
# the name of default policy class. This policy will be used in every
|
||||||
|
# case when Pundit is unable to find suitable policy.
|
||||||
|
# config.pundit_default_policy = "MyDefaultPunditPolicy"
|
||||||
|
|
||||||
|
# If you wish to maintain a separate set of Pundit policies for admin
|
||||||
|
# resources, you may set a namespace here that Pundit will search
|
||||||
|
# within when looking for a resource's policy.
|
||||||
|
# config.pundit_policy_namespace = :admin
|
||||||
|
|
||||||
|
# You can customize your CanCan Ability class name here.
|
||||||
|
# config.cancan_ability_class = "Ability"
|
||||||
|
|
||||||
|
# You can specify a method to be called on unauthorized access.
|
||||||
|
# This is necessary in order to prevent a redirect loop which happens
|
||||||
|
# because, by default, user gets redirected to Dashboard. If user
|
||||||
|
# doesn't have access to Dashboard, he'll end up in a redirect loop.
|
||||||
|
# Method provided here should be defined in application_controller.rb.
|
||||||
|
# config.on_unauthorized_access = :access_denied
|
||||||
|
|
||||||
|
# == Current User
|
||||||
|
#
|
||||||
|
# Active Admin will associate actions with the current
|
||||||
|
# user performing them.
|
||||||
|
#
|
||||||
|
# This setting changes the method which Active Admin calls
|
||||||
|
# (within the application controller) to return the currently logged in user.
|
||||||
|
config.current_user_method = :current_user
|
||||||
|
|
||||||
|
# == Logging Out
|
||||||
|
#
|
||||||
|
# Active Admin displays a logout link on each screen. These
|
||||||
|
# settings configure the location and method used for the link.
|
||||||
|
#
|
||||||
|
# This setting changes the path where the link points to. If it's
|
||||||
|
# a string, the strings is used as the path. If it's a Symbol, we
|
||||||
|
# will call the method to return the path.
|
||||||
|
#
|
||||||
|
# Default:
|
||||||
|
config.logout_link_path = :destroy_user_session_path
|
||||||
|
|
||||||
|
# This setting changes the http method used when rendering the
|
||||||
|
# link. For example :get, :delete, :put, etc..
|
||||||
|
#
|
||||||
|
# Default:
|
||||||
|
config.logout_link_method = :delete
|
||||||
|
|
||||||
|
# == Root
|
||||||
|
#
|
||||||
|
# Set the action to call for the root path. You can set different
|
||||||
|
# roots for each namespace.
|
||||||
|
#
|
||||||
|
# Default:
|
||||||
|
# config.root_to = 'dashboard#index'
|
||||||
|
|
||||||
|
# == Admin Comments
|
||||||
|
#
|
||||||
|
# This allows your users to comment on any resource registered with Active Admin.
|
||||||
|
#
|
||||||
|
# You can completely disable comments:
|
||||||
|
# config.comments = false
|
||||||
|
#
|
||||||
|
# You can change the name under which comments are registered:
|
||||||
|
# config.comments_registration_name = 'AdminComment'
|
||||||
|
#
|
||||||
|
# You can change the order for the comments and you can change the column
|
||||||
|
# to be used for ordering:
|
||||||
|
# config.comments_order = 'created_at ASC'
|
||||||
|
#
|
||||||
|
# You can disable the menu item for the comments index page:
|
||||||
|
# config.comments_menu = false
|
||||||
|
#
|
||||||
|
# You can customize the comment menu:
|
||||||
|
# config.comments_menu = { parent: 'Admin', priority: 1 }
|
||||||
|
|
||||||
|
# == Batch Actions
|
||||||
|
#
|
||||||
|
# Enable and disable Batch Actions
|
||||||
|
#
|
||||||
|
config.batch_actions = true
|
||||||
|
|
||||||
|
# == Controller Filters
|
||||||
|
#
|
||||||
|
# You can add before, after and around filters to all of your
|
||||||
|
# Active Admin resources and pages from here.
|
||||||
|
#
|
||||||
|
# config.before_action :do_something_awesome
|
||||||
|
|
||||||
|
# == Attribute Filters
|
||||||
|
#
|
||||||
|
# You can exclude possibly sensitive model attributes from being displayed,
|
||||||
|
# added to forms, or exported by default by ActiveAdmin
|
||||||
|
#
|
||||||
|
config.filter_attributes = [:encrypted_password, :password, :password_confirmation]
|
||||||
|
|
||||||
|
# == Localize Date/Time Format
|
||||||
|
#
|
||||||
|
# Set the localize format to display dates and times.
|
||||||
|
# To understand how to localize your app with I18n, read more at
|
||||||
|
# https://guides.rubyonrails.org/i18n.html
|
||||||
|
#
|
||||||
|
# You can run `bin/rails runner 'puts I18n.t("date.formats")'` to see the
|
||||||
|
# available formats in your application.
|
||||||
|
#
|
||||||
|
config.localize_format = :long
|
||||||
|
|
||||||
|
# == Setting a Favicon
|
||||||
|
#
|
||||||
|
# config.favicon = 'favicon.ico'
|
||||||
|
|
||||||
|
# == Meta Tags
|
||||||
|
#
|
||||||
|
# Add additional meta tags to the head element of active admin pages.
|
||||||
|
#
|
||||||
|
# Add tags to all pages logged in users see:
|
||||||
|
# config.meta_tags = { author: 'My Company' }
|
||||||
|
|
||||||
|
# By default, sign up/sign in/recover password pages are excluded
|
||||||
|
# from showing up in search engine results by adding a robots meta
|
||||||
|
# tag. You can reset the hash of meta tags included in logged out
|
||||||
|
# pages:
|
||||||
|
# config.meta_tags_for_logged_out_pages = {}
|
||||||
|
|
||||||
|
# == Removing Breadcrumbs
|
||||||
|
#
|
||||||
|
# Breadcrumbs are enabled by default. You can customize them for individual
|
||||||
|
# resources or you can disable them globally from here.
|
||||||
|
#
|
||||||
|
# config.breadcrumb = false
|
||||||
|
|
||||||
|
# == Create Another Checkbox
|
||||||
|
#
|
||||||
|
# Create another checkbox is disabled by default. You can customize it for individual
|
||||||
|
# resources or you can enable them globally from here.
|
||||||
|
#
|
||||||
|
# config.create_another = true
|
||||||
|
|
||||||
|
# == Register Stylesheets & Javascripts
|
||||||
|
#
|
||||||
|
# We recommend using the built in Active Admin layout and loading
|
||||||
|
# up your own stylesheets / javascripts to customize the look
|
||||||
|
# and feel.
|
||||||
|
#
|
||||||
|
# To load a stylesheet:
|
||||||
|
# config.register_stylesheet 'my_stylesheet.css'
|
||||||
|
#
|
||||||
|
# You can provide an options hash for more control, which is passed along to stylesheet_link_tag():
|
||||||
|
# config.register_stylesheet 'my_print_stylesheet.css', media: :print
|
||||||
|
#
|
||||||
|
# To load a javascript file:
|
||||||
|
# config.register_javascript 'my_javascript.js'
|
||||||
|
|
||||||
|
# == CSV options
|
||||||
|
#
|
||||||
|
# Set the CSV builder separator
|
||||||
|
# config.csv_options = { col_sep: ';' }
|
||||||
|
#
|
||||||
|
# Force the use of quotes
|
||||||
|
# config.csv_options = { force_quotes: true }
|
||||||
|
|
||||||
|
# == Menu System
|
||||||
|
#
|
||||||
|
# You can add a navigation menu to be used in your application, or configure a provided menu
|
||||||
|
#
|
||||||
|
# To change the default utility navigation to show a link to your website & a logout btn
|
||||||
|
#
|
||||||
|
# config.namespace :admin do |admin|
|
||||||
|
# admin.build_menu :utility_navigation do |menu|
|
||||||
|
# menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank }
|
||||||
|
# admin.add_logout_button_to_menu menu
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# If you wanted to add a static menu item to the default menu provided:
|
||||||
|
#
|
||||||
|
# config.namespace :admin do |admin|
|
||||||
|
# admin.build_menu :default do |menu|
|
||||||
|
# menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank }
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
|
# == Download Links
|
||||||
|
#
|
||||||
|
# You can disable download links on resource listing pages,
|
||||||
|
# or customize the formats shown per namespace/globally
|
||||||
|
#
|
||||||
|
# To disable/customize for the :admin namespace:
|
||||||
|
#
|
||||||
|
# config.namespace :admin do |admin|
|
||||||
|
#
|
||||||
|
# # Disable the links entirely
|
||||||
|
# admin.download_links = false
|
||||||
|
#
|
||||||
|
# # Only show XML & PDF options
|
||||||
|
# admin.download_links = [:xml, :pdf]
|
||||||
|
#
|
||||||
|
# # Enable/disable the links based on block
|
||||||
|
# # (for example, with cancan)
|
||||||
|
# admin.download_links = proc { can?(:view_download_links) }
|
||||||
|
#
|
||||||
|
# end
|
||||||
|
|
||||||
|
# == Pagination
|
||||||
|
#
|
||||||
|
# Pagination is enabled by default for all resources.
|
||||||
|
# You can control the default per page count for all resources here.
|
||||||
|
#
|
||||||
|
# config.default_per_page = 30
|
||||||
|
#
|
||||||
|
# You can control the max per page count too.
|
||||||
|
#
|
||||||
|
# config.max_per_page = 10_000
|
||||||
|
|
||||||
|
# == Filters
|
||||||
|
#
|
||||||
|
# By default the index screen includes a "Filters" sidebar on the right
|
||||||
|
# hand side with a filter for each attribute of the registered model.
|
||||||
|
# You can enable or disable them for all resources here.
|
||||||
|
#
|
||||||
|
# config.filters = true
|
||||||
|
#
|
||||||
|
# By default the filters include associations in a select, which means
|
||||||
|
# that every record will be loaded for each association (up
|
||||||
|
# to the value of config.maximum_association_filter_arity).
|
||||||
|
# You can enabled or disable the inclusion
|
||||||
|
# of those filters by default here.
|
||||||
|
#
|
||||||
|
# config.include_default_association_filters = true
|
||||||
|
|
||||||
|
# config.maximum_association_filter_arity = 256 # default value of :unlimited will change to 256 in a future version
|
||||||
|
# config.filter_columns_for_large_association = [
|
||||||
|
# :display_name,
|
||||||
|
# :full_name,
|
||||||
|
# :name,
|
||||||
|
# :username,
|
||||||
|
# :login,
|
||||||
|
# :title,
|
||||||
|
# :email,
|
||||||
|
# ]
|
||||||
|
# config.filter_method_for_large_association = '_starts_with'
|
||||||
|
|
||||||
|
# == Head
|
||||||
|
#
|
||||||
|
# You can add your own content to the site head like analytics. Make sure
|
||||||
|
# you only pass content you trust.
|
||||||
|
#
|
||||||
|
# config.head = ''.html_safe
|
||||||
|
|
||||||
|
# == Footer
|
||||||
|
#
|
||||||
|
# By default, the footer shows the current Active Admin version. You can
|
||||||
|
# override the content of the footer here.
|
||||||
|
#
|
||||||
|
# config.footer = 'my custom footer text'
|
||||||
|
|
||||||
|
# == Sorting
|
||||||
|
#
|
||||||
|
# By default ActiveAdmin::OrderClause is used for sorting logic
|
||||||
|
# You can inherit it with own class and inject it for all resources
|
||||||
|
#
|
||||||
|
# config.order_clause = MyOrderClause
|
||||||
|
|
||||||
|
# == Webpacker
|
||||||
|
#
|
||||||
|
# By default, Active Admin uses Sprocket's asset pipeline.
|
||||||
|
# You can switch to using Webpacker here.
|
||||||
|
#
|
||||||
|
# config.use_webpacker = true
|
||||||
|
end
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
devise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks' }
|
devise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks' }
|
||||||
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
|
|
||||||
|
|
||||||
# Defines the root path route ("/")
|
ActiveAdmin.routes(self)
|
||||||
# root "articles#index"
|
|
||||||
end
|
end
|
||||||
|
|||||||
16
db/migrate/20220721015136_create_active_admin_comments.rb
Normal file
16
db/migrate/20220721015136_create_active_admin_comments.rb
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
class CreateActiveAdminComments < ActiveRecord::Migration[7.0]
|
||||||
|
def self.up
|
||||||
|
create_table :active_admin_comments do |t|
|
||||||
|
t.string :namespace
|
||||||
|
t.text :body
|
||||||
|
t.references :resource, polymorphic: true
|
||||||
|
t.references :author, polymorphic: true
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
add_index :active_admin_comments, [:namespace]
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.down
|
||||||
|
drop_table :active_admin_comments
|
||||||
|
end
|
||||||
|
end
|
||||||
16
db/schema.rb
generated
16
db/schema.rb
generated
@@ -10,10 +10,24 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[7.0].define(version: 2022_07_21_002916) do
|
ActiveRecord::Schema[7.0].define(version: 2022_07_21_015136) do
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
|
||||||
|
create_table "active_admin_comments", force: :cascade do |t|
|
||||||
|
t.string "namespace"
|
||||||
|
t.text "body"
|
||||||
|
t.string "resource_type"
|
||||||
|
t.bigint "resource_id"
|
||||||
|
t.string "author_type"
|
||||||
|
t.bigint "author_id"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["author_type", "author_id"], name: "index_active_admin_comments_on_author"
|
||||||
|
t.index ["namespace"], name: "index_active_admin_comments_on_namespace"
|
||||||
|
t.index ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource"
|
||||||
|
end
|
||||||
|
|
||||||
create_table "users", force: :cascade do |t|
|
create_table "users", force: :cascade do |t|
|
||||||
t.string "email", default: "", null: false
|
t.string "email", default: "", null: false
|
||||||
t.string "encrypted_password", default: "", null: false
|
t.string "encrypted_password", default: "", null: false
|
||||||
|
|||||||
@@ -5,3 +5,4 @@
|
|||||||
#
|
#
|
||||||
# movies = Movie.create([{ name: "Star Wars" }, { name: "Lord of the Rings" }])
|
# movies = Movie.create([{ name: "Star Wars" }, { name: "Lord of the Rings" }])
|
||||||
# Character.create(name: "Luke", movie: movies.first)
|
# Character.create(name: "Luke", movie: movies.first)
|
||||||
|
User.create!(email: 'admin@example.com', name: 'Admin User', password: 'password', password_confirmation: 'password')
|
||||||
Reference in New Issue
Block a user