diff --git a/webcompat/static/js/lib/issue-list.js b/webcompat/static/js/lib/issue-list.js index 159c42c1b..76aaf0b99 100644 --- a/webcompat/static/js/lib/issue-list.js +++ b/webcompat/static/js/lib/issue-list.js @@ -293,7 +293,7 @@ issueList.IssueView = Backbone.View.extend({ events: { 'click .js-issue-label': 'labelSearch', }, - _filterRegex: /&*stage=(new|needscontact|needsdiagnosis|contactready|sitewait|closed)&*/i, + _filterRegex: /(stage=(?:new|status-needscontact|status-needsdiagnosis|status-contactready|status-sitewait|status-closed))/ig, _isLoggedIn: $('body').data('username'), _loadingIndicator: $('.js-loader'), _nextButton: $('.js-pagination-next'), diff --git a/webcompat/static/js/lib/labels.js b/webcompat/static/js/lib/labels.js index c65bb4b93..c1447180b 100644 --- a/webcompat/static/js/lib/labels.js +++ b/webcompat/static/js/lib/labels.js @@ -31,7 +31,7 @@ issues.LabelsView = Backbone.View.extend({ subTemplate: _.template([ '<% _.each(labels, function(label) { %>', '', - '<%= label.name %>', + '<%= label.name.replace(/(browser|status)-/, "") %>', '', '<% }); %>'].join('')), render: function() { diff --git a/webcompat/static/js/lib/models/issue.js b/webcompat/static/js/lib/models/issue.js index 666c2113a..10264593e 100644 --- a/webcompat/static/js/lib/models/issue.js +++ b/webcompat/static/js/lib/models/issue.js @@ -83,6 +83,20 @@ }); }, updateLabels: function(labelsArray) { + // maybe this should be in a shared config file outside of python/JS + var statusLabels = ['contactready', 'needscontact', 'needsdiagnosis', 'sitewait', ' closed-duplicate', 'closed-fixed', 'closed-invalid']; + var browserLabels = ['chrome', 'firefox', 'ie', 'opera', 'safari', 'vivaldi']; + var osLabels = ['android', 'fxos', 'ios', 'linux', 'mac', 'win'] + // we check if we need to append the correct string before sending stuff back + for (var i = labelsArray.length - 1; i >= 0; i--) { + if (statusLabels.indexOf(labelsArray[i]) != -1) { + labelsArray[i] = 'status-'.concat(labelsArray[i]) + } else if (browserLabels.indexOf(labelsArray[i]) != -1) { + labelsArray[i] = 'browser-'.concat(labelsArray[i]) + } else if (osLabels.indexOf(labelsArray[i]) != -1) { + labelsArray[i] = 'os-'.concat(labelsArray[i]) + }; + }; var self = this; if (!$.isArray(labelsArray)) { return; diff --git a/webcompat/templates/issue-list.html b/webcompat/templates/issue-list.html index e86c5f571..b576601f0 100644 --- a/webcompat/templates/issue-list.html +++ b/webcompat/templates/issue-list.html @@ -75,7 +75,7 @@
<% _.each(issue.labels, function(label) { %> - <%= label.name %> + <%= label.name.replace(/(browser|status)-/, '') %> <% }); %>
diff --git a/webcompat/templates/issue.html b/webcompat/templates/issue.html index 0913e68c4..8035a0ad3 100644 --- a/webcompat/templates/issue.html +++ b/webcompat/templates/issue.html @@ -30,7 +30,7 @@

<% _.each(labels, function(label) { %> - <%= label.name %> + <%= label.name.replace(/(browser|status)-/, '') %> <% }); %> @@ -118,9 +118,9 @@

<% _.each(labels, function(label) { %> <% }); %>