These are chat archives for opal/opal

6th
Jan 2015
Andrew Havens
@andrewhavens
Jan 06 2015 00:02
hmm….just found the docs you were referring to…
So I guess my question is, if I add the opal gem to the Gemfile of my Rails app, can I create a file like app/assets/templates/myfile.erb and reference it with JST[‘myfile’]
…and pass some variables into the template: JST[‘myfile’]({user: {name: ‘Andrew'}})
Can Edremitoglu
@cantonic
Jan 06 2015 01:48
@andrewhavens afaik you cannot use JST, but opal has a Template class which does what you need. Look here: http://opalrb.org/docs/templates/
@andrewhavens By the way: i am also switching from backbone to opal currently
Bernhard Weichel
@bwl21
Jan 06 2015 11:00
This message was deleted
There is a class "JsonErrorx" and I cannot find out where it comes from ...
Jared White
@jaredcwhite
Jan 06 2015 18:46
@andrewhavens Yes, it's very easy to use erb templates using the Template class in Opal. I'm doing exactly that on a project. :sparkles:
Hey folks, excited to announce the first public release of my new gem Shimmer. https://github.com/jaredcwhite/opal-shimmer
it provides an easy, "Hashie"-like way to set and load values, use nested namespaces, and even persist values across browser sessions using localStorage. Soon, I will add an observer feature so you can hook into configuration value changes to update UI in real-time, etc.
Can Edremitoglu
@cantonic
Jan 06 2015 19:05
Hi there. I try to render a haml template with opal, but keep getting parse error on value "." (tDOT) :form_modal:1. Does anyone have an idea what the problem could be?
Adam Beynon
@adambeynon
Jan 06 2015 20:10
@cantonic can you gist your haml file? (or maybe just a part of it which fails so I can try here)
Can Edremitoglu
@cantonic
Jan 06 2015 20:37
@adambeynon: I just added .foobar to it
@adambeynon but i will put together a gist of all files involved
Can Edremitoglu
@cantonic
Jan 06 2015 22:37
when I change .foobar to #foobar it doesn’t complain anymore. using dots for defining element classes in the HAML way seems to not work
Can Edremitoglu
@cantonic
Jan 06 2015 22:42
@adambeynon Using opal-haml from github instead of rubygems solved the problem
Andrew Havens
@andrewhavens
Jan 06 2015 23:27
@cantonic Interesting…what was the diff between versions?
Can Edremitoglu
@cantonic
Jan 06 2015 23:44
@andrewhavens https://github.com/opal/opal-haml/compare/ea15b55999b1e6e1fbf8f0264e2a3dd9bb377b20...master … but I am not sure which change fixed that problem. The main diff I see is the addition of lib/opal/haml/builder.rb
Adam Beynon
@adambeynon
Jan 06 2015 23:44
I think the git versions uses the new beta of opal. 0.7
Can Edremitoglu
@cantonic
Jan 06 2015 23:45
right. it was 0.5.0 before
Adam Beynon
@adambeynon
Jan 06 2015 23:45
Ahh. The git version of opal haml defines a handler for the new builder system. Without it Builder tried to compile it as a normal ruby file
Andrew Havens
@andrewhavens
Jan 06 2015 23:46
ah, interesting
Can Edremitoglu
@cantonic
Jan 06 2015 23:47
you are talking about the changes in lib/opal/haml.rb, right?