How to create new Easy Page - dashboard
This section provide basic information what needs to be implement for working Easy Page - new dashboard.
Controller
Controller just call registration EasyPageHandler which provide all necessary DSL for future dashboard.
| Example of dashboard controller | |
|---|---|
arguments
page_name- internal name of EasyPage corresponding to this dashboard. EasyPage must exists in database.path- must beprocand its route to dashboard.show_action- is default "view" - its dashboard itselfedit_action- is "edit" part of dashboard. In this action user can add modules...
For complete list see method definition.
Routes
Routes are defined in config/routes.rb.
resources :my_dashboard, only: [:index], path: "/super-dashboard" do
match :layout, action: :index_layout, via: %i[get post], on: :collection
end
Views
Views are defined in app/views/my_dashboard folder. There must exists index.html.erb and index_layout.html.erb files.
Migration
Generate new data migration which creates EasyPage object in database.
Tests
in specs you can define fixtures with your new easy_page and of course test itself. My recommendation:
Fixtures
in spec/fixtures/easy_pages.yml
easy_page_069:
id: 69
page_name: my-dashboard
layout_path: easy_page_layouts/two_column_header_first_wider
in spec/fixtures/easy_available_zones.yml
Test
in spec/requests/dashboard_controller_spec.rb