diff --git a/Gemfile b/Gemfile index f8a685000..fa1a3f747 100644 --- a/Gemfile +++ b/Gemfile @@ -68,8 +68,6 @@ gem 'tinymce-rails' # Rich text editor gem 'base62' # Used for smart annotations -gem 'nokogiri' # XML parser - group :development, :test do gem 'byebug' gem 'better_errors' diff --git a/app/assets/javascripts/application.js.erb b/app/assets/javascripts/application.js.erb index 2ceb50997..56bf2fb5f 100644 --- a/app/assets/javascripts/application.js.erb +++ b/app/assets/javascripts/application.js.erb @@ -224,6 +224,32 @@ var HelperModule = (function(){ } } + helpers.flashAlertMsg = function(message, type) { + var alertType; + var glyphSign; + $('#notifications').html(''); + if (type === 'success') { + alertType = ' alert-success '; + glyphSign = ' glyphicon-ok-sign '; + } else if (type === 'danger') { + alertType = ' alert-danger '; + glyphSign = ' glyphicon-exclamation-sign '; + } + var htmlSnippet = '
' + + '
' + + '' + + '' + + '' + message + '' + + '
' + + '
'; + $('#notifications').html(htmlSnippet); + $('#content-wrapper').addClass('alert-shown'); + helpers.hideFlashMsg(); + } + $( document ).ready(function() { helpers.treeLinkTruncation(); helpers.hideFlashMsg(); diff --git a/app/assets/javascripts/assets.js b/app/assets/javascripts/assets.js index acffc50a5..5d5d23eb1 100644 --- a/app/assets/javascripts/assets.js +++ b/app/assets/javascripts/assets.js @@ -19,6 +19,7 @@ function setupAssetsLoading() { type: "GET", dataType: "json", success: function (data) { + var wopiBtns; $el.attr("data-status", "asset-loaded"); $el.find('img').hide(); $el.next().hide(); @@ -33,10 +34,16 @@ function setupAssetsLoading() { data['preview-url'] + "'>

" + data.filename + '

' ); - } else if(data.type === "wopi") { - $el.html(data['wopi-file-name'] + - data['wopi-view'] + - data['wopi-edit']); + } else if (data.type === 'wopi') { + if (data['wopi-edit']) { + wopiBtns = data['wopi-file-name'] + + data['wopi-view'] + + data['wopi-edit']; + } else { + wopiBtns = data['wopi-file-name'] + + data['wopi-view']; + } + $el.html(wopiBtns); } else { $el.html( "

" + diff --git a/app/assets/javascripts/samples/sample_datatable.js.erb b/app/assets/javascripts/samples/sample_datatable.js.erb index ae6d86fa1..f2f08f423 100644 --- a/app/assets/javascripts/samples/sample_datatable.js.erb +++ b/app/assets/javascripts/samples/sample_datatable.js.erb @@ -503,7 +503,9 @@ function onClickEdit() { }, error: function (e, data, status, xhr) { if (e.status == 403) { - sampleAlertMsg(I18n.t("samples.js.permission_error"), "danger"); + HelperModule.flashAlertMsg( + I18n.t('samples.js.permission_error'), 'danger' + ); changeToViewMode(); updateButtons(); } @@ -565,7 +567,7 @@ function onClickSave() { dataType: "json", data: data, success: function (data) { - sampleAlertMsg(data.flash, "success"); + HelperModule.flashAlertMsg(data.flash, 'success'); onClickCancel(); }, error: function (e, eData, status, xhr) { @@ -573,12 +575,16 @@ function onClickSave() { clearAllErrors(); if (e.status == 404) { - sampleAlertMsg(I18n.t("samples.js.not_found_error"), "danger"); + HelperModule.flashAlertMsg( + I18n.t('samples.js.not_found_error'), 'danger' + ); changeToViewMode(); updateButtons(); } else if (e.status == 403) { - sampleAlertMsg(I18n.t("samples.js.permission_error"), "danger"); + HelperModule.flashAlertMsg( + I18n.t('samples.js.permission_error'), 'danger' + ); changeToViewMode(); updateButtons(); } @@ -794,7 +800,9 @@ function onClickAddSample() { }, error: function (e, eData, status, xhr) { if (e.status == 403) - sampleAlertMsg(I18n.t("samples.js.permission_error"), "danger"); + HelperModule.flashAlertMsg( + I18n.t('samples.js.permission_error'), 'danger' + ); changeToViewMode(); updateButtons(); } diff --git a/app/assets/javascripts/samples/samples.js b/app/assets/javascripts/samples/samples.js index 1e5a3c7bc..5021f95eb 100644 --- a/app/assets/javascripts/samples/samples.js +++ b/app/assets/javascripts/samples/samples.js @@ -53,32 +53,6 @@ function updateSamplesTypesandGroups() { }); } -function sampleAlertMsg(message, type) { - var alertType; - var glyphSign; - $('#notifications').html(''); - if (type === 'success') { - alertType = ' alert-success '; - glyphSign = ' glyphicon-ok-sign '; - } else if (type === 'danger') { - alertType = ' alert-danger '; - glyphSign = ' glyphicon-exclamation-sign '; - } - var htmlSnippet = '

