Skip to content

Commit

Permalink
Documentation (#90)
Browse files Browse the repository at this point in the history
* added docs for custom fields and resources

* Added docs for routes and views
  • Loading branch information
kashiftariq1997 authored Aug 16, 2021
1 parent 55990a2 commit d769cba
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/custom_fields.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## 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
7 changes: 7 additions & 0 deletions docs/resources.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# 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
7 changes: 7 additions & 0 deletions docs/routes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Routes
Routes should be under the namespace of madmin module.Like
namespace :madmin do
namespace :user do
resources :connected_accounts
end
end
8 changes: 8 additions & 0 deletions docs/views.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# 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

0 comments on commit d769cba

Please sign in to comment.