FrankDrebbin
FrankDrebbin

Reputation: 135

2 link_to on the same line?

So i was wondering if this was possible, because from what i've tried and read it seems not. I have two link_to inside a div, and i want them to be on the same line. One link_to has a string like "Time Machine" and the other is just an X icon, to delete something. If we click on "Time Machine" we go to a different view, and if we click on the "X", we just delete that div, but i don't know how to get them in the same row. I've used the class row, inline, block-inline, i also used col-md to give them a fixed space, but nothing.

Thing is the X gets placed below the other link, resulting in some weird format in the web, so i want the X to be on the right of "Time Machine".

enter image description here

This is my code:

<div class="row">
   <li class="time_machine" data-toggle="tooltip", title="<%= "#{t '.time'} (#{Time.zone.at(current_user.time_machine_now).strftime('%Y-%m-%d %H:%M')})" %>">
      <%= link_to content_tag(:i, nil, class: "fa fa-remove"), '?time_machine_now=' %>
      <%= link_to "#{t '.time'}", time_selector_users_path, 'data-toggle' => "modal", 'data-target' => "#time_selector_modal", "data-backdrop" => "static" %>
   </li>
</div>

Any ideas?

Upvotes: 0

Views: 449

Answers (1)

Palash Bera
Palash Bera

Reputation: 716

if you are using bootstrap, then you can try this.

<div class="row">
  <li class="time_machine" data-toggle="tooltip", title="<%= "#{t '.time'} (#{Time.zone.at(current_user.time_machine_now).strftime('%Y-%m-%d %H:%M')})" %>">
    <div class="d-flex"> 
      <%= link_to content_tag(:i, nil, class: "fa fa-remove"), '?time_machine_now=' %>
      <%= link_to "#{t '.time'}", time_selector_users_path, 'data-toggle' => "modal", 'data-target' => "#time_selector_modal", "data-backdrop" => "static" %>
    </div>
  </li>
</div>

Thanks. :)

Upvotes: 2

Related Questions