-
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added docs for custom fields and resources * Added docs for routes and views
- Loading branch information
1 parent
55990a2
commit d769cba
Showing
4 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |