add translationPath option to dropdown-select-multiple filter
This commit is contained in:
@@ -8,6 +8,7 @@ export default Ember.Component.extend
|
||||
eager_filter: false # filter on single select
|
||||
has_active_filter_value: Ember.computed.bool 'selected.length'
|
||||
search_string: ''
|
||||
translationPath: '' # if set indicating a flat select requiring translated values
|
||||
search_placeholder: 'Search...' #.htmlSafe()
|
||||
filtered_options: Ember.computed 'options.length', 'search_string', ->
|
||||
return @get('options') unless @get('search_string.length') > 1
|
||||
@@ -31,6 +32,12 @@ export default Ember.Component.extend
|
||||
result_html += '<br><hr>' if result_html
|
||||
result_html += get(option, labelPath)
|
||||
result_html
|
||||
else if translationPath = @get('translationPath')
|
||||
result_html = ''
|
||||
@get('selected').forEach (value) ->
|
||||
result_html += '<br><hr>' if result_html
|
||||
result_html += t(value, scope: translationPath, default: value)
|
||||
result_html
|
||||
else
|
||||
@get('selected').join('<br><hr>')
|
||||
selected_display: Ember.computed 'selected.length', ->
|
||||
|
||||
@@ -15,6 +15,8 @@ ui-dropdown class='right basic labeled icon' action='nothing'
|
||||
each filtered_options as |option|
|
||||
if labelPath
|
||||
ui-checkbox class='item' checked=(contains (get option valuePath) selected) label=(get option labelPath) onChange=(action 'toggle_filter' option)
|
||||
else if translationPath
|
||||
ui-checkbox class='item' checked=(contains option selected) label=(t option scope=translationPath) onChange=(action 'toggle_filter' option)
|
||||
else
|
||||
ui-checkbox class='item' checked=(contains option selected) label=option onChange=(action 'toggle_filter' option)
|
||||
if selected.length
|
||||
|
||||
@@ -6,8 +6,7 @@ ui-dropdown class='right basic labeled icon' action='nothing'
|
||||
.item{action 'set_filter' option}
|
||||
if labelPath
|
||||
= get option labelPath
|
||||
else
|
||||
if translationPath
|
||||
else if translationPath
|
||||
= t option scope=translationPath
|
||||
else
|
||||
= option
|
||||
|
||||
Reference in New Issue
Block a user