• Stars
    star
    497
  • Rank 85,316 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 3 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A robust Admin Interface for Ruby on Rails apps

Madmin

πŸ›  A robust Admin Interface for Ruby on Rails apps

Build Status Gem Version

Why another Ruby on Rails admin? We wanted an admin that was:

  • Familiar and customizable like Rails scaffolds (less DSL)
  • Supports all the Rails features out of the box (ActionText, ActionMailbox, has_secure_password, etc)
  • Stimulus / Turbolinks / Hotwire ready

Madmin Screenshot We're still working on the design!

Installation

Add madmin to your application's Gemfile:

bundle add madmin

Then run the madmin generator:

rails g madmin:install

This will install Madmin and generate resources for each of the models it finds.

Resources

Madmin uses Resource classes to add models to the admin area.

Generate a Resource

To generate a resource for a model, you can run:

rails g madmin:resource ActionText::RichText

Configuring Views

The views packaged within the gem are a great starting point, but inevitably people will need to be able to customize those views.

You can use the included generator to create the appropriate view files, which can then be customized.

For example, running the following will copy over all of the views into your application that will be used for every resource:

rails generate madmin:views

The view files that are copied over in this case includes all of the standard Rails action views (index, new, edit, show, and _form), as well as:

  • application.html.erb (layout file)
  • _javascript.html.erb (default JavaScript setup)
  • _navigation.html.erb (renders the navigation/sidebar menu)

As with the other views, you can specifically run the views generator for only the navigation or application layout views:

rails g madmin:views:navigation
 # -> app/views/madmin/_navigation.html.erb

rails g madmin:views:layout  # Note the layout generator includes the layout, javascript, and navigation files.
 # -> app/views/madmin/application.html.erb
 # -> app/views/madmin/_javascript.html.erb
 # -> app/views/madmin/_navigation.html.erb

If you only need to customize specific views, you can restrict which views are copied by the generator:

rails g madmin:views:index
 # -> app/views/madmin/application/index.html.erb

You might want to make some of your model's attributes visible in some views but invisible in others. The attribute method in model_resource.rb gives you that flexibility.

 # -> app/madmin/resources/book_resource.rb
class UserResource < Madmin::Resource
  attribute :id, form: false
  attribute :tile
  attribute :subtitle, index: false
  attribute :author
  attribute :genre
  attribute :pages, show: false
end

You can also scope the copied view(s) to a specific Resource/Model:

rails generate madmin:views:index Book
 # -> app/views/madmin/books/index.html.erb

Custom Fields

You can generate a custom field with:

rails g madmin:field Custom

This will create a CustomField class in app/madmin/fields/custom_field.rb And the related views:

# -> app/views/madmin/fields/custom_field/_form.html.erb
# -> app/views/madmin/fields/custom_field/_index.html.erb
# -> app/views/madmin/fields/custom_field/_show.html.erb

You can then use this field on our resource:

class PostResource < Madmin::Resource
  attribute :title, field: CustomField
end

Authentication

You can use a couple of strategies to authenticate users who are trying to access your madmin panel: Authentication Docs

πŸ™ Contributing

This project uses Standard for formatting Ruby code. Please make sure to run standardrb before submitting pull requests.

πŸ“ License

The gem is available as open source under the terms of the MIT License.

More Repositories

1

noticed

Notifications for Ruby on Rails applications
Ruby
2,275
star
2

simple_calendar

A wonderfully simple calendar gem for Rails
Ruby
1,476
star
3

jumpstart

Easily jumpstart a new Rails application with a bunch of great features by default
HTML
1,168
star
4

tailwindcss-stimulus-components

A set of StimulusJS components for TailwindCSS apps similar to Bootstrap JS components.
JavaScript
1,083
star
5

receipts

Easy receipts and invoices for your Rails applications
Ruby
495
star
6

simple_discussion

A simple, extensible Rails forum
Ruby
368
star
7

prefixed_ids

Friendly Prefixed IDs for your Ruby on Rails models
Ruby
198
star
8

