Merge pull request #584 from Retrospring/phpMyAdmin

rails_admin: group models together and add nice icons
This commit is contained in:
Georg Gadinger 2022-07-28 20:23:42 +02:00 committed by GitHub
commit 216e6003c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 73 additions and 2 deletions

View File

@ -83,6 +83,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt update && sudo apt-get install -y libpq-dev libxml2-dev libxslt1-dev libmagickwand-dev imagemagick libidn11-dev
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:

View File

@ -3,8 +3,8 @@
# workaround to get pagination right
RailsAdmin.config do |config|
config.asset_source = :webpacker
config.main_app_name = ['justask', 'Kontrollzentrum']
config.parent_controller = '::ApplicationController'
config.main_app_name = %w[justask Kontrollzentrum]
config.parent_controller = "::ApplicationController"
## == Authentication ==
config.authenticate_with do
@ -51,4 +51,73 @@ RailsAdmin.config do |config|
User
UserBan
]
# set up icons for some models
{
"AnonymousBlock" => "user-secret",
"Answer" => "exclamation",
"Appendable" => "paperclip",
"Appendable::Reaction" => "smile",
"Comment" => "comment",
"Inbox" => "inbox",
"List" => "list",
"ListMember" => "users",
"MuteRule" => "volume-mute",
"Notification" => "bell",
"Profile" => "id-card",
"Question" => "question",
"Relationship" => "people-arrows",
"Relationships::Block" => "user-slash",
"Relationships::Follow" => "user-friends",
"Report" => "exclamation-triangle",
"Service" => "network-wired",
"Services::Twitter" => "dumpster-fire",
"Theme" => "paint-brush",
"User" => "user",
"UserBan" => "user-lock"
}.each do |model, icon|
config.model model do
navigation_icon "fa fa-fw fa-#{icon} me-1"
end
end
# set up custom parents for certain models to group them nicely together
{
"AnonymousBlock" => User,
"Inbox" => User,
"List" => User,
"MuteRule" => User,
"Notification" => User,
"Profile" => User,
"Relationship" => User,
"Service" => User,
"Theme" => User,
"ListMember" => List
}.each do |model, parent_model|
config.model model do
parent parent_model
end
end
# create groups inside nav tree
{
"User content" => %w[
Answer
Appendable
Comment
Question
User
],
"Global" => %w[
Report
UserBan
]
}.each do |label, models|
models.each do |model|
config.model model do
navigation_label label
end
end
end
end