haml

accessing Ruby variable(from model or controller) in SASS

末鹿安然 提交于 2019-12-04 05:45:38
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: :sass #header :background url(user.banner.url) is this possible at all? *Apparently it isn't: http://sass-lang.com/docs/yardoc/file.FAQ.html#q-ruby-code Is there a way other than this 'dirty' code fix we did(we converted _styles partial to rhtml then) #header { background

Angular Material2 md-select dropdown appears at bottom of the page

荒凉一梦 提交于 2019-12-04 03:45:43
问题 I'm currently using Angular Material2 in an Angular 2.4.0 application (using @angular/material: 2.0.0-beta.1 ). For some reason, the md-select dropdown, instead of appearing over the initial value or placeholder or arrow to select the dropdown, as demonstrated in these examples from the material docs, appears all the way at the bottom of the page. To the point that if the md-select dropdown is at the top right of the page (the component I am attempting to place mine in is at the top right of

How to change color of HAML tags in NetBeans?

荒凉一梦 提交于 2019-12-04 02:09:39
问题 I use Aloha theme in NetBeans 6.8, everything looks cool except these blue tags in HAML files, which are unreadable. How to find a place where this blue color could be changed? P.S. I use that HAML plugin which seems to be unsupported and lacks features Screenshot: http://img.leprosorium.com/846904 (sorry, new users can't embed images) 回答1: Lots of people would DIE for a decent Netbeans HAML plugin. I suggest that we just PAY for someone to write it : http://www.cofundos.org/project.php?id

How can I auto compile my HAML files into HTML files in a tiny project that doesn't run on RoR?

北战南征 提交于 2019-12-04 01:44:59
I have only today started playing with compass and haml . While I am quite familiar with the way sass works and I get the idea of what compass is for sass and how to use it, I've hit a little bit of a road block when it comes to using haml efficiently. Of course I am hoping that someone here already knows the answer to my problem and can give me a little jump start into haml . Here is what I'd like to accomplish: Auto compile my HAML files when I save them. The project however is just a tiny static site (couple of pages) to build up a template set for a later integration into the

haml-rails on rails 4.0?

回眸只為那壹抹淺笑 提交于 2019-12-04 01:03:39
问题 I'm wondering if anyone has run into any snags with the haml-rails gem in Rails 4.0. There is a Rails Cast that says there were some problems but there is not much more mention of this. The gem hosted on GitHub also doesn't explicitly mention support for Rails 4.0. So what's the status on this? 回答1: I'm using haml-rails (0.4) in a rails 4 project and everything is working 回答2: Haml 4.0.4 have release to support rails 4 application. You can use haml-rails. Now, it doesn't have problem. Include

Sublime colorize :javascript block in haml

喜你入骨 提交于 2019-12-03 23:23:58
I have sublime 2/3 and the colorize inside a :javascript block doesn't work fine. The package is this https://sublime.wbond.net/packages/Haml Actually they says that: "Text inside Ruby, ERB, Javascript, Sass, and CSS filters are now properly recognized so you get all the syntax highlighting, snippets, commands, etc." but in sublime it doesn't work. For me, sublime 3, comes installed with Rails package. This also provide "Ruby Haml". If you press ctrl + alt + p and type haml you will probably see two Set Syntax: Ruby Haml . The best solution for me was also install ApplySyntax and in it's user

Rails flash messages with HAML

﹥>﹥吖頭↗ 提交于 2019-12-03 16:34:27
问题 i started learn HAML: and i can't translate flash block to HAML: <% flash.each do |key, value| %> <div class="alert alert-<%= key %>"> <button type="button" class="close" data-dismiss="alert">×</button> <strong><%= value %></strong> </div> <% end %> 回答1: Here you go: = flash.each do |key, value| .alert{ :class => "alert-#{key}" } %button.close{ :data => { :dismiss => "alert" } } x %strong = value Just FYI you can add attributes to any element by attaching them as a hash after the declaration.

render a partial from jquery and haml

一曲冷凌霜 提交于 2019-12-03 15:50:23
The functionality I plan on doing is to insert some form elements depending on a number chosen from a select tag. I have a select tag called for number_of_passengers, and i plan to dynamically append new passenger fields for the number chosen. Say I select 2 from number_of_passengers, then 2 forms should appear in a fieldset. these forms contain name, age weight etc. I tried following this: call a rails function from jquery? and just converted it to haml-speak but I get errors whenever I use the :javascript tag. Also I don't think I can "escape" the javascript tag once I am in it :javascript $

Create a local variable in Haml only

China☆狼群 提交于 2019-12-03 14:38:52
问题 I'm using Haml as a quick way of prototyping layouts. This is not using Rails, Sinatra or any framework. What I want to do is declare a variable at the top and be able to call it throughout the page, similar to the way I can declare a variable in Sass and use it throughout the code. !!! 5 %body / Declare Variable - $type = 'Audio' .container{:id => "page-#{$type}"} Is this possible? 回答1: Drop the $ to avoid declaring a global variable. It should work just fine. !!! 5 %body / Declare Variable

Library for making static websites with HAML/SASS/CSS framework [closed]

不问归期 提交于 2019-12-03 12:47:39
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I'm looking for a library or a collection of libraries that work together with the following requirements: HAML and SASS can be used. Have a small server capability to see HAML/SASS compiled every time I refresh my browser. (I don't want to start a fresh Rails app, though.) Works with popular CSS frameworks.