' + - '
' + - '' + - '' + - '' + message + '' + - '
' + - '
'; - $('#notifications').html(htmlSnippet); - $('#content-wrapper').addClass('alert-shown'); - HelperModule.hideFlashMsg(); -} - /** * Initializes tutorial */ diff --git a/app/controllers/assets_controller.rb b/app/controllers/assets_controller.rb index fe1d0748c..d6b0ce7bc 100644 --- a/app/controllers/assets_controller.rb +++ b/app/controllers/assets_controller.rb @@ -60,7 +60,7 @@ class AssetsController < ApplicationController Constants::FILENAME_TRUNCATION_LENGTH), 'download-url' => download_asset_path(@asset), 'type' => asset_data_type(@asset), - 'wopi-file-name' => wopi_asset_file_name(@asset), + 'wopi-file-name' => wopi_asset_file_name(@asset, true), 'wopi-edit' => (wopi_asset_edit_button(@asset) if wopi_file?(@asset)), 'wopi-view' => (wopi_asset_view_button(@asset) if wopi_file?(@asset)) }, status: 200 diff --git a/app/controllers/protocols_controller.rb b/app/controllers/protocols_controller.rb index 302ddcc6c..8b7c5dd93 100644 --- a/app/controllers/protocols_controller.rb +++ b/app/controllers/protocols_controller.rb @@ -521,7 +521,9 @@ class ProtocolsController < ApplicationController transaction_error = false Protocol.transaction do begin - import_into_existing(@protocol, @protocol_json, current_user) + import_into_existing( + @protocol, @protocol_json, current_user, current_team + ) rescue Exception transaction_error = true raise ActiveRecord:: Rollback diff --git a/app/controllers/result_assets_controller.rb b/app/controllers/result_assets_controller.rb index 6cdea4b86..3ce0b8745 100644 --- a/app/controllers/result_assets_controller.rb +++ b/app/controllers/result_assets_controller.rb @@ -29,6 +29,7 @@ class ResultAssetsController < ApplicationController @asset = Asset.new(result_params[:asset_attributes]) @asset.created_by = current_user @asset.last_modified_by = current_user + @asset.team = current_team @result = Result.new( user: current_user, my_module: @my_module, @@ -98,6 +99,7 @@ class ResultAssetsController < ApplicationController asset = Asset.find_by_id(update_params[:asset_attributes][:id]) asset.created_by = current_user asset.last_modified_by = current_user + asset.team = current_team @result.asset = asset end diff --git a/app/controllers/result_tables_controller.rb b/app/controllers/result_tables_controller.rb index c2e640474..7c3820625 100644 --- a/app/controllers/result_tables_controller.rb +++ b/app/controllers/result_tables_controller.rb @@ -31,6 +31,7 @@ class ResultTablesController < ApplicationController def create @table = Table.new(result_params[:table_attributes]) @table.created_by = current_user + @table.team = current_team @table.last_modified_by = current_user @result = Result.new( user: current_user, @@ -92,6 +93,7 @@ class ResultTablesController < ApplicationController update_params = result_params @result.last_modified_by = current_user @result.table.last_modified_by = current_user + @result.table.team = current_team @result.assign_attributes(update_params) flash_success = t("result_tables.update.success_flash", module: @my_module.name) @@ -218,6 +220,4 @@ class ResultTablesController < ApplicationController ] ) end - end - diff --git a/app/controllers/steps_controller.rb b/app/controllers/steps_controller.rb index e057c2270..c781102c6 100644 --- a/app/controllers/steps_controller.rb +++ b/app/controllers/steps_controller.rb @@ -33,6 +33,14 @@ class StepsController < ApplicationController @step.protocol = @protocol @step.user = current_user @step.last_modified_by = current_user + @step.assets.each do |asset| + asset.created_by = current_user + asset.team = current_team + end + @step.tables.each do |table| + table.created_by = current_user + table.team = current_team + end # Update default checked state @step.checklists.each do |checklist| @@ -133,6 +141,18 @@ class StepsController < ApplicationController @step.assign_attributes(step_params_all) @step.last_modified_by = current_user + @step.assets.each do |asset| + asset.created_by = current_user if asset.new_record? + asset.last_modified_by = current_user unless asset.new_record? + asset.team = current_team + end + + @step.tables.each do |table| + table.created_by = current_user if table.new_record? + table.last_modified_by = current_user unless table.new_record? + table.team = current_team + end + if @step.save @step.reload diff --git a/app/controllers/wopi_controller.rb b/app/controllers/wopi_controller.rb index 510a53444..dd7b30192 100644 --- a/app/controllers/wopi_controller.rb +++ b/app/controllers/wopi_controller.rb @@ -49,9 +49,12 @@ class WopiController < ActionController::Base end def check_file_info + asset_owner_id = @asset.id.to_s + asset_owner_id = @asset.created_by_id.to_s if @asset.created_by_id + msg = { BaseFileName: @asset.file_file_name, - OwnerId: @asset.created_by_id.to_s, + OwnerId: asset_owner_id, Size: @asset.file_file_size, UserId: @user.id.to_s, Version: @asset.version.to_s, @@ -281,18 +284,23 @@ class WopiController < ActionController::Base @can_write = can_edit_step_in_protocol(@protocol) if @protocol.in_module? - @close_url = protocols_my_module_path(@protocol.my_module, - only_path: false) + @close_url = protocols_my_module_url(@protocol.my_module, + only_path: false, + host: ENV['WOPI_BREADCRUMBS_HOST']) project = @protocol.my_module.experiment.project @breadcrumb_brand_name = project.name - @breadcrumb_brand_url = project_path(project, only_path: false) + @breadcrumb_brand_url = project_url(project, + only_path: false, + host: ENV['WOPI_BREADCRUMBS_HOST']) @breadcrumb_folder_name = @protocol.my_module.name else - @close_url = protocols_path(only_path: false) + @close_url = protocols_url(only_path: false, + host: ENV['WOPI_BREADCRUMBS_HOST']) @breadcrump_brand_name = 'Projects' - @breadcrumb_brand_url = root_path(only_path: false) + @breadcrumb_brand_url = root_url(only_path: false, + host: ENV['WOPI_BREADCRUMBS_HOST']) @breadcrumb_folder_name = 'Protocol managament' end @breadcrumb_folder_url = @close_url @@ -300,11 +308,14 @@ class WopiController < ActionController::Base @can_read = can_view_or_download_result_assets(@my_module) @can_write = can_edit_result_asset_in_module(@my_module) - @close_url = results_my_module_path(@my_module, only_path: false) + @close_url = results_my_module_url(@my_module, + only_path: false, + host: ENV['WOPI_BREADCRUMBS_HOST']) @breadcrumb_brand_name = @my_module.experiment.project.name - @breadcrumb_brand_url = project_path(@my_module.experiment.project, - only_path: false) + @breadcrumb_brand_url = project_url(@my_module.experiment.project, + only_path: false, + host: ENV['WOPI_BREADCRUMBS_HOST']) @breadcrumb_folder_name = @my_module.name @breadcrumb_folder_url = @close_url end diff --git a/app/helpers/wopi_helper.rb b/app/helpers/wopi_helper.rb index eaaeec08d..097a5cbc1 100644 --- a/app/helpers/wopi_helper.rb +++ b/app/helpers/wopi_helper.rb @@ -51,12 +51,24 @@ module WopiHelper end end - def wopi_asset_file_name(asset) + def wopi_asset_file_name(asset, link = false) html = '

