mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-03 18:35:36 +08:00
Remove old reports code [SCI-5650]
This commit is contained in:
parent
945d5ea6c6
commit
bb458abec6
42 changed files with 118 additions and 1510 deletions
|
@ -1020,18 +1020,20 @@ function reportHandsonTableConverter() {
|
|||
});
|
||||
|
||||
// Project content
|
||||
reportData.project_content = { experiments: [], tasks: {}, repositories: [] };
|
||||
reportData.project_content = { experiments: [], repositories: [] };
|
||||
$.each($('.project-contents-container .experiment-element'), function(i, experiment) {
|
||||
let expCheckbox = $(experiment).find('.report-experiment-checkbox');
|
||||
if (!expCheckbox.prop('checked') && !expCheckbox.prop('indeterminate')) return;
|
||||
|
||||
let experimentId = $(experiment).find('.report-experiment-checkbox').val();
|
||||
reportData.project_content.tasks[experimentId] = [];
|
||||
reportData.project_content.experiments.push(experimentId);
|
||||
let experimentData = {};
|
||||
experimentData.id = parseInt($(experiment).find('.report-experiment-checkbox').val(), 10);
|
||||
experimentData.my_module_ids = [];
|
||||
$.each($(experiment).find('.report-my-module-checkbox:checked'), function(j, myModule) {
|
||||
reportData.project_content.tasks[experimentId].push(parseInt(myModule.value, 10));
|
||||
experimentData.my_module_ids.push(parseInt(myModule.value, 10));
|
||||
});
|
||||
reportData.project_content.experiments.push(experimentData);
|
||||
});
|
||||
|
||||
$.each($('.task-contents-container .repositories-contents .repositories-setting:checked'), function(i, e) {
|
||||
reportData.project_content.repositories.push(parseInt(e.value, 10));
|
||||
});
|
||||
|
|
|
@ -1,186 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module ReportActions
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def in_params?(val)
|
||||
params.include? val and params[val] == '1'
|
||||
end
|
||||
|
||||
def generate_new_el(hide)
|
||||
el = {}
|
||||
el[:html] = render_to_string(
|
||||
partial: 'reports/elements/new_element.html.erb',
|
||||
locals: { hide: hide }
|
||||
)
|
||||
el[:children] = []
|
||||
el[:new_element] = true
|
||||
el
|
||||
end
|
||||
|
||||
def generate_el(partial, locals)
|
||||
el = {}
|
||||
el[:html] = render_to_string(
|
||||
partial: partial,
|
||||
locals: locals
|
||||
)
|
||||
el[:children] = []
|
||||
el[:new_element] = false
|
||||
el
|
||||
end
|
||||
|
||||
def generate_project_contents_json
|
||||
res = []
|
||||
if params.include? :modules
|
||||
module_ids = (params[:modules].select { |_, p| p == '1' }).keys.collect(&:to_i)
|
||||
|
||||
# Get unique experiments from given modules
|
||||
experiments = @project.experiments.distinct.joins(:my_modules).where('my_modules.id': module_ids)
|
||||
experiments.each do |experiment|
|
||||
res << generate_new_el(false)
|
||||
el = generate_el(
|
||||
'reports/elements/experiment_element.html.erb',
|
||||
experiment: experiment
|
||||
)
|
||||
selected_modules = experiment.my_modules.includes(:tags).where(id: module_ids)
|
||||
el[:children] = generate_experiment_contents_json(selected_modules)
|
||||
res << el
|
||||
end
|
||||
end
|
||||
res << generate_new_el(false)
|
||||
res
|
||||
end
|
||||
|
||||
def generate_experiment_contents_json(selected_modules)
|
||||
res = []
|
||||
selected_modules.order(:workflow_order).each do |my_module|
|
||||
res << generate_new_el(false)
|
||||
el = generate_el(
|
||||
'reports/elements/my_module_element.html.erb',
|
||||
my_module: my_module
|
||||
)
|
||||
el[:children] = generate_module_contents_json(my_module)
|
||||
res << el
|
||||
end
|
||||
res << generate_new_el(false)
|
||||
res
|
||||
end
|
||||
|
||||
def generate_module_contents_json(my_module)
|
||||
res = []
|
||||
|
||||
ReportExtends::MODULE_CONTENTS.each do |contents|
|
||||
elements = []
|
||||
contents.values.each do |element|
|
||||
if contents.has_many
|
||||
elements = params.select { |k| k.starts_with?("module_#{element}") }
|
||||
elements = elements.select { |_, v| v == '1' }.keys
|
||||
elements.map! { |el| el.gsub('module_', '') }.map! { |el| el.split('_') }
|
||||
elements.map! { |el| [el[0].to_sym, el[1].to_i] }
|
||||
break unless elements.empty?
|
||||
else
|
||||
present = in_params?("module_#{element}".to_sym) || in_params?(element.to_sym)
|
||||
if present
|
||||
elements << [element.to_sym, nil]
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
next if elements.empty?
|
||||
|
||||
elements.each do |_, el_id|
|
||||
if contents.children
|
||||
contents.collection(my_module, params).each do |report_el|
|
||||
res << generate_new_el(false)
|
||||
locals = contents.parse_locals([report_el])
|
||||
locals[:element_id] = el_id if el_id
|
||||
el = generate_el(
|
||||
"reports/elements/my_module_#{contents.element.to_s.singularize}"\
|
||||
"_element.html.erb",
|
||||
locals
|
||||
)
|
||||
if :step.in? contents.locals
|
||||
el[:children] = generate_step_contents_json(report_el)
|
||||
elsif :result.in? contents.locals
|
||||
el[:children] = generate_result_contents_json(report_el)
|
||||
end
|
||||
res << el
|
||||
end
|
||||
else
|
||||
file_name = contents.file_name
|
||||
res << generate_new_el(false)
|
||||
locals = contents.parse_locals([my_module, :asc])
|
||||
locals[:element_id] = el_id if el_id
|
||||
res << generate_el(
|
||||
"reports/elements/my_module_#{file_name}_element.html.erb",
|
||||
locals
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
res << generate_new_el(false)
|
||||
res
|
||||
end
|
||||
|
||||
def generate_step_contents_json(step)
|
||||
res = []
|
||||
if in_params? :step_checklists
|
||||
step.checklists.asc.each do |checklist|
|
||||
res << generate_new_el(false)
|
||||
res << generate_el(
|
||||
'reports/elements/step_checklist_element.html.erb', checklist: checklist
|
||||
)
|
||||
end
|
||||
end
|
||||
if in_params? :step_assets
|
||||
sort_value = step.current_view_state(current_user).state.dig('assets', 'sort')
|
||||
step.assets.order(view_mode: :desc).sort_assets(sort_value).each do |asset|
|
||||
res << generate_new_el(false)
|
||||
res << generate_el(
|
||||
'reports/elements/step_asset_element.html.erb', asset: asset
|
||||
)
|
||||
end
|
||||
end
|
||||
if in_params? :step_tables
|
||||
step.tables.each do |table|
|
||||
res << generate_new_el(false)
|
||||
res << generate_el(
|
||||
'reports/elements/step_table_element.html.erb', table: table
|
||||
)
|
||||
end
|
||||
end
|
||||
if in_params? :step_comments
|
||||
res << generate_new_el(false)
|
||||
res << generate_el(
|
||||
'reports/elements/step_comments_element.html.erb', step: step, order: :asc
|
||||
)
|
||||
end
|
||||
res << generate_new_el(false)
|
||||
res
|
||||
end
|
||||
|
||||
def generate_result_contents_json(result)
|
||||
res = []
|
||||
if in_params? :result_comments
|
||||
res << generate_new_el(true)
|
||||
res << generate_el(
|
||||
'reports/elements/result_comments_element.html.erb', result: result, order: :asc
|
||||
)
|
||||
else
|
||||
res << generate_new_el(false)
|
||||
end
|
||||
res
|
||||
end
|
||||
|
||||
def elements_empty?(elements)
|
||||
return true if elements.blank? || elements.count.zero?
|
||||
|
||||
if elements.count == 1
|
||||
el = elements[0]
|
||||
return true if el.include?(:new_element) && el[:new_element]
|
||||
|
||||
return false
|
||||
end
|
||||
false
|
||||
end
|
||||
end
|
|
@ -2,6 +2,7 @@ class ReportsController < ApplicationController
|
|||
include TeamsHelper
|
||||
include ReportActions
|
||||
include ReportsHelper
|
||||
include StringUtility
|
||||
|
||||
BEFORE_ACTION_METHODS = %i(
|
||||
create
|
||||
|
@ -9,17 +10,8 @@ class ReportsController < ApplicationController
|
|||
update
|
||||
generate_pdf
|
||||
generate_docx
|
||||
save_modal
|
||||
new_template_values
|
||||
project_contents
|
||||
experiment_contents_modal
|
||||
module_contents_modal
|
||||
step_contents_modal
|
||||
result_contents_modal
|
||||
experiment_contents
|
||||
module_contents
|
||||
step_contents
|
||||
result_contents
|
||||
).freeze
|
||||
|
||||
before_action :load_vars, only: %i(edit update document_preview generate_pdf generate_docx status
|
||||
|
@ -246,58 +238,6 @@ class ReportsController < ApplicationController
|
|||
render json: { message: e.message }, status: :internal_server_error
|
||||
end
|
||||
|
||||
# Modal for saving the existsing/new report
|
||||
def save_modal
|
||||
# Assume user is updating existing report
|
||||
@report = @project.reports.find_by_id(params[:id])
|
||||
@method = :put
|
||||
|
||||
# Case when saving a new report
|
||||
if @report.blank?
|
||||
@report = Report.new
|
||||
@method = :post
|
||||
@url = project_reports_path(@project, format: :json)
|
||||
else
|
||||
@url = project_report_path(@project, @report, format: :json)
|
||||
end
|
||||
|
||||
render_403 and return unless params.include? :contents
|
||||
|
||||
@report_contents = params[:contents]
|
||||
|
||||
respond_to do |format|
|
||||
format.json do
|
||||
render json: {
|
||||
html: render_to_string(
|
||||
partial: 'reports/new/modal/save.html.erb'
|
||||
)
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Experiment for adding contents into experiment element
|
||||
def experiment_contents_modal
|
||||
experiment = @project.experiments.find_by_id(params[:experiment_id])
|
||||
|
||||
respond_to do |format|
|
||||
if experiment.blank?
|
||||
format.json do
|
||||
render json: {}, status: :not_found
|
||||
end
|
||||
else
|
||||
format.json do
|
||||
render json: {
|
||||
html: render_to_string(
|
||||
partial: 'reports/new/modal/experiment_contents.html.erb',
|
||||
locals: { project: @project, experiment: experiment }
|
||||
)
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Modal for adding contents into module element
|
||||
def module_contents_modal
|
||||
my_module = MyModule.find_by_id(params[:my_module_id])
|
||||
|
@ -376,105 +316,6 @@ class ReportsController < ApplicationController
|
|||
}
|
||||
end
|
||||
|
||||
def experiment_contents
|
||||
experiment = @project.experiments.find_by(id: params[:id])
|
||||
module_ids = (params[:modules].select { |_, p| p == '1' }).keys.collect(&:to_i)
|
||||
selected_modules = experiment.my_modules.where(id: module_ids)
|
||||
|
||||
respond_to do |format|
|
||||
if experiment.blank?
|
||||
format.json { render json: {}, status: :not_found }
|
||||
elsif selected_modules.blank?
|
||||
format.json { render json: {}, status: :no_content }
|
||||
else
|
||||
elements = generate_experiment_contents_json(selected_modules)
|
||||
end
|
||||
|
||||
if elements_empty? elements
|
||||
format.json { render json: {}, status: :no_content }
|
||||
else
|
||||
format.json do
|
||||
render json: {
|
||||
status: :ok,
|
||||
elements: elements
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def module_contents
|
||||
my_module = MyModule.find_by_id(params[:id])
|
||||
return render_403 unless my_module.experiment.project == @project
|
||||
|
||||
respond_to do |format|
|
||||
if my_module.blank?
|
||||
format.json { render json: {}, status: :not_found }
|
||||
else
|
||||
elements = generate_module_contents_json(my_module)
|
||||
|
||||
if elements_empty? elements
|
||||
format.json { render json: {}, status: :no_content }
|
||||
else
|
||||
format.json do
|
||||
render json: {
|
||||
status: :ok,
|
||||
elements: elements
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def step_contents
|
||||
step = Step.find_by_id(params[:id])
|
||||
return render_403 unless step.my_module.experiment.project == @project
|
||||
|
||||
respond_to do |format|
|
||||
if step.blank?
|
||||
format.json { render json: {}, status: :not_found }
|
||||
else
|
||||
elements = generate_step_contents_json(step)
|
||||
|
||||
if elements_empty? elements
|
||||
format.json { render json: {}, status: :no_content }
|
||||
else
|
||||
format.json {
|
||||
render json: {
|
||||
status: :ok,
|
||||
elements: elements
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def result_contents
|
||||
result = Result.find_by_id(params[:id])
|
||||
return render_403 unless result.my_module.experiment.project == @project
|
||||
|
||||
respond_to do |format|
|
||||
if result.blank?
|
||||
format.json { render json: {}, status: :not_found }
|
||||
else
|
||||
elements = generate_result_contents_json(result)
|
||||
|
||||
if elements_empty? elements
|
||||
format.json { render json: {}, status: :no_content }
|
||||
else
|
||||
format.json {
|
||||
render json: {
|
||||
status: :ok,
|
||||
elements: elements
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def available_repositories
|
||||
render json: { results: @available_repositories }, status: :ok
|
||||
end
|
||||
|
@ -491,7 +332,6 @@ class ReportsController < ApplicationController
|
|||
|
||||
private
|
||||
|
||||
include StringUtility
|
||||
AvailableRepository = Struct.new(:id, :name)
|
||||
|
||||
def load_vars
|
||||
|
|
|
@ -3,91 +3,24 @@
|
|||
module ReportsHelper
|
||||
include StringUtility
|
||||
|
||||
def render_new_element(hide)
|
||||
render partial: 'reports/elements/new_element.html.erb',
|
||||
locals: { hide: hide }
|
||||
end
|
||||
|
||||
def render_report_element(element, provided_locals = nil)
|
||||
# Determine partial
|
||||
file_name = element.type_of
|
||||
if element.type_of.in? ReportExtends::MY_MODULE_CHILDREN_ELEMENTS
|
||||
file_name = "my_module_#{element.type_of.singularize}"
|
||||
end
|
||||
view = "reports/elements/#{file_name}_element.html.erb"
|
||||
view = "reports/elements/#{element.type_of}_element.html.erb"
|
||||
|
||||
# Set locals
|
||||
|
||||
locals = provided_locals.nil? ? {} : provided_locals.clone
|
||||
|
||||
children_html = ''.html_safe
|
||||
# First, recursively render element's children
|
||||
if element.comments? || element.project_header?
|
||||
# Render no children
|
||||
elsif element.result?
|
||||
# Special handling for result comments
|
||||
if element.children.active.present?
|
||||
children_html.safe_concat render_new_element(true)
|
||||
element.children.active.each do |child|
|
||||
children_html
|
||||
.safe_concat render_report_element(child, provided_locals)
|
||||
end
|
||||
else
|
||||
children_html.safe_concat render_new_element(false)
|
||||
if element.children.active.present?
|
||||
element.children.active.each do |child|
|
||||
children_html.safe_concat render_report_element(child, provided_locals)
|
||||
end
|
||||
else
|
||||
if element.children.active.present?
|
||||
element.children.active.each do |child|
|
||||
children_html.safe_concat render_new_element(false)
|
||||
children_html
|
||||
.safe_concat render_report_element(child, provided_locals)
|
||||
end
|
||||
end
|
||||
children_html.safe_concat render_new_element(false)
|
||||
end
|
||||
locals[:report_element] = element
|
||||
locals[:children] = children_html
|
||||
|
||||
if provided_locals[:export_all]
|
||||
# Set path and filename locals for files and tables in export all ZIP
|
||||
|
||||
if element['type_of'] == 'my_module_repository'
|
||||
obj_id = element[:repository_id]
|
||||
elsif element['type_of'].in? %w(step_asset step_table result_asset
|
||||
result_table)
|
||||
|
||||
parent_el = ReportElement.find(element['parent_id'])
|
||||
parent_type = parent_el[:type_of]
|
||||
parent = parent_type.singularize.classify.constantize
|
||||
.find(parent_el["#{parent_type}_id"])
|
||||
|
||||
if parent.class == Step
|
||||
obj_id = if element['type_of'] == 'step_asset'
|
||||
element[:asset_id]
|
||||
elsif element['type_of'] == 'step_table'
|
||||
element[:table_id]
|
||||
end
|
||||
elsif parent.class == MyModule
|
||||
result = Result.find(element[:result_id])
|
||||
obj_id = if element['type_of'] == 'result_asset'
|
||||
result.asset.id
|
||||
elsif element['type_of'] == 'result_table'
|
||||
result.table.id
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# ReportExtends is located in config/initializers/extends/report_extends.rb
|
||||
ReportElement.type_ofs.keys.each do |type|
|
||||
next unless element.public_send("#{type}?")
|
||||
|
||||
element.element_references.each do |el_ref|
|
||||
locals[el_ref.class.name.underscore.to_sym] = el_ref
|
||||
end
|
||||
end
|
||||
|
||||
(render partial: view, locals: locals).html_safe
|
||||
render partial: view, locals: locals
|
||||
end
|
||||
|
||||
# "Hack" to omit file preview URL because of WKHTML issues
|
||||
|
@ -98,25 +31,6 @@ module ReportsHelper
|
|||
image_tag('icon_small/missing.png')
|
||||
end
|
||||
|
||||
# "Hack" to load Glyphicons css directly from the CDN
|
||||
# site so they work in report
|
||||
def bootstrap_cdn_link_tag
|
||||
specs = Gem.loaded_specs['bootstrap-sass']
|
||||
return '' unless specs.present?
|
||||
|
||||
stylesheet_link_tag("http://netdna.bootstrapcdn.com/bootstrap/" \
|
||||
"#{specs.version.version}/css/bootstrap.min.css",
|
||||
media: 'all')
|
||||
end
|
||||
|
||||
def font_awesome_cdn_link_tag
|
||||
stylesheet_link_tag(
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/fontawesome.min.css',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/regular.min.css',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/solid.min.css'
|
||||
)
|
||||
end
|
||||
|
||||
def assigned_repository_or_snapshot(my_module, repository)
|
||||
if repository.is_a?(RepositorySnapshot)
|
||||
return my_module.repository_snapshots.find_by(parent_id: repository.parent_id, selected: true)
|
||||
|
@ -128,14 +42,6 @@ module ReportsHelper
|
|||
selected_snapshot || repository
|
||||
end
|
||||
|
||||
def assigned_repositories_in_project_list(project)
|
||||
live_repositories = Repository.assigned_to_project(project)
|
||||
snapshots = RepositorySnapshot.of_unassigned_from_project(project)
|
||||
|
||||
snapshots.each { |snapshot| snapshot.name = "#{snapshot.name} #{t('projects.reports.index.deleted')}" }
|
||||
(live_repositories + snapshots).sort_by { |r| r.name.downcase }
|
||||
end
|
||||
|
||||
def step_status_label(step)
|
||||
if step.completed
|
||||
style = 'success'
|
||||
|
@ -147,20 +53,6 @@ module ReportsHelper
|
|||
"<span class=\"label step-label-#{style}\">[#{text}]</span>".html_safe
|
||||
end
|
||||
|
||||
# Fixes issues with avatar images in reports
|
||||
def fix_smart_annotation_image(html)
|
||||
html_doc = Nokogiri::HTML(html)
|
||||
html_doc.search('.atwho-user-popover').each do |el|
|
||||
text = el.content
|
||||
el.replace("<a href='#' style='margin-left: 5px'>#{text}</a>")
|
||||
end
|
||||
html_doc.search('[ref="missing-img"]').each do |el|
|
||||
tag = wicked_pdf_image_tag('icon_small/missing.png')
|
||||
el.replace(tag)
|
||||
end
|
||||
html_doc.to_s
|
||||
end
|
||||
|
||||
def filter_steps_for_report(steps, settings)
|
||||
include_completed_steps = settings.dig('task', 'protocol', 'completed_steps')
|
||||
include_uncompleted_steps = settings.dig('task', 'protocol', 'uncompleted_steps')
|
||||
|
@ -203,19 +95,4 @@ module ReportsHelper
|
|||
.where(id: report.report_elements.my_module.select(:my_module_id))
|
||||
repository.repository_rows.joins(:my_modules).where(my_modules: my_modules)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def obj_name_to_filename(obj, filename_suffix = '')
|
||||
obj_name = if obj.class == Asset
|
||||
obj_name, extension = obj.file_name.split('.')
|
||||
extension&.prepend('.')
|
||||
obj_name
|
||||
elsif obj.class.in? [Table, Result, Repository]
|
||||
extension = '.csv'
|
||||
obj.name.present? ? obj.name : obj.class.name
|
||||
end
|
||||
obj_name = to_filesystem_name(obj_name)
|
||||
obj_name + "#{filename_suffix}#{extension}"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -94,12 +94,6 @@ class Report < ApplicationRecord
|
|||
report_elements.active.where(parent: nil).order(:position)
|
||||
end
|
||||
|
||||
# Clean report elements from report
|
||||
# the function runs before the report is edit
|
||||
def cleanup_report
|
||||
report_elements.each(&:clean_removed_or_archived_elements)
|
||||
end
|
||||
|
||||
def self.generate_whole_project_report(project, current_user, current_team)
|
||||
content = {
|
||||
'experiments' => [],
|
||||
|
|
|
@ -12,7 +12,6 @@ class ReportElement < ApplicationRecord
|
|||
validates :position, presence: true
|
||||
validates :report, presence: true
|
||||
validates :type_of, presence: true
|
||||
validate :has_one_of_referenced_elements
|
||||
|
||||
belongs_to :report, inverse_of: :report_elements
|
||||
|
||||
|
@ -33,71 +32,7 @@ class ReportElement < ApplicationRecord
|
|||
belongs_to :checklist, inverse_of: :report_elements, optional: true
|
||||
belongs_to :asset, inverse_of: :report_elements, optional: true
|
||||
belongs_to :table, inverse_of: :report_elements, optional: true
|
||||
belongs_to :repository, inverse_of: :report_elements, optional: true,
|
||||
foreign_key: :repository_id, class_name: 'RepositoryBase'
|
||||
belongs_to :repository, inverse_of: :report_elements, optional: true, class_name: 'RepositoryBase'
|
||||
|
||||
scope :active, -> { where(type_of: ReportExtends::ACTIVE_REPORT_ELEMENTS) }
|
||||
|
||||
def result?
|
||||
result_asset? or result_table? or result_text?
|
||||
end
|
||||
|
||||
def comments?
|
||||
step_comments? or result_comments?
|
||||
end
|
||||
|
||||
# Get the referenced elements (previously, element's type_of must be set)
|
||||
def element_references
|
||||
ReportExtends::ELEMENT_REFERENCES.each do |el_ref|
|
||||
if el_ref.check(self)
|
||||
return el_ref.elements.map { |el| eval(el.gsub('_id', '')) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Set the element references (previously, element's type_of must be set)
|
||||
def set_element_references(ref_ids)
|
||||
ReportExtends::SET_ELEMENT_REFERENCES_LIST.each do |el_ref|
|
||||
check = el_ref.check(self)
|
||||
next unless check
|
||||
el_ref.elements.each do |element|
|
||||
public_send("#{element}=", ref_ids[element])
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
# removes element that are archived or deleted
|
||||
def clean_removed_or_archived_elements
|
||||
parent_model = ''
|
||||
%w(project
|
||||
experiment
|
||||
my_module
|
||||
step
|
||||
result
|
||||
checklist
|
||||
asset
|
||||
table
|
||||
repository)
|
||||
.each do |el|
|
||||
parent_model = el if send el
|
||||
end
|
||||
|
||||
if parent_model == 'experiment'
|
||||
destroy unless send(parent_model).project == report.project
|
||||
else
|
||||
destroy unless (send(parent_model).active? rescue send(parent_model))
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def has_one_of_referenced_elements
|
||||
element_references.each do |el|
|
||||
next unless el.nil?
|
||||
errors.add(:base,
|
||||
'Report element doesn\'t have correct element references.')
|
||||
break
|
||||
end
|
||||
end
|
||||
scope :active, -> { where(type_of: Extends::ACTIVE_REPORT_ELEMENTS) }
|
||||
end
|
||||
|
|
|
@ -61,24 +61,24 @@ module ReportActions
|
|||
def generate_content
|
||||
save_element!({ 'project_id' => @report.project_id }, :project_header, nil)
|
||||
|
||||
@content['experiments'].each do |exp_id|
|
||||
generate_experiment_content(exp_id, @content['tasks'][exp_id])
|
||||
@content['experiments'].each do |experiment|
|
||||
generate_experiment_content(experiment[:id], experiment[:my_module_ids])
|
||||
end
|
||||
end
|
||||
|
||||
def generate_experiment_content(exp_id, my_modules)
|
||||
experiment = Experiment.find_by(id: exp_id)
|
||||
def generate_experiment_content(experiment_id, my_module_ids)
|
||||
experiment = Experiment.find_by(id: experiment_id)
|
||||
return if !experiment && !can_read_experiment?(experiment, @user)
|
||||
|
||||
experiment_element = save_element!({ 'experiment_id' => experiment.id }, :experiment, nil)
|
||||
generate_my_modules_content(experiment, experiment_element, my_modules)
|
||||
generate_my_modules_content(experiment, experiment_element, my_module_ids)
|
||||
end
|
||||
|
||||
def generate_my_modules_content(experiment, experiment_element, selected_my_modules)
|
||||
def generate_my_modules_content(experiment, experiment_element, my_module_ids)
|
||||
my_modules = experiment.my_modules
|
||||
.active
|
||||
.where(id: selected_my_modules)
|
||||
my_modules.sort_by { |m| selected_my_modules.index m.id }.each do |my_module|
|
||||
.where(id: my_module_ids)
|
||||
my_modules.sort_by { |m| my_module_ids.index m.id }.each do |my_module|
|
||||
my_module_element = save_element!({ 'my_module_id' => my_module.id }, :my_module, experiment_element)
|
||||
|
||||
@repositories.each do |repository|
|
||||
|
@ -94,13 +94,13 @@ module ReportActions
|
|||
end
|
||||
end
|
||||
|
||||
def save_element!(reference, type_of, parent)
|
||||
def save_element!(references, type_of, parent)
|
||||
el = ReportElement.new
|
||||
el.position = @element_position
|
||||
el.report = @report
|
||||
el.parent = parent
|
||||
el.type_of = type_of
|
||||
el.set_element_references(reference)
|
||||
el.assign_attributes(references)
|
||||
el.save!
|
||||
|
||||
@element_position += 1
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
<% if !defined? show_sort then show_sort = false end %>
|
||||
<% if !defined? show_move_up then show_move_up = true end %>
|
||||
<% if !defined? show_move_down then show_move_down = true end %>
|
||||
<% if !defined? show_remove then show_remove = true end %>
|
||||
|
||||
<%if show_sort %>
|
||||
<a href="" data-action="sort-asc" title="<%=t "projects.reports.elements.all.sort_asc" %>"><span class="fas fa-sort-by-attributes"></span></a>
|
||||
<a href="" data-action="sort-desc" title="<%=t "projects.reports.elements.all.sort_desc" %>"><span class="fas fa-sort-by-attributes-alt"></span></a>
|
||||
<% end %>
|
||||
<% if show_move_up %>
|
||||
<a href="" data-action="move-up" title="<%=t "projects.reports.elements.all.move_up" %>"><span class="fas fa-chevron-up"></span></a>
|
||||
<% end %>
|
||||
<% if show_move_down %>
|
||||
<a href="" data-action="move-down" title="<%=t "projects.reports.elements.all.move_down" %>"><span class="fas fa-chevron-down"></span></a>
|
||||
<% end %>
|
||||
<% if show_remove %>
|
||||
<a href="" data-action="remove" title="<%=t "projects.reports.elements.all.remove" %>"><span class="fas fa-times"></span></a>
|
||||
<% end %>
|
|
@ -1,22 +1,13 @@
|
|||
<% experiment ||= report_element.experiment %>
|
||||
<% timestamp = experiment.created_at %>
|
||||
<% name = experiment.name %>
|
||||
<% export_all = defined?(export_all) && export_all %>
|
||||
<div class="report-element report-experiment-element"
|
||||
data-ts="<%= timestamp.to_i %>"
|
||||
data-type="experiment"
|
||||
data-id='{ "experiment_id": <%= experiment.id %> }'
|
||||
data-scroll-id="<%= experiment.id %>"
|
||||
data-modal-title="<%=t "projects.reports.elements.modals.experiment_contents.head_title",
|
||||
experiment: experiment.name %>" data-name="<%= name %>" data-icon-class="fas fa-flask">
|
||||
<div class="report-element report-experiment-element">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left user-time">
|
||||
<%=t "projects.reports.elements.experiment.user_time", timestamp: l(timestamp, format: :full) %>
|
||||
<%= t('projects.reports.elements.experiment.user_time', timestamp: l(timestamp, format: :full)) %>
|
||||
<b><%= link_to t('projects.reports.elements.all.scinote_link'),canvas_experiment_url(experiment), target: :_blank %></b>
|
||||
</div>
|
||||
<div class="pull-right controls">
|
||||
<%= render partial: "reports/elements/element_controls.html.erb", locals: { show_sort: true } %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="report-element-body" data-hook="report-experiment-element">
|
||||
|
@ -24,9 +15,9 @@
|
|||
<div class="pull-left experiment-name">
|
||||
<h4>
|
||||
<i class="fas fa-flask"></i>
|
||||
<%= name %>
|
||||
<%= experiment.name %>
|
||||
<% if experiment.archived? %>
|
||||
<span class="label label-warning"><%=t 'search.index.archived' %></span>
|
||||
<span class="label label-warning"><%= t('search.index.archived') %></span>
|
||||
<% end %>
|
||||
</h4>
|
||||
</div>
|
||||
|
@ -36,7 +27,7 @@
|
|||
<% if experiment.description.present? %>
|
||||
<%= custom_auto_link(experiment.description, team: current_team, base64_encoded_imgs: export_all) %>
|
||||
<% else %>
|
||||
<em><%=t "projects.reports.elements.experiment.no_description" %></em>
|
||||
<em><%= t('projects.reports.elements.experiment.no_description') %></em>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,45 +1,39 @@
|
|||
<% my_module ||= @my_module %>
|
||||
<% timestamp = Time.current + 1.year - 2.days %>
|
||||
<% my_module ||= report_element.my_module %>
|
||||
<% activities = ActivitiesService.my_module_activities(my_module).order(created_at: :desc) %>
|
||||
<div class="report-element report-module-activity-element" data-ts="<%= timestamp.to_i %>" data-type="my_module_activity" data-id='{ "my_module_id": <%= my_module.id %> }' data-scroll-id="<%= my_module.id %>" data-name="<%=t "projects.reports.elements.module_activity.sidebar_name" %>" data-icon-class="fas fa-list">
|
||||
<div class="report-element report-module-activity-element">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left activity-icon">
|
||||
<span class="fas fa-list"></span>
|
||||
</div>
|
||||
<div class="pull-left activity-name">
|
||||
<%=t "projects.reports.elements.module_activity.name", my_module: my_module.name %>
|
||||
</div>
|
||||
<div class="pull-right controls">
|
||||
<%= render partial: "reports/elements/element_controls.html.erb", locals: { show_sort: true } %>
|
||||
<%= t('projects.reports.elements.module_activity.name', my_module: my_module.name) %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="report-element-body">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 activity-container">
|
||||
<% if activities.any? %>
|
||||
<!-- TODO: This might become potentially very big! -->
|
||||
<% if activities.present? %>
|
||||
<ul class="no-style activity-list">
|
||||
<% activities.each do |activity| %>
|
||||
<% activity_ts = activity.created_at %>
|
||||
<li class="activity" data-ts="<%= activity_ts.to_i %>">
|
||||
<li class="activity">
|
||||
<span class="activity-prefix">
|
||||
<%=l activity_ts, format: :full %>
|
||||
<%= l(activity.created_at, format: :full) %>
|
||||
</span>
|
||||
<span class="activity-message">
|
||||
|
||||
<% if activity.old_activity? %>
|
||||
<%= sanitize_input(activity.message) %>
|
||||
<%= activity.message %>
|
||||
<% else %>
|
||||
<%= sanitize_input(generate_activity_content(activity, no_links: true)) %>
|
||||
<%= generate_activity_content(activity, no_links: true) %>
|
||||
<% end %>
|
||||
</span>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% else %>
|
||||
<em><%=t "projects.reports.elements.module_activity.no_activity" %></em>
|
||||
<em><%= t('projects.reports.elements.module_activity.no_activity') %></em>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
<% if my_module.blank? and @my_module.present? then my_module = @my_module end %>
|
||||
<% my_module ||= report_element.my_module %>
|
||||
<% timestamp = my_module.created_at %>
|
||||
<% name = my_module.name %>
|
||||
<% export_all = defined?(export_all) && export_all %>
|
||||
<div class="report-element report-module-element" data-ts="<%= timestamp.to_i %>" data-type="my_module" data-id='{ "my_module_id": <%= my_module.id %> }' data-scroll-id="<%= my_module.id %>" data-modal-title="<%=t "projects.reports.elements.modals.module_contents.head_title", module: my_module.name %>" data-name="<%= name %>" data-icon-class="fas fa-credit-card">
|
||||
<div class="report-element report-module-element">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left user-time">
|
||||
<%= t("projects.reports.elements.module.user_time", timestamp: l(timestamp, format: :full)) %>
|
||||
<%= t('projects.reports.elements.module.user_time', timestamp: l(timestamp, format: :full)) %>
|
||||
<b><%= link_to t('projects.reports.elements.all.scinote_link'), protocols_my_module_url(my_module), target: :_blank %></b>
|
||||
</div>
|
||||
<div class="pull-right controls">
|
||||
<%= render partial: "reports/elements/element_controls.html.erb", locals: { show_sort: true } %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="report-element-body">
|
||||
|
@ -19,9 +15,9 @@
|
|||
<div class="pull-left module-name">
|
||||
<h4>
|
||||
<span class="fas fa-credit-card"></span>
|
||||
<%= name %>
|
||||
<%= my_module.name %>
|
||||
<% if my_module.archived? %>
|
||||
<span class="label label-warning"><%=t 'search.index.archived' %></span>
|
||||
<span class="label label-warning"><%= t('search.index.archived') %></span>
|
||||
<% end %>
|
||||
</h4>
|
||||
</div>
|
||||
|
@ -30,32 +26,34 @@
|
|||
<% if my_module.started_on.present? %>
|
||||
<%= t('projects.reports.elements.module.started_on', started_on: l(my_module.started_on, format: :full)) %>
|
||||
<% else %>
|
||||
<em><%= t("projects.reports.elements.module.no_start_date") %></em>
|
||||
<em><%= t('projects.reports.elements.module.no_start_date') %></em>
|
||||
<% end %>
|
||||
</p>
|
||||
<p class="module-due-date">
|
||||
<% if my_module.due_date.present? %>
|
||||
<%= t("projects.reports.elements.module.due_date", due_date: l(my_module.due_date, format: :full)) %>
|
||||
<%= t('projects.reports.elements.module.due_date', due_date: l(my_module.due_date, format: :full)) %>
|
||||
<% else %>
|
||||
<em><%= t("projects.reports.elements.module.no_due_date") %></em>
|
||||
<em><%= t('projects.reports.elements.module.no_due_date') %></em>
|
||||
<% end %>
|
||||
</p>
|
||||
<p class="module-status">
|
||||
<% status = my_module.my_module_status %>
|
||||
<%= t("projects.reports.elements.module.status") %>
|
||||
<span class="status-block" style="background: <%= status.color %>"><%= status.name %></span>
|
||||
<%= t('projects.reports.elements.module.status') %>
|
||||
<span class="status-block" style="background: <%= status.color %>">
|
||||
<%= status.name %>
|
||||
</span>
|
||||
<% if my_module.completed? %>
|
||||
<span style="margin-left: 10px;">
|
||||
<%= t("my_modules.states.completed") %>
|
||||
<%= t('my_modules.states.completed') %>
|
||||
<%= l(my_module.completed_on, format: :full) %>
|
||||
</span>
|
||||
<% end %>
|
||||
</p>
|
||||
<div class="row module-tags">
|
||||
<div class="pull-left">
|
||||
<%= t("projects.reports.elements.module.tags_header") %>
|
||||
<%= t('projects.reports.elements.module.tags_header') %>
|
||||
</div>
|
||||
<% if my_module.tags.any? %>
|
||||
<% if my_module.tags.present? %>
|
||||
<% my_module.tags.each do |tag| %>
|
||||
<div class="pull-left module-tag" style="background-color: <%= tag.color %>;">
|
||||
<%= tag.name %>
|
||||
|
@ -63,7 +61,7 @@
|
|||
<% end %>
|
||||
<% else %>
|
||||
<div class="pull-left module-no-tag">
|
||||
<em><%= t("projects.reports.elements.module.no_tags") %></em>
|
||||
<em><%= t('projects.reports.elements.module.no_tags') %></em>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -75,7 +73,7 @@
|
|||
simple_format: false,
|
||||
base64_encoded_imgs: export_all) %>
|
||||
<% else %>
|
||||
<em><%= t("projects.reports.elements.module.no_description") %></em>
|
||||
<em><%= t('projects.reports.elements.module.no_description') %></em>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
<% protocol ||= my_module.protocol %>
|
||||
<% my_module = protocol.my_module %>
|
||||
<% protocol ||= report_element.my_module.protocol %>
|
||||
<% export_all = defined?(export_all) && export_all %>
|
||||
<div class="report-element report-module-protocol-element" data-ts="<%= protocol.created_at %>" data-type="my_module_protocol" data-id='{ "my_module_id": <%= my_module.id %> }' data-scroll-id="<%= protocol.id %>">
|
||||
<div class="report-element report-module-protocol-element">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left user-time">
|
||||
<%=t "projects.reports.elements.module.protocol.user_time", timestamp: l(protocol.created_at, format: :full) %>
|
||||
</div>
|
||||
<div class="pull-right controls">
|
||||
<%= render partial: "reports/elements/element_controls.html.erb", locals: { show_sort: true } %>
|
||||
<%= t('projects.reports.elements.module.protocol.user_time', timestamp: l(protocol.created_at, format: :full)) %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,17 +1,8 @@
|
|||
<% my_module ||= @my_module %>
|
||||
<% my_module ||= report_element.my_module %>
|
||||
<% repository ||= report_element.repository %>
|
||||
<% element_id ||= repository&.id %>
|
||||
<% repository ||= assigned_repository_or_snapshot(my_module, repository) %>
|
||||
<% timestamp = Time.current + 1.year - 1.days %>
|
||||
<% rows_json = my_module.repository_json_hot(repository, :desc) %>
|
||||
<div class="report-element report-module-repository-element"
|
||||
data-sort-hot="1"
|
||||
data-ts="<%= timestamp.to_i %>"
|
||||
data-type="my_module_repository"
|
||||
data-id='{ "my_module_id": <%= my_module.id %>, "repository_id": <%= repository.id %> }'
|
||||
data-scroll-id="<%= "#{my_module.id}_#{repository.id}" %>"
|
||||
data-name="<%= repository.name %>"
|
||||
data-icon-class="fas fa-list-alt">
|
||||
<div class="report-element report-module-repository-element">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left repository-icon">
|
||||
|
@ -29,9 +20,6 @@
|
|||
</a>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="pull-right controls">
|
||||
<%= render partial: "reports/elements/element_controls.html.erb", locals: { show_sort: true } %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="report-element-body">
|
||||
|
|
|
@ -1,16 +1,7 @@
|
|||
<% result ||= @result %>
|
||||
<% result ||= report_element.result %>
|
||||
<% asset = result.asset %>
|
||||
<% comments = result.result_comments %>
|
||||
<% timestamp = asset.created_at %>
|
||||
<% icon_class = 'fas ' + file_fa_icon_class(asset) if asset.file_name %>
|
||||
<div class="report-element report-result-element report-result-asset-element"
|
||||
data-ts="<%= timestamp.to_i %>"
|
||||
data-type="result_asset"
|
||||
data-id='{ "result_id": <%= result.id %> }'
|
||||
data-scroll-id="<%= result.id %>"
|
||||
data-modal-title="<%= t("projects.reports.elements.modals.result_contents.head_title", result: result.name) %>"
|
||||
data-name="<%= result.name %>"
|
||||
data-icon-class="<%= icon_class %>">
|
||||
<div class="report-element report-result-element report-result-asset-element">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left result-icon">
|
||||
|
@ -42,9 +33,6 @@
|
|||
<%= t('projects.reports.elements.result_asset.full_preview_attached') %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="pull-right controls">
|
||||
<%= render partial: "reports/elements/element_controls.html.erb" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row"></div>
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
<% result ||= @result %>
|
||||
<% result ||= report_element.result %>
|
||||
<% table = result.table %>
|
||||
<% comments = result.result_comments %>
|
||||
<% timestamp = table.created_at %>
|
||||
<div class="report-element report-result-element report-result-table-element" data-ts="<%= timestamp.to_i %>" data-type="result_table" data-id='{ "result_id": <%= result.id %> }' data-scroll-id="<%= result.id %>" data-modal-title="<%=t "projects.reports.elements.modals.result_contents.head_title", result: result.name %>" data-name="<%= result.name %>" data-icon-class="fas fa-table">
|
||||
<div class="report-element report-result-element report-result-table-element">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left result-name-container">
|
||||
|
@ -12,7 +11,7 @@
|
|||
<div class="pull-left result-name">
|
||||
<%= result.name %>
|
||||
<% if result.archived? %>
|
||||
<span class="label label-warning"><%=t 'search.index.archived' %></span>
|
||||
<span class="label label-warning"><%= t('search.index.archived') %></span>
|
||||
<% end %>
|
||||
</div>
|
||||
<% if defined? export_all and export_all %>
|
||||
|
@ -24,10 +23,7 @@
|
|||
</div>
|
||||
<% end %>
|
||||
<div class="pull-left user-time">
|
||||
<%=t "projects.reports.elements.result_table.user_time", user: result.user.full_name , timestamp: l(timestamp, format: :full) %>
|
||||
</div>
|
||||
<div class="pull-right controls">
|
||||
<%= render partial: "reports/elements/element_controls.html.erb" %>
|
||||
<%= t('projects.reports.elements.result_table.user_time', user: result.user.full_name , timestamp: l(timestamp, format: :full)) %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
<% if result.blank? and @result.present? then result = @result end %>
|
||||
<% result ||= report_element.result %>
|
||||
<% result_text = result.result_text %>
|
||||
<% comments = result.result_comments %>
|
||||
<% timestamp = result.created_at %>
|
||||
<% name = result.name %>
|
||||
<% export_all = defined?(export_all) && export_all %>
|
||||
<div class="report-element report-result-element report-result-text-element" data-ts="<%= timestamp.to_i %>" data-type="result_text" data-id='{ "result_id": <%= result.id %> }' data-scroll-id="<%= result.id %>" data-modal-title="<%=t "projects.reports.elements.modals.result_contents.head_title", result: result.name %>" data-name="<%= name %>" data-icon-class="fas fa-asterisk">
|
||||
<div class="report-element report-result-element report-result-text-element">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left result-icon">
|
||||
|
@ -13,14 +12,11 @@
|
|||
<div class="pull-left result-name">
|
||||
<%= name %>
|
||||
<% if result.archived? %>
|
||||
<span class="label label-warning"><%=t 'search.index.archived' %></span>
|
||||
<span class="label label-warning"><%= t('search.index.archived') %></span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="pull-left user-time">
|
||||
<%=t "projects.reports.elements.result_text.user_time", user: result.user.full_name, timestamp: l(timestamp, format: :full) %>
|
||||
</div>
|
||||
<div class="pull-right controls">
|
||||
<%= render partial: "reports/elements/element_controls.html.erb" %>
|
||||
<%= t('projects.reports.elements.result_text.user_time', user: result.user.full_name, timestamp: l(timestamp, format: :full)) %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<% step ||= @step %>
|
||||
<% step ||= report_element.step %>
|
||||
<% step_type_str = step.completed ? 'completed' : 'uncompleted' %>
|
||||
<% user = step.completed? ? step.last_modified_by : step.user %>
|
||||
<% timestamp = step.completed ? step.completed_on : step.created_at %>
|
||||
|
@ -6,21 +6,11 @@
|
|||
<% assets = step.assets %>
|
||||
<% checklists = step.checklists %>
|
||||
<% export_all = defined?(export_all) && export_all %>
|
||||
<div class="report-element report-step-element"
|
||||
data-ts="<%= timestamp.to_i %>"
|
||||
data-type="step"
|
||||
data-id='{ "step_id": <%= step.id %> }'
|
||||
data-scroll-id="<%= step.id %>"
|
||||
data-modal-title="<%=t "projects.reports.elements.modals.step_contents.head_title", step: step.name %>"
|
||||
data-name="<%=t "projects.reports.elements.step.sidebar_name", pos: (step.position_plus_one), name: step.name %>"
|
||||
data-icon-class="fas fa-arrow-circle-right">
|
||||
<div class="report-element report-step-element">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left user-time">
|
||||
<%=t "projects.reports.elements.step.#{step_type_str}.user_time", user: user.full_name , timestamp: l(timestamp, format: :full) %>
|
||||
</div>
|
||||
<div class="pull-right controls">
|
||||
<%= render partial: "reports/elements/element_controls.html.erb", locals: { show_sort: true } %>
|
||||
<%= t("projects.reports.elements.step.#{step_type_str}.user_time", user: user.full_name , timestamp: l(timestamp, format: :full)) %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -29,7 +19,7 @@
|
|||
<div class="pull-left step-name">
|
||||
<h5>
|
||||
<span class="fas fa-arrow-circle-right"></span>
|
||||
<b><%=t "projects.reports.elements.step.step_pos", pos: (step.position_plus_one) %></b> <%= step.name %>
|
||||
<b><%= t('projects.reports.elements.step.step_pos', pos: (step.position_plus_one)) %></b> <%= step.name %>
|
||||
<%= step_status_label(step) %>
|
||||
</h5>
|
||||
</div>
|
||||
|
@ -43,7 +33,7 @@
|
|||
tags: %w(img),
|
||||
base64_encoded_imgs: export_all) %>
|
||||
<% else %>
|
||||
<em><%=t "projects.reports.elements.step.no_description" %></em>
|
||||
<em><%= t('projects.reports.elements.step.no_description') %></em>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
<% if !defined? hide then hide = false end %>
|
||||
<% if !defined? initial then initial = false end %>
|
||||
<div class="new-element <%= "hidden" if hide %> <%= "initial" if initial %>" data-ts="ignore" data-type="new" title="<%=t "projects.reports.elements.new_element.title" %>">
|
||||
<a href="" class="new-element-href" data-action="add-new-elements">
|
||||
<div class="line left-line">
|
||||
<div class="filler-wrapper">
|
||||
<div class="filler"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="plus-icon">
|
||||
<span class="fas fa-plus"></span>
|
||||
</div>
|
||||
<div class="line right-line">
|
||||
<div class="filler-wrapper">
|
||||
<div class="filler"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</a>
|
||||
</div>
|
|
@ -1,10 +1,9 @@
|
|||
<% if project.blank? and @project.present? then project = @project end %>
|
||||
<% name = t("projects.reports.elements.project_header.title", project: project.name) %>
|
||||
<div class="report-element report-project-header-element" data-ts="ignore" data-type="project_header" data-id='{ "project_id": <%= project.id %> }' data-scroll-id="<%= project.id %>" data-name="<%= name %>" data-icon-class="fas fa-heading">
|
||||
<% project ||= report_element.project %>
|
||||
<div class="report-element report-project-header-element">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left user-time">
|
||||
<%=t "projects.reports.elements.project_header.user_time", timestamp: l(project.created_at, format: :full) %>
|
||||
<%= t('projects.reports.elements.project_header.user_time', timestamp: l(project.created_at, format: :full)) %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -12,9 +11,9 @@
|
|||
<div class="row">
|
||||
<div class="col-xs-12 project-name">
|
||||
<h2>
|
||||
<%= name %>
|
||||
<%= t('projects.reports.elements.project_header.title', project: project.name) %>
|
||||
<% if project.archived? %>
|
||||
<span class="label label-warning"><%=t 'search.index.archived' %></span>
|
||||
<span class="label label-warning"><%= t('search.index.archived') %></span>
|
||||
<% end %>
|
||||
</h2>
|
||||
</div>
|
||||
|
|
|
@ -1,25 +1,21 @@
|
|||
<% result ||= @result %>
|
||||
<% result ||= report_element.result %>
|
||||
<% comments = result.result_comments.order(created_at: :desc) %>
|
||||
<% timestamp = Time.current + 1.year %>
|
||||
<% export_all = defined?(export_all) && export_all %>
|
||||
<div class="report-element report-comments-element report-result-comments-element" data-ts="<%= timestamp.to_i %>" data-type="result_comments" data-id='{ "result_id": <%= result.id %> }' data-scroll-id="<%= result.id %>" data-name="<%=t "projects.reports.elements.result_comments.sidebar_name" %>" data-icon-class="fas fa-comment">
|
||||
<div class="report-element report-comments-element report-result-comments-element">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left comments-icon">
|
||||
<span class="fas fa-comment"></span>
|
||||
</div>
|
||||
<div class="pull-left comments-name">
|
||||
<%=t "projects.reports.elements.result_comments.name", result: result.name %>
|
||||
</div>
|
||||
<div class="pull-right controls">
|
||||
<%= render partial: "reports/elements/element_controls.html.erb", locals: { show_sort: true, show_move_up: false, show_move_down: false } %>
|
||||
<%= t('projects.reports.elements.result_comments.name', result: result.name) %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="report-element-body">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 comments-container simple">
|
||||
<% if comments.any? %>
|
||||
<% if comments.present? %>
|
||||
<ul class="no-style content-comments">
|
||||
<% comments.each do |comment| %>
|
||||
<%= render partial: 'shared/comments/item.html.erb',
|
||||
|
@ -27,7 +23,7 @@
|
|||
<% end %>
|
||||
</ul>
|
||||
<% else %>
|
||||
<em><%=t "projects.reports.elements.result_comments.no_comments" %></em>
|
||||
<em><%= t('projects.reports.elements.result_comments.no_comments') %></em>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<% asset ||= @asset %>
|
||||
<% asset ||= report_element.asset %>
|
||||
<% timestamp = asset.created_at %>
|
||||
<% icon_class = file_fa_icon_class(asset) if asset.file_name %>
|
||||
<div class="report-element report-step-attachment-element report-step-asset-element" data-ts="<%= timestamp.to_i %>" data-type="step_asset" data-id='{ "asset_id": <%= asset.id %> }' data-scroll-id="<%= asset.id %>" data-name="<%=t "projects.reports.elements.step_asset.sidebar_name", file: asset.file_name %>" data-icon-class="<%= icon_class %>">
|
||||
<div class="report-element report-step-attachment-element report-step-asset-element">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left attachment-icon <%= defined?(export_all) && export_all ? 'export-all-icons' : '' %>">
|
||||
|
@ -22,10 +21,7 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<div class="pull-left user-time">
|
||||
<%=t 'projects.reports.elements.step_asset.user_time', timestamp: l(timestamp, format: :full) %>
|
||||
</div>
|
||||
<div class="pull-right controls">
|
||||
<%= render partial: 'reports/elements/element_controls.html.erb' %>
|
||||
<%= t('projects.reports.elements.step_asset.user_time', timestamp: l(timestamp, format: :full)) %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,24 +1,21 @@
|
|||
<% if checklist.blank? and @checklist.present? then checklist = @checklist end %>
|
||||
<% checklist ||= report_element.checklist %>
|
||||
<% items = checklist.checklist_items %>
|
||||
<% timestamp = checklist.created_at %>
|
||||
<% export_all = defined?(export_all) && export_all %>
|
||||
<div class="report-element report-step-attachment-element report-step-checklist-element" data-ts="<%= timestamp.to_i %>" data-type="step_checklist" data-id='{ "checklist_id": <%= checklist.id %> }' data-scroll-id="<%= checklist.id %>" data-name="<%= checklist.name %>" data-icon-class="fas fa-tasks">
|
||||
<div class="report-element report-step-attachment-element report-step-checklist-element">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left attachment-icon">
|
||||
<span class="fas fa-tasks"></span>
|
||||
<span class="fas fa-tasks"></span>
|
||||
</div>
|
||||
<div class="pull-left checklist-name">
|
||||
<%= custom_auto_link(t('projects.reports.elements.step_checklist.checklist_name',
|
||||
name: checklist.name),
|
||||
team: current_team,
|
||||
base64_encoded_imgs: export_all) %>
|
||||
name: checklist.name),
|
||||
team: current_team,
|
||||
base64_encoded_imgs: export_all) %>
|
||||
</div>
|
||||
<div class="pull-left user-time">
|
||||
<%=t 'projects.reports.elements.step_checklist.user_time', timestamp: l(timestamp, format: :full) %>
|
||||
</div>
|
||||
<div class="pull-right controls">
|
||||
<%= render partial: 'reports/elements/element_controls.html.erb' %>
|
||||
<%= t('projects.reports.elements.step_checklist.user_time', timestamp: l(timestamp, format: :full)) %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,25 +1,21 @@
|
|||
<% if step.blank? and @step.present? then step = @step end %>
|
||||
<% step ||= report_element.step %>
|
||||
<% comments = step.step_comments.order(created_at: :desc) %>
|
||||
<% timestamp = Time.current + 1.year %>
|
||||
<% export_all = defined?(export_all) && export_all %>
|
||||
<div class="report-element report-comments-element report-step-comments-element" data-ts="<%= timestamp.to_i %>" data-order="asc" data-type="step_comments" data-id='{ "step_id": <%= step.id %> }' data-scroll-id="<%= step.id %>" data-name="<%=t "projects.reports.elements.step_comments.sidebar_name" %>" data-icon-class="fas fa-comment">
|
||||
<div class="report-element report-comments-element report-step-comments-element">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left comments-icon">
|
||||
<span class="fas fa-comment"></span>
|
||||
</div>
|
||||
<div class="pull-left comments-name">
|
||||
<%=t "projects.reports.elements.step_comments.name", step: step.name %>
|
||||
</div>
|
||||
<div class="pull-right controls">
|
||||
<%= render partial: "reports/elements/element_controls.html.erb", locals: { show_sort: true } %>
|
||||
<%= t('projects.reports.elements.step_comments.name', step: step.name) %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="report-element-body">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 comments-container simple">
|
||||
<% if comments.any? %>
|
||||
<% if comments.present? %>
|
||||
<ul class="no-style content-comments">
|
||||
<% comments.each do |comment| %>
|
||||
<%= render partial: 'shared/comments/item.html.erb',
|
||||
|
@ -27,7 +23,7 @@
|
|||
<% end %>
|
||||
</ul>
|
||||
<% else %>
|
||||
<em><%=t "projects.reports.elements.step_comments.no_comments" %></em>
|
||||
<em><%= t('projects.reports.elements.step_comments.no_comments') %></em>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,30 +1,29 @@
|
|||
<% table ||= @table %>
|
||||
<% table ||= report_element.table %>
|
||||
<% timestamp = table.created_at %>
|
||||
<div class="report-element report-step-attachment-element report-step-table-element" data-ts="<%= timestamp.to_i %>" data-type="step_table" data-id='{ "table_id": <%= table.id %> }' data-scroll-id="<%= table.id %>" data-name="<%= table.name %>" data-icon-class="fas fa-table">
|
||||
<div class="report-element report-step-attachment-element report-step-table-element">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left attachment-icon">
|
||||
<span class="fas fa-table"></span>
|
||||
<span class="fas fa-table"></span>
|
||||
</div>
|
||||
<div class="pull-left table-name">
|
||||
<% if defined? export_all and export_all %>
|
||||
<% file_link = @obj_filenames.dig(:tables, table.id, :file) %>
|
||||
<a href="<%= file_link %>">
|
||||
<em><%=t 'projects.reports.elements.step_table.table_name', name: file_link&.split('/')&.last %></em>
|
||||
<em>
|
||||
<%= t('projects.reports.elements.step_table.table_name', name: file_link&.split('/')&.last) %>
|
||||
</em>
|
||||
</a>
|
||||
<% else %>
|
||||
<% if table.try(:name) %>
|
||||
<em><%=t 'projects.reports.elements.step_table.table_name',
|
||||
name: truncate(table.name,
|
||||
length: Constants::FILENAME_TRUNCATION_LENGTH) %></em>
|
||||
<em>
|
||||
<%= t('projects.reports.elements.step_table.table_name', name: truncate(table.name, length: Constants::FILENAME_TRUNCATION_LENGTH)) %>
|
||||
</em>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="pull-left user-time">
|
||||
<%=t 'projects.reports.elements.step_table.user_time', timestamp: l(timestamp, format: :full) %>
|
||||
</div>
|
||||
<div class="pull-right controls">
|
||||
<%= render partial: 'reports/elements/element_controls.html.erb' %>
|
||||
<%= t('projects.reports.elements.step_table.user_time', timestamp: l(timestamp, format: :full)) %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
<% report.root_elements.each do |el| %>
|
||||
<%= render_report_element(el, local_assigns) %>
|
||||
<%= render_new_element(false) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
<div class="navbar-report">
|
||||
<div class="center-block" id="report-menu">
|
||||
|
||||
<div class="dropdown" id="sort-report">
|
||||
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||||
<span class="fas fa-sort visible-xs-inline"></span>
|
||||
<span class="hidden-xs"><%= t'projects.reports.new.nav_sort_by' %></span>
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
||||
<li><a href="#" data-sort="desc" data-turbolinks="false"><%= t('projects.reports.new.nav_sort_desc') %></a></li>
|
||||
<li><a href="#" data-sort="asc" data-turbolinks="false"><%= t('projects.reports.new.nav_sort_asc') %></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<%= link_to "", class: "btn btn-secondary", remote: true, id: "print-report" do %>
|
||||
<span class="fas fa-print"></span>
|
||||
<span class="hidden-xs"><%=t "projects.reports.new.nav_print" %></span>
|
||||
<% end %>
|
||||
|
||||
|
||||
<div class="dropdown" id="download-report">
|
||||
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||||
<span class="fas fa-download"></span>
|
||||
<span class="hidden-xs"><%= t("projects.reports.new.nav_download") %><span>
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<button
|
||||
onclick="$('#savePDFtoInventory').modal('show')"
|
||||
class="btn btn-secondary">
|
||||
<span class="fas fa-save">
|
||||
</span>
|
||||
<%=t 'projects.reports.new.save_PDF_to_inventory'%>
|
||||
</button>
|
||||
|
||||
<div class="pull-right">
|
||||
<%= link_to reports_path, data: { no_turbolink: false }, id: "cancel-report-link", class: "btn btn-secondary" do %>
|
||||
<span class="hidden-xs"><%=t "projects.reports.new.nav_close" %></span>
|
||||
<% end %>
|
||||
<%= link_to "", class: "btn btn-primary", remote: true, id: "save-report-link" do %>
|
||||
<span class="hidden-xs"><%=t "projects.reports.new.nav_save" %></span>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
|
@ -1,36 +0,0 @@
|
|||
<%= bootstrap_form_tag remote: true, url: experiment_contents_project_reports_path(project, format: :json), method: :post, html: { id: "add-contents-form" } do |f| %>
|
||||
<%= hidden_field_tag :id, experiment.id %>
|
||||
<div>
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li role="presentation" class="active">
|
||||
<a href="#tasks-tab" aria-controls="tasks-tab" role="tab" data-toggle="tab">
|
||||
<span class="fas fa-credit-card visible-xs"></span>
|
||||
<span class="hidden-xs"><%= t("projects.reports.elements.modals.project_contents.tasks_tab") %></span>
|
||||
</a>
|
||||
</li>
|
||||
<li role="presentation">
|
||||
<a href="#content-tab" aria-controls="content-tab" role="tab" data-toggle="tab">
|
||||
<span class="fas fa-link visible-xs"></span>
|
||||
<span class="hidden-xs"><%= t("projects.reports.elements.modals.project_contents.content_tab") %></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content">
|
||||
<div role="tabpanel" class="tab-pane active" id="tasks-tab">
|
||||
<h5 class="visible-xs"><%= t("projects.reports.elements.modals.project_contents.tasks_tab") %></h5>
|
||||
<%= render partial: "reports/new/modal/experiment_contents_inner.html.erb", locals: { form: f, experiment: experiment } %>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="content-tab">
|
||||
<h5 class="visible-xs"><%= t("projects.reports.elements.modals.project_contents.content_tab") %></h5>
|
||||
<%= render partial: "reports/new/modal/module_contents_inner.html.erb", locals: { form: f } %>
|
||||
<hr>
|
||||
<%= render partial: "reports/new/modal/step_contents_inner.html.erb", locals: { form: f } %>
|
||||
<hr>
|
||||
<%= render partial: "reports/new/modal/result_contents_inner.html.erb", locals: { form: f } %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
|
@ -1,41 +0,0 @@
|
|||
<div>
|
||||
<em>
|
||||
<%= t("projects.reports.elements.modals.experiment_contents_inner.instructions") %>
|
||||
</em>
|
||||
</div>
|
||||
|
||||
<% if experiment.my_modules.exists? %>
|
||||
<div class="checkbox-tree">
|
||||
<ul>
|
||||
<li>
|
||||
<%= form.check_box :experiment_all, label: experiment.name %>
|
||||
<ul>
|
||||
|
||||
<% experiment.my_module_groups.each do |my_module_group| %>
|
||||
<% if my_module_group.my_modules.exists? then %>
|
||||
<% my_module_group.my_modules.workflow_ordered.each do |my_module| %>
|
||||
<li>
|
||||
<%= form.check_box "modules[#{my_module.id}]", label: my_module.name %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<!-- Tasks without groups -->
|
||||
<% experiment.my_modules.without_group.each do |my_module| %>
|
||||
<li>
|
||||
<%= form.check_box "modules[#{my_module.id}]", label: my_module.name %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<% else %>
|
||||
<div>
|
||||
<em>
|
||||
<%= t("projects.reports.elements.modals.experiment_contents_inner.no_modules") %>
|
||||
</em>
|
||||
</div>
|
||||
<% end %>
|
|
@ -1,26 +0,0 @@
|
|||
<%= bootstrap_form_tag remote: true, url: module_contents_project_reports_path(project, format: :json), method: :post, html: { id: "add-contents-form" } do |f| %>
|
||||
<%= hidden_field_tag :id, my_module.id %>
|
||||
<div>
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li role="presentation" class="active">
|
||||
<a href="#content-tab" aria-controls="content-tab" role="tab" data-toggle="tab">
|
||||
<span class="fas fa-link visible-xs"></span>
|
||||
<span class="hidden-xs"><%= t("projects.reports.elements.modals.project_contents.content_tab") %></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content">
|
||||
<div role="tabpanel" class="tab-pane active" id="content-tab">
|
||||
<h5 class="visible-xs"><%= t("projects.reports.elements.modals.project_contents.content_tab") %></h5>
|
||||
<%= render partial: "reports/new/modal/module_contents_inner.html.erb", locals: { form: f } %>
|
||||
<hr>
|
||||
<%= render partial: "reports/new/modal/step_contents_inner.html.erb", locals: { form: f } %>
|
||||
<hr>
|
||||
<%= render partial: "reports/new/modal/result_contents_inner.html.erb", locals: { form: f } %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
|
@ -1,79 +0,0 @@
|
|||
<% my_module_undefined = !defined? my_module or my_module.blank? %>
|
||||
<div>
|
||||
<em>
|
||||
<%= t("projects.reports.elements.modals.module_contents_inner.instructions") %>
|
||||
</em>
|
||||
</div>
|
||||
|
||||
<div class="checkbox-tree">
|
||||
<ul data-hook="module-content-list">
|
||||
<li>
|
||||
<%= form.check_box :module_all, label: t("projects.reports.elements.modals.module_contents_inner.check_all") %>
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
<%= form.check_box :module_protocol, label: t("projects.reports.elements.modals.module_contents_inner.protocol") %>
|
||||
</li>
|
||||
|
||||
<% if my_module_undefined or my_module.protocol.steps.exists? %>
|
||||
<li>
|
||||
<%= form.check_box :module_steps, label: t("projects.reports.elements.modals.module_contents_inner.steps") %>
|
||||
<ul>
|
||||
<li>
|
||||
<%= form.check_box :module_completed_steps, label: t("projects.reports.elements.modals.module_contents_inner.completed_steps") %>
|
||||
</li>
|
||||
<li>
|
||||
<%= form.check_box :module_uncompleted_steps, label: t("projects.reports.elements.modals.module_contents_inner.uncompleted_steps") %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<% else %>
|
||||
<div>
|
||||
<em>
|
||||
<%= t("projects.reports.elements.modals.module_contents_inner.no_steps") %>
|
||||
</em>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if my_module_undefined or (my_module.results.select { |r| r.active? }).exists? %>
|
||||
<li>
|
||||
<%= form.check_box :module_results, label: t("projects.reports.elements.modals.module_contents_inner.results") %>
|
||||
<ul data-hook="result-types-list">
|
||||
<% if my_module_undefined or (my_module.results.select { |r| r.is_asset && r.active? }).exists? %>
|
||||
<li>
|
||||
<%= form.check_box :module_result_assets, label: t("projects.reports.elements.modals.module_contents_inner.result_assets") %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if my_module_undefined or (my_module.results.select { |r| r.is_table && r.active? }).exists? %>
|
||||
<li>
|
||||
<%= form.check_box :module_result_tables, label: t("projects.reports.elements.modals.module_contents_inner.result_tables") %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if my_module_undefined or (my_module.results.select { |r| r.is_text && r.active? }).exists? %>
|
||||
<li>
|
||||
<%= form.check_box :module_result_texts, label: t("projects.reports.elements.modals.module_contents_inner.result_texts") %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<% else %>
|
||||
<div>
|
||||
<em>
|
||||
<%= t("projects.reports.elements.modals.module_contents_inner.no_results") %>
|
||||
</em>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<li>
|
||||
<%= form.check_box :module_activity, label: t("projects.reports.elements.modals.module_contents_inner.activity") %>
|
||||
</li>
|
||||
<% assigned_repositories_in_project_list(@project).each do |repository| %>
|
||||
<li>
|
||||
<%= form.check_box "module_repository_#{repository.id}", label: repository.name.capitalize, data: { id: repository.id } %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
|
@ -1,38 +0,0 @@
|
|||
<%= bootstrap_form_tag remote: true, url: project_contents_project_reports_path(project, format: :json), method: :post, html: { id: "add-contents-form" } do |f| %>
|
||||
<%= hidden_field_tag :id, project.id %>
|
||||
<div>
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li role="presentation" class="active">
|
||||
<a href="#tasks-tab" aria-controls="tasks-tab" role="tab" data-toggle="tab">
|
||||
<span class="fas fa-credit-card visible-xs"></span>
|
||||
<span class="hidden-xs"><%= t("projects.reports.elements.modals.project_contents.tasks_tab") %></span>
|
||||
</a>
|
||||
</li>
|
||||
<% if project.project_my_modules.active.exists? %>
|
||||
<li role="presentation">
|
||||
<a href="#content-tab" aria-controls="content-tab" role="tab" data-toggle="tab">
|
||||
<span class="fas fa-link visible-xs"></span>
|
||||
<span class="hidden-xs"><%= t("projects.reports.elements.modals.project_contents.content_tab") %></span>
|
||||
</a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content">
|
||||
<div role="tabpanel" class="tab-pane active" id="tasks-tab">
|
||||
<h5 class="visible-xs"><%= t("projects.reports.elements.modals.project_contents.tasks_tab") %></h5>
|
||||
<%= render partial: "reports/new/modal/project_contents_inner.html.erb", locals: { form: f, project: project } %>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="content-tab">
|
||||
<h5 class="visible-xs"><%= t("projects.reports.elements.modals.project_contents.content_tab") %></h5>
|
||||
<%= render partial: "reports/new/modal/module_contents_inner.html.erb", locals: { form: f } %>
|
||||
<hr>
|
||||
<%= render partial: "reports/new/modal/step_contents_inner.html.erb", locals: { form: f } %>
|
||||
<hr>
|
||||
<%= render partial: "reports/new/modal/result_contents_inner.html.erb", locals: { form: f } %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
|
@ -1,49 +0,0 @@
|
|||
<div>
|
||||
<em>
|
||||
<%= t("projects.reports.elements.modals.project_contents_inner.instructions") %>
|
||||
</em>
|
||||
</div>
|
||||
|
||||
<% if project.project_my_modules.active.exists? %>
|
||||
<div class="checkbox-tree">
|
||||
<ul>
|
||||
<li>
|
||||
<%= form.check_box :project, label: project.name %>
|
||||
<ul>
|
||||
|
||||
<% project.experiments.includes(:my_module_groups).active.each do |experiment| %>
|
||||
<% next unless experiment.my_modules.active.exists? %>
|
||||
<li>
|
||||
<%= form.check_box "experiment_#{experiment.id}", label: experiment.name %>
|
||||
<ul>
|
||||
|
||||
<% experiment.my_module_groups.each do |my_module_group| %>
|
||||
<% my_module_group.my_modules.workflow_ordered.active.each do |my_module| %>
|
||||
<li>
|
||||
<%= form.check_box "modules[#{my_module.id}]", label: my_module.name %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<!-- Tasks without groups -->
|
||||
<% experiment.my_modules.without_group.each do |my_module| %>
|
||||
<li>
|
||||
<%= form.check_box "modules[#{my_module.id}]", label: my_module.name %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<% else %>
|
||||
<div>
|
||||
<em>
|
||||
<%= t("projects.reports.elements.modals.project_contents_inner.no_modules") %>
|
||||
</em>
|
||||
</div>
|
||||
<% end %>
|
|
@ -1,4 +0,0 @@
|
|||
<%= bootstrap_form_tag remote: true, url: result_contents_project_reports_path(project, format: :json), method: :post, html: { id: "add-contents-form" } do |f| %>
|
||||
<%= hidden_field_tag :id, result.id %>
|
||||
<%= render partial: "reports/new/modal/result_contents_inner.html.erb", locals: { form: f } %>
|
||||
<% end %>
|
|
@ -1,18 +0,0 @@
|
|||
<div>
|
||||
<em>
|
||||
<%= t("projects.reports.elements.modals.result_contents_inner.instructions") %>
|
||||
</em>
|
||||
</div>
|
||||
|
||||
<div class="checkbox-tree">
|
||||
<ul>
|
||||
<li>
|
||||
<%= form.label :result_all, t("projects.reports.elements.modals.result_contents_inner.check_all"), class: "checkbox" %>
|
||||
<ul>
|
||||
<li>
|
||||
<%= form.check_box :result_comments, label: t("projects.reports.elements.modals.result_contents_inner.comments") %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
|
@ -1,5 +0,0 @@
|
|||
<%= bootstrap_form_for [@project, @report], remote: true, url: @url, method: @method, html: { id: "save-report-form" } do |f| %>
|
||||
<%= f.text_field :name, label: t("projects.reports.elements.modals.save_report.name"), placeholder: t("projects.reports.elements.modals.save_report.name_placeholder") %>
|
||||
<%= f.smart_text_area :description, label: t("projects.reports.elements.modals.save_report.description"), placeholder: t("projects.reports.elements.modals.save_report.description_placeholder") %>
|
||||
<%= hidden_field_tag :report_contents, @report_contents %>
|
||||
<% end %>
|
|
@ -1,4 +0,0 @@
|
|||
<%= bootstrap_form_tag remote: true, url: step_contents_project_reports_path(project, format: :json), method: :post, html: { id: "add-contents-form" } do |f| %>
|
||||
<%= hidden_field_tag :id, step.id %>
|
||||
<%= render partial: "reports/new/modal/step_contents_inner.html.erb", locals: { form: f, step: step } %>
|
||||
<% end %>
|
|
@ -1,58 +0,0 @@
|
|||
<% step_undefined = !defined? step or step.blank? %>
|
||||
|
||||
<div>
|
||||
<em>
|
||||
<%= t("projects.reports.elements.modals.step_contents_inner.instructions") %>
|
||||
</em>
|
||||
</div>
|
||||
|
||||
<div class="checkbox-tree">
|
||||
<ul>
|
||||
<li>
|
||||
<%= form.check_box :step_all, label: t("projects.reports.elements.modals.step_contents_inner.check_all") %>
|
||||
<ul>
|
||||
|
||||
<% if step_undefined or step.checklists.exists? %>
|
||||
<li>
|
||||
<%= form.check_box :step_checklists, label: t("projects.reports.elements.modals.step_contents_inner.checklists") %>
|
||||
</li>
|
||||
<% else %>
|
||||
<div>
|
||||
<em>
|
||||
<%= t("projects.reports.elements.modals.step_contents_inner.no_checklists") %>
|
||||
</em>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if step_undefined or step.assets.exists? %>
|
||||
<li>
|
||||
<%= form.check_box :step_assets, label: t("projects.reports.elements.modals.step_contents_inner.assets") %>
|
||||
</li>
|
||||
<% else %>
|
||||
<div>
|
||||
<em>
|
||||
<%= t("projects.reports.elements.modals.step_contents_inner.no_assets") %>
|
||||
</em>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if step_undefined or step.tables.exists? %>
|
||||
<li>
|
||||
<%= form.check_box :step_tables, label: t("projects.reports.elements.modals.step_contents_inner.tables") %>
|
||||
</li>
|
||||
<% else %>
|
||||
<div>
|
||||
<em>
|
||||
<%= t("projects.reports.elements.modals.step_contents_inner.no_tables") %>
|
||||
</em>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<li>
|
||||
<%= form.check_box :step_comments, label: t("projects.reports.elements.modals.step_contents_inner.comments") %>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
|
@ -4,8 +4,9 @@
|
|||
<meta charset='utf-8' />
|
||||
<%= wicked_pdf_stylesheet_link_tag "application" %>
|
||||
<%= wicked_pdf_stylesheet_link_tag "reports_pdf" %>
|
||||
<%= bootstrap_cdn_link_tag %>
|
||||
<%= font_awesome_cdn_link_tag %>
|
||||
<%= wicked_pdf_stylesheet_pack_tag "fonts" %>
|
||||
<%= wicked_pdf_stylesheet_pack_tag "fontawesome" %>
|
||||
<%= wicked_pdf_stylesheet_link_tag "bootstrap" %>
|
||||
<%= wicked_pdf_javascript_include_tag "jquery" %>
|
||||
<%= wicked_pdf_javascript_include_tag "handsontable.full" %>
|
||||
<!-- Libraries for formulas -->
|
||||
|
@ -25,7 +26,6 @@
|
|||
<div class="print-report">
|
||||
<% report.root_elements.each do |el| %>
|
||||
<%= render_report_element(el, local_assigns) %>
|
||||
<%= render_new_element(false) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -42,6 +42,8 @@ class Extends
|
|||
my_module_repository: 17,
|
||||
my_module_protocol: 18 }
|
||||
|
||||
ACTIVE_REPORT_ELEMENTS = %i(project_header my_module experiment my_module_repository)
|
||||
|
||||
# Data type name should match corresponding model's name
|
||||
REPOSITORY_DATA_TYPES = { RepositoryTextValue: 0,
|
||||
RepositoryDateValue: 1,
|
||||
|
|
|
@ -1,227 +0,0 @@
|
|||
#########################################################
|
||||
# EXTENDS METHODS. Here you can extend the arrays, #
|
||||
# hashes,.. which is used in methods. Please specify #
|
||||
# the method name and location! #
|
||||
#########################################################
|
||||
|
||||
module ReportExtends
|
||||
# path: app/controllers/concerns/ReportActions
|
||||
# method: generate_module_contents_json
|
||||
|
||||
# ModuleElement struct creates an argument objects which is needed in
|
||||
# generate_module_contents_json method. It takes 3 parameters a Proc and
|
||||
# additional options wich can be extended.
|
||||
# :values => name of the hook/identifier for specific module element state
|
||||
# :element => name of module element in plural
|
||||
# :children => bolean if element has children elements in report
|
||||
# :locals => an array of names of local variables which are passed in the view
|
||||
# :coll => a procedure which the my_module is passed and have to return a
|
||||
# collection of elements
|
||||
# :singular => true by defaut; change the enum type to singular - needed when
|
||||
# querying partials by name
|
||||
# :has_many => false by default; whether the element can have many
|
||||
# manifestations, and its id will be appended.
|
||||
|
||||
ModuleElement = Struct.new(:values,
|
||||
:element,
|
||||
:children,
|
||||
:locals,
|
||||
:coll,
|
||||
:singular,
|
||||
:has_many) do
|
||||
def initialize(values,
|
||||
element,
|
||||
children,
|
||||
locals,
|
||||
coll = nil,
|
||||
singular = true,
|
||||
has_many = false)
|
||||
super(values, element, children, locals, coll, singular, has_many)
|
||||
end
|
||||
|
||||
def collection(my_module, params2)
|
||||
coll.call(my_module, params2) if coll
|
||||
end
|
||||
|
||||
def parse_locals(values)
|
||||
container = {}
|
||||
locals.each_with_index do |local, index|
|
||||
container[local] = values[index]
|
||||
end
|
||||
container
|
||||
end
|
||||
|
||||
def file_name
|
||||
return element.to_s unless singular
|
||||
element.to_s.singularize
|
||||
end
|
||||
end
|
||||
|
||||
ACTIVE_REPORT_ELEMENTS = %i(project_header my_module project_activity experiment my_module_repository)
|
||||
|
||||
# Module contents element
|
||||
MODULE_CONTENTS = [
|
||||
ModuleElement.new([:protocol],
|
||||
:protocol,
|
||||
false,
|
||||
[:my_module]),
|
||||
ModuleElement.new(%i(completed_steps uncompleted_steps),
|
||||
:steps,
|
||||
true,
|
||||
[:step],
|
||||
proc do |my_module, params2|
|
||||
steps = []
|
||||
steps << true if params2["module_completed_steps"] == '1'
|
||||
steps << false if params2["module_uncompleted_steps"] == '1'
|
||||
my_module.protocol.steps.where(completed: steps).order(:position)
|
||||
end),
|
||||
ModuleElement.new([:result_assets],
|
||||
:result_assets,
|
||||
true,
|
||||
[:result],
|
||||
proc do |my_module|
|
||||
my_module.results.joins(:result_asset).select(&:active?)
|
||||
end),
|
||||
ModuleElement.new([:result_tables],
|
||||
:result_tables,
|
||||
true,
|
||||
[:result],
|
||||
proc do |my_module|
|
||||
my_module.results.joins(:result_table).select(&:active?)
|
||||
end),
|
||||
ModuleElement.new([:result_texts],
|
||||
:result_texts,
|
||||
true,
|
||||
[:result],
|
||||
proc do |my_module|
|
||||
my_module.results.joins(:result_text).select(&:active?)
|
||||
end),
|
||||
ModuleElement.new([:activity],
|
||||
:activity,
|
||||
false,
|
||||
%i(my_module order)),
|
||||
ModuleElement.new([:repository],
|
||||
:repository,
|
||||
false,
|
||||
%i(my_module order),
|
||||
nil,
|
||||
true,
|
||||
true)
|
||||
]
|
||||
|
||||
# path: app/helpers/reports_helpers.rb
|
||||
# method: render_report_element
|
||||
|
||||
# sets local :my_module to the listed my_module child elements
|
||||
MY_MODULE_ELEMENTS = %w(my_module
|
||||
my_module_protocol
|
||||
my_module_activity
|
||||
my_module_repository)
|
||||
|
||||
# sets local name to first element of the listed elements
|
||||
FIRST_PART_ELEMENTS = %w(result_comments
|
||||
result_text
|
||||
result_asset
|
||||
result_table
|
||||
project_header
|
||||
step_comments)
|
||||
|
||||
MY_MODULE_CHILDREN_ELEMENTS = %w(step result_asset result_table result_text)
|
||||
|
||||
# path: app/models/report_element.rb
|
||||
# method: set_element_reference
|
||||
|
||||
ElementReference = Struct.new(:checker, :elements) do
|
||||
def initialize(checker, elements = :element_reference_needed!)
|
||||
super(checker, elements)
|
||||
end
|
||||
|
||||
def check(report_element)
|
||||
checker.call(report_element)
|
||||
end
|
||||
end
|
||||
|
||||
SET_ELEMENT_REFERENCES_LIST = [
|
||||
ElementReference.new(
|
||||
proc do |report_element|
|
||||
report_element.project_header?
|
||||
end,
|
||||
['project_id']
|
||||
),
|
||||
ElementReference.new(proc(&:experiment?), ['experiment_id']),
|
||||
ElementReference.new(
|
||||
proc do |report_element|
|
||||
report_element.my_module? ||
|
||||
report_element.my_module_protocol? ||
|
||||
report_element.my_module_activity?
|
||||
end,
|
||||
['my_module_id']
|
||||
),
|
||||
ElementReference.new(
|
||||
proc(&:my_module_repository?),
|
||||
%w(my_module_id repository_id)
|
||||
),
|
||||
ElementReference.new(
|
||||
proc do |report_element|
|
||||
report_element.step? || report_element.step_comments?
|
||||
end,
|
||||
['step_id']
|
||||
),
|
||||
ElementReference.new(
|
||||
proc do |report_element|
|
||||
report_element.result_asset? ||
|
||||
report_element.result_table? ||
|
||||
report_element.result_text? ||
|
||||
report_element.result_comments?
|
||||
end,
|
||||
['result_id']
|
||||
),
|
||||
ElementReference.new(proc(&:step_checklist?), ['checklist_id']),
|
||||
ElementReference.new(proc(&:step_asset?), ['asset_id']),
|
||||
ElementReference.new(proc(&:step_table?), ['table_id'])
|
||||
]
|
||||
|
||||
# path: app/models/report_element.rb
|
||||
# method: element_reference
|
||||
|
||||
ELEMENT_REFERENCES = [
|
||||
ElementReference.new(
|
||||
proc do |report_element|
|
||||
report_element.project_header?
|
||||
end,
|
||||
['project_id']
|
||||
),
|
||||
ElementReference.new(proc(&:experiment?), ['experiment_id']),
|
||||
ElementReference.new(
|
||||
proc do |report_element|
|
||||
report_element.my_module? ||
|
||||
report_element.my_module_protocol? ||
|
||||
report_element.my_module_activity?
|
||||
end,
|
||||
['my_module_id']
|
||||
),
|
||||
ElementReference.new(
|
||||
proc(&:my_module_repository?),
|
||||
%w(my_module_id repository_id)
|
||||
),
|
||||
ElementReference.new(
|
||||
proc do |report_element|
|
||||
report_element.step? ||
|
||||
report_element.step_comments?
|
||||
end,
|
||||
['step_id']
|
||||
),
|
||||
ElementReference.new(
|
||||
proc do |report_element|
|
||||
report_element.result_asset? ||
|
||||
report_element.result_table? ||
|
||||
report_element.result_text? ||
|
||||
report_element.result_comments?
|
||||
end,
|
||||
['result_id']
|
||||
),
|
||||
ElementReference.new(proc(&:step_checklist?), ['checklist_id']),
|
||||
ElementReference.new(proc(&:step_asset?), ['asset_id']),
|
||||
ElementReference.new(proc(&:step_table?), ['table_id'])
|
||||
]
|
||||
end
|
|
@ -654,71 +654,6 @@ en:
|
|||
appended_table: "Appended table"
|
||||
elements:
|
||||
download: "[Download]"
|
||||
modals:
|
||||
project_contents:
|
||||
head_title: "Add contents to report"
|
||||
tasks_tab: "Choose tasks"
|
||||
content_tab: "Choose content"
|
||||
project_contents_inner:
|
||||
instructions: "To create a project report select one or multiple experiment. You can include an entire experiment or individual experimental tasks."
|
||||
no_modules: "The project contains no tasks"
|
||||
no_module_group: "No workflow"
|
||||
module_contents:
|
||||
head_title: "Add contents to task %{module}"
|
||||
module_tab: "Task content"
|
||||
steps_tab: "Protocols content"
|
||||
results_tab: "Results content"
|
||||
module_contents_inner:
|
||||
instructions: "Select the information from your task that you would like to include to your report."
|
||||
check_all: "All tasks content"
|
||||
protocol: "Protocol"
|
||||
steps: "Steps"
|
||||
completed_steps: "Completed"
|
||||
uncompleted_steps: "Uncompleted"
|
||||
no_steps: "Task has no steps"
|
||||
results: "Results"
|
||||
result_assets: "Files"
|
||||
result_tables: "Tables"
|
||||
result_texts: "Texts"
|
||||
no_results: "Task contains no results"
|
||||
activity: "Activity"
|
||||
experiment_contents:
|
||||
head_title: "Add contents to experiment %{experiment}"
|
||||
experiment_tab: "Experiment content"
|
||||
module_tab: "Task content"
|
||||
steps_tab: "Protocols content"
|
||||
results_tab: "Results content"
|
||||
experiment_contents_inner:
|
||||
instructions: "Select tasks to include in the report"
|
||||
no_modules: "The experiment contains no tasks"
|
||||
step_contents:
|
||||
head_title: "Add contents to step %{step}"
|
||||
step_tab: "Step content"
|
||||
results_tab: "Results content"
|
||||
step_contents_inner:
|
||||
instructions: "Select the information from task protocol step/s to include in the report"
|
||||
check_all: "All protocols steps content"
|
||||
tables: "Tables"
|
||||
no_tables: "Step contains no tables"
|
||||
assets: "Files"
|
||||
no_assets: "Step contains no uploaded files"
|
||||
checklists: "Checklists"
|
||||
no_checklists: "Step contains no checklists"
|
||||
comments: "Comments"
|
||||
result_contents:
|
||||
head_title: "Add contents to result %{result}"
|
||||
result_contents_inner:
|
||||
instructions: "Include result/s comments in the report?"
|
||||
check_all: "All results content"
|
||||
comments: "Comments"
|
||||
add: "Add"
|
||||
save_report:
|
||||
head_title: "Save report"
|
||||
name: "Report name"
|
||||
name_placeholder: "My report"
|
||||
description: "Report description"
|
||||
description_placeholder: "My report description..."
|
||||
save: "Save"
|
||||
all:
|
||||
sort_asc: "Sort report element contents by oldest on top"
|
||||
sort_desc: "Sort report element contents by newest on top"
|
||||
|
@ -726,8 +661,6 @@ en:
|
|||
move_down: "Move report element down"
|
||||
remove: "Remove report element from the report"
|
||||
scinote_link: "SciNote link"
|
||||
new_element:
|
||||
title: "Add new report element/s here"
|
||||
project_header:
|
||||
user_time: "Project created on %{timestamp}."
|
||||
title: "Report for project %{project}"
|
||||
|
|
|
@ -255,42 +255,7 @@ Rails.application.routes.draw do
|
|||
end
|
||||
|
||||
collection do
|
||||
# The posts following here should in theory be gets,
|
||||
# but are posts because of parameters payload
|
||||
get 'new/', to: 'reports#new'
|
||||
get 'new/project_contents_modal',
|
||||
to: 'reports#project_contents_modal',
|
||||
as: :project_contents_modal
|
||||
post 'new/project_contents',
|
||||
to: 'reports#project_contents',
|
||||
as: :project_contents
|
||||
get 'new/experiment_contents_modal',
|
||||
to: 'reports#experiment_contents_modal',
|
||||
as: :experiment_contents_modal
|
||||
post 'new/experiment_contents',
|
||||
to: 'reports#experiment_contents',
|
||||
as: :experiment_contents
|
||||
get 'new/module_contents_modal',
|
||||
to: 'reports#module_contents_modal',
|
||||
as: :module_contents_modal
|
||||
post 'new/module_contents',
|
||||
to: 'reports#module_contents',
|
||||
as: :module_contents
|
||||
get 'new/step_contents_modal',
|
||||
to: 'reports#step_contents_modal',
|
||||
as: :step_contents_modal
|
||||
post 'new/step_contents',
|
||||
to: 'reports#step_contents',
|
||||
as: :step_contents
|
||||
get 'new/result_contents_modal',
|
||||
to: 'reports#result_contents_modal',
|
||||
as: :result_contents_modal
|
||||
post 'new/result_contents',
|
||||
to: 'reports#result_contents',
|
||||
as: :result_contents
|
||||
post '_save',
|
||||
to: 'reports#save_modal',
|
||||
as: :save_modal
|
||||
get 'new', to: 'reports#new'
|
||||
end
|
||||
end
|
||||
resources :experiments, only: %i(new create), defaults: { format: 'json' } do
|
||||
|
|
Loading…
Add table
Reference in a new issue