https://github.com/trailblazer/cells-slim
https://github.com/trailblazer/cells-slim
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/trailblazer/cells-slim
- Owner: trailblazer
- License: other
- Created: 2014-10-22T07:44:01.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2023-01-25T15:09:39.000Z (over 2 years ago)
- Last Synced: 2024-04-25T06:42:25.663Z (over 1 year ago)
- Language: Ruby
- Homepage:
- Size: 43.9 KB
- Stars: 17
- Watchers: 13
- Forks: 22
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Cells::Slim
Support for Slim templates with Cells.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'cells-slim'
```## Usage
```ruby
class CommentCell < Cell::ViewModelSlim
```## Important
Cells Slim change default settings for Slim and disables escaping in templates.
To re-enable it, you can use below snippet:It can be changed easy by override **template_options_for** from **Cells::Slim**:
```ruby
module Cell
module Slim
def template_options_for(options)
{
template_class: ::Slim::Template,
suffix: 'slim',
disable_escape: false,
escape_code: false,
use_html_safe: false, # set true for Rails
buffer: '@output_buffer'
}
end
end
end
```This can be put in **config/application.rb**.
**Remember** that you need to use '==' instead of '=' ([reference in Slim docs](http://www.rubydoc.info/gems/slim/frames#Output_without_HTML_escaping___)) in your templates for code which should not be escaped, for example form_builder (notice that only from_for line require '=='):
```
== form_for model, url: users_path, method: method do |f|
= f.text_field :first_name
= f.text_field :last_name
```## Documentation
[More documentation](http://trailblazer.to/gems/cells/templates.html) can be found on the Trailblazer page.