haml

Reopen SASS Mixins

Hi, Is there a way to redefine SASS mixins. I want to override SASS mixins for site specific styling needs. Is there a way to do it ? ...

Get absolute (base) url in sinatra.

Right now, I do a get '/' do set :base_url, "#{request.env['rack.url_scheme']}://#{request.env['HTTP_HOST']}" # ... haml :index end to be able to use options.base_url in the HAML index.haml. But I am sure there is a far better, DRY, way of doing this. Yet I cannot see, nor find it. (I am new to Sinatra :)) Somehow, outside of...

'uninitialized constant ActionPack' when starting rails

When starting my rails server I'm getting an 'uninitialized constant ActionPack' error. raw stack trace I'm using blunder with rails 2.3.8 running 'bundle list' shows: * actionmailer (2.3.8) * actionpack (2.3.8) * activerecord (2.3.8) * activeresource (2.3.8) * activesupport (2.3.8) * acts-as-taggable-on (2.0.6) * auth...

Some questions about working with Haml

I am trying to use Haml with Grails but I am having some issues. The plugin for haml has errors to parse empty lines. The plugin generate gsp files, so I think that I can use the online haml html generator. Bug I want something like an editor with syntax highlighting, blocks, etc, and that generate html. Is there something like this? ...

Does TextMate has an easy way to indent 2 spaces for an HAML file?

I look around for the preferences in TextMate and there seems to be no method to set the indent to 2 spaces when we highlight some code and choose Text -> Shift Right Right now it is indenting 4 spaces but is there a way to make it 2? ...

Haml Inherit Templates

I'm using Haml (Haml/Sass 3.0.9 - Classy Cassidy) stand-alone to generate static HTML. I want to create a shared layout template that all my other templates inherit. Layout.haml %html %head %title Test Template %body .Content Content.haml SOMEHOW INHERIT Layout.haml SOMEHOW Change the title of the page "My Content". %p...

Is there a way to use a Ruby loop inside of HAML's :javascript region?

Inside of HAML, can we have a loop inside the :javascript region? This will work: - 10.upto(20) do |i| :javascript document.getElementById('aDiv').innerHTML += '#{i}'; and this will not: :javascript - 10.upto(20) do |i| document.getElementById('aDiv').innerHTML += '#{i}'; can the code above also be made to work as well...

accessing Ruby variable(from model or controller) in SASS

Is there a way to access Ruby variables in SASS or do I have to make a custom function for it? What I'm trying to do is to generate a stylesheet for each user so in the controller, I do something like: def show respond_to do |format| format.css{render :partial => "styles"} end end then in the view name _styles.haml I do this...

HAML indentation problem IF

This is my code: [email protected] do |a| -if @i%3 == 0 %ul %li=link_to a.name, a -@i += 1 I need the li to be inside the ul which is inside the if-statement. I can't do it because of the indentation. Can't I just tell the li to indent automatically? Thanks ...

why adding a simple div to HAML will break the code?

it is quite strange that the following works: - 1.upto(30) do |i| = i %br but the following won't: %div this line - 1.upto(30) do |i| = i %br Isn't the second part just to add a div and let the numbers go into that div? ...

in HAML, how to write comments in :javascript region so that comments not shown to the public?

in HAML, we can write comments using -# some comment and it won't become HTML and made public but if it is inside :javascript -# comments like this line will break the javascript interpreter as it becomes javascript code // so we are forced to use comment like this and is publicly viewable is there a way to make it non-public?...

What kind of Ruby / Erb is allowed inside HAML's :javascript filter?

It seems that inside of HAML's :javascript filter, no Ruby code is allowed, not even a comment. So this is NOT allowed: :javascript - 1.upto(10) do |i| :javascript -# just a comment not to show to public (somebody said there is not way to hide comment like that inside a :javascript filter. Is that true? but it seems the only t...

Can Ruby on Rails cache a Controller "as long as code is not changed"?

At work, we have a situation where when script/server is run, then all the controller code is cached. This is to speed up the development server. But that will mean that whenever we change the controller code, we need to restart the server. So we can turn off the caching of controller code all together. But can't there be mechanis...

fieldWithErrors not wrapping every error field

Notice the following result when I submit blank :title and :description fields The validations are in the controller: class Question < ActiveRecord::Base validates_presence_of :title validates_presence_of :description And, the form is generated with those names: -form_for(@question) do |f| = f.error_messages = f.label :tit...

How do I use Haml in a view in my new plugin?

I'm creating a new plugin for a jruby on rails application that will eventually be turned into a gem. Inside my plugin I have controllers, helpers and views. For my views I'd like to use Haml. The problem is that I can't seem to get it to recognize that they are haml templates. Is it even possible to do this? Is there a way for a plugin ...

What is the best way to create a form for editing a model attribute which is an array of strings in Rails?

Take a model with an attribute that is an array of strings. This attribute is serialized to the database. class MyModel < ActiveRecord::Base serialize :str_array end In the edit view I would like to display a text field for each element of the array allowing the user to view and modify the attributes elements. ...

recursive html2haml

I have many html files in nested directories which I need to convert to Haml templates I've modified the following bash script from here - http://terrbear.org/?p=277 to modify html files and not erb but I still need to modify it to be recursive ... #!/bin/bash if [ -z "$1" ]; then wdir="." else wdir=$1 fi for f in $( ls $wdir/*...

How to watch for changes to HAML files and save them

Hi I want to run HAML command every time i save a particular file I now this can be done by compass but only for sass not HAML has anyone done this or guide me how to. Thanks in advance ...

haml / rails: yield title with german umlauts

Hi, I would like to do something like this in my application layout: %title= "#{yield(:sub_title)} - Page Name" and in a real view - content_for :sub_title do Übersicht # I tried &Uuml;bersicht, != "&Uuml;bersicht" and a bunch of other methods what happens is, I either get the black pound with the question mark in it -> wrong e...

In HAML on Ruby on Rails, how to use the :sass filter?

If using HAML on Ruby on Rails, then :sass #someDiv border: 3px dashed orange won't have any <style> tag around them. and then :css :sass #someDiv border: 3px dashed orange won't kick on the :sass filter, but :css :sass #someDiv border: 3px dashed orange will kick on the :sass filter, but it is outside o...