haml

Preserve attribute ordering in Haml

Deadly 提交于 2019-12-01 20:57:17
If I create an XML element in HAML: %tag{:b => "b", :a => "a"} I get this output: <tag a="a" b="b"/> Is it possible to keep the ordering of the attributes in HAML? I need this for a client-side code to display values in certain order and don't want to pass extra information on the client just to maintain ordering. It's not possible with HAML because it's a hash. 来源: https://stackoverflow.com/questions/7766240/preserve-attribute-ordering-in-haml

Adding bootstrap button class to button_to in rails 4

这一生的挚爱 提交于 2019-12-01 20:36:12
I have a button_to call in my Rails 4 haml file that looks like this = button_to("Click Me", action: "click", class: "btn btn-primary") However, the class: "btn btn-primary" code snippet isn't working properly, and my button isn't changing. I've also tried the old Ruby syntax of :class => "btn btn-primary" , but that doesn't seem to do the trick. Any help would be greatly appreciated. You need to make sure the second and third parameters to button_to are separate. Currently the action and class keys are being passed as a single hash, but they should be two arguments, one for options and one

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

给你一囗甜甜゛ 提交于 2019-12-01 18:41:22
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 the page) when you click the arrow to view the dropdown options it will scroll you to the bottom of the

How to use Javascript to manipulate modal content?

时光毁灭记忆、已成空白 提交于 2019-12-01 14:45:43
I am using bootstrap modals and Ruby on Rails. I was able to display the modal fine but I am having trouble using Javascript to manipulate the contents of the modal. I am not sure what I am doing wrong but I was not able to use Javascript to impact the contents of the modal at all, to the point that I started wondering if there are such a thing as different stack levels on the DOM elements or whether even the modal contents are part of the DOM. Here is my app/views/home/index.haml: - url = @entry.class.to_s.downcase.singularize = link_to(send("#{url}_path", @entry), remote: true) do = yield

How do you make text and variable in haml appear on same line?

我是研究僧i 提交于 2019-12-01 13:26:38
问题 I have this code and I want it to read as Volunteers Needed: 10 (event.numberofvolunteers value) on the same line. How can I do this without using css? I haven't found a specific post addressing this issue. %td Volunteers Needed: = event.numberofvolunteers 回答1: Try this: %td= "Volunteers Needed: #{event.numberofvolunteers}" 回答2: Best way to write this would be : %td Volunteers Needed: #{event.numberofvolunteers} 来源: https://stackoverflow.com/questions/19309764/how-do-you-make-text-and

How to change color of HAML tags in NetBeans?

风格不统一 提交于 2019-12-01 12:37:31
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) 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=181 Sad to say "that HAML plugin which seems to be unsupported and lacks features", is the only Haml plugin

Adding dynamic attributes to HAML tag using helper method in rails

冷暖自知 提交于 2019-12-01 06:54:07
So i figured out a way of doing this, but is there an easier way to do it? What i want to do is just to add .class after the %th tag if params[:sort] == sortBy, do i really need to have the rest of the HAML in the helper-method? This is my helper method from my helper.rb file: def yellow?(sortBy,name,id) haml_tag :th, class: "#{'hilite' if params[:sort]== sortBy}" do haml_concat link_to name, movies_path(sort: sortBy),{:id => id} end end This is from my HAML file: %tr - yellow?("title","Movie Title","title_header") %th Rating Mik Have you tried this solution: %tr %th{ :class => if params[:sort

Adding dynamic attributes to HAML tag using helper method in rails

北慕城南 提交于 2019-12-01 05:10:34
问题 So i figured out a way of doing this, but is there an easier way to do it? What i want to do is just to add .class after the %th tag if params[:sort] == sortBy, do i really need to have the rest of the HAML in the helper-method? This is my helper method from my helper.rb file: def yellow?(sortBy,name,id) haml_tag :th, class: "#{'hilite' if params[:sort]== sortBy}" do haml_concat link_to name, movies_path(sort: sortBy),{:id => id} end end This is from my HAML file: %tr - yellow?("title","Movie

HAML prevents template engines to render anything else than HTML

為{幸葍}努か 提交于 2019-12-01 04:24:43
I am using Jbuilder (and I also tried to use Rabl) to render json. When I try to render the jbuilder template in my application it renders the template within the layouts/application file and returns HTML as JSON (see line 'within layouts/application'): Rides controller on Github Started GET "/random_photo.json" Processing by RidesController#random_photo as JSON >> Rendered rides/random_photo.json.jbuilder within layouts/application (0.3ms) Rendered shared/_banners_in_corners.haml (3.0ms) Rendered shared/_sign_in_and_out.haml (2.0ms) Rendered layouts/_navigation.haml (7.3ms) Completed 200 OK

haml-rails on rails 4.0?

寵の児 提交于 2019-12-01 03:47:27
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? I'm using haml-rails (0.4) in a rails 4 project and everything is working Haml 4.0.4 have release to support rails 4 application. You can use haml-rails. Now, it doesn't have problem. Include gem package in gem file gem 'haml-rails' and bundle the project 来源: https://stackoverflow.com/questions/18485147