'issues/facets/file-facet'
'issues/facets/reporter-facet'
'issues/facets/language-facet'
+ 'issues/facets/author-facet'
'issues/facets/issue-key-facet'
'issues/facets/context-facet'
], (
FileFacet
ReporterFacet
LanguageFacet
+ AuthorFacet
IssueKeyFacet
ContextFacet
) ->
when 'fileUuids' then FileFacet
when 'reporters' then ReporterFacet
when 'languages' then LanguageFacet
+ when 'authors' then AuthorFacet
when 'issues' then IssueKeyFacet
when 'context' then ContextFacet
else BaseFacet
--- /dev/null
+define [
+ 'issues/facets/custom-values-facet'
+], (
+ CustomValuesFacet
+) ->
+
+
+ class extends CustomValuesFacet
+
+ getUrl: ->
+ "#{baseUrl}/api/issues/authors"
+
+
+ prepareSearch: ->
+ @$('.js-custom-value').select2
+ placeholder: 'Search...'
+ minimumInputLength: 2
+ allowClear: false
+ formatNoMatches: -> t 'select2.noMatches'
+ formatSearching: -> t 'select2.searching'
+ formatInputTooShort: -> tp 'select2.tooShort', 2
+ width: '100%'
+ ajax:
+ quietMillis: 300
+ url: @getUrl()
+ data: (term) -> { q: term, ps: 25 }
+ results: (data) -> { more: false, results: data.authors.map (author) -> { id: author, text: author } }