Adding placeholders to filters

This commit is contained in:
Anton Ignatov 2019-03-27 11:19:58 +01:00
parent c2e1e85913
commit 1d244508f5
4 changed files with 18 additions and 5 deletions

View file

@ -2,6 +2,7 @@
$.fn.extend({
select2Multiple: function(config = {}) {
// Adding ID to each block
var placeholder = this[0].dataset.placeholder || '';
if (this.next().find('.select2-selection').length > 0) return this;
var templateSelection = (state) => {
return $('<span class="select2-block-body" data-select-id="' + state.id + '">'
@ -12,6 +13,7 @@ $.fn.extend({
closeOnSelect: false,
multiple: true,
ajax: config.ajax,
placeholder: placeholder,
templateSelection: templateSelection,
sorter: function(data) {
return data.sort(function(a, b) {

View file

@ -16,6 +16,10 @@
width: calc(100% - 26px)
}
.select2-search__field {
min-width: 150px;
}
.select2-selection__choice {
background: $color-concrete;
border: 1px solid $color-alto;

View file

@ -6,7 +6,8 @@
'data-select-all-button': t('global_activities.index.all_teams_btn'),
'data-select-multiple-name': t('global_activities.index.l_teams'),
'data-select-multiple-all-selected': t('global_activities.index.all_teams'),
'data-dropdown-position': 'left'
'data-dropdown-position': 'left',
'data-placeholder': t('global_activities.index.select_teams')
} %>
</div>
</div>
@ -49,7 +50,8 @@
'data-select-multiple-name': t('global_activities.index.l_activities'),
'data-select-multiple-all-selected': t('global_activities.index.all_activities'),
'data-dropdown-position': 'left',
'data-select-by-group': 'true'
'data-select-by-group': 'true',
'data-placeholder': t('global_activities.index.select_activity_types')
} %>
</div>
</div>
@ -63,7 +65,8 @@
'data-select-all': 'true',
'data-select-multiple-name': t('global_activities.index.l_users'),
'data-select-multiple-all-selected': t('global_activities.index.all_users'),
'data-dropdown-position': 'left'
'data-dropdown-position': 'left',
'data-placeholder': t('global_activities.index.select_users')
} %>
</div>
</div>
@ -72,6 +75,6 @@
<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"></select>
<select name="subject" data-select-all="false" data-dropdown-position="left" data-placeholder="<%= t('global_activities.index.select_objects') %>"></select>
</div>
</div>

View file

@ -27,6 +27,10 @@ en:
all_activities_btn: "Select All Activities"
l_activities: "activities"
clear_filters: "Clear filters"
select_teams: "Select Teams"
select_activity_types: "Select Activity types"
select_users: "Select Users"
select_objects: "Select Objects"
content:
create_project_html: "%{user} created project %{project}."
rename_project_html: "%{user} renamed project %{project}."
@ -190,7 +194,7 @@ en:
create_inventory: "Inventory created"
rename_inventory: "Inventory renamed"
delete_inventory: "Inventory deleted"
create_item_inventory: Inventory item created"
create_item_inventory: "Inventory item created"
edit_item_inventory: "Inventory item edited"
delete_item_inventory: "Inventory item deleted"
create_column_inventory: "Inventory column created"