* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import CustomValuesFacet from './custom-values-facet';
+import Template from '../templates/facets/issues-projects-facet.hbs';
import { translate, translateWithParameters } from '../../../helpers/l10n';
+import { areThereCustomOrganizations, getOrganization } from '../../../store/organizations/utils';
export default CustomValuesFacet.extend({
+ template: Template,
getUrl () {
return window.baseUrl + '/api/components/search';
getValuesWithLabels () {
const values = this.model.getValues();
const projects = this.options.app.facets.components;
+ const displayOrganizations = areThereCustomOrganizations();
values.forEach(v => {
const uuid = v.val;
let label = '';
+ let organization = null;
if (uuid) {
const project = projects.find(p => p.uuid === uuid);
if (project != null) {
label = project.longName;
+ organization = displayOrganizations && project.organization ?
+ getOrganization(project.organization) : null;
}
}
v.label = label;
+ v.organization = organization;
});
return values;
},
--- /dev/null
+{{> "_issues-facet-header"}}
+
+<div class="search-navigator-facet-list">
+ {{#each values}}
+ <a class="facet search-navigator-facet js-facet" data-value="{{val}}" title="{{#if extra}}({{extra}}) {{/if}}{{default label val}}">
+ <span class="facet-name">{{#if organization}}{{organization.name}}<span class="slash-separator"></span>{{/if}}{{default label val}}</span>
+ <span class="facet-stat">
+ {{#eq ../state.facetMode 'count'}}{{numberShort count}}{{else}}{{formatMeasure count 'SHORT_WORK_DUR'}}{{/eq}}
+ </span>
+ </a>
+ {{/each}}
+
+ <div class="search-navigator-facet-custom-value">
+ <input type="hidden" class="js-custom-value">
+ </div>
+</div>