0

I'm trying to pass two parameters, data-no-turbolinks and mobile

This works:

(1) %a{href: "#{test_path}", data: { no: { turbolink: true }}} %span Test

which translates to

<a data-no-turbolink href='/test'> <span>Test</span></a>

Now I need to add one parameter to this link: mobile

All of the following didn't work!

(1) %a{href: "", mobile: 1, data: { no: { turbolink: true }}} or

 %a{href: "", data: {mobile: 1, no: { turbolink: true }}}

(turbo-link got passed correctly, not the mobile)

(2) %span= link_to "Mobile", {mobile: 1, data: { no: { turbolink: true }}}

(3) %span= link_to "Mobile", {'mobile' => 1, 'data-no-turbolink' => true }

(4) %span= link_to "Mobile", url_for('mobile' => 1, 'data-no-turbolink' => true)

(5) %span= link_to "Mobile", data: {mobile: 1, no: {turbolink: true} }

  • You need to provide the result you are getting, and what you want to get. – matt Sep 12 '13 at 20:51
  • okay I will edit but in short, I'm trying to do this http://railscasts.com/episodes/199-mobile-devices <%= link_to "Mobile Site", :mobile => 1 %> plus passing the turbolinks with it so that js gets displayed too ... –  Sep 12 '13 at 20:56
  • plus trying to avoid the old syntax mobile => 1 and sticking with the new syntax mobile: 1 ... althu neither is working –  Sep 12 '13 at 20:57

2 Answers2

0
= link_to "Mobile", '#', {"data-mobile" => "1", "data-no-turbolink" => "true"}

which outputs

<a href="#" data-no-turbolink="true" data-mobile="1">
raphael_turtle
  • 7,154
  • 10
  • 55
  • 89
0

I am using slim and I solve this problem using

ol data-no-turbolink=true #// here ol is unorders list tag for my case
Raza Hussain
  • 762
  • 8
  • 18