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

Error in loading SASS stylesheet

I am experimenting with SASS and am trying to load a simple sytlesheet using scss in my sinatra application. The route handler in main.rb is get('/styles.css'){ scss :styles } In the layout (using the slim view renderer), I am using the css file…
Sumit Bisht
  • 1,507
  • 1
  • 16
  • 31
0
votes
1 answer

Bootstrap popovers on Rails simple_form inputs

I'm trying to show some popovers in a form I am currently building. They should appear when the user has focus on a specific field, but I can't quite manage to do so, here is what I got (in Slim): #sample_form=simple_form_for sample do |form| …
Heartcroft
  • 1,672
  • 2
  • 19
  • 31
0
votes
2 answers

Rails Relation "Has_none_or_one"

I have a problem, I got a 'User' model and a 'Professional' model. Inside the Professional model, it is specified that it belongs to a user. However, there is no written relation in the user model. There is nothing wrong it should be like that, a…
sidney
  • 2,704
  • 3
  • 28
  • 44
0
votes
2 answers

Creating Table Filters

I have a simple table with 3 columns like so table thead th Element th Owner th Progress tbody == render :partial => "element_row" :collection => @elements :as => table_element Each element is unique, and one owner may have…
jamesfzhang
  • 4,403
  • 8
  • 32
  • 43
0
votes
1 answer

Calling ruby code from coffee: slim tag

Possible Duplicate: How to access instance variables in CoffeeScript engine inside a Slim template How can I use Ruby code in my coffee tags? #{} is a slim construction to call Ruby code, but it doesn't work in coffee tag, because `#´ is used to…
just so
  • 1,088
  • 2
  • 11
  • 23
0
votes
1 answer

how to unindent slim code in emacs

I am using slim with emacs for development. I am able to indent blocks of slim code by just marking the block and then pressing tab. However how do I unindent a whole block back? Any help will be appreciated. Thanks, Murtaa
murtaza52
  • 46,887
  • 28
  • 84
  • 120
0
votes
1 answer

Rails field_error_proc - Change default error target

I have the following desired html (slim template): li label span | Password small.error ERROR MESSAGE br = f.password_field :password I wanna put the error (small.error) within the "span"…
maiconsanson
  • 243
  • 3
  • 16
0
votes
1 answer

Why doesn't my partial work with slim and Rails 3.2?

I'm using Rails 3.2 and instead of ERB, I am using slim. Here is my form partial: = simple_form_for @game, :html => { :class => 'form-horizontal' } do |f| The syntax error I am getting is: _form.html.slim:1: syntax error, unexpected ')' ... =>…
cbmeeks
  • 11,248
  • 22
  • 85
  • 136
0
votes
2 answers

Rubygems not loading gem

I installed slim gem to a custom directory of my own but require 'slim' gives me error. Installing slim: $ cd /var/www $ mkdir project $ cd project/ $ gem install slim -i gems/ Fetching: temple-0.4.0.gem (100%) Fetching: slim-1.2.2.gem…
user1437328
  • 15,546
  • 9
  • 34
  • 44
-1
votes
1 answer

Variable not found in CoffeeScript

I am new to coffee scripting..This is my first script and is not working.. html head title='hello world' css: h1{ color: blue; } coffee: number = 42 opposite = true saybye = () -> alert 'hello'+number '' …
coool
  • 8,085
  • 12
  • 60
  • 80
-1
votes
1 answer

How to insert text and link_to within

in Slim

How can I insert a link_to alongside text in a

tag using Slim? here is my html.slim view : p.subtitle = t('.subtitle') = link_to 'Link', t('.title_link') But it doesn't work I also tried : p.subtitle = t('.subtitle') = link_to 'Link',…

TheGame
  • 91
  • 1
  • 8
-1
votes
1 answer

Print any variable inside ruby sinatra controller

I need to output (say, display in the browser) a variable value that lives inside Ruby sinatra controller : get '/endpoint' do someVariable = MyModel.All # print/output/dump someVariable value ! end I've tried put, puts, print...…
-1
votes
1 answer

Making image absolute messes it up (Ruby on Rails)

I'm trying to create a Bootstrap carousel with images that have text over them. To do that, I need to make the position of the images in the carousel absolute. Here is an image in the carousel before I made it absolute I need the testimonials and…
Nick Gilbert
  • 4,159
  • 8
  • 43
  • 90
-1
votes
3 answers

Why can't show restaurant list?

I'm trying to make some restaurant list. I associated two tables, and then write this code. class Restaurant < ActiveRecord::Base has_many :restaurant_translations end class RestaurantTranslation < ActiveRecord::Base self.table_name…
Noriaki Takamizawa
  • 887
  • 1
  • 10
  • 25
-1
votes
1 answer

Calling Coffeescript variables in Slim

Im trying to declare a coffescript function and call it later in the code. I'm pretty new to this, and can't seem to find anything on it. Here is the code im working on, as you can see I try to call the square function: coffee: @square = (x) -> x…
Idva
  • 184
  • 2
  • 12
1 2 3
45
46