add translationPath option to dropdown-select-multiple filter

This commit is contained in:
2018-01-06 10:09:15 -03:00
parent 8eee5586e7
commit 05d9f7afeb
3 changed files with 12 additions and 4 deletions
@@ -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', ->