mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-12 06:47:15 +08:00
Revert "Improve breadcrumbs implementation [SCI-8087]"
This commit is contained in:
parent
e431056ef1
commit
78d41d10a6
18 changed files with 20 additions and 242 deletions
|
@ -1,3 +0,0 @@
|
||||||
<svg width="6" height="11" viewBox="0 0 6 11" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<path d="M0.7 10.6L0 9.9L4.6 5.3L0 0.7L0.7 0L6 5.3L0.7 10.6Z" fill="#98A2B3"/>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 180 B |
|
@ -1,42 +0,0 @@
|
||||||
.sci--layout-navigation-breadcrumbs {
|
|
||||||
--max-breadcrumbs-link-width: 11.25rem;
|
|
||||||
align-items: center;
|
|
||||||
column-gap: .875rem;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
padding: .875rem 1.5rem .5rem;
|
|
||||||
|
|
||||||
.breadcrumbs-link {
|
|
||||||
color: var(--sn-blue);
|
|
||||||
display: inline-block;
|
|
||||||
max-width: var(--max-breadcrumbs-link-width);
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
|
|
||||||
&:last-child {
|
|
||||||
color: var(--sn-grey);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.delimiter {
|
|
||||||
padding-bottom: .25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.breadcrumbs-collapsed-container {
|
|
||||||
color: var(--sn-blue);
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
.show-breadcrumbs {
|
|
||||||
align-items: center;
|
|
||||||
cursor: pointer;
|
|
||||||
display: flex;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
@include font-button;
|
|
||||||
color: var(--sn-blue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -77,7 +77,3 @@ html {
|
||||||
// $headings-font-weight: 500;
|
// $headings-font-weight: 500;
|
||||||
// $headings-line-height: 1.1;
|
// $headings-line-height: 1.1;
|
||||||
// $headings-color: inherit;
|
// $headings-color: inherit;
|
||||||
|
|
||||||
html {
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,63 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
module Breadcrumbs
|
|
||||||
extend ActiveSupport::Concern
|
|
||||||
|
|
||||||
included do
|
|
||||||
def set_breadcrumbs_items
|
|
||||||
my_module = @my_module
|
|
||||||
experiment = my_module&.experiment || @experiment
|
|
||||||
project = experiment&.project || @project
|
|
||||||
current_folder = project&.project_folder || @current_folder
|
|
||||||
@breadcrumbs_items = []
|
|
||||||
|
|
||||||
folders = helpers.tree_ordered_parent_folders(current_folder)
|
|
||||||
|
|
||||||
@breadcrumbs_items.push({
|
|
||||||
label: t('projects.index.breadcrumbs_root'),
|
|
||||||
url: projects_path
|
|
||||||
})
|
|
||||||
|
|
||||||
folders&.each do |project_folder|
|
|
||||||
@breadcrumbs_items.push({
|
|
||||||
label: project_folder.name,
|
|
||||||
url: project_folder_path(project_folder)
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
include_project(project) if project
|
|
||||||
|
|
||||||
include_experiment(experiment) if experiment
|
|
||||||
|
|
||||||
include_my_module(my_module) if my_module
|
|
||||||
|
|
||||||
@breadcrumbs_items
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def include_project(project)
|
|
||||||
@breadcrumbs_items.push({
|
|
||||||
label: project.name,
|
|
||||||
url: project_path(project),
|
|
||||||
archived: project.archived?
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
def include_experiment(experiment)
|
|
||||||
@breadcrumbs_items.push({
|
|
||||||
label: experiment.name,
|
|
||||||
url: my_modules_experiment_path(experiment),
|
|
||||||
archived: experiment.archived?
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
def include_my_module(my_module)
|
|
||||||
@breadcrumbs_items.push({
|
|
||||||
label: my_module.name,
|
|
||||||
url: my_module_path(my_module),
|
|
||||||
archived: my_module.archived?
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -6,7 +6,6 @@ class ExperimentsController < ApplicationController
|
||||||
include ActionView::Helpers::TextHelper
|
include ActionView::Helpers::TextHelper
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
include Rails.application.routes.url_helpers
|
include Rails.application.routes.url_helpers
|
||||||
include Breadcrumbs
|
|
||||||
|
|
||||||
before_action :load_project, only: %i(new create archive_group restore_group)
|
before_action :load_project, only: %i(new create archive_group restore_group)
|
||||||
before_action :load_experiment, except: %i(new create archive_group restore_group)
|
before_action :load_experiment, except: %i(new create archive_group restore_group)
|
||||||
|
@ -19,7 +18,6 @@ class ExperimentsController < ApplicationController
|
||||||
before_action :check_clone_permissions, only: %i(clone_modal clone)
|
before_action :check_clone_permissions, only: %i(clone_modal clone)
|
||||||
before_action :check_move_permissions, only: %i(move_modal move)
|
before_action :check_move_permissions, only: %i(move_modal move)
|
||||||
before_action :set_inline_name_editing, only: %i(canvas table module_archive)
|
before_action :set_inline_name_editing, only: %i(canvas table module_archive)
|
||||||
before_action :set_breadcrumbs_items, only: %i(canvas table module_archive)
|
|
||||||
|
|
||||||
layout 'fluid'
|
layout 'fluid'
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ class LabelTemplatesController < ApplicationController
|
||||||
before_action :check_manage_permissions, only: %i(create duplicate set_default delete update)
|
before_action :check_manage_permissions, only: %i(create duplicate set_default delete update)
|
||||||
before_action :load_label_templates, only: %i(index datatable)
|
before_action :load_label_templates, only: %i(index datatable)
|
||||||
before_action :load_label_template, only: %i(show set_default update template_tags)
|
before_action :load_label_template, only: %i(show set_default update template_tags)
|
||||||
before_action :set_breadcrumbs_items, only: %i(index show)
|
|
||||||
|
|
||||||
layout 'fluid'
|
layout 'fluid'
|
||||||
|
|
||||||
|
@ -187,20 +186,4 @@ class LabelTemplatesController < ApplicationController
|
||||||
team: label_template.team,
|
team: label_template.team,
|
||||||
message_items: message_items)
|
message_items: message_items)
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_breadcrumbs_items
|
|
||||||
@breadcrumbs_items = []
|
|
||||||
|
|
||||||
@breadcrumbs_items.push({
|
|
||||||
label: t('breadcrumbs.labels'),
|
|
||||||
url: label_templates_path
|
|
||||||
})
|
|
||||||
|
|
||||||
if @label_template
|
|
||||||
@breadcrumbs_items.push({
|
|
||||||
label: @label_template.name,
|
|
||||||
url: label_template_path(@label_template)
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,6 @@ class MyModulesController < ApplicationController
|
||||||
include ActionView::Helpers::UrlHelper
|
include ActionView::Helpers::UrlHelper
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
include MyModulesHelper
|
include MyModulesHelper
|
||||||
include Breadcrumbs
|
|
||||||
|
|
||||||
before_action :load_vars, except: %i(restore_group create new save_table_state)
|
before_action :load_vars, except: %i(restore_group create new save_table_state)
|
||||||
before_action :load_experiment, only: %i(create new)
|
before_action :load_experiment, only: %i(create new)
|
||||||
|
@ -20,7 +19,6 @@ class MyModulesController < ApplicationController
|
||||||
before_action :check_update_state_permissions, only: :update_state
|
before_action :check_update_state_permissions, only: :update_state
|
||||||
before_action :set_inline_name_editing, only: %i(protocols results activities archive)
|
before_action :set_inline_name_editing, only: %i(protocols results activities archive)
|
||||||
before_action :load_experiment_my_modules, only: %i(protocols results activities archive)
|
before_action :load_experiment_my_modules, only: %i(protocols results activities archive)
|
||||||
before_action :set_breadcrumbs_items, only: %i(results protocols activities)
|
|
||||||
|
|
||||||
layout 'fluid'.freeze
|
layout 'fluid'.freeze
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ class ProjectsController < ApplicationController
|
||||||
include ProjectsHelper
|
include ProjectsHelper
|
||||||
include CardsViewHelper
|
include CardsViewHelper
|
||||||
include ExperimentsHelper
|
include ExperimentsHelper
|
||||||
include Breadcrumbs
|
|
||||||
|
|
||||||
attr_reader :current_folder
|
attr_reader :current_folder
|
||||||
helper_method :current_folder
|
helper_method :current_folder
|
||||||
|
@ -23,7 +22,6 @@ class ProjectsController < ApplicationController
|
||||||
before_action :load_exp_sort_var, only: :show
|
before_action :load_exp_sort_var, only: :show
|
||||||
before_action :reset_invalid_view_state, only: %i(index cards show)
|
before_action :reset_invalid_view_state, only: %i(index cards show)
|
||||||
before_action :set_folder_inline_name_editing, only: %i(index cards)
|
before_action :set_folder_inline_name_editing, only: %i(index cards)
|
||||||
before_action :set_breadcrumbs_items, only: %i(index show)
|
|
||||||
|
|
||||||
layout 'fluid'
|
layout 'fluid'
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,6 @@ class ProtocolsController < ApplicationController
|
||||||
|
|
||||||
before_action :set_importer, only: %i(load_from_file import)
|
before_action :set_importer, only: %i(load_from_file import)
|
||||||
before_action :set_inline_name_editing, only: :show
|
before_action :set_inline_name_editing, only: :show
|
||||||
before_action :set_breadcrumbs_items, only: %i(index show)
|
|
||||||
|
|
||||||
layout 'fluid'
|
layout 'fluid'
|
||||||
|
|
||||||
|
@ -1126,21 +1125,4 @@ class ProtocolsController < ApplicationController
|
||||||
protocol: link_to(@protocol.name, protocol_url(@protocol)))
|
protocol: link_to(@protocol.name, protocol_url(@protocol)))
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_breadcrumbs_items
|
|
||||||
@breadcrumbs_items = []
|
|
||||||
|
|
||||||
@breadcrumbs_items.push({
|
|
||||||
label: t('breadcrumbs.protocols'),
|
|
||||||
url: protocols_path
|
|
||||||
})
|
|
||||||
|
|
||||||
if @protocol
|
|
||||||
@breadcrumbs_items.push({
|
|
||||||
label: @protocol.name,
|
|
||||||
url: protocol_path(@protocol),
|
|
||||||
archived: @protocol.archived?
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -22,7 +22,6 @@ class RepositoriesController < ApplicationController
|
||||||
before_action :check_create_permissions, only: %i(create_modal create)
|
before_action :check_create_permissions, only: %i(create_modal create)
|
||||||
before_action :check_copy_permissions, only: %i(copy_modal copy)
|
before_action :check_copy_permissions, only: %i(copy_modal copy)
|
||||||
before_action :set_inline_name_editing, only: %i(show)
|
before_action :set_inline_name_editing, only: %i(show)
|
||||||
before_action :set_breadcrumbs_items, only: %i(index show)
|
|
||||||
|
|
||||||
layout 'fluid'
|
layout 'fluid'
|
||||||
|
|
||||||
|
@ -526,21 +525,4 @@ class RepositoriesController < ApplicationController
|
||||||
team: @repository.team,
|
team: @repository.team,
|
||||||
message_items: message_items)
|
message_items: message_items)
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_breadcrumbs_items
|
|
||||||
@breadcrumbs_items = []
|
|
||||||
|
|
||||||
@breadcrumbs_items.push({
|
|
||||||
label: t('breadcrumbs.inventories'),
|
|
||||||
url: repositories_path
|
|
||||||
})
|
|
||||||
|
|
||||||
if @repository
|
|
||||||
@breadcrumbs_items.push({
|
|
||||||
label: @repository.name,
|
|
||||||
url: repository_path(@repository),
|
|
||||||
archived: @repository.archived?
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
<div class="content-header sticky-header">
|
<div class="content-header sticky-header">
|
||||||
|
<div id="breadcrumbsWrapper">
|
||||||
|
<%= render partial: 'projects/index/breadcrumbs', locals: {target_folder: @experiment.project.project_folder, project: @experiment.project, experiment: @experiment} %>
|
||||||
|
</div>
|
||||||
<div class="title-row">
|
<div class="title-row">
|
||||||
<h1 class="experimnet-name" data-toggle="tooltip" data-placement="bottom" title="<%= @experiment.name %>">
|
<h1 class="experimnet-name" data-toggle="tooltip" data-placement="bottom" title="<%= @experiment.name %>">
|
||||||
<% if @experiment.archived? %>
|
<% if @experiment.archived? %>
|
||||||
|
|
|
@ -57,7 +57,8 @@
|
||||||
<span style="display: none;" data-hook="body-js"></span>
|
<span style="display: none;" data-hook="body-js"></span>
|
||||||
<span style="display: none;" data-hook="application-body-html"></span>
|
<span style="display: none;" data-hook="application-body-html"></span>
|
||||||
|
|
||||||
<div class="sci--layout" data-breadcrumbs-collapsed="<%= !@breadcrumbs_items.present? %>" data-navigator-collapsed="<%= !content_for?(:sidebar_title) %>">
|
|
||||||
|
<div class="sci--layout" data-breadcrumbs-collapsed="true" data-navigator-collapsed="<%= !content_for?(:sidebar_title) %>">
|
||||||
<div class="sci--layout-navigation-top" >
|
<div class="sci--layout-navigation-top" >
|
||||||
<%= render "shared/navigation/top" %>
|
<%= render "shared/navigation/top" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
%>
|
%>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= render partial: 'shared/drag_n_drop_overlay' %>
|
<%= render partial: 'shared/drag_n_drop_overlay' %>
|
||||||
<%= render partial: 'shared/secondary_navigation', locals: { render_breadcrumbs: false, project: @experiment.project, experiment: @experiment } %>
|
<%= render partial: 'shared/secondary_navigation', locals: { render_breadcrumbs: true, project: @experiment.project, experiment: @experiment } %>
|
||||||
|
|
||||||
<div class="content-pane my-modules-protocols-index" data-task-id="<%= @my_module.id %>">
|
<div class="content-pane my-modules-protocols-index" data-task-id="<%= @my_module.id %>">
|
||||||
<div class="my-module-position-container">
|
<div class="my-module-position-container">
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
<div class="content-header sticky-header">
|
<div class="content-header sticky-header">
|
||||||
|
<div id="breadcrumbsWrapper">
|
||||||
|
<%= render partial: 'projects/index/breadcrumbs', locals: { target_folder: current_folder, folder_page: true } if current_folder %>
|
||||||
|
</div>
|
||||||
<div class="title-row">
|
<div class="title-row">
|
||||||
<% if current_folder&.name && @inline_editable_title_config.present? %>
|
<% if current_folder&.name && @inline_editable_title_config.present? %>
|
||||||
<h1 data-view-mode="active" class="projects-title">
|
<h1 data-view-mode="active" class="projects-title">
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
<div class="content-header sticky-header">
|
<div class="content-header sticky-header">
|
||||||
|
<div id="breadcrumbsWrapper">
|
||||||
|
<%= render partial: 'projects/index/breadcrumbs', locals: { target_folder: @project.project_folder } %>
|
||||||
|
</div>
|
||||||
<div class="title-row">
|
<div class="title-row">
|
||||||
<h1 class="project-name">
|
<h1 class="project-name">
|
||||||
<% if @project.archived? %>
|
<% if @project.archived? %>
|
||||||
|
|
|
@ -5,6 +5,14 @@
|
||||||
<% provide(:container_class, 'no-second-nav-container') %>
|
<% provide(:container_class, 'no-second-nav-container') %>
|
||||||
<div class="content-pane protocols-show" >
|
<div class="content-pane protocols-show" >
|
||||||
<div class="content-header">
|
<div class="content-header">
|
||||||
|
<div id="breadcrumbsWrapper">
|
||||||
|
<div class="breadcrumbs-container protocol-breadcrumbs">
|
||||||
|
<a href="<%= protocols_path %>" class="breadcrumbs-link">
|
||||||
|
<%= t('sidebar.templates.protocol_templates') %>
|
||||||
|
</a>
|
||||||
|
<span class="delimiter">/</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="title-row">
|
<div class="title-row">
|
||||||
<h1>
|
<h1>
|
||||||
<% if @inline_editable_title_config.present? %>
|
<% if @inline_editable_title_config.present? %>
|
||||||
|
|
|
@ -1,64 +0,0 @@
|
||||||
<% if @breadcrumbs_items&.length %>
|
|
||||||
<% @breadcrumbs_items.each { |item| item[:label] = "(A) #{item[:label]}" if item[:archived] }%>
|
|
||||||
<% shortened = @breadcrumbs_items.length > 4 %>
|
|
||||||
|
|
||||||
<% if shortened %>
|
|
||||||
<% first_breadcrumb_item = @breadcrumbs_items.shift
|
|
||||||
last_breadcrumb_items = @breadcrumbs_items.pop(2) %>
|
|
||||||
<%= link_to(first_breadcrumb_item[:label], first_breadcrumb_item[:url],
|
|
||||||
class: "breadcrumbs-link",
|
|
||||||
title: first_breadcrumb_item[:label]) %>
|
|
||||||
<span class="delimiter">
|
|
||||||
<%= image_tag "icon_small/navigate_next.svg",
|
|
||||||
alt: "navigate next",
|
|
||||||
class: "navigate_next" %>
|
|
||||||
</span>
|
|
||||||
<span class="breadcrumbs-collapsed-container">
|
|
||||||
<span class="show-breadcrumbs" data-toggle="dropdown" title="<%= t('projects.index.breadcrumbs_collapsed') %>">
|
|
||||||
•••
|
|
||||||
<span class="caret pull-right"></span>
|
|
||||||
</span>
|
|
||||||
<ul class="dropdown-menu breadcrumbs-dropdown" role="menu">
|
|
||||||
<% @breadcrumbs_items.each do |item| %>
|
|
||||||
<li>
|
|
||||||
<%= link_to(item[:label], item[:url]) %>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
</span>
|
|
||||||
<span class="delimiter">
|
|
||||||
<%= image_tag "icon_small/navigate_next.svg",
|
|
||||||
alt: "navigate next",
|
|
||||||
class: "navigate_next" %>
|
|
||||||
</span>
|
|
||||||
<% item = last_breadcrumb_items.first %>
|
|
||||||
<%= link_to(item[:label], item[:url],
|
|
||||||
class: "breadcrumbs-link",
|
|
||||||
title: item[:label]) %>
|
|
||||||
<span class="delimiter">
|
|
||||||
<%= image_tag "icon_small/navigate_next.svg",
|
|
||||||
alt: "navigate next",
|
|
||||||
class: "navigate_next" %>
|
|
||||||
</span>
|
|
||||||
<% last_item = last_breadcrumb_items.last %>
|
|
||||||
<span class="breadcrumbs-link" title="<%= last_item[:label] %>">
|
|
||||||
<%= last_item[:label] %>
|
|
||||||
</span>
|
|
||||||
<% else %>
|
|
||||||
<% last_item = @breadcrumbs_items.pop %>
|
|
||||||
<% @breadcrumbs_items.each do |item| %>
|
|
||||||
<%= link_to(item[:label], item[:url],
|
|
||||||
class: "breadcrumbs-link",
|
|
||||||
title: item[:label]) %>
|
|
||||||
<span class="delimiter">
|
|
||||||
<img src="<%= asset_path "icon_small/navigate_next.svg"%>"
|
|
||||||
alt="navigate next"
|
|
||||||
class="navigate_next">
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
<span class="breadcrumbs-link" title="<%= last_item[:label] %>">
|
|
||||||
<%= last_item[:label] %>
|
|
||||||
</span>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
|
@ -3484,11 +3484,6 @@ en:
|
||||||
url:
|
url:
|
||||||
not_valid: "Not valid URL"
|
not_valid: "Not valid URL"
|
||||||
|
|
||||||
breadcrumbs:
|
|
||||||
projects: "Projects"
|
|
||||||
inventories: "Inventories"
|
|
||||||
protocols: "Protocol templates"
|
|
||||||
labels: "Label templates"
|
|
||||||
|
|
||||||
Add: "Add"
|
Add: "Add"
|
||||||
Asset: "File"
|
Asset: "File"
|
||||||
|
|
Loading…
Add table
Reference in a new issue