revise_auth

A pure Rails authentication system like Devise.
Ruby
192
star
9

stack_rescue

A gem for Rails to automatically search Google for exceptions raised in your Rails applications
Ruby
171
star
10

esbuild-rails

Esbuild Rails plugin
JavaScript
137
star
11

signalman

Development tools for Ruby on Rails
Ruby
92
star
12

beginnerbounties.com

Small Projects for Junior Developers
Ruby
77
star
13

dotfiles

My personal dotfiles for macOS: zsh, MacVim, iterm, and more.
Vim Script
70
star
14

stimulus-slimselect

A Stimulus wrapper around SlimSelect
JavaScript
66
star
15

python-apt

This is a Python library interface to libapt, which allows you to query and manipulat APT package repository information using the Python programming language.
C++
63
star
16

combined_time_select

A Rails time_select like Google Calendar with combined hour and minute time_select
Ruby
60
star
17

logbot

A minimal IRC bot for logging channels
Python
59
star
18

textual-solarized

A port of the Solarized theme to Textual IRC
JavaScript
31
star
19

simple_calendar-ajax-example

An example Rails application to demonstrate SimpleCalendar AJAX next/previous links
Ruby
29
star
20

scheduled_tweets

Ruby
28
star
21

gorails-forum

Ruby
24
star
22

betterminitest.com

Learn how to write better Minitest tests
CSS
21
star
23

Rails-Learning

List of resources to learning this amazing platform for building top-quality web apps with Ruby on Rails! ❀
20
star
24

trello-stimulus-reflex

A trello clone using Stimulus Reflex
Ruby
17
star
25

railshackathon.com

The RailsHackathon.com website
HTML
17
star
26

asdf-vars

An asdf extension that safely sets global and per-project environment variables, based upon rbenv
Shell
17
star
27

railsconf-2020-actiontext

Railsconf 2020 example app for showcasing ActionText
Ruby
16
star
28

nine_to_five

Ruby
14
star
29

oauthable

Setup, test, and implement the OAuth connections to over 70 different APIs.
Ruby
13
star
30

gorails-ruby

An interactive CLI for GoRails, Railsbytes, Jumpstart, and more.
Ruby
12
star
31

animatedgif.me-v2

Ruby
11
star
32

keryx

Python
11
star
33

current_projects

Lists a user's active github projects
Ruby
9
star
34

israilsdead.com

It's pretty self explanatory I think
HTML
9
star
35

urlgrabber

A high-level cross-protocol url-grabber
Python
8
star
36

Sublime-Ruby-on-Rails.tmLanguage

8
star
37

fluttrly

An elegantly simple todo list
Ruby
8
star
38

simpyl_pastebin

A simple python pastebin
Python
8
star
39

zapier

Zapier API Rubygem
Ruby
8
star
40

excid3-wordpress-theme

My wordpress theme for excid3.com
PHP
7
star
41

animatedgifme

A ruby library for http://animatedgif.me
Ruby
7
star
42

weather_underground

A Ruby gem for the Weather Underground API
Ruby
7
star
43

wistia-player-speed

Add 2x, 1.5x, 0.5x speeds and skip 30 seconds controls to your Wistia video player
HTML
7
star
44

stimulus-js-2.0

A look at Stimulus JS 2.0's new Values and CSS Classes APIs
Ruby
6
star
45

railsconf-2021

Realtime Rails applications with Hotwire & ActionMailbox
Ruby
6
star
46

superleggera

Monitor your CSS in development to create a whitelist for PurgeCSS in Rails with Webpacker
Ruby
6
star
47

deploy_test

See how to deploy Rails to Ubuntu with Capistrano
Ruby
5
star
48

feedforward.io

Curating articles that inspire discussion
Ruby
5
star
49

particlesjs-rails-example

Ruby
5
star
50

clickable-simple_calendar

An example how to make the dates clickable with simple_calendar for creating new events
Ruby
5
star
51

webhookmonitor.com

