mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-12-16 21:59:00 +08:00
Move route module_archive_project -> module_archive_experiment
Also add some new routes, move some templates.
This commit is contained in:
parent
ebda92ef05
commit
edafcaeed6
6 changed files with 21 additions and 12 deletions
|
|
@ -4,14 +4,14 @@ class ProjectsController < ApplicationController
|
||||||
|
|
||||||
before_action :load_vars, only: [:show, :edit, :update,
|
before_action :load_vars, only: [:show, :edit, :update,
|
||||||
:notifications, :reports,
|
:notifications, :reports,
|
||||||
:samples, :module_archive,
|
:samples, :experiment_archive,
|
||||||
:delete_samples, :samples_index]
|
:delete_samples, :samples_index]
|
||||||
before_action :check_view_permissions, only: [:show, :reports,
|
before_action :check_view_permissions, only: [:show, :reports,
|
||||||
:samples, :module_archive,
|
:samples, :experiment_archive,
|
||||||
:samples_index]
|
:samples_index]
|
||||||
before_action :check_view_notifications_permissions, only: [ :notifications ]
|
before_action :check_view_notifications_permissions, only: [ :notifications ]
|
||||||
before_action :check_edit_permissions, only: [ :edit ]
|
before_action :check_edit_permissions, only: [ :edit ]
|
||||||
before_action :check_module_archive_permissions, only: [:module_archive]
|
before_action :check_experiment_archive_permissions, only: [:experiment_archive]
|
||||||
|
|
||||||
filter_by_archived = false
|
filter_by_archived = false
|
||||||
|
|
||||||
|
|
@ -259,8 +259,7 @@ class ProjectsController < ApplicationController
|
||||||
@organization = @project.organization
|
@organization = @project.organization
|
||||||
end
|
end
|
||||||
|
|
||||||
def module_archive
|
def experiment_archive
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def samples_index
|
def samples_index
|
||||||
|
|
@ -306,8 +305,8 @@ class ProjectsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_module_archive_permissions
|
def check_experiment_archive_permissions
|
||||||
unless can_restore_archived_modules(@project)
|
unless can_view_project_archive(@project)
|
||||||
render_403
|
render_403
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,13 @@ module PermissionHelper
|
||||||
:can_edit_result_asset_in_module,
|
:can_edit_result_asset_in_module,
|
||||||
:can_archive_result_asset_in_module,
|
:can_archive_result_asset_in_module,
|
||||||
:can_add_samples_to_module,
|
:can_add_samples_to_module,
|
||||||
:can_delete_samples_from_module
|
:can_delete_samples_from_module,
|
||||||
|
:can_create_experiment,
|
||||||
|
:can_edit_experiment,
|
||||||
|
:can_view_experiment,
|
||||||
|
:can_view_experiment_archive,
|
||||||
|
:can_archive_experiment,
|
||||||
|
:can_restore_experiment
|
||||||
] do |proxy, *args, &block|
|
] do |proxy, *args, &block|
|
||||||
if args[0]
|
if args[0]
|
||||||
my_module = args[0]
|
my_module = args[0]
|
||||||
|
|
@ -313,6 +319,10 @@ module PermissionHelper
|
||||||
can_view_project(experiment.project)
|
can_view_project(experiment.project)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def can_view_experiment_archive(experiment)
|
||||||
|
can_view_project(experiment.project)
|
||||||
|
end
|
||||||
|
|
||||||
def can_archive_experiment(project)
|
def can_archive_experiment(project)
|
||||||
is_user_or_higher_of_project(project)
|
is_user_or_higher_of_project(project)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ module SidebarHelper
|
||||||
when "samples"
|
when "samples"
|
||||||
return samples_project_path(project)
|
return samples_project_path(project)
|
||||||
when "archive"
|
when "archive"
|
||||||
return module_archive_project_url(project)
|
return experiment_archive_project_url(project)
|
||||||
else
|
else
|
||||||
return project_path(project)
|
return project_path(project)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
<% if my_module.archived? %>
|
<% if my_module.archived? %>
|
||||||
<span class="label label-warning"><%=t "search.index.archived" %></span>
|
<span class="label label-warning"><%=t "search.index.archived" %></span>
|
||||||
<% if can_view_project_archive(my_module.experiment.project) and can_restore_module(my_module) %>
|
<% if can_view_experiment_archive(my_module.experiment) and can_restore_module(my_module) %>
|
||||||
<a href="<%= module_archive_project_url(my_module.experiment.project) %>">
|
<a href="<%= module_archive_experiment_url(my_module.experiment) %>">
|
||||||
<%= text %>
|
<%= text %>
|
||||||
</a>
|
</a>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if can_view_project_archive(@project) then %>
|
<% if can_view_project_archive(@project) then %>
|
||||||
<li id="project-archive-nav-tab" class="<%= "active" if is_project_archive? %>">
|
<li id="project-archive-nav-tab" class="<%= "active" if is_project_archive? %>">
|
||||||
<a href="<%= module_archive_project_url(@project) %>"><span class="glyphicon glyphicon-briefcase"></span></a>
|
<a href="<%= experiment_archive_project_url(@project) %>"><span class="glyphicon glyphicon-briefcase"></span></a>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue