Recourse

resources

Swap two characters and get admin screens for your Rails app.

A recourses line in config/routes.rb draws the routes, the controllers and every view a resource needs. More convention, less configuration.

Get started Read the guides

Install it and edit your routes

Add recourse to the Gemfile. Then edit config/routes.rb replacing resources with recourses.

# Gemfile
gem 'recourse'
# config/routes.rb
- resources :posts, only: %i[index show] do
+ recourses :posts, only: %i[index show] do
-   resources :comments, except: :destroy
+   recourses :comments, except: :destroy
  end

That is the whole of what a host has to do. Everything else is optional.

What you get

index

A paginated, searchable, sortable table with a sidebar entry, a keyboard shortcut, and live reload.

show

The record’s page with properly formatted attributes (numbers with precision, currency, localized timestamps, masked secrets).

new and edit

A field for each column’s kind, carrying what the validators say — a length as maxlength, a format as pattern, a required attribute as a required field.

A delete that asks first

A dialog naming the record and counting what goes with it, and a page that says so rather than raising when a model will not give a row up.

Nesting

Each resource nested under a record is a tab on its card, counted where the record keeps a count, and a bare action is a button beside the breadcrumb.

Other shapes

A table of places reads as a Google map, a table of events as a week, a table with a position is dragged into order, and one fed from elsewhere offers to fetch again.

Bookmarks

One Proc naming the viewer’s kept rows, and every table that can hold one opens with a square to keep a row by, kept rows first.

Your look

A primary color, one of nine palettes, light or dark at the reader’s own choosing, and every time drawn in the reader’s own zone.

The guides

One page per screen, in the order a host meets them.