haml

PhpStorm shows Haml file like plain text (transcompilation works, but not the syntax highlighting)

一笑奈何 提交于 2019-12-11 22:29:38
问题 The syntax highlighting for my haml files in PhpStorm does not work, and the icon is just the icon for plain text. (It should be a red icon with an h, similar to the icon for the scss file.) The transcompilation works only if File type in the watcher is set to Text files . If I choose HAML files , it tells me that there are "No such files in scope". Any ideas, why PhpStorm recognizes the scss file, but not the haml file? 回答1: First of all -- make sure that HAML support plugin is installed and

Tablesorter becomes non-functional after jquery page load

扶醉桌前 提交于 2019-12-11 19:35:31
问题 I have a page that has a variable refresh rate, and displays a couple of tables. The tablesorter.js code works fine initially, but after the first refresh its non-functional. I've tried placing the tablesorter function inside the click function for each branch, or at the end of the whole click function or inside the load function -and- After looking at the docs for tablesorter, I have tried calling $("#workstation-table").trigger("update", true) in all the forementioned scenarios. Everytime

cycle() an image_tag

Deadly 提交于 2019-12-11 18:05:47
问题 I'm want to display different image version: first article: big banner second: small banner that float to right/left so, first thing: use cycle() but dont work: = cycle(image_tag(banner_big), image_tag(banner_small) or = image_tag(cycle(banner_big_path, banner_small_path)) Only first image is displayed There's a proper way to make one like that ? 回答1: Your problem is that rails is expecting you to call cycle with the same set of strings each time. At the moment you're passing a different pair

Using datepicker within haml

别来无恙 提交于 2019-12-11 17:14:37
问题 I am sorta new to using datepicker within haml and was hoping to get some guidance. I have included a javascript with a datepicker within my main.html along with two date fields. Unfortunately, when I try to test the following code I get nothing. Any idea what I might be overlooking? Any help will be greatly appricated. #content %h3 Please enter the following information: =form('/search', :post) =input(:id, :report_id, class: "formbox") =input(:date, :start_date, class: "formbox") =input(

Issue mixing jquery, rails, and haml

浪尽此生 提交于 2019-12-11 16:35:18
问题 I'm converting an html.erb into html.haml. I have some jquery in an erb which is.. :javascript $(".level").live("click", function() { //..some code <% if @milestone %> milestone = "&milestone=<%= @milestone%>"; <% end %> //..some code }); I want to convert the if statement into haml and for that I'm doing.. - if @milestone milestone = '&milestone="#{@milestone}"' but this does not work and gives me a syntax error on "if @milestone" What am I doing wrong? Can you not mix jquery and haml? 回答1:

How to use HAML to generate standalone HTML files via a layout template

与世无争的帅哥 提交于 2019-12-11 15:07:34
问题 I use haml a lot when developing web applications but for the job I am doing right now all the client needs is flat HTML files and some javascript . There are quite a few files I thought it might be easier to code them all up using haml , with a layout file to capture the stuff common to each page. I checked the haml docs and they offer a simple example: haml hello_world.haml hello_world.html that happily generates a hello world page from my template. I've scoured the docs for information on

Implementing “Pure CSS Sphere” into website - how do I do it?

孤街浪徒 提交于 2019-12-11 14:16:05
问题 http://codepen.io/waynespiegel/pen/jEGGbj I found this awesome thing that I would like to be a part of my website (just for personal use and practise) and am curious to how this would be implemented. I'm fairly new to this kind of programming. I'm using GitPages and got a website running. Decided to make a file called "sphere.css" with the code: $size: 300px; $total: 100; $time: 5s; * { box-sizing:border-box; } html, body { width: 100%; height: 100%; background: #000; overflow: hidden;

ERB view embedded in a Haml layout: what to do about whitespace now?

元气小坏坏 提交于 2019-12-11 13:57:30
问题 I have a Rails 3 app where the views are all done in Haml. However, there are some views coming from a required gems that are in ERB, and Haml is adding whitespace, and it's messing up textareas and such. (If you're not familiar with this aspect of haml, look here.) I'd rather not have to convert my layout to ERB, and because the gem is in ERB, all of the traditional Haml whitespace solutions don't help. So how do I get my textareas (and <pre>s etc) not to wrap? Anything smart I can do in my

How to use the HAML t() helper in RoR

本秂侑毒 提交于 2019-12-11 12:23:16
问题 I'm developing an application with Rails 4 and I want to use the helper t() with HAML, but I can not Example usage: =model_name = @article.class.model_name.human %h1 Create t(:model_name) My first line shows me the correct article, but when I use t() it shows me t(:model_name). Thanks. 回答1: hope in translational file you have en.yml en: article: MyArticle Then %h2= t 'article' if you want dynamically `` %h2= t '#{model_name}' 来源: https://stackoverflow.com/questions/33873894/how-to-use-the

HAML | JSON: Add a Script Tag of Type Application/JSON

北战南征 提交于 2019-12-11 11:32:28
问题 Write a Script Tag With the Type Application/JSON This is about as straight-forward as it sounds. I'd like the HAML equivalent of: <script class="_config" type="application/json"> { "template": "#myId", "css": { "background": "#fff", "opacity": "0.8" } } </script> As of now, the only solution is... %script._config{ type: 'application/json' } { | "template": "#id", | "css": { "background": "#fff" } | } ... Which sucks -- it renders the JSON in the page. Also, there should be no need to write