<meh`>
fkchang, for future reference, you can also put raw stuff in the DSL
<meh`>
style 'key', 'value'
<meh`>
fkchang, but most things should be implemented, if something isn't it's a bug
<meh`>
I mean, I know many things aren't
<meh`>
but I usually just add them as I go
<meh`>
and I really don't like the extension mechanism for for the CSS DSL, but I still haven't figured out a good way
<ryanstout>
can someone explain bridged types to me? Like I noticed passing a opal string to google maps causes some issues. But I thought opal strings were just normal JS strings
<ryanstout>
.to_n fixed the issue
<meh`>
ryanstout, that's not an issue with bridged types
<meh`>
ryanstout, if you try to pass a new String("whatever") to Google maps
<meh`>
you'll get the same thing
<meh`>
it's a retardation inside js
<ryanstout>
interesting
<meh`>
if you call a method on a literal that returns this
<ryanstout>
so are they doing typeof(val)
<meh`>
the this becomes an object
<meh`>
yes
<ryanstout>
=== 'string'
<meh`>
#to_n calls .valueOf
<ryanstout>
ok, thats what I figured
<meh`>
so you get a literal back
<ryanstout>
cool, thanks for the info. So opal strings are created with new String('...') ?
<travis-ci>
[travis-ci] opal/opal-browser#134 (master - 0b74e56 : meh): The build has errored.
<meh`>
fucking travis
<meh`>
no, fucking browserstack
<meh`>
this is why we can't have nice things
<fkchang>
meh`: next time, when u r cursing travis, js, IE, opera, etc. do it in italian, I'm curious to see how that looks :)
<meh`>
lol
<meh`>
it would include a lot of heresy
<ryanstout>
adambeynon: sorry, I wasn't around. All code in the views evaluates in the context of the controller. So you could just make a controller method. (still need to figure out if I want to do it another way). As long as that method also returns a reactive value, it will updated in the binding. So you could do something like:
<ryanstout>
so normally you could do something like:
<ryanstout>
def format_with_breaks(str)
<ryanstout>
str.gsub("\n", "<br />")
<ryanstout>
end
<ryanstout>
or you could just put the gsub in the binding
<ryanstout>
but there's one issue with .to_s, which is that ruby basically requires that you return an instance of string. So to_s is weird in volt.
<adambeynon>
ryanstout: the str you pass into that method will be the reactive value, yeh? (so gsub is just another chained call)
<ryanstout>
so for formatting a number, you have to use .with, which takes a block that passes in the current value for the ReactiveValue, and the return value is used in a new ReactiveValue, with the dependencies set.
<dleedev>
ryanstout: I guess I need to make one too, then :)
<ryanstout>
dleedev: yea :-)
<ryanstout>
dleedev: if you're interested, check out Volt. I would love some more feedback on it. Its still really early, but the basics for the front-end are there.
<ryanstout>
anyone know if its possible to redefine new in opal?
<adambeynon>
ryanstout: yeap, it is
<ryanstout>
adambeynon: thanks, must be another issue then
<ryanstout>
adambeynon: does allocate work?
<adambeynon>
ryanstout: it should do
<adambeynon>
what class are you changing it in?
<ryanstout>
just a custom class of mine
<ryanstout>
not inheriting from anything
<adambeynon>
strange
<ryanstout>
I'll keep messing with it, maybe I'm just doing something wrong
<adambeynon>
what error are you getting?
<ryanstout>
Cannot call method '$new' of undefined
<ryanstout>
let me try this on MRI
<adambeynon>
ryanstout: are you calling super in that method?
<ryanstout>
no
<ryanstout>
its a class method
<adambeynon>
ryanstout: it might even be that the constant is missing
<ryanstout>
new is
<ryanstout>
humm, that would be weird
<adambeynon>
ryanstout: on master, const_missing is off by default, so a missing constant is likely to cause that error
<adambeynon>
sure its required?
<ryanstout>
adambeynon: ok, yea, I think it isn't for some reason
<ryanstout>
thanks
<ryanstout>
yea, sorry, that was it
<adambeynon>
ryanstout: back to reactive stuff, ever seen frappuccino?
<ryanstout>
adambeynon: yea, my stuff is somewhat similar
<ryanstout>
though I tried to make it feel like writing normal ruby
<ryanstout>
also, its more event oriented than stream
<adambeynon>
yeah. I see similarities. I always found ruby's Observable really awkward to use, so frappuccino felt very limited
<ryanstout>
adambeynon: yep, I have very similar thoughts
[o__o] has left #opal [#opal]
[o__o] has joined #opal
[o__o] has left #opal [#opal]
[o__o] has joined #opal
<fkchang>
meh`: seems like when I override css in a lissio component, it overrides the parent
<fkchang>
meh`: I see, it's because I override the css for background color, but the tag class is the same as the parent
<fkchang>
so the last one wins
<fkchang>
so I thought I'd try tag class: "card bug-card", which generates the class on the parent div correctly, but not the generated css, i.e. <style type="text/css">.card bug-card {background: red;}</style>
<fkchang>
is there a way to specify a higher level css than starting from the component parent?
<meh`>
fkchang, tag class: [:card, 'bug-card']
<meh`>
fkchang, also, how old is the lissio version?
<meh`>
because it should magically assign inheritance missing classes
dleedev has quit [Quit: dleedev]
<fkchang>
meh`: cool, the array of classes worked. Lissio is probably about a week old
<meh`>
I don't remember if I fixed that before or after
<meh`>
fkchang, in general, now, you could even go without assigning a class to the component
<meh`>
it will create one itself
<meh`>
I still use classes because it makes your life easier when inspecting the document tho
<meh`>
basically it adds a lissio-#{Component.object_id} class
<meh`>
and it goes up the inheritance chain
<meh`>
I could probably use the name of the class as well
<meh`>
to make it more understandable
<meh`>
but there may very well be a bug in the tag inference
<meh`>
it tries to just use the assigned class in #tag if it can
<meh`>
I'll go for a smoke and see if there's anything wrong going on
<meh`>
and add the other attribute support to #tag
<fkchang>
meh`: I'd probably also like to override behavior. It seems when I add css or on to the subclass, the parent get those too
<fkchang>
I just put an on :click on the child, and the behavior showed up on the parent
<fkchang>
somehow there should be a way to pick include parent behavior or override
<fkchang>
maybe super the way do it in methods
<meh`>
fkchang, that shouldn't be the case
<fkchang>
I'll update lissio and see
<meh`>
no wait
<meh`>
you're right, somewhat
<meh`>
let me ask you something
<meh`>
do you mean that when you define an #on on a subclass
<meh`>
you get the behaviour even when you create a parent component
<meh`>
or that when you define an #on on a subclass, you get both behaviors?
<meh`>
the parent and the subclass behavior
<meh`>
fkchang, ^
<fkchang>
meh`: in my case, I added another on :click to the child, and both child and parent classes show both behaviors
<meh`>
fkchang, ok that's definitely a bug, so yeah, try updating
<meh`>
because from the current code, it shouldn't happen at all
<meh`>
unless
<meh`>
fkchang, are you defining those #on in #initialize?
<meh`>
or on the class?
<meh`>
no wait, it wouldn't make sense either
<meh`>
yeah, it doesn't make sense with the current code