Questions tagged [slim-lang]

Slim is a lightweight template engine for Ruby whose goal is reduce the syntax to the essential parts without becoming cryptic.

Slim is a template language whose goal is reduce the syntax to the essential parts without becoming cryptic.

The initial design of Slim is what you see on the home page. It started as an exercise to see how much could be removed from a standard html template (<, >, closing tags, etc...). As more people took an interest in Slim, the functionality grew and so did the flexibility of the syntax.

Slim will strive to maintain simplicity, but not everyone's definition of a readable syntax is the same. The docs will show you the options.

Slim uses Temple and Tilt. If you want to learn how Slim works, you'll need to study these projects.

Source: Slim-lang.com (About)

681 questions
0
votes
1 answer

Trying to Use 'Angular Rails Templates' gem

so, I'm trying to use the templates folder in AngularJS instead of the 'views' folders that you'd normally use in Rails. Things work great when I write everything in html, but what if I want to write things in slim, and still work with AngularJS…
rikkitikkitumbo
  • 954
  • 3
  • 17
  • 38
0
votes
1 answer

rails 4 merge 2 content for together?

I have various pages that need multiple content_for at the top i.e: - content_for :title, AppConfig.product['slogan'] - content_for :class, 'brand' That are used in my layout: == render 'layouts/top_wrapper' …
Chris Hough
  • 3,389
  • 3
  • 41
  • 80
0
votes
2 answers

rails render objects(hashes) in slim-lang

I try to render hash in my rails application to be considering as object in javascript. div.sort-cartridges data-cartridges-selections=cartridges_selections where cartridges_selections is function which return ruby hash. But if in jQuery + coffee I…
Alex Antonov
  • 14,134
  • 7
  • 65
  • 142
0
votes
2 answers

undefined method `map' for string in rails4

In my Rails app, I'm trying to get links of events tagged with specified tags in my events#index view. In order to make them linked with link_to, I got the error below: undefined method `map' for "fgssgf,sfgdsfg,dsgfsdgf,sgfdsg":String` error …
ekremkaraca
  • 1,453
  • 2
  • 18
  • 37
0
votes
1 answer

Devise error on auto-generated slim

When i use devise's edit user registration slim file, it gives this error: Started GET "/users/edit" for 127.0.0.1 at 2014-04-30 00:28:39 +0530 Processing by Devise::RegistrationsController#edit as HTML User Load (0.2ms) SELECT "users".* FROM…
vjdhama
  • 4,878
  • 5
  • 33
  • 47
0
votes
2 answers

Ruby on Rails; division

I am fairly new to RoR. I have the following codes and uses a simple summation and division, but the value I get is 0. Not sure where I went wrong. Thx - capacity_left = (total_capacity / total_amps) rescue 0 h4 = "Capacity Reserve Left: …
Kourosh
  • 51
  • 9
0
votes
1 answer

Table row tr not being interpreted by Slim and missing in HTML output

I'm using Slim in my Rails app and my table rows (tr) are not being interpreted inside a loop. - if @item.suggestions.size > 0 table - @item.suggestions.each do |suggestion| tr td=raw "Posted by " +…
tigerdahl
  • 113
  • 7
0
votes
1 answer

Create a simple pattern with HAML

I am teaching myself HAML, and I'm trying to create a simple pattern of sorts. This is the HTML output I want:

1 - a

2 - b

3 - a

4 - b

As you can see, it counts up normally, and then adds either "a" or "b". I know you…
Nix
  • 5,746
  • 4
  • 30
  • 51
0
votes
1 answer

Improve SASS checkbox with FontAwesome and Slim-Lang

I'm changing the standard checkboxes of the browser with the fontawesome icons. This works but I'm basicly typing things twice for the hover status. How can I make this without typing the same code twice? SASS .input-checkbox-alt opacity: 0 …
Sharpless512
  • 3,062
  • 5
  • 35
  • 60
0
votes
1 answer

submit button not working rails

I've been having some trouble with my form in my ruby and rails application. I am using the slim template engine to create the layouts. here is my form code = form_tag(:action => '/project/new', :method => "post", class: 'form-horizontal') do …
Ameya Savale
  • 431
  • 1
  • 8
  • 21
0
votes
1 answer

Rails - Add class if Radio button is checked

How to get the value of the radio button from the form_for helper? Using SLIM. =form_for(@foo) do |f| label[class="#{ f.type.value == 'type 1'? 'foo' : 'bar'}"] | Type 1 = f.radio_button :type, 'Type 1' label[class="#{ f.type.value ==…
Vivek Chandra
  • 4,240
  • 9
  • 33
  • 38
0
votes
1 answer

slim tries to render template from wrong path

I'm new to the ruby world, and Sinatra for that matter, so I have no choice but to ask here about the error I keep getting. I'm using a combination of Rack + Sinatra with Slim as template engine. I have my app.rb setup as this: module Pulsr class…
Roland
  • 9,321
  • 17
  • 79
  • 135
0
votes
1 answer

Occasional inline HTML compilation with Slim-Lang?

I'm trying slim-lang. td something is compiled as : something I'd like it to be compiled like this : something Is that possible?
Gaston Flanchard
  • 519
  • 1
  • 5
  • 15
0
votes
1 answer

form_for with slim does not work

I am using rails 4.0.2 with ruby 1.9.3. When I use rails scaffold generator like this rails g scaffold Person name:string everything works correctly. But i want to use Slim language for templating, so i added gem 'slim' to my Gemfile. Then changed…
lunr
  • 5,159
  • 4
  • 31
  • 47
0
votes
2 answers

rails slim syntax error

hogehoge.html.erb <% flash.each do |key, value| %>
<%= value %>
<% end %> I want to transrate into hogehoge.html.slim can anybody help me?
user3061082
  • 7
  • 3
  • 6