mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-01 05:02:50 +08:00
Merge pull request #3150 from aignatov-bio/ai-sci-5479-fix-routes-to-archived-page
Fix archived experiments page routes and clean old archive page [SCI-5479]
This commit is contained in:
commit
a688824544
9 changed files with 12 additions and 42 deletions
|
@ -632,7 +632,6 @@ ul.double-line > li {
|
|||
}
|
||||
|
||||
#project-show,
|
||||
#project-show-archive,
|
||||
#module-archive,
|
||||
#result-archive {
|
||||
.panel-default {
|
||||
|
|
|
@ -11,13 +11,13 @@ class ProjectsController < ApplicationController
|
|||
helper_method :current_folder
|
||||
|
||||
before_action :switch_team_with_param, only: :index
|
||||
before_action :load_vars, only: %i(show edit update notifications experiment_archive sidebar experiments_cards)
|
||||
before_action :load_current_folder, only: %i(index cards new show experiment_archive)
|
||||
before_action :check_view_permissions, only: %i(show notifications experiment_archive sidebar experiments_cards)
|
||||
before_action :load_vars, only: %i(show edit update notifications sidebar experiments_cards)
|
||||
before_action :load_current_folder, only: %i(index cards new show)
|
||||
before_action :check_view_permissions, only: %i(show notifications sidebar experiments_cards)
|
||||
before_action :check_create_permissions, only: %i(new create)
|
||||
before_action :check_manage_permissions, only: :edit
|
||||
before_action :set_inline_name_editing, only: %i(show)
|
||||
before_action :load_exp_sort_var, only: %i(show experiment_archive)
|
||||
before_action :load_exp_sort_var, only: %i(show)
|
||||
before_action :reset_invalid_view_state, only: %i(index cards)
|
||||
|
||||
layout 'fluid'
|
||||
|
@ -258,6 +258,9 @@ class ProjectsController < ApplicationController
|
|||
def show
|
||||
# This is the "info" view
|
||||
current_team_switch(@project.team)
|
||||
|
||||
view_state = @project.current_view_state(current_user)
|
||||
@current_sort = view_state.state.dig('experiments', experiments_view_mode(@project), 'sort') || 'atoz'
|
||||
end
|
||||
|
||||
def experiments_cards
|
||||
|
@ -287,10 +290,6 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def experiment_archive
|
||||
current_team_switch(@project.team)
|
||||
end
|
||||
|
||||
def users_filter
|
||||
users = current_team.users.search(false, params[:query]).map do |u|
|
||||
{ value: u.id, label: sanitize_input(u.name), params: { avatar_url: avatar_path(u, :icon_small) } }
|
||||
|
@ -349,7 +348,6 @@ class ProjectsController < ApplicationController
|
|||
@project.save
|
||||
end
|
||||
@current_sort = @project.experiments_order || 'new'
|
||||
@current_sort = 'new' if @current_sort.include?('arch') && action_name != 'experiment_archive'
|
||||
end
|
||||
|
||||
def filters_included?
|
||||
|
|
|
@ -63,7 +63,7 @@ module GlobalActivitiesHelper
|
|||
when Experiment
|
||||
return current_value unless obj.navigable?
|
||||
|
||||
path = obj.archived? ? experiment_archive_project_path(obj.project) : canvas_experiment_path(obj)
|
||||
path = obj.archived? ? project_path(obj.project, view_mode: :archived) : canvas_experiment_path(obj)
|
||||
when MyModule
|
||||
return current_value unless obj.navigable?
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<div class="ga-breadcrumb">
|
||||
<%= image_tag 'icon_small/experiment.svg' %>
|
||||
<% if subject&.navigable? %>
|
||||
<% path = subject.archived? ? experiment_archive_project_path(subject.project) : canvas_experiment_path(subject) %>
|
||||
<% path = subject.archived? ? project_path(subject.project, view_mode: :archived) : canvas_experiment_path(subject) %>
|
||||
<%= route_to_other_team(path,
|
||||
team,
|
||||
subject.name&.truncate(Constants::NAME_TRUNCATION_LENGTH),
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
<% provide(:head_title, t("projects.experiment_archive.head_title", project: h(@project.name)).html_safe) %>
|
||||
<% provide(:sidebar_title, t("sidebar.experiments.sidebar_title_archived")) %>
|
||||
<% provide(:sidebar_url, project_sidebar_path(@project)) %>
|
||||
<% provide(:container_class, 'no-second-nav-container') %>
|
||||
<%= content_for :sidebar do %>
|
||||
<%= render partial: 'shared/sidebar/experiments.html.erb', locals: { project: @project, archived: true } %>
|
||||
<% end %>
|
||||
|
||||
<div class="content-pane flexible" id="project-show-archive">
|
||||
<%= render partial: 'projects/show/header' %>
|
||||
<% if @project.archived_experiments.count > 0 %>
|
||||
<div class="row" style="margin-top: 10px;">
|
||||
<% @project.sorted_experiments(@current_sort, true).each_with_index do |experiment, i| %>
|
||||
<%= render partial: "projects/show/experiment.html.erb", locals: { experiment: experiment} %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<em><%=t "projects.experiment_archive.no_archived_experiments" %></em>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= javascript_include_tag("projects/show") %>
|
|
@ -13,7 +13,7 @@
|
|||
</div>
|
||||
<div class="project-name-cell table-cell">
|
||||
<% if project.archived? %>
|
||||
<%= link_to project_url(project, archived: :true) do %>
|
||||
<%= link_to project_url(project, view_mode: :archived) do %>
|
||||
<h3 class="name" title="<%= project.name %>">
|
||||
<%= project.name %>
|
||||
</h3>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<% provide(:head_title, t("projects.show.head_title", project: h(@project.name)).html_safe) %>
|
||||
<% provide(:sidebar_title, t("sidebar.experiments.sidebar_title")) %>
|
||||
<% provide(:sidebar_title, experiments_view_mode(@project) == 'archived' ? t("sidebar.experiments.sidebar_title_archived") : t("sidebar.experiments.sidebar_title")) %>
|
||||
<% provide(:sidebar_url, sidebar_project_path(@project)) %>
|
||||
<% provide(:container_class, 'no-second-nav-container') %>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<ul class="sidebar-branch">
|
||||
<% if experiment.archived_branch? %>
|
||||
<li class="sidebar-leaf">
|
||||
<%= link_to t('sidebar.my_modules.back_to_archived_button'), experiment_archive_project_url(experiment.project), class: 'sidebar-link back-button' %>
|
||||
<%= link_to t('sidebar.my_modules.back_to_archived_button'), project_path(experiment.project, view_mode: :archived), class: 'sidebar-link back-button' %>
|
||||
</li>
|
||||
<% else %>
|
||||
<li class="sidebar-leaf">
|
||||
|
|
|
@ -292,7 +292,6 @@ Rails.application.routes.draw do
|
|||
member do
|
||||
# Notifications popup for individual project in projects index
|
||||
get 'notifications'
|
||||
get 'experiment_archive' # Experiment archive for single project
|
||||
get 'experiments_cards'
|
||||
get 'sidebar'
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue