Merge branch 'master' of https://github.com/biosistemika/scinote-web into zd_SCI_1003_add_extends

This commit is contained in:
zmagod 2017-03-24 16:09:28 +01:00
commit 4635a3320d
24 changed files with 202 additions and 80 deletions

View file

@ -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'

View file

@ -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 = '<div class="alert alert' + alertType +
'alert-dismissable alert-floating">' +
'<div class="container">' +
'<button type="button" class="close" ' +
'data-dismiss="alert" aria-label="Close">' +
'<span aria-hidden="true">×</span></button>' +
'<span class="glyphicon' + glyphSign + '"></span>' +
'<span>' + message + '</span>' +
'</div>' +
'</div>';
$('#notifications').html(htmlSnippet);
$('#content-wrapper').addClass('alert-shown');
helpers.hideFlashMsg();
}
$( document ).ready(function() {
helpers.treeLinkTruncation();
helpers.hideFlashMsg();

View file

@ -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'] + "'><p>" +
data.filename + '</p></a>'
);
} else if(data.type === "wopi") {
$el.html(data['wopi-file-name'] +
} else if (data.type === 'wopi') {
if (data['wopi-edit']) {
wopiBtns = data['wopi-file-name'] +
data['wopi-view'] +
data['wopi-edit']);
data['wopi-edit'];
} else {
wopiBtns = data['wopi-file-name'] +
data['wopi-view'];
}
$el.html(wopiBtns);
} else {
$el.html(
"<a href='" + data['download-url'] + "'><p>" +

View file

@ -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();
}

View file

@ -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 = '<div class="alert alert' + alertType +
'alert-dismissable alert-floating">' +
'<div class="container">' +
'<button type="button" class="close" ' +
'data-dismiss="alert" aria-label="Close">' +
'<span aria-hidden="true">×</span></button>' +
'<span class="glyphicon' + glyphSign + '"></span>' +
'<span>' + message + '</span>' +
'</div>' +
'</div>';
$('#notifications').html(htmlSnippet);
$('#content-wrapper').addClass('alert-shown');
HelperModule.hideFlashMsg();
}
/**
* Initializes tutorial
*/

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -51,12 +51,24 @@ module WopiHelper
end
end
def wopi_asset_file_name(asset)
def wopi_asset_file_name(asset, link = false)
html = '<p style="display: inline-block">'
html += "#{file_extension_icon(asset)}&nbsp;"
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 += '&nbsp;</p>'
sanitize_input(html, %w(img))
sanitize_input(html, %w(img a))
end
end

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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'

View file

@ -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

View file

@ -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 %>
<div class="report-element report-comments-element report-result-comments-element" data-ts="<%= timestamp.to_i %>" data-order="<%= order == :asc ? "asc" : "desc" %>" data-type="result_comments" data-id="<%= result.id %>" data-name="<%=t "projects.reports.elements.result_comments.sidebar_name" %>" data-icon-class="glyphicon-comment">
<div class="report-element-header">

View file

@ -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 %>
<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 %>" data-name="<%=t "projects.reports.elements.step_comments.sidebar_name" %>" data-icon-class="glyphicon-comment">
<div class="report-element-header">

View file

@ -86,7 +86,8 @@
</span>
</a>
<ul class="dropdown-menu ">
<ul class="dropdown-menu"
data-hook="teams-dropdown">
<%= form_for(current_user,
url: user_current_team_path,
method: :post) do |f| %>
@ -103,9 +104,11 @@
<% end %>
<% end %>
<% if current_user.teams.length > 1 %>
<li role="separator" class="divider"></li>
<li data-hook="new-team-btn"
role="separator"
class="divider"></li>
<% end %>
<li>
<li data-hook="new-team-btn">
<%= link_to new_team_path do %>
<span class="glyphicon glyphicon-plus"></span>
<%= t('users.settings.teams.index.new_team') %>

View file

