Add step position for steps in Protocol repository. Add default value for blank names also.

This commit is contained in:
Urban Rotnik 2019-03-29 15:12:15 +01:00
parent b91f08fe99
commit 0ed96d68de
2 changed files with 17 additions and 2 deletions

View file

@ -45,9 +45,11 @@ module GlobalActivitiesHelper
path = obj.archived? ? projects_path : project_path(obj)
when Experiment
return current_value unless obj.navigable?
path = obj.archived? ? experiment_archive_project_path(obj.project) : canvas_experiment_path(obj)
when MyModule
return current_value unless obj.navigable?
path = obj.archived? ? module_archive_experiment_path(obj.experiment) : protocols_my_module_path(obj)
when Protocol
if obj.in_repository?
@ -59,16 +61,28 @@ module GlobalActivitiesHelper
end
when Result
return current_value unless obj.navigable?
path = obj.archived? ? archive_my_module_path(obj.my_module) : results_my_module_path(obj.my_module)
when Step
if obj.protocol.in_repository?
path = protocols_path
elsif obj.protocol.my_module.navigable?
path = protocols_my_module_path(obj.my_module)
else
return current_value
end
else
return current_value
end
route_to_other_team(path, obj, current_value)
route_to_other_team(path, team, current_value)
end
def generate_name(message_item)
obj = message_item[:type].constantize.find_by_id(message_item[:id])
return message_item[:value] unless obj
obj.public_send(message_item[:getter] || 'name')
value = obj.public_send(message_item[:getter] || 'name')
value = t('global_activities.index.no_name') if value.blank?
value
end
end

View file

@ -32,6 +32,7 @@ en:
select_users: "Select Users"
select_objects: "Select Objects"
deselect_all_objects: "Deselect All Objects"
no_name: "(unnamed)"
content:
create_project_html: "%{user} created project %{project}."
rename_project_html: "%{user} renamed project %{project}."