Project

cells-slim

0.05
No release in over 3 years
Low commit activity in last 3 years
There's a lot of open issues
Slim integration for Cells.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 4.0.1, < 6.0.0
>= 3.0
 Project Readme

Cells::Slim

Support for Slim templates with Cells.

Installation

Add this line to your application's Gemfile:

gem 'cells-slim'

Usage

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:

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) 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 can be found on the Trailblazer page.