Sunday 15 August 2010

ruby on rails - set data-* attribute -


I have a situation where I have to set the price for a "data- *" on a div in a dual way What I'm really using is:

  = tag ('div', {class: 'agile-carousel', data: {carousel_list: url_for (format :: json)} }, True) = "& lt; / div & gt;" Html_safe   

Which is awesome, besides rail one and lt; Div / & gt; Turns off the device in a fashion, which certainly does not like Chrome and other browsers (to create some disasters).

So my solution is that one. I would like to ask that there is another way to do this.

Update 1:

I have a small problem, this code:

  Span class == I18n.locale == locale_used? "Disabled": zero = link_ to (I18n.t ('locale_name', locale: locale_used), \ url_ (locale: locale_US))   

If I remove link_to this job Does. Note that if i | << Code> "<< P> instead of

> content_tag instead of> tags >
, but you should not

you are using Therefore, the use of slim :

  .gile-carouesel data-carousel_list = Url_for (format :: json) < / Code>  

Output:

  

The whole point of Slim and Ham is that you have to write the tags There is a brilliant brief sentence that you should use it when they are not necessary, then they should use the Tag Tag Assistants. By using them, you are restarting all the punctuation marks they want to remove. .

No comments:

Post a Comment