Add issues filters reset btn (ES6-ified).
(Also refactored checkChanged slightly.)
This commit is contained in:
parent
fda07a2524
commit
1750fe3210
|
@ -107,6 +107,7 @@ v 8.11.3
|
|||
- Fix external issue tracker "Issues" link leading to 404s
|
||||
- Don't try to show merge conflict resolution info if a merge conflict contains non-UTF-8 characters
|
||||
- Automatically expand hidden discussions when accessed by a permalink !5585 (Mike Greiling)
|
||||
- Issues filters reset button
|
||||
|
||||
v 8.11.2
|
||||
- Show "Create Merge Request" widget for push events to fork projects on the source project. !5978
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
Issuable.initTemplates();
|
||||
Issuable.initSearch();
|
||||
Issuable.initChecks();
|
||||
Issuable.initResetFilters();
|
||||
return Issuable.initLabelFilterRemove();
|
||||
},
|
||||
initTemplates: function() {
|
||||
|
@ -55,6 +56,17 @@
|
|||
return Turbolinks.visit(issuesUrl);
|
||||
};
|
||||
})(this),
|
||||
initResetFilters: function() {
|
||||
$('.reset-filters').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
const target = e.target;
|
||||
const $form = $(target).parents('.js-filter-form');
|
||||
const baseIssuesUrl = target.href;
|
||||
|
||||
$form.attr('action', baseIssuesUrl);
|
||||
Turbolinks.visit(baseIssuesUrl);
|
||||
});
|
||||
},
|
||||
initChecks: function() {
|
||||
this.issuableBulkActions = $('.bulk-update').data('bulkActions');
|
||||
$('.check_all_issues').off('click').on('click', function() {
|
||||
|
@ -64,19 +76,22 @@
|
|||
return $('.selected_issue').off('change').on('change', Issuable.checkChanged.bind(this));
|
||||
},
|
||||
checkChanged: function() {
|
||||
var checked_issues, ids;
|
||||
checked_issues = $('.selected_issue:checked');
|
||||
if (checked_issues.length > 0) {
|
||||
ids = $.map(checked_issues, function(value) {
|
||||
const $checkedIssues = $('.selected_issue:checked');
|
||||
const $updateIssuesIds = $('#update_issues_ids');
|
||||
const $issuesOtherFilters = $('.issues-other-filters');
|
||||
const $issuesBulkUpdate = $('.issues_bulk_update');
|
||||
|
||||
if ($checkedIssues.length > 0) {
|
||||
let ids = $.map($checkedIssues, function(value) {
|
||||
return $(value).data('id');
|
||||
});
|
||||
$('#update_issues_ids').val(ids);
|
||||
$('.issues-other-filters').hide();
|
||||
$('.issues_bulk_update').show();
|
||||
$updateIssuesIds.val(ids);
|
||||
$issuesOtherFilters.hide();
|
||||
$issuesBulkUpdate.show();
|
||||
} else {
|
||||
$('#update_issues_ids').val([]);
|
||||
$('.issues_bulk_update').hide();
|
||||
$('.issues-other-filters').show();
|
||||
$updateIssuesIds.val([]);
|
||||
$issuesBulkUpdate.hide();
|
||||
$issuesOtherFilters.show();
|
||||
this.issuableBulkActions.willUpdateLabels = false;
|
||||
}
|
||||
return true;
|
|
@ -1,6 +1,10 @@
|
|||
.filter-item {
|
||||
margin-right: 6px;
|
||||
vertical-align: top;
|
||||
|
||||
&.reset-filters {
|
||||
padding: 7px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: $screen-sm-min) {
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
.filter-item.inline.labels-filter
|
||||
= render "shared/issuable/label_dropdown"
|
||||
|
||||
.filter-item.inline.reset-filters
|
||||
%a{href: page_filter_path(without: [:assignee_id, :author_id, :milestone_title, :label_name, :issue_search])} Reset filters
|
||||
|
||||
.pull-right
|
||||
- if controller.controller_name == 'boards'
|
||||
#js-boards-seach.issue-boards-search
|
||||
|
|
Loading…
Reference in New Issue