mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-25 09:13:05 +08:00
Reworked task view sidebar [SCI-5701]
This commit is contained in:
parent
5cadc388f8
commit
b6588c2334
7 changed files with 59 additions and 29 deletions
|
@ -112,6 +112,15 @@
|
|||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.fa-map-marker-alt {
|
||||
color: $color-alto;
|
||||
}
|
||||
|
||||
&:hover .fa-map-marker-alt,
|
||||
.fa-map-marker-alt.module-hover {
|
||||
color: $color-concrete;
|
||||
}
|
||||
|
||||
.toggle-branch {
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
|
@ -124,6 +133,7 @@
|
|||
|
||||
&:hover ~ .sidebar-link:not(.selected) {
|
||||
background: $color-alto;
|
||||
|
||||
}
|
||||
|
||||
&.collapsed ~ .sidebar-branch {
|
||||
|
@ -152,6 +162,7 @@
|
|||
&.selected {
|
||||
background: $color-white;
|
||||
color: $brand-primary;
|
||||
font-weight: bold;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ class MyModulesController < ApplicationController
|
|||
before_action :check_view_permissions, except: %i(update update_description update_protocol_description restore_group)
|
||||
before_action :check_update_state_permissions, only: :update_state
|
||||
before_action :set_inline_name_editing, only: %i(protocols results activities archive)
|
||||
before_action :load_experiment_my_modules, only: %i(protocols results activities archive)
|
||||
|
||||
layout 'fluid'.freeze
|
||||
|
||||
|
@ -243,6 +244,8 @@ class MyModulesController < ApplicationController
|
|||
.experiment
|
||||
.project
|
||||
.team)
|
||||
|
||||
|
||||
@results_order = params[:order] || 'new'
|
||||
|
||||
@results = @my_module.archived_branch? ? @my_module.results : @my_module.results.active
|
||||
|
@ -313,6 +316,10 @@ class MyModulesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def load_experiment_my_modules
|
||||
@experiment_my_modules = @my_module.experiment.my_modules.active.order(:name)
|
||||
end
|
||||
|
||||
def check_manage_permissions
|
||||
render_403 && return unless can_manage_module?(@my_module)
|
||||
end
|
||||
|
|
|
@ -2,7 +2,13 @@
|
|||
<% provide(:sidebar_title, t("sidebar.my_module.sidebar_title")) %>
|
||||
|
||||
<%= content_for :sidebar do %>
|
||||
<%= render partial: 'shared/sidebar/my_module.html.erb' %>
|
||||
<%= render partial: 'shared/sidebar/my_module.html.erb',
|
||||
locals: {
|
||||
my_modules: @experiment_my_modules,
|
||||
experiment: @experiment,
|
||||
current_my_module: @my_module
|
||||
}
|
||||
%>
|
||||
<% end %>
|
||||
<%= render partial: "shared/secondary_navigation" %>
|
||||
|
||||
|
|
|
@ -2,7 +2,13 @@
|
|||
<% provide(:sidebar_title, t("sidebar.my_module.sidebar_title")) %>
|
||||
|
||||
<%= content_for :sidebar do %>
|
||||
<%= render partial: 'shared/sidebar/my_module.html.erb' %>
|
||||
<%= render partial: 'shared/sidebar/my_module.html.erb',
|
||||
locals: {
|
||||
my_modules: @experiment_my_modules,
|
||||
experiment: @experiment,
|
||||
current_my_module: @my_module
|
||||
}
|
||||
%>
|
||||
<% end %>
|
||||
<%= render partial: "shared/secondary_navigation" %>
|
||||
|
||||
|
|
|
@ -11,7 +11,13 @@
|
|||
<% provide(:sidebar_title, t("sidebar.my_module.sidebar_title")) %>
|
||||
|
||||
<%= content_for :sidebar do %>
|
||||
<%= render partial: 'shared/sidebar/my_module.html.erb' %>
|
||||
<%= render partial: 'shared/sidebar/my_module.html.erb',
|
||||
locals: {
|
||||
my_modules: @experiment_my_modules,
|
||||
experiment: @my_module.experiment,
|
||||
current_my_module: @my_module
|
||||
}
|
||||
%>
|
||||
<% end %>
|
||||
<%= render partial: 'shared/drag_n_drop_overlay' %>
|
||||
<%= render partial: 'shared/secondary_navigation', locals: { render_breadcrumbs: true, project: @experiment.project, experiment: @experiment } %>
|
||||
|
|
|
@ -2,7 +2,13 @@
|
|||
<% provide(:sidebar_title, t("sidebar.my_module.sidebar_title")) %>
|
||||
|
||||
<%= content_for :sidebar do %>
|
||||
<%= render partial: 'shared/sidebar/my_module.html.erb' %>
|
||||
<%= render partial: 'shared/sidebar/my_module.html.erb',
|
||||
locals: {
|
||||
my_modules: @experiment_my_modules,
|
||||
experiment: @my_module.experiment,
|
||||
current_my_module: @my_module
|
||||
}
|
||||
%>
|
||||
<% end %>
|
||||
<%= render partial: "shared/secondary_navigation" %>
|
||||
<%= render partial: 'shared/drag_n_drop_overlay' %>
|
||||
|
|
|
@ -1,32 +1,20 @@
|
|||
<ul class="sidebar-branch">
|
||||
<li class="sidebar-leaf">
|
||||
<% if @my_module.archived_branch? %>
|
||||
<%= link_to t('sidebar.my_module.back_button_archived'), module_archive_experiment_url(@my_module.experiment), class: 'sidebar-link back-button' %>
|
||||
<% else %>
|
||||
<%= link_to t('sidebar.my_module.back_button'), canvas_experiment_path(@my_module.experiment), class: 'sidebar-link back-button' %>
|
||||
<% end %>
|
||||
<%= link_to t('sidebar.my_module.back_button'), canvas_experiment_url(experiment), class: 'sidebar-link back-button' %>
|
||||
</li>
|
||||
<% my_modules.each do |my_module| %>
|
||||
<li class="sidebar-leaf">
|
||||
<%= link_to t('sidebar.my_module.steps'),
|
||||
protocols_my_module_url(@my_module),
|
||||
class: "sidebar-link #{'selected' if is_module_protocols?}" %>
|
||||
</li>
|
||||
<li class="sidebar-leaf">
|
||||
<%= link_to t('sidebar.my_module.results'),
|
||||
results_my_module_url(@my_module),
|
||||
class: "sidebar-link #{'selected' if is_module_results?}" %>
|
||||
</li>
|
||||
<li class="sidebar-leaf">
|
||||
<%= link_to t('sidebar.my_module.activities'),
|
||||
activities_my_module_url(@my_module),
|
||||
class: "sidebar-link #{'selected' if is_module_activities?}" %>
|
||||
</li>
|
||||
<li data-hook="sidebar-my-module"></li>
|
||||
<% unless @my_module.archived_branch? %>
|
||||
<li class="sidebar-leaf">
|
||||
<%= link_to t('sidebar.my_module.archive'),
|
||||
archive_my_module_url(@my_module),
|
||||
class: "sidebar-link #{'selected' if is_module_archive?}" %>
|
||||
<%= link_to my_module.name,
|
||||
protocols_my_module_url(my_module),
|
||||
title: my_module.name,
|
||||
class: "sidebar-link #{'selected' if my_module == current_my_module}",
|
||||
data: { module_id: my_module.id } %>
|
||||
</li>
|
||||
<% end %>
|
||||
<li class="sidebar-leaf">
|
||||
<%= link_to module_archive_experiment_url(experiment), class: 'sidebar-link' do %>
|
||||
<i class="fas fa-archive"></i>
|
||||
<%= t('sidebar.my_modules.archived_button') %>
|
||||
<% end%>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
Loading…
Reference in a new issue