Traces#index: Introduce tab navigation, fix tag-filter
- introduce bootstrap tabs to switch the views - introduce `content_for :heading_class` to remove the padding below the bootstrap tabs - update the rss-image to use a svg, adopted from https://icons.getbootstrap.com/icons/rss/ (without the outer border) - move rss- and new-button away from the view-switching actions - the `@tag` logic was broken. introduce new link to remove the tag-filter; the tabs keep the filter once given; use params[:tag] directly in the view - use `&.` syntax nil-safety so we can remove `@display_name`
This commit is contained in:
parent
60b16b9421
commit
f4e998804d
3 changed files with 52 additions and 17 deletions
|
@ -5,7 +5,7 @@
|
|||
<%= render :partial => "layouts/flash", :locals => { :flash => flash } %>
|
||||
<% if content_for? :heading %>
|
||||
<div class="content-heading">
|
||||
<div class="content-inner">
|
||||
<div class="content-inner <%= yield :heading_class %>">
|
||||
<%= yield :heading %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,25 +1,61 @@
|
|||
<% content_for :heading_class, 'pb-0' %>
|
||||
<% content_for :heading do %>
|
||||
<h1><%= @title %></h1>
|
||||
<ul class='secondary-actions clearfix'>
|
||||
<li><%= t(".description") %></li>
|
||||
<li><%= rss_link_to :action => "georss", :display_name => @display_name, :tag => @tag %></li>
|
||||
<li><%= link_to t(".upload_trace"), new_trace_path %></li>
|
||||
<% if @tag %>
|
||||
<li><%= link_to t(".see_all_traces"), :controller => "traces", :action => "index", :display_name => nil, :tag => nil, :page => nil %></li>
|
||||
<li><%= link_to t(".see_my_traces"), :action => "mine", :tag => nil, :page => nil %></li>
|
||||
<% else %>
|
||||
<% if @display_name %>
|
||||
<li><%= link_to t(".see_all_traces"), :controller => "traces", :action => "index", :display_name => nil, :tag => nil, :page => nil %></li>
|
||||
<% end %>
|
||||
<% if current_user && current_user != @target_user %>
|
||||
<li><%= link_to t(".see_my_traces"), :action => "mine", :tag => nil, :page => nil %></li>
|
||||
<% end %>
|
||||
<p>
|
||||
<%= t(".description") %>
|
||||
<% if params[:tag] %>
|
||||
<%= link_to t(".remove_tag_filter", :tag => params[:tag]), {:controller => "traces", :action => "index", :display_name => nil, :tag => nil, :page => nil}, {:class => "border-left ml-2 pl-2"} %>
|
||||
<% end %>
|
||||
</p>
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="nav-item">
|
||||
<% if @target_user.blank? %>
|
||||
<!-- public traces -->
|
||||
<% if current_user %>
|
||||
<li class="nav-item">
|
||||
<%= link_to t(".see_my_traces"), {:action => "mine", :page => nil}, {:class => "nav-link"} %>
|
||||
</li>
|
||||
<% end %>
|
||||
<li class="nav-item">
|
||||
<%= link_to t(".see_all_traces"), {:controller => "traces", :action => "index", :display_name => nil, :page => nil}, {:class => "nav-link active"} %>
|
||||
</li>
|
||||
<% elsif current_user && current_user == @target_user %>
|
||||
<!-- my traces -->
|
||||
<li class="nav-item">
|
||||
<%= link_to t(".see_my_traces"), {:action => "mine", :page => nil}, {:class => "nav-link active"} %>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<%= link_to t(".see_all_traces"), {:controller => "traces", :action => "index", :display_name => nil, :page => nil}, {:class => "nav-link"} %>
|
||||
</li>
|
||||
<% else %>
|
||||
<!-- public_traces_from @target_user -->
|
||||
<li class="nav-item">
|
||||
<%= link_to t(".see_public_traces_from", :user => @target_user&.display_name), {:action => "mine", :page => nil}, {:class => "nav-link active"} %>
|
||||
</li>
|
||||
<% if current_user && current_user != @target_user %>
|
||||
<li class="nav-item">
|
||||
<%= link_to t(".see_my_traces"), {:action => "mine", :page => nil}, {:class => "nav-link"} %>
|
||||
</li>
|
||||
<% end %>
|
||||
<li class="nav-item">
|
||||
<%= link_to t(".see_all_traces"), {:controller => "traces", :action => "index", :display_name => nil, :page => nil}, {:class => "nav-link"} %>
|
||||
</li>
|
||||
<% end %>
|
||||
</li>
|
||||
|
||||
<li class="nav-item ml-auto pt-1">
|
||||
<%= link_to({:action => :georss, :display_name => @target_user&.display_name, :tag => params[:tag]}, {:class => "btn btn-secondary btn-sm px-1 py-0"}) do %>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="white" viewBox="0 0 16 16">
|
||||
<path d="M5.5 12a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm-3-8.5a1 1 0 0 1 1-1c5.523 0 10 4.477 10 10a1 1 0 1 1-2 0 8 8 0 0 0-8-8 1 1 0 0 1-1-1zm0 4a1 1 0 0 1 1-1 6 6 0 0 1 6 6 1 1 0 1 1-2 0 4 4 0 0 0-4-4 1 1 0 0 1-1-1z"/>
|
||||
</svg>
|
||||
<% end -%>
|
||||
<%= link_to t(".upload_trace"), new_trace_path, :class => "btn btn-secondary btn-sm px-1 py-0" %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
<% content_for :auto_discovery_link_tag do %>
|
||||
<%= auto_discovery_link_tag :rss, :action => "georss", :display_name => @display_name, :tag => @tag %>
|
||||
<%= auto_discovery_link_tag :rss, :action => "georss", :display_name => @target_user&.display_name, :tag => params[:tag] %>
|
||||
<% end %>
|
||||
|
||||
<% if @traces.size > 0 %>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue