Adding localization for activity name and activity group (#1598)

This commit is contained in:
aignatov-bio 2019-03-27 10:33:33 +01:00 committed by GitHub
parent 1b19e67c07
commit c2e1e85913
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 126 additions and 3 deletions

View file

@ -12,7 +12,20 @@ $.fn.extend({
closeOnSelect: false,
multiple: true,
ajax: config.ajax,
templateSelection: templateSelection
templateSelection: templateSelection,
sorter: function(data) {
return data.sort(function(a, b) {
var from = a.text.toLowerCase();
var to = b.text.toLowerCase();
var result = 0;
if (from > to) {
result = 1;
} else if (from < to) {
result = -1;
}
return result;
});
}
});
// Add dynamic size
select2.next().css('width', '100%');

View file

@ -31,7 +31,7 @@ class Activity < ApplicationRecord
def self.activity_types_list
activity_list = type_ofs.map do |key, value|
[
key.tr('_', ' ').capitalize,
I18n.t("global_activities.activity_name.#{key}"),
value
]
end.sort_by { |a| a[0] }
@ -40,7 +40,7 @@ class Activity < ApplicationRecord
result = {}
activity_groups.each do |key, activities|
group_name = key.to_s.tr('_', ' ').capitalize
group_name = I18n.t("global_activities.activity_group.#{key}")
result[group_name] = []
activities.each do |activity_id|
activity_hash = activity_list.select { |activity| activity[1] == activity_id }[0]

View file

@ -118,3 +118,113 @@ en:
change_users_role_on_team_html: "%{user} changed user %{user_changed}'s role in team %{team} to %{role}"
export_projects_html: "%{user} exported project(s) %{projects} to .zip"
export_inventory_items_html: "%{user} exported inventory item(s) from %{repository}"
activity_name:
create_project: "Project created"
rename_project: "Project renamed"
change_project_visibility: "Project visibility changed"
archive_project: "Project archived"
restore_project: "Project restored"
add_comment_to_project: "Project comment added"
edit_project_comment: "Project comment edited"
delete_project_comment: "Project comment deleted"
create_report: "Report created"
edit_report: "Report edited"
delete_report: "Report deleted"
add_result: "Result added"
edit_result: "Result edited"
add_comment_to_result: "Result comment added"
edit_result_comment: "Result comment edited"
delete_result_comment: "Result comment deleted"
archive_result: "Result archived"
destroy_result: "Result deleted"
create_module: "Task created"
clone_module: "Task copied"
archive_module: "Task archived"
restore_module: "Task restored"
add_comment_to_module: "Task comment added"
edit_module_comment: "Task comment edited"
delete_module_comment: "Task comment deleted"
change_module_description: "Task description edited"
create_step: "Task step added"
edit_step: "Task step edited"
destroy_step: "Task step deleted"
load_protocol_to_task_from_repository: "Task protocol loaded from repository"
load_protocol_to_task_from_file: "Task protocol loaded from file"
update_protocol_in_task_from_repository: "Task protocol updated from repository"
check_step_checklist_item: "Task step checklist completed"
uncheck_step_checklist_item: "Task step checklist uncompleted"
add_comment_to_step: "Task step comment added"
edit_step_comment: "Task step comment edited"
delete_step_comment: "Task step comment deleted"
complete_step: "Task step completed"
uncomplete_step: "Task step uncompleted"
uncomplete_task: "Task uncompleted"
complete_task: "Task completed"
assign_repository_record: "Task inventory assigned"
unassign_repository_record: "Task inventory unassigned"
assign_user_to_project: "User assigned to Project"
unassign_user_from_project: "User removed from Project"
change_user_role_on_project: "User role changed on Project"
assign_user_to_module: "User assigned to Task"
unassign_user_from_module: "User removed from Task"
create_experiment: "Experiment created"
edit_experiment: "Experiment edited"
move_experiment: "Experiment moved"
clone_experiment: "Experiment copied as template"
archive_experiment: "Experiment archived"
edit_wopi_file_on_result: "Office online file on result edited"
edit_wopi_file_on_step: "Office online file on step edited"
restore_experiment: "Experiment restored"
rename_task: "Task renamed"
move_task: "Task moved"
archive_task: "Task archived"
set_task_due_date: "Task due date set"
change_task_due_date: "Task due date changed"
remove_task_due_date: "Task due date removed"
add_task_tag: "Task tag added"
edit_task_tag: "Task tag edited"
remove_task_tag: "Task tag removed"
sign_and_lock_task: "Task signed and locked"
cosign_and_lock_task: "Task co-signed and locked"
unlock_task: "Task unlocked"
create_inventory: "Inventory created"
rename_inventory: "Inventory renamed"
delete_inventory: "Inventory deleted"
create_item_inventory: Inventory item created"
edit_item_inventory: "Inventory item edited"
delete_item_inventory: "Inventory item deleted"
create_column_inventory: "Inventory column created"
edit_column_inventory: "Inventory column edited"
delete_column_inventory: "Inventory column deleted"
update_protocol_in_repository_from_task: "Protocol updated from task"
create_protocol_in_repository: "Protocol created"
add_step_to_protocol_repository: "Step added"
edit_step_in_protocol_repository: "Step edited"
delete_step_in_protocol_repository: "Step deleted"
edit_description_in_protocol_repository: "Description edited"
edit_keywords_in_protocol_repository: "Keywords edited"
edit_authors_in_protocol_repository: "Authors edited"
archive_protocol_in_repository: "Protocol archived"
restore_protocol_in_repository: "Protocol restored from archive"
move_protocol_in_repository: "Protocol moved"
import_protocol_in_repository: "Protocol imported from file"
export_protocol_in_repository: "Protocol exported"
invite_user_to_team: "User invited to team"
remove_user_from_team: "User removed from team"
change_users_role_on_team: "Users role changed on team"
export_projects: "Projects exported"
export_inventory_items: "Inventory items exported"
export_audit_trails: "Audit trails exported"
export_system_logs: "System logs exported"
activity_group:
projects: "Projects"
task_results: "Task results"
task: "Task"
task_protocol: "Task protocol"
task_inventory: "Task inventory"
experiment: "Experiment"
reports: "Reports"
inventories: "Inventories"
protocol_repository: "Protocol repository"
team: "Team"
exports: "Exports"