mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-30 11:41:19 +08:00
Adding placeholders to filters
This commit is contained in:
parent
c2e1e85913
commit
1d244508f5
4 changed files with 18 additions and 5 deletions
|
@ -2,6 +2,7 @@
|
||||||
$.fn.extend({
|
$.fn.extend({
|
||||||
select2Multiple: function(config = {}) {
|
select2Multiple: function(config = {}) {
|
||||||
// Adding ID to each block
|
// Adding ID to each block
|
||||||
|
var placeholder = this[0].dataset.placeholder || '';
|
||||||
if (this.next().find('.select2-selection').length > 0) return this;
|
if (this.next().find('.select2-selection').length > 0) return this;
|
||||||
var templateSelection = (state) => {
|
var templateSelection = (state) => {
|
||||||
return $('<span class="select2-block-body" data-select-id="' + state.id + '">'
|
return $('<span class="select2-block-body" data-select-id="' + state.id + '">'
|
||||||
|
@ -12,6 +13,7 @@ $.fn.extend({
|
||||||
closeOnSelect: false,
|
closeOnSelect: false,
|
||||||
multiple: true,
|
multiple: true,
|
||||||
ajax: config.ajax,
|
ajax: config.ajax,
|
||||||
|
placeholder: placeholder,
|
||||||
templateSelection: templateSelection,
|
templateSelection: templateSelection,
|
||||||
sorter: function(data) {
|
sorter: function(data) {
|
||||||
return data.sort(function(a, b) {
|
return data.sort(function(a, b) {
|
||||||
|
|
|
@ -16,6 +16,10 @@
|
||||||
width: calc(100% - 26px)
|
width: calc(100% - 26px)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.select2-search__field {
|
||||||
|
min-width: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
.select2-selection__choice {
|
.select2-selection__choice {
|
||||||
background: $color-concrete;
|
background: $color-concrete;
|
||||||
border: 1px solid $color-alto;
|
border: 1px solid $color-alto;
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
'data-select-all-button': t('global_activities.index.all_teams_btn'),
|
'data-select-all-button': t('global_activities.index.all_teams_btn'),
|
||||||
'data-select-multiple-name': t('global_activities.index.l_teams'),
|
'data-select-multiple-name': t('global_activities.index.l_teams'),
|
||||||
'data-select-multiple-all-selected': t('global_activities.index.all_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>
|
||||||
</div>
|
</div>
|
||||||
|
@ -49,7 +50,8 @@
|
||||||
'data-select-multiple-name': t('global_activities.index.l_activities'),
|
'data-select-multiple-name': t('global_activities.index.l_activities'),
|
||||||
'data-select-multiple-all-selected': t('global_activities.index.all_activities'),
|
'data-select-multiple-all-selected': t('global_activities.index.all_activities'),
|
||||||
'data-dropdown-position': 'left',
|
'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>
|
||||||
</div>
|
</div>
|
||||||
|
@ -63,7 +65,8 @@
|
||||||
'data-select-all': 'true',
|
'data-select-all': 'true',
|
||||||
'data-select-multiple-name': t('global_activities.index.l_users'),
|
'data-select-multiple-name': t('global_activities.index.l_users'),
|
||||||
'data-select-multiple-all-selected': t('global_activities.index.all_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>
|
||||||
</div>
|
</div>
|
||||||
|
@ -72,6 +75,6 @@
|
||||||
<h4 class="title"><%= t('global_activities.index.object') %></h4>
|
<h4 class="title"><%= t('global_activities.index.object') %></h4>
|
||||||
<h6 class="clear"><%= t('global_activities.index.clear') %></h6>
|
<h6 class="clear"><%= t('global_activities.index.clear') %></h6>
|
||||||
<div class="select-container">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -27,6 +27,10 @@ en:
|
||||||
all_activities_btn: "Select All Activities"
|
all_activities_btn: "Select All Activities"
|
||||||
l_activities: "activities"
|
l_activities: "activities"
|
||||||
clear_filters: "Clear filters"
|
clear_filters: "Clear filters"
|
||||||
|
select_teams: "Select Teams"
|
||||||
|
select_activity_types: "Select Activity types"
|
||||||
|
select_users: "Select Users"
|
||||||
|
select_objects: "Select Objects"
|
||||||
content:
|
content:
|
||||||
create_project_html: "%{user} created project %{project}."
|
create_project_html: "%{user} created project %{project}."
|
||||||
rename_project_html: "%{user} renamed project %{project}."
|
rename_project_html: "%{user} renamed project %{project}."
|
||||||
|
@ -190,7 +194,7 @@ en:
|
||||||
create_inventory: "Inventory created"
|
create_inventory: "Inventory created"
|
||||||
rename_inventory: "Inventory renamed"
|
rename_inventory: "Inventory renamed"
|
||||||
delete_inventory: "Inventory deleted"
|
delete_inventory: "Inventory deleted"
|
||||||
create_item_inventory: Inventory item created"
|
create_item_inventory: "Inventory item created"
|
||||||
edit_item_inventory: "Inventory item edited"
|
edit_item_inventory: "Inventory item edited"
|
||||||
delete_item_inventory: "Inventory item deleted"
|
delete_item_inventory: "Inventory item deleted"
|
||||||
create_column_inventory: "Inventory column created"
|
create_column_inventory: "Inventory column created"
|
||||||
|
|
Loading…
Reference in a new issue