Sha256: d68686cd8816ca0770ad43a72d64e919a75c17335f0f55ba990ed671c0ebd519

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

# 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.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cells-slim-0.1.1 README.md