A tool for recording and monitoring webhooks
Ruby
4
star
52

rpi-pms5003

Raspberry Pi air quality monitoring with PMS5003 and Ruby
Ruby
4
star
53

chef-rails-stack

Chef Solo recipes to setup a Rails stack on Ubuntu 12.04 LTS
Ruby
4
star
54

cfps

Conference talk submissions (CFPs)
4
star
55

react-todolist

A react todo list application with Ruby on Rails
Ruby
4
star
56

landing

My new website landing page
CSS
4
star
57

vuejs-rails-markdown-field

Use VueJS to add markdown previews to any Rails form input field or text area.
Ruby
4
star
58

better_resources

Resources routes that use the same for new and edit so users get less 404s
Ruby
3
star
59

rails-5.2-actiontext

Testing ActionText in Rails 5.2
Ruby
3
star
60

simple_calendar-example

A simple calendar gem example with Rails 6
Ruby
3
star
61

irc_bothost

A Django web application for maintaining python IRC bots
Python
3
star
62

sponsor-hub

A hub for your GitHub sponsors
Ruby
3
star
63

excid3

3
star
64

simple_calendar-full-day-example

Ruby
3
star
65

download_counter

A download counter implemented in Rails3 with an administration interface
Ruby
3
star
66

administrate-trix-editor

Episode 211: Adding the Trix Editor as an Administrate Custom Field
Ruby
3
star
67

gemspec-cheatsheet

An interactive GemSpec cheat sheet
3
star
68

excid3.com

Moving to Jekyll
HTML
3
star
69

reply_parser

Parser for email replies
Ruby
3
star
70

animatedgif.me

With Great Gifs Comes Great Responsibility
Ruby
3
star
71

turbolinks-3-example

Ruby
3
star
72

imageme

Ruby
2
star
73

unwrapt

A pure python layer for offline package managers
Python
2
star
74

chromium

cluster rendering
C
2
star
75

googleweather

Ruby client for the undocumented Google Weather API
Ruby
2
star
76

lithoslabs.com

2
star
77

cultivate

Ruby
2
star
78

blogspam

A Ruby and/or Rails client for Blogspam.net
Ruby
2
star
79

pastebot

An IRC bot that accepts pastes, uploads them, and notifies recipients
Python
2
star
80

excid3bot

A hubot
CoffeeScript
2
star
81

cdnjs-rails

A mechanized way to pull in one to many CDNJS libraries with fall back to local installed versions.
Ruby
2
star
82

keryx_profiler

A website to maintain user submitted profiles for Keryx
Ruby
2
star
83

rugby

A Ruby IRC bot
Ruby
2
star
84

trackler

A package tracker visualizing progress on Google Maps
Ruby
2
star
85

panopticode

Social Volt Contest Entry
Ruby
2
star
86

hatchbox-marketing

2
star
87

No-Net-Debs

List and download deb packages for updates (dist-upgrade included) or new package(s) for a computer without Internet. Hosting in case http://ubuntu.no.sapo.pt/nonetdebs/nonetdebs goes down.
2
star
88

fluttr-desktop

Fluttr desktop application in Python and GTK
Python
2
star
89

omniauth-stripeplatform

A strategy for omniauth and the new beta Stripe.com platofrm.
Ruby
1
star
90

simple_map

Ruby
1
star
91

hacker_rank

A Ruby interface to the HackerRank / InterviewStreet API
Ruby
1
star
92

anonykron

anonykron.com
Ruby
1
star
93

ipcommerce

Ruby
1
star
94

confab

A NodeJS IRC client in the browser
JavaScript
1
star
95

taip-parser

Ruby
1
star
96

omniauth-linode

An Omniauth Strategy for Linode's v4 API
Ruby
1
star
97

ice_rocket

A Rubygem for the IceRocket API
Ruby
1
star
98

combined_time_select-example

Ruby
1
star
99

resume

My resume!
1
star
100

shortbot

An IRC bot that shortens URLs via bit.ly
Python
1
star