Questions tagged [hamlc]

JavaScript templating using HAML and CoffeeScript.

Haml Coffee is a JavaScript template solution (JST) that uses HAML for markup and inline CoffeeScript for the logic. It's used to dynamically create HTML code from JavaScript and is often used in Single-Page Applications.

25 questions
8
votes
2 answers

Haml syntax highlight in Sublime Text 2 for .hamlc templates

I installed the HAML textmate bundle, that display syntax highlight for .haml templates, but I also have Coffee HAML templates that are named like layout.jst.hamlc and I would like to add syntax highlight as well. The Ruby Haml syntax is good…
tothemario
  • 5,851
  • 3
  • 44
  • 39
5
votes
1 answer

How do I make a haml-coffee closure which spans multiple lines?

I am trying to add a small amount of logic to one of my templates (please don't scold me on the faults of putting logic in the view) and am having a hard time getting the correct hamlc syntax. I am iterating over a collection and want to skip…
Billy
  • 563
  • 5
  • 15
3
votes
0 answers

Draper: How to convert all allowed attributes and public methods of the decorated model into json

I'm looking for an easy way to convert decorated model into json to use in my client-side templates. I'd like to find a solution where all allowed attributes and public methods of the decorated model will persist in json. Currently I have backbone…
Ortepko
  • 371
  • 1
  • 10
2
votes
4 answers

Rails, HAML, using a link_to

here's what I'm trying to do: That 'Request Key: ' part should actually be a 6-digit value, e.g. Request Key: 614551 And the 'PCN: ' part is similar, it should be: PCN: MEDDAET Clicking on MEDDEAT would open a route that would search on that…
Mike Earley
  • 1,223
  • 4
  • 20
  • 47
2
votes
1 answer

Haml Coffee ie8 error

I'm currently using haml_coffee_assets on a project with backbone. All browsers seem to work quite well........ except IE8. Error I receive: Expected ']' in regular expression the line it refers to is the following: HAML.findAndPreserve =…
Seth
  • 10,198
  • 10
  • 45
  • 68
2
votes
1 answer

How to embed raw html string attribute into .hamlc template?

Currently I have backbone RIA with rails backend. I'm using haml_coffee_assets gem for client-side templating. But I miss rails view helpers there. I decided to add raw html strings into my backbone models. So, I have this kind of object in my…
2
votes
1 answer

Backbone.js Collection.models not working

I have a Rails project with Backbone.js and HAML as client side templating language. in file app/assets/views/meeting.coffee: class window.MeetingIndex extends Backbone.View template: JST['meeting/index'] render: -> @collection.fetch() …
sites
  • 21,417
  • 17
  • 87
  • 146
1
vote
1 answer

What does the operator ?= mean?

I have a hamlc (known as Haml + Inline CoffeeScript) which has a line like - @variable1 ?= @object1.element[0] I wonder if this means: if @object1.element[0] has a value then store it inside @variable1. I cannot find any info about hamlc. Also, if…
Takumi
  • 355
  • 1
  • 7
  • 19
1
vote
1 answer

haml-coffee guard plugin issue

When trying to initialize haml-coffee into my Guardfile, I get these messages in my terminal Could not load 'guard/haml-coffee' or '~/.guard/templates/haml-coffee' or find class Guard::Hamlcoffee ERROR - Error is: No such file or directory -…
tommybond
  • 650
  • 6
  • 19
1
vote
0 answers

Rails - Setting up karma with hamlc - getting parse error on hamlcoffee.js.coffee.erb

I'm trying to set up an angular testing environment using Karma, Jasmine, and Phantomjs. It's a rails app using hamlcoffee as template language. My problem is that when i try to run the tests i get the following error: PhantomJS 1.9.7 (Linux)…
Pål
  • 958
  • 2
  • 13
  • 18
1
vote
1 answer

Dynamically give all attributes using haml-coffee

Example template: %input{ @attributes } Example rendering: @attributes = {:foo => :bar} render :example_template Example output with haml: I tried to achieve this with haml-coffe with JST['example_template']({attributes: {foo:…
Joni
  • 3,327
  • 3
  • 25
  • 22
1
vote
1 answer

Conditional CSS Class In Haml Coffee Template

Give the following code in a .hamlc template: .myDiv some content here What if I wanted to add the class "special" to the div.myDiv based on a property of the model passed to the template. so if is_special property of the model was true, the…
ek_ny
  • 10,153
  • 6
  • 47
  • 60
1
vote
3 answers

Backbone.js not performing document.write at the correct time?

I have a backbone.js CMS of sorts, that accepts html and then renders it in the browser. The following is the template file (in .hamlc) that renders the backbone page object. %h1.text= @page.get('title') .text.page-content!=…
jake
  • 1,635
  • 2
  • 20
  • 30
1
vote
1 answer

Backbone Models - extracting names at runtime

I need to be able extract a backbone model's name at runtime from a backbone View to write generic View and then Template code. That is: I need to get the "ClassName" from the model that is passed to the View and then take the first three…
Bharat
  • 2,409
  • 6
  • 32
  • 57
1
vote
2 answers

Iteration over object in backbone coffee-haml template?

I am trying to iterate over a backbone collection object and print one of it's attributes into a unlinked list on a haml-coffee template (.hamlc). In context, I have a collection of fonts. I want to print the name of each font onto the…
1
2