Improve behaviour of secondary action lists when wrapping

Based on https://stackoverflow.com/a/31732902 this ensure that when
a secondary action list wraps the additional lines don't start with
an item delimiter by pushing it to the left, outside of a parent nav
element which then hides it.
This commit is contained in:
Tom Hughes 2021-08-21 15:32:47 +01:00
parent 3f8cf32272
commit 29e9857145
10 changed files with 247 additions and 223 deletions

View file

@ -31,15 +31,17 @@
<% end %>
</p>
<ul class='secondary-actions clearfix text-muted'>
<li><%= link_to t("users.show.send message"), new_message_path(contact) %></li>
<li>
<% if current_user.is_friends_with?(contact) %>
<%= link_to t("users.show.remove as friend"), remove_friend_path(:display_name => contact.display_name, :referer => request.fullpath), :method => :post %>
<% else %>
<%= link_to t("users.show.add as friend"), make_friend_path(:display_name => contact.display_name, :referer => request.fullpath), :method => :post %>
<% end %>
</li>
</ul>
<nav class='secondary-actions'>
<ul class='clearfix text-muted'>
<li><%= link_to t("users.show.send message"), new_message_path(contact) %></li>
<li>
<% if current_user.is_friends_with?(contact) %>
<%= link_to t("users.show.remove as friend"), remove_friend_path(:display_name => contact.display_name, :referer => request.fullpath), :method => :post %>
<% else %>
<%= link_to t("users.show.add as friend"), make_friend_path(:display_name => contact.display_name, :referer => request.fullpath), :method => :post %>
<% end %>
</li>
</ul>
</nav>
</div>
<% end %>

View file

@ -32,10 +32,12 @@
<% if friends.empty? %>
<%= t ".no friends" %>
<% else %>
<ul class='secondary-actions clearfix'>
<li><%= link_to t(".friends_changesets"), friend_changesets_path %></li>
<li><%= link_to t(".friends_diaries"), friends_diary_entries_path %></li>
</ul>
<nav class='secondary-actions'>
<ul class='clearfix'>
<li><%= link_to t(".friends_changesets"), friend_changesets_path %></li>
<li><%= link_to t(".friends_diaries"), friends_diary_entries_path %></li>
</ul>
</nav>
<div id="friends-container">
<%= render :partial => "contact", :collection => friends, :locals => { :type => "friend" } %>
</div>
@ -48,10 +50,12 @@
<% if nearby.empty? %>
<%= t ".no nearby users" %>
<% else %>
<ul class='secondary-actions clearfix'>
<li><%= link_to t(".nearby_changesets"), nearby_changesets_path %></li>
<li><%= link_to t(".nearby_diaries"), nearby_diary_entries_path %></li>
</ul>
<nav class='secondary-actions'>
<ul class='clearfix'>
<li><%= link_to t(".nearby_changesets"), nearby_changesets_path %></li>
<li><%= link_to t(".nearby_diaries"), nearby_diary_entries_path %></li>
</ul>
</nav>
<div id="nearbyusers">
<%= render :partial => "contact", :collection => nearby, :locals => { :type => "nearby mapper" } %>
</div>