mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-27 18:21:50 +08:00
fixes controllers
This commit is contained in:
parent
d7f514db09
commit
bb9c03df24
7 changed files with 19 additions and 6 deletions
|
@ -1,5 +1,7 @@
|
|||
class ExperimentsController < ApplicationController
|
||||
include PermissionHelper
|
||||
include OrganizationsHelper
|
||||
|
||||
before_action :set_experiment,
|
||||
except: [:new, :create]
|
||||
before_action :set_project,
|
||||
|
|
|
@ -232,10 +232,14 @@ class MyModulesController < ApplicationController
|
|||
|
||||
def protocols
|
||||
@protocol = @my_module.protocol
|
||||
current_organization_switch(@protocol.organization)
|
||||
end
|
||||
|
||||
def results
|
||||
|
||||
current_organization_switch(@my_module
|
||||
.experiment
|
||||
.project
|
||||
.organization)
|
||||
end
|
||||
|
||||
def samples
|
||||
|
@ -245,6 +249,10 @@ class MyModulesController < ApplicationController
|
|||
|
||||
def archive
|
||||
@archived_results = @my_module.archived_results
|
||||
current_organization_switch(@my_module
|
||||
.experiment
|
||||
.project
|
||||
.organization)
|
||||
end
|
||||
|
||||
# Submit actions
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
class ProjectsController < ApplicationController
|
||||
include SampleActions
|
||||
include RenamingUtil
|
||||
include OrganizationsHelper
|
||||
|
||||
before_action :load_vars, only: [:show, :edit, :update,
|
||||
:notifications, :reports,
|
||||
|
|
|
@ -99,9 +99,10 @@ class ReportsController < ApplicationController
|
|||
|
||||
def edit
|
||||
# cleans all the deleted report
|
||||
current_organization_switch(@report.project.organization)
|
||||
@report.cleanup_report
|
||||
load_markdown
|
||||
render "reports/new.html.erb"
|
||||
render 'reports/new.html.erb'
|
||||
end
|
||||
|
||||
# Updating existing report from the _save modal of the new page
|
||||
|
|
|
@ -5,6 +5,10 @@ class SampleMyModulesController < ApplicationController
|
|||
@number_of_samples = @my_module.number_of_samples
|
||||
@samples = @my_module.first_n_samples
|
||||
|
||||
current_organization_switch(@my_module
|
||||
.experiment
|
||||
.project
|
||||
.organization)
|
||||
respond_to do |format|
|
||||
format.json {
|
||||
render :json => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module OrganizationsHelper
|
||||
# resets the current organization if needed
|
||||
def current_organization_switch(org)
|
||||
# resets the current organization if needed
|
||||
if org != current_organization
|
||||
current_user.current_organization_id = org.id
|
||||
current_user.save
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
<% text = query.present? ? highlight(report.name, query.strip.split(/\s+/)) : report.name %>
|
||||
|
||||
<% if can_view_reports(report.project) %>
|
||||
<a href="<%= edit_project_report_path(report.project, report) %>">
|
||||
<%= text %>
|
||||
</a>
|
||||
<%= route_to_other_org edit_project_report_path(report.project, report),
|
||||
report.project.organization,
|
||||
text %>
|
||||
|
|
Loading…
Reference in a new issue