2016-02-12 23:52:43 +08:00
|
|
|
module SamplesHelper
|
|
|
|
def all_custom_fields
|
2017-01-25 16:48:49 +08:00
|
|
|
CustomField.where(team_id: @team).order(:created_at)
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def num_of_columns
|
|
|
|
# Magic numbers, woohoo:
|
|
|
|
# - 1 for checkbox column,
|
|
|
|
# - 6 corresponds to initial number of basic sample columns (without
|
|
|
|
# custom)
|
|
|
|
1 + 6 + all_custom_fields.count
|
|
|
|
end
|
|
|
|
|
|
|
|
def form_submit_link
|
2016-07-29 21:47:41 +08:00
|
|
|
if module_page?
|
2016-02-12 23:52:43 +08:00
|
|
|
assign_samples_my_module_path(@my_module)
|
2016-07-29 22:20:35 +08:00
|
|
|
elsif project_page?
|
2016-02-12 23:52:43 +08:00
|
|
|
delete_samples_project_path(@project)
|
2017-01-06 19:56:14 +08:00
|
|
|
elsif experiment_page?
|
|
|
|
delete_samples_experiment_path(@experiment)
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|