' html += "#{file_extension_icon(asset)} " - html += truncate(asset.file_file_name, - length: Constants::FILENAME_TRUNCATION_LENGTH) + if link + html += link_to download_asset_path(asset), + data: { no_turbolink: true, + id: true, + status: 'asset-present' } do + truncate( + asset.file_file_name, + length: Constants::FILENAME_TRUNCATION_LENGTH + ) + end + else + html += truncate(asset.file_file_name, + length: Constants::FILENAME_TRUNCATION_LENGTH) + end html += ' 

' - sanitize_input(html, %w(img)) + sanitize_input(html, %w(img a)) end end diff --git a/app/models/asset.rb b/app/models/asset.rb index dcce691a1..f31358cef 100644 --- a/app/models/asset.rb +++ b/app/models/asset.rb @@ -48,6 +48,7 @@ class Asset < ActiveRecord::Base belongs_to :last_modified_by, foreign_key: 'last_modified_by_id', class_name: 'User' + belongs_to :team has_one :step_asset, inverse_of: :asset, dependent: :destroy diff --git a/app/models/protocol.rb b/app/models/protocol.rb index 17d658fb4..79efff5ad 100644 --- a/app/models/protocol.rb +++ b/app/models/protocol.rb @@ -291,8 +291,6 @@ class Protocol < ActiveRecord::Base ) item2.created_by = current_user item2.last_modified_by = current_user - p item - p item2 item2.save end @@ -306,6 +304,7 @@ class Protocol < ActiveRecord::Base asset.file_file_size ) asset2.created_by = current_user + asset2.team = dest.team asset2.last_modified_by = current_user asset2.file_processing = true if asset.is_image? asset2.save @@ -323,6 +322,7 @@ class Protocol < ActiveRecord::Base table2 = Table.new(name: table.name, contents: table.contents) table2.created_by = current_user table2.last_modified_by = current_user + table2.team = dest.team step2.tables << table2 end end diff --git a/app/models/table.rb b/app/models/table.rb index cf9874389..45ed3252e 100644 --- a/app/models/table.rb +++ b/app/models/table.rb @@ -10,6 +10,7 @@ class Table < ActiveRecord::Base belongs_to :created_by, foreign_key: 'created_by_id', class_name: 'User' belongs_to :last_modified_by, foreign_key: 'last_modified_by_id', class_name: 'User' + belongs_to :team has_one :step_table, inverse_of: :table has_one :step, through: :step_table diff --git a/app/utilities/delayed_uploader_tutorial.rb b/app/utilities/delayed_uploader_tutorial.rb index d7a7a58db..993e519cb 100644 --- a/app/utilities/delayed_uploader_tutorial.rb +++ b/app/utilities/delayed_uploader_tutorial.rb @@ -1,11 +1,12 @@ module DelayedUploaderTutorial # Get asset from tutorial_files folder - def self.get_asset(user, file_name) + def self.get_asset(user, team, file_name) Asset.new( file: File.open( "#{Rails.root}/app/assets/tutorial_files/#{file_name}", 'r' ), created_by: user, + team: team, last_modified_by: user ) end @@ -15,11 +16,12 @@ module DelayedUploaderTutorial def self.generate_result_asset( my_module:, current_user:, + current_team:, result_name:, created_at: Time.now, file_name: ) - temp_asset = get_asset(current_user, file_name) + temp_asset = get_asset(current_user, current_team, file_name) temp_result = Result.new( created_at: created_at, user: current_user, @@ -48,8 +50,9 @@ module DelayedUploaderTutorial end # Adds asset to existing step - def self.add_step_asset(step:, current_user:, file_name:) - temp_asset = DelayedUploaderTutorial.get_asset(current_user, file_name) + def self.add_step_asset(step:, current_user:, current_team:, file_name:) + temp_asset = + DelayedUploaderTutorial.get_asset(current_user, current_team, file_name) step.assets << temp_asset temp_asset.post_process_file(step.my_module.experiment.project.team) end diff --git a/app/utilities/first_time_data_generator.rb b/app/utilities/first_time_data_generator.rb index 82a480e7f..5a30fed09 100644 --- a/app/utilities/first_time_data_generator.rb +++ b/app/utilities/first_time_data_generator.rb @@ -422,6 +422,7 @@ module FirstTimeDataGenerator DelayedUploaderTutorial.delay(queue: :tutorial).generate_result_asset( my_module: my_modules[0], current_user: user, + current_team: team, result_name: 'sF', created_at: generate_random_time(my_modules[0].created_at, 2.days), file_name: 'samples.txt' @@ -440,6 +441,7 @@ module FirstTimeDataGenerator ) temp_result.table = Table.new( created_by: user, + team: team, contents: tab_content['module1']['experimental_design'] ) temp_result.save @@ -467,6 +469,7 @@ module FirstTimeDataGenerator DelayedUploaderTutorial.delay(queue: :tutorial).add_step_asset( step: my_modules[1].protocol.steps.where('position = 0').take, current_user: user, + current_team: team, file_name: 'sample-potatoe.txt' ) @@ -474,6 +477,7 @@ module FirstTimeDataGenerator DelayedUploaderTutorial.delay(queue: :tutorial).generate_result_asset( my_module: my_modules[1], current_user: user, + current_team: team, result_name: 'PVY-inoculated plant, symptoms', created_at: generate_random_time(my_modules[1].created_at, 1.days), file_name: 'DSCN0660.JPG' @@ -482,6 +486,7 @@ module FirstTimeDataGenerator DelayedUploaderTutorial.delay(queue: :tutorial).generate_result_asset( my_module: my_modules[1], current_user: user, + current_team: team, result_name: 'mock-inoculated plant', created_at: generate_random_time(my_modules[1].created_at, 2.days), file_name: 'DSCN0354.JPG' @@ -490,6 +495,7 @@ module FirstTimeDataGenerator DelayedUploaderTutorial.delay(queue: :tutorial).generate_result_asset( my_module: my_modules[1], current_user: user, + current_team: team, result_name: 'Height of plants at 6dpi', created_at: generate_random_time(my_modules[1].created_at, 3.days), file_name: '6dpi_height.JPG' @@ -541,6 +547,7 @@ module FirstTimeDataGenerator DelayedUploaderTutorial.delay(queue: :tutorial).add_step_asset( step: my_modules[2].protocol.steps.where('position = 1').take, current_user: user, + current_team: team, file_name: 'RNeasy-Plant-Mini-Kit-EN.pdf' ) @@ -559,6 +566,7 @@ module FirstTimeDataGenerator ) temp_result.table = Table.new( created_by: user, + team: team, contents: tab_content['module3']['nanodrop'] ) temp_result.save @@ -581,6 +589,7 @@ module FirstTimeDataGenerator DelayedUploaderTutorial.delay(queue: :tutorial).generate_result_asset( my_module: my_modules[2], current_user: user, + current_team: team, result_name: 'Agarose gel electrophoresis of totRNA samples', created_at: generate_random_time(my_modules[2].created_at, 3.days), file_name: 'totRNA_gel.jpg' @@ -599,6 +608,7 @@ module FirstTimeDataGenerator DelayedUploaderTutorial.delay(queue: :tutorial).add_step_asset( step: my_modules[3].protocol.steps.where('position = 0').take, current_user: user, + current_team: team, file_name: 'G2938-90034_KitRNA6000Nano_ebook.pdf' ) @@ -606,6 +616,7 @@ module FirstTimeDataGenerator DelayedUploaderTutorial.delay(queue: :tutorial).generate_result_asset( my_module: my_modules[3], current_user: user, + current_team: team, result_name: 'Result of RNA integrity', created_at: generate_random_time(my_modules[3].created_at, 2.days), file_name: 'Bioanalyser_result.JPG' @@ -671,24 +682,28 @@ module FirstTimeDataGenerator DelayedUploaderTutorial.delay(queue: :tutorial).add_step_asset( step: my_modules[5].protocol.steps.where('position = 0').take, current_user: user, + current_team: team, file_name: 'sample_preparation.JPG' ) DelayedUploaderTutorial.delay(queue: :tutorial).add_step_asset( step: my_modules[5].protocol.steps.where('position = 1').take, current_user: user, + current_team: team, file_name: 'reaction_setup.JPG' ) DelayedUploaderTutorial.delay(queue: :tutorial).add_step_asset( step: my_modules[5].protocol.steps.where('position = 2').take, current_user: user, + current_team: team, file_name: 'cycling_conditions.JPG' ) DelayedUploaderTutorial.delay(queue: :tutorial).add_step_asset( step: my_modules[5].protocol.steps.where('position = 3').take, current_user: user, + current_team: team, file_name: '96plate.doc' ) @@ -702,6 +717,7 @@ module FirstTimeDataGenerator ) temp_result.table = Table.new( created_by: user, + team: team, contents: tab_content['module6']['distribution'] % { sample0: samples_to_assign[0].name, sample1: samples_to_assign[1].name, @@ -729,6 +745,7 @@ module FirstTimeDataGenerator DelayedUploaderTutorial.delay(queue: :tutorial).generate_result_asset( my_module: my_modules[5], current_user: user, + current_team: team, result_name: 'Mixtures and plate setup', created_at: generate_random_time(my_modules[5].created_at, 2.days), file_name: 'Mixes_Templats.xls' @@ -737,6 +754,7 @@ module FirstTimeDataGenerator DelayedUploaderTutorial.delay(queue: :tutorial).generate_result_asset( my_module: my_modules[5], current_user: user, + current_team: team, result_name: 'Raw data from ABI 7300', created_at: generate_random_time(my_modules[5].created_at, 3.days), file_name: 'BootCamp-Experiment-results-20122.sds' @@ -745,6 +763,7 @@ module FirstTimeDataGenerator DelayedUploaderTutorial.delay(queue: :tutorial).generate_result_asset( my_module: my_modules[5], current_user: user, + current_team: team, result_name: 'All results - curves', created_at: generate_random_time(my_modules[5].created_at, 4.days), file_name: 'curves.JPG' @@ -791,6 +810,7 @@ module FirstTimeDataGenerator DelayedUploaderTutorial.delay(queue: :tutorial).add_step_asset( step: my_modules[7].protocol.steps.where('position = 0').take, current_user: user, + current_team: team, file_name: 'ddCq-quantification_diagnostics-template.xls' ) @@ -798,6 +818,7 @@ module FirstTimeDataGenerator DelayedUploaderTutorial.delay(queue: :tutorial).generate_result_asset( my_module: my_modules[7], current_user: user, + current_team: team, result_name: 'Results of ddCq method', created_at: generate_random_time(my_modules[7].created_at, 1.days), file_name: 'ddCq-quantification_diagnostics-results.xls' @@ -806,6 +827,7 @@ module FirstTimeDataGenerator DelayedUploaderTutorial.delay(queue: :tutorial).generate_result_asset( my_module: my_modules[7], current_user: user, + current_team: team, result_name: 'Dilution curve and efficiency', created_at: generate_random_time(my_modules[7].created_at, 2.days), file_name: 'dilution_curve-efficiency.JPG' @@ -814,6 +836,7 @@ module FirstTimeDataGenerator DelayedUploaderTutorial.delay(queue: :tutorial).generate_result_asset( my_module: my_modules[7], current_user: user, + current_team: team, result_name: 'Relative quantification results', created_at: generate_random_time(my_modules[7].created_at, 3.days), file_name: 'result-ddCq.JPG' diff --git a/app/utilities/protocols_importer.rb b/app/utilities/protocols_importer.rb index a44e8c897..0e0edddf1 100644 --- a/app/utilities/protocols_importer.rb +++ b/app/utilities/protocols_importer.rb @@ -22,18 +22,18 @@ module ProtocolsImporter protocol.save! # Protocol is saved, populate it - populate_protocol(protocol, protocol_json, user) + populate_protocol(protocol, protocol_json, user, team) return protocol end - def import_into_existing(protocol, protocol_json, user) + def import_into_existing(protocol, protocol_json, user, team) # Firstly, destroy existing protocol's contents protocol.destroy_contents(user) protocol.reload # Alright, now populate the protocol - populate_protocol(protocol, protocol_json, user) + populate_protocol(protocol, protocol_json, user, team) protocol.reload # Unlink the protocol @@ -43,7 +43,7 @@ module ProtocolsImporter private - def populate_protocol(protocol, protocol_json, user) + def populate_protocol(protocol, protocol_json, user, team) protocol.reload asset_ids = [] @@ -93,7 +93,8 @@ module ProtocolsImporter name: table_json['name'], contents: Base64.decode64(table_json['contents']), created_by: user, - last_modified_by: user + last_modified_by: user, + team: team ) StepTable.create!( step: step, @@ -106,7 +107,8 @@ module ProtocolsImporter step_json["assets"].values.each do |asset_json| asset = Asset.new( created_by: user, - last_modified_by: user + last_modified_by: user, + team: team ) # Decode the file bytes diff --git a/app/views/reports/elements/_result_comments_element.html.erb b/app/views/reports/elements/_result_comments_element.html.erb index 9d643f55c..08a6a96ed 100644 --- a/app/views/reports/elements/_result_comments_element.html.erb +++ b/app/views/reports/elements/_result_comments_element.html.erb @@ -1,6 +1,6 @@ <% if result.blank? and @result.present? then result = @result end %> <% if order.blank? and @order.present? then order = @order end %> -<% comments = result.comments.order(created_at: order) %> +<% comments = result.result_comments.order(created_at: order) %> <% timestamp = Time.current + 1.year %>
" data-type="result_comments" data-id="<%= result.id %>" data-name="<%=t "projects.reports.elements.result_comments.sidebar_name" %>" data-icon-class="glyphicon-comment">
diff --git a/app/views/reports/elements/_step_comments_element.html.erb b/app/views/reports/elements/_step_comments_element.html.erb index 9ca7fb14e..dbb8d1a65 100644 --- a/app/views/reports/elements/_step_comments_element.html.erb +++ b/app/views/reports/elements/_step_comments_element.html.erb @@ -1,6 +1,6 @@ <% if step.blank? and @step.present? then step = @step end %> <% if order.blank? and @order.present? then order = @order end %> -<% comments = step.comments.order(created_at: order) %> +<% comments = step.step_comments.order(created_at: order) %> <% timestamp = Time.current + 1.year %>
" data-icon-class="glyphicon-comment">
diff --git a/app/views/shared/_navigation.html.erb b/app/views/shared/_navigation.html.erb index 3b4e97f2d..8870ad0a3 100644 --- a/app/views/shared/_navigation.html.erb +++ b/app/views/shared/_navigation.html.erb @@ -86,7 +86,8 @@ -