scinote-web/app/views/shared/_secondary_navigation.html.erb
aignatov-bio b1df8c9aa7
Adding inline editing to experiment title, project title and task title [SCI-3059] (#1524)
* Adding inline editing to experiment title, project title and task title
2019-03-06 09:17:34 +01:00

175 lines
8.6 KiB
Text

<% content_for :secondary_navigation do %>
<nav class="navbar navbar-default navbar-secondary">
<div class="container-fluid">
<div class="navbar-header">
<!-- Small devices dropdown button -->
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#secondary-menu" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- buttons -->
<div class="collapse navbar-collapse" id="secondary-menu">
<!-- True secondary navigation (buttons on the right side) -->
<ul class="nav navbar-nav navbar-right" style="vertical-align: bottom">
<% if all_projects_page? %>
<% if can_read_team?(current_team) %>
<li id="projects-active-nav-tab"
class="<%= 'active' if @current_filter == 'active' %> projects-view-filter"
data-filter="active">
<a href="#" title="<%=t "nav2.all_projects.index" %>">
<span><%=t "nav2.all_projects.index" %></span>
</a>
</li>
<li id="projects-archive-nav-tab"
class="<%= 'active' if @current_filter == 'archived' %> projects-view-filter"
data-filter="archived">
<a href="#" title="<%=t "nav2.all_projects.archive" %>">
<span><%=t "nav2.all_projects.archive" %></span>
</a>
</li>
<li id="projects-all-nav-tab"
class="<%= 'active' if @current_filter == 'all' %> projects-view-filter"
data-filter="all">
<a href="#" title="<%=t "nav2.all_projects.all" %>">
<span><%=t "nav2.all_projects.all" %></span>
</a>
</li>
<li>
<ul class="list-unstyled">
<li>
<div class="btn-group projects-view-mode-switch" data-toggle="buttons">
<a class="btn btn-toggle active" href="#projects-cards-view" data-toggle="tab" data-mode="cards">
<input type="radio" name="projects-view-mode-selector" value="cards">
<i class="fas fa-th-large"></i>
</a>
<a class="btn btn-toggle" href="#projects-table-view" data-toggle="tab" data-mode="table">
<input type="radio" name="projects-view-mode-selector" value="table">
<i class="fas fa-th-list"></i>
</a>
</div>
</li>
</ul>
</li>
<% end %>
<% elsif project_page? ||
sample_types_page_project? ||
sample_groups_page_project? %>
<% if can_read_project?(@project) then %>
<li id="canvas-nav-tab" class="<%= "active" if is_project_show? %>">
<a href="<%= project_url(@project) %>" title="<%=t "nav2.projects.show" %>">
<span class="hidden-sm hidden-md"><%=t "nav2.projects.show" %></span>
<span class="hidden-xs hidden-lg fas fa-folder"></span>
</a>
</li>
<li id="project-archive-nav-tab" class="<%= "active" if is_project_archive? %>">
<a href="<%= experiment_archive_project_url(@project) %>" title="<%=t "nav2.projects.archive" %>">
<span class="hidden-sm hidden-md"><%=t "nav2.projects.archive" %></span>
<span class="hidden-xs hidden-lg fas fa-briefcase"></span>
</a>
</li>
<% end %>
<% elsif experiment_page? ||
sample_groups_page_experiment? ||
sample_types_page_expermient? %>
<% if can_read_experiment?(@experiment) %>
<li id="canvas-nav-tab" class="<%= "active" if is_experiment_canvas? %>">
<a href="<%= canvas_experiment_url(@experiment) %>" title="<%=t "nav2.experiments.canvas" %>">
<span class="hidden-sm hidden-md"><%=t "nav2.experiments.canvas" %></span>
<span class="hidden-xs hidden-lg fas fa-folder"></span>
</a>
</li>
<% end %>
<% if can_read_project?(@experiment.project) %>
<li id="project-archive-nav-tab" class="<%= "active" if is_experiment_archive? %>">
<a href="<%= module_archive_experiment_url(@experiment) %>" title="<%=t "nav2.experiments.archive" %>">
<span class="hidden-sm hidden-md"><%=t "nav2.experiments.archive" %></span>
<span class="hidden-xs hidden-lg fas fa-briefcase"></span>
</a>
</li>
<% end %>
<% elsif module_page? ||
sample_types_page_my_module? ||
sample_groups_page_my_module? %>
<% if can_read_experiment?(@my_module.experiment) %>
<li id="steps-nav-tab" class="<%= "active" if is_module_protocols? %>">
<a href="<%= protocols_my_module_url(@my_module) %>" title="<%=t "nav2.modules.steps" %>">
<span class="hidden-sm hidden-md"><%=t "nav2.modules.steps" %></span>
<span class="hidden-xs hidden-lg fas fa-arrow-circle-right"></span>
</a>
</li>
<li id="results-nav-tab" class="<%= "active" if is_module_results? %>">
<a href="<%= results_my_module_url(@my_module) %>" title="<%=t "nav2.modules.results" %>">
<span class="hidden-sm hidden-md"><%=t "nav2.modules.results" %></span>
<span class="hidden-xs hidden-lg fas fa-columns"></span>
</a>
</li>
<li id="activities-nav-tab" class="<%= "active" if is_module_activities? %>">
<a href="<%= activities_my_module_url(@my_module) %>" title="<%=t "nav2.modules.activities" %>">
<span class="hidden-sm hidden-md"><%=t "nav2.modules.activities" %></span>
<span class="hidden-xs hidden-lg fas fa-list"></span>
</a>
</li>
<% end %>
<li data-hook="secondary-navigation-tabs"></li>
<% if can_read_team?(@my_module.experiment.project.team) &&
@my_module.experiment.project.team.repositories.exists? %>
<li id="repositories-nav-tab"
class="<%= "active" if module_repository_page? %> dropdown repositories-dropdown"
data-url="<%= module_repository_page? ? repositories_dropdown_repository_tab_my_module_path(repository: @repository) : repositories_dropdown_my_module_path %>">
<a href="#" id="repositoriesDropdownMenuLink" title="<%=t "nav2.modules.repositories" %>" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="hidden-sm hidden-md"><%=t "nav2.modules.repositories" %></span>
<span class="hidden-xs hidden-lg fas fa-list-alt"></span>
<span class="caret"></span>
</a>
<ul class="dropdown-menu repositories-dropdown-menu" aria-labelledby="repositoriesDropdownMenuLink">
<%= render partial: "repositories_dropdown.html.erb", locals: { enable_counters: false } %>
</ul>
</li>
<% end %>
<% if can_read_experiment?(@my_module.experiment) then %>
<li id="archive-nav-tab" class="<%= "active" if is_module_archive? %>">
<a href="<%= archive_my_module_url(@my_module) %>" title="<%= t'nav2.modules.archive' %>">
<span class="hidden-sm hidden-md"><%=t "nav2.modules.archive" %></span>
<span class="hidden-xs hidden-lg fas fa-briefcase"></span>
</a>
</li>
<% end %>
<% end %>
</ul>
<!-- Secondary navigation title -->
<% editable = false if local_assigns[:editable].nil? %>
<h4 class="nav-name <%= (editable && editable[:active]) ? 'editable' : '' %>">
<% if editable && editable[:active] %>
<%= render partial: "shared/inline_editing", locals: {
initial_value: truncate(title_element.name, length: Constants::MAX_EDGE_LENGTH),
width: editable[:width] || '100%',
name: editable[:name],
field_to_udpate: editable[:field_to_udpate],
path_to_update: editable[:path_to_update],
params_group: editable[:params_group]
} %>
<% else %>
<%= truncate(title_element.name,
length: Constants::MAX_EDGE_LENGTH) %>
<% end %>
</h4>
</div>
</div>
</nav>
<%= javascript_include_tag('secondary_navigation') %>
<% end %>