From: Stas Vilchik Date: Thu, 5 Feb 2015 15:18:40 +0000 (+0100) Subject: SONAR-6150 It should be possible to select a custom author in the facet on Issues... X-Git-Tag: 5.1-RC1~394 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=95de6de818b61776d420edf82ff4638001b69f0e;p=sonarqube.git SONAR-6150 It should be possible to select a custom author in the facet on Issues page --- diff --git a/server/sonar-web/src/main/coffee/issues/facets-view.coffee b/server/sonar-web/src/main/coffee/issues/facets-view.coffee index a116b380b90..d5b1f845903 100644 --- a/server/sonar-web/src/main/coffee/issues/facets-view.coffee +++ b/server/sonar-web/src/main/coffee/issues/facets-view.coffee @@ -15,6 +15,7 @@ define [ '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' ], ( @@ -34,6 +35,7 @@ define [ FileFacet ReporterFacet LanguageFacet + AuthorFacet IssueKeyFacet ContextFacet ) -> @@ -55,6 +57,7 @@ define [ 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 diff --git a/server/sonar-web/src/main/coffee/issues/facets/author-facet.coffee b/server/sonar-web/src/main/coffee/issues/facets/author-facet.coffee new file mode 100644 index 00000000000..73a56c66886 --- /dev/null +++ b/server/sonar-web/src/main/coffee/issues/facets/author-facet.coffee @@ -0,0 +1,27 @@ +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 } }