The question is how to create this:

<a class="btn" data-toggle="modal" href="#myModal" >Launch Modal</a>

Using link_to method

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Javier Quarite at Mar 28, 2012 at 2:19 am

    On Tue, Mar 27, 2012 at 9:16 PM, Karthikeyan A k wrote:

    The question is how to create this:

    <a class="btn" data-toggle="modal" href="#myModal" >Launch Modal</a>

    Using link_to method
    <%= link_to "Launch Modal","#myModal", :data => {:toggle=>"modal"},
    :class=>"btn"%>

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Karthikeyan A k at Mar 29, 2012 at 10:04 am
    Thanks a lot!

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Nana Kwame at Jun 6, 2016 at 1:45 pm
    <li class="active"><a href="#">Link <span
    class="sr-only">(current)</span></a></li>
             <li><a href="#">Link</a></li>

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/4fc121de4d7d3655febc645433e1d7cb%40ruby-forum.com.
    For more options, visit https://groups.google.com/d/optout.
  • Colin Law at Jun 6, 2016 at 1:49 pm

    On 6 June 2016 at 14:44, Nana Kwame wrote:
    <li class="active"><a href="#">Link <span
    class="sr-only">(current)</span></a></li>
    <li><a href="#">Link</a></li>
    Are you trying to ask a question? If so it is not at all clear what
    the question is. I suggest asking the question in the form of a
    sentence explaining what you are trying to do.

    Colin

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLuCEJ9s8O2bVuB0VG5sHRidDE3m7L%3DYfK0-a%3DKBD2Va-g%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.
  • Nana Kwame at Jun 6, 2016 at 1:45 pm
    <li class="active"><a href="#">Link <span class="sr-only">(current</span
    </a></li><li><a href="#">Link</a></li>

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/e736dcaff19ae1a20c42713593d6785f%40ruby-forum.com.
    For more options, visit https://groups.google.com/d/optout.
  • Nana Kwame at Jun 6, 2016 at 1:45 pm
    <li class="active"><a href="#">Link <span class="sr-only">(current</span
    </a></li><li><a href="#">Link</a></li>

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1dbe815259e91cd69bc798d7031c3a21%40ruby-forum.com.
    For more options, visit https://groups.google.com/d/optout.
  • Nana Kwame at Jun 6, 2016 at 1:47 pm
    <li class="active"><a href="#">Link <span
    class="sr-only">(current</span> </a></li><li><a href="#">Link</a></li>

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/2e4d050bccbe96606c9c1a5b1556344e%40ruby-forum.com.
    For more options, visit https://groups.google.com/d/optout.
  • Greg Navis at Jun 8, 2016 at 4:29 am
    You can pass a block to `#link_to`. An example from the docs:

    <%= link_to(@profile) do %>
       <strong><%= @profile.name %></strong> -- <span>Check it out!</span>
    <% end %>
    # => <a href="/profiles/1">
            <strong>David</strong> -- <span>Check it out!</span>
          </a>

    See
    http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-link_to
    --
    Greg Navis
    I help tech companies to scale Heroku-hosted Rails apps.
    Free, biweekly scalability newsletter for SaaS CEOs
    <http://www.gregnavis.com/newsletter/>

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAA6WWt9kMapiQ5F1HwPZXhywY5MaoTi-beZx__hM0d48th%2BJOQ%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.
  • Nana Kwame at Jun 6, 2016 at 9:05 pm
    Am trying to rewrite this html (<li class="active"><a href="#">Link
    <span
    class="sr-only">(current)</span></a></li> <li><a href="#">Link</a></li>) into
    ruby syntax

    Thanx

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/bff1ec47f70b7309d4b94b6c9d435d38%40ruby-forum.com.
    For more options, visit https://groups.google.com/d/optout.
  • Walter Lee Davis at Jun 7, 2016 at 12:39 am

    On Jun 6, 2016, at 5:04 PM, Nana Kwame wrote:

    Am trying to rewrite this html (<li class="active"><a href="#">Link
    <span
    class="sr-only">(current)</span></a></li> <li><a href="#">Link</a></li>) into
    ruby syntax
    <%= content_tag :li, class: 'active' do %>
       <%= link_to '#' do %>
         Link
         <%= content_tag :span, '(current)', class: 'sr-only' %>
       <%- end -%>
    <%- end -%>
    <%= content_tag :li, link_to('Link', '#') %>

    Assuming by ruby you mean ERB syntax...

    Walter

    >
    Thanx

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/bff1ec47f70b7309d4b94b6c9d435d38%40ruby-forum.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CB6FFDFC-F43F-4372-ACF3-7DB079B657D6%40wdstudio.com.
    For more options, visit https://groups.google.com/d/optout.
  • Nana Kwame at Jun 6, 2016 at 9:09 pm
    The question is how to create this:

      <li class="active"><a href="#">Link
    <span> class="sr-only">(current)</span></a></li> <li><a href="#">Link</a
    </li>)

      Using link_to method

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/8c6c072dfd7dc7795f236f215b28fb18%40ruby-forum.com.
    For more options, visit https://groups.google.com/d/optout.
  • Nana Kwame at Jun 7, 2016 at 10:07 am
    Thank you

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/99641b15023fff12f08ec52eb1a0c3ad%40ruby-forum.com.
    For more options, visit https://groups.google.com/d/optout.
  • Nana Kwame at Jun 7, 2016 at 10:18 pm
    How to create this:


    <a data-toggle="dropdown" role="button"
    aria-expanded="false">Groups<span class="caret"></span> <a/>

    Using link_to method

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/54fd5772eebc2f8f2d02cc6d50110fee%40ruby-forum.com.
    For more options, visit https://groups.google.com/d/optout.
  • Walter Lee Davis at Jun 7, 2016 at 10:30 pm
    Please do yourself a favor and visit the Rails Guides site: http://guides.rubyonrails.com and read them. All of this is documented well.

    To add a data attribute in ERB, you make a nested hash with data as the outermost key:

    <%= link_to( nil, data: { data_toggle: 'dropdown' }, role: 'button', 'aria-expanded': 'false' ) do %>
       Groups
       <span class="caret"></span>
    <%- end %>

    You didn't ask about aria-expanded, but that's how you would add that as well (Ruby 2.3 syntax, don't try this on 1.9.x). The point of using data as a hash is that you often have many different data-attributes on the same element, so you would do data: { foo: 'bar', baz: 'boo' } and end up with data-foo="bar" data-baz="boo" in the generated HTML.

    Walter
    On Jun 7, 2016, at 6:17 PM, Nana Kwame wrote:

    How to create this:


    <a data-toggle="dropdown" role="button"
    aria-expanded="false">Groups<span class="caret"></span> <a/>

    Using link_to method

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/54fd5772eebc2f8f2d02cc6d50110fee%40ruby-forum.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/A86E5F33-1812-41F9-8FE0-C47EA9D578C9%40wdstudio.com.
    For more options, visit https://groups.google.com/d/optout.
  • Walter Lee Davis at Jun 7, 2016 at 10:39 pm
    Sorry, this should read data: { toggle: 'dropdown' } -- typo on my part.

    Walter
    On Jun 7, 2016, at 6:30 PM, Walter Lee Davis wrote:

    data: { data_toggle: 'dropdown' },
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/F3785BD1-9191-4BCC-8894-C089DD978100%40wdstudio.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedMar 28, '12 at 2:16a
activeJun 8, '16 at 4:29a
posts16
users5
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2022 Grokbase