-
Notifications
You must be signed in to change notification settings - Fork 9
Creating components
Para comes without general purpose components to create simple forms and CRUDs, and allows to create your own components.
These are the basic components :
- The
:crud
component, which allows to display a simple table / form CRUD structure for a given model. Useful for most of the user-facing models of your app. - The
:form
components, which creates a simple form for a single instance of a given model. Useful for configuration interfaces and other models which may be easily edited as a single form instead of having a single instance in a table and using a:crud
component.
Most of the time, a combination of those two components, with the other customization capacities of Para will be enough to cover your needs.
If you need to create a special component, from scratch or inheriting from existing components functionality, you can build your own components, as described below.
If you only need to add functionnality to a specific :crud
component, you can override the controller used by your component to access your data.
Most of the time, you'll want that controller to keep existing code and add some features to it.
This can be acomplished by creating a controller inheriting from the Para::Admin::CrudResourcesController
, adding missing routes and forcing it to be used by your component in your config/components.rb
file.
You can find examples here : Overriding and adding actions to components
This works exactly the same as extending the :crud
component as described above.
The only difference is that you'll use a different parent class for your controller (Para::Admin::FormResourcesController
) and a different helper in your routes (form_component
).