Adding deselect button to objects filter and some localizations fix (#1608)

This commit is contained in:
aignatov-bio 2019-03-29 09:04:58 +01:00 committed by GitHub
parent 88b4ca0798
commit ce7bbd6b07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 10 deletions

View file

@ -33,6 +33,11 @@ $.fn.extend({
// Add dynamic size
select2.next().css('width', '100%');
//Placeholder fix for ajax fields
if (config.ajax){
select2.next().find('.select2-search__field').css('min-width', '150px');
}
// unlimited size
if (config.unlimitedSize) {
this[0].dataset.unlimitedSize = true;
@ -68,7 +73,10 @@ $.fn.extend({
$('<div class="select2_select_all btn btn-default"><strong>' + selectElement.dataset.selectAllButton + '</strong></div>').prependTo('.select2-dropdown').on('click', function() {
var scrollTo = $('.select2-results__options').scrollTop();
var elementsToSelect = $.map($(selectElement).find('option'), e => e.value);
if ($(selectElement).find('option:selected').length === elementsToSelect.length) elementsToSelect = [];
if (
$(selectElement).find('option:selected').length === elementsToSelect.length
|| config.ajax
) elementsToSelect = [];
$(selectElement).val(elementsToSelect).trigger('change');
$(selectElement).select2('close');
$(selectElement).select2('open');

View file

@ -17,7 +17,6 @@
}
.select2-search__field {
min-width: 150px;
&::placeholder{
color: $color-silver-chalice;

View file

@ -75,6 +75,8 @@
<h4 class="title"><%= t('global_activities.index.object') %></h4>
<h6 class="clear"><%= t('global_activities.index.clear') %></h6>
<div class="select-container">
<select name="subject" data-select-all="false" data-dropdown-position="left" data-placeholder="<%= t('global_activities.index.select_objects') %>"></select>
<select name="subject" data-select-all="false" data-dropdown-position="left" data-placeholder="<%= t('global_activities.index.select_objects') %>"
data-select-all-button= "<%= t('global_activities.index.deselect_all_objects') %>"
></select>
</div>
</div>

View file

@ -31,6 +31,7 @@ en:
select_activity_types: "Select Activity types"
select_users: "Select Users"
select_objects: "Select Objects"
deselect_all_objects: "Deselect All Objects"
content:
create_project_html: "%{user} created project %{project}."
rename_project_html: "%{user} renamed project %{project}."
@ -40,9 +41,9 @@ en:
add_comment_to_project_html: "%{user} commented on project %{project}."
edit_project_comment_html: "%{user} edited comment on project %{project}."
delete_project_comment_html: "%{user} deleted comment on project %{project}."
create_report_html: "%{user} created report %{report}."
edit_report_html: "%{user} edited report %{report}."
delete_report_html: "%{user} deleted report %{report}."
create_report_html: "%{user} created report <strong>%{report}</strong>."
edit_report_html: "%{user} edited report <strong>%{report}</strong>."
delete_report_html: "%{user} deleted report <strong>%{report}</strong>."
add_result_html: "%{user} added %{type_of_result} result %{result}."
edit_result_html: "%{user} edited %{type_of_result} result %{result}."
add_comment_to_result_html: "%{user} commented on result %{result}."
@ -63,8 +64,8 @@ en:
load_protocol_to_task_from_repository_html: "%{user} loaded protocol %{protocol} to task from Protocol repository %{protocol_repository}."
load_protocol_to_task_from_file_html: "%{user} loaded protocol %{protocol} to task from file."
update_protocol_in_task_from_repository_html: "%{user} updated protocol %{protocol} on task with version from Protocol repository %{protocol_repository}."
check_step_checklist_item_html: "%{user} completed checklist item %{checkbox} (%{num_completed}/%{num_all} completed) in protocol %{protocol}'s step %{step_position} %{step}."
uncheck_step_checklist_item_html: "%{user} uncompleted checklist item %{checkbox} (%{num_completed}/%{num_all} completed) in protocol %{protocol}'s step %{step_position} %{step}."
check_step_checklist_item_html: "%{user} completed checklist item <strong>%{checkbox}</strong> (%{num_completed}/%{num_all} completed) in protocol %{protocol}'s step %{step_position} %{step}."
uncheck_step_checklist_item_html: "%{user} uncompleted checklist item <strong>%{checkbox}</strong> (%{num_completed}/%{num_all} completed) in protocol %{protocol}'s step %{step_position} %{step}."
add_comment_to_step_html: "%{user} commented on protocol %{protocol}'s step %{step_position} %{step}."
edit_step_comment_html: "%{user} edited comment on protocol %{protocol}'s step %{step_position} %{step}."
delete_step_comment_html: "%{user} deleted comment on protocol %{protocol}'s step %{step_position} %{step}."
@ -93,8 +94,8 @@ en:
set_task_due_date_html: "%{user} set due date %{my_module_duedate} on task %{my_module}"
change_task_due_date_html: "%{user} changed due date %{my_module_duedate} on task %{my_module}"
remove_task_due_date_html: "%{user} removed due date %{my_module_duedate} on task %{my_module}"
add_task_tag_html: "%{user} added tag %{tag} to task %{my_module}"
remove_task_tag_html: "%{user} removed tag %{tag} from task %{my_module}"
add_task_tag_html: "%{user} added tag <strong>%{tag}</strong> to task %{my_module}"
remove_task_tag_html: "%{user} removed tag <strong>%{tag}</strong> from task %{my_module}"
create_inventory_html: "%{user} created inventory %{repository}"
rename_inventory_html: "%{user} renamed inventory %{repository}"
delete_inventory_html: "%{user} deleted inventory %{repository}"