@ -190,7 +190,7 @@ class Constants
#=============================================================================
# Application version
APP_VERSION = '1.8.1'.freeze
APP_VERSION = '1.9.0'.freeze
TEXT_EXTRACT_FILE_TYPES = [
'application/pdf',

View file

@ -1001,6 +1001,8 @@ en:
change_module_description: "<i>%{user}</i> changed task <strong>%{module}</strong>'s description."
complete_module: "<i>%{user}</i> completed task <strong>%{module}</strong>."
uncomplete_module: "<i>%{user}</i> uncompleted task <strong>%{module}</strong>."
assign_sample: "<i>%{user}</i> assigned sample(s) <strong>%{samples}</strong> to task(s) <strong>%{tasks}</strong>"
unassign_sample: "<i>%{user}</i> unassigned sample(s) <strong>%{samples}</strong> from task(s) <strong>%{tasks}</strong>"
create_step: "<i>%{user}</i> created Step %{step} <strong>%{step_name}</strong>."
destroy_step: "<i>%{user}</i> deleted Step %{step} <strong>%{step_name}</strong>."
add_comment_to_step: "<i>%{user}</i> commented on Step %{step} <strong>%{step_name}</strong>."
@ -1038,6 +1040,12 @@ en:
start_edit_wopi_file_result: "<i>%{user}</i> started editing File %{file} on Result <strong>%{result}</strong>."
unlock_wopi_file_step: "<i>%{user}</i> closed File %{file} for editing on Step %{step} <strong>%{step_name}</strong>."
unlock_wopi_file_result: "<i>%{user}</i> started editing File %{file} on Result <strong>%{result}</strong>."
load_protocol_from_file: "<i>%{user}</i> loaded protocol <strong>%{protocol}</strong> from file."
load_protocol_from_repository: "<i>%{user}</i> loaded protocol <strong>%{protocol}</strong> from repository."
revert_protocol: "<i>%{user}</i> reverted protocol <strong>%{protocol}</strong> from repository."
create_report: "<i>%{user}</i> created report <strong>%{report}</strong>."
delete_report: "<i>%{user}</i> deleted report <strong>%{report}</strong>."
edit_report: "<i>%{user}</i> edited report <strong>%{report}</strong>."
user_my_modules:
new:
@ -1069,14 +1077,6 @@ en:
create: "Add comment"
create:
success_flash: "Successfully added comment to result."
load_protocol_from_file: "<i>%{user}</i> loaded protocol <strong>%{protocol}</strong> from file."
load_protocol_from_repository: "<i>%{user}</i> loaded protocol <strong>%{protocol}</strong> from repository."
revert_protocol: "<i>%{user}</i> reverted protocol <strong>%{protocol}</strong> from repository."
create_report: "<i>%{user}</i> created report <strong>%{report}</strong>."
delete_report: "<i>%{user}</i> deleted report <strong>%{report}</strong>."
edit_report: "<i>%{user}</i> edited report <strong>%{report}</strong>."
assign_sample: "<i>%{user}</i> assigned sample(s) <strong>%{samples}</strong> to task(s) <strong>%{tasks}</strong>."
unassign_sample: "<i>%{user}</i> unassigned sample(s) <strong>%{samples}</strong> from task(s) <strong>%{tasks}</strong>."
users:
enums:

View file

@ -0,0 +1,29 @@
class AddTeamIdToAssetAndTables < ActiveRecord::Migration
def change
add_column :assets, :team_id, :integer
add_index :assets, :team_id
add_column :tables, :team_id, :integer
add_index :tables, :team_id
Asset.find_each do |asset|
if asset.result
asset.update_columns(
team_id: asset.result.my_module.experiment.project.team_id
)
elsif asset.step
asset.update_columns(team_id: asset.step.protocol.team_id)
end
end
Table.find_each do |table|
if table.result
table.update_columns(
team_id: table.result.my_module.experiment.project.team_id
)
elsif table.step
table.update_columns(team_id: table.step.protocol.team_id)
end
end
end
end