Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/admin.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ view of any object that has blocks attached.
<%= render 'no_cms/admin/blocks/blocks/index', f: f %>
```

To use it you will need to add two methods to your controller's helper:

* **block_form_classes**: receives a block and returns an array of classes that will be used in the block's admin layout
* **block_form_id**: receives a block and returns the id assigned to the block's admoin layout in the HTML.

### Block admin templates

Same way that a block has a partial that gets rendered in the public views it
Expand Down
11 changes: 10 additions & 1 deletion doc/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,16 @@ And creating the relationship in your model:

```ruby
class Page
has_many :blocks, class_name: "NoCms::Blocks::Block
has_many :blocks, class_name: "NoCms::Blocks::Block"
end
```

Also, if you plan to use `fields_for` to manage your blocks from your model's edit form (or you are going to use the admin helper provided by this gem) you are going to need to accept nested attributes by adding:

```ruby
class Page
has_many :blocks, class_name: "NoCms::Blocks::Block"
accepts_nested_attributes_for :blocks
end
```

Expand Down