-
Notifications
You must be signed in to change notification settings - Fork 2
Generating cells
Petr Marek edited this page Nov 27, 2020
·
4 revisions
Generate a single view cell.
$ rails g folio:cell articles/box
Running via Spring preloader in process 29974
create app/cells/project_namespace/articles/box_cell.rb
create app/cells/project_namespace/articles/box/show.slim
create test/cells/project_namespace/articles/box_cell_test.rb
Place custom stylesheets in app/cells/project_namespace/articles/box/box.sass
, which get loaded automatically.
Place custom js/coffee in app/cells/project_namespace/articles/box/box.coffee
and require it in application.js
:
//= require project_namespace/articles/box/box
Cells should be generated into folders/namespaces corresponding to the resources. A product list should be in project_namespace/products/list
. A generic pagination cell can be in the root project_namespace/pagination
.
- Avoid using
id
attribute. - Classnames should be prefixed with the first letter of the application name (lowercase).
- Each cell should have a class name corresponding to its path in the project.
ProjectNamespace::Products::List
inproject_namespace/products/list/show.slim
should have a root class namep-products-list
. - Use BEM for classnames in the cell with the cell root class name being the BEM Block. Image in the products list cell would be
p-products-list__img