2017-05-15 18:12:43 -04:00
|
|
|
import IssuableBulkUpdateSidebar from './issuable_bulk_update_sidebar';
|
|
|
|
import IssuableBulkUpdateActions from './issuable_bulk_update_actions';
|
2016-12-13 22:01:05 -05:00
|
|
|
|
2017-10-26 14:03:48 -04:00
|
|
|
export default class IssuableIndex {
|
|
|
|
constructor(pagePrefix) {
|
|
|
|
this.initBulkUpdate(pagePrefix);
|
|
|
|
IssuableIndex.resetIncomingEmailToken();
|
|
|
|
}
|
|
|
|
initBulkUpdate(pagePrefix) {
|
|
|
|
const userCanBulkUpdate = $('.issues-bulk-update').length > 0;
|
|
|
|
const alreadyInitialized = !!this.bulkUpdateSidebar;
|
|
|
|
|
|
|
|
if (userCanBulkUpdate && !alreadyInitialized) {
|
|
|
|
IssuableBulkUpdateActions.init({
|
|
|
|
prefixId: pagePrefix,
|
2016-08-24 07:46:07 -04:00
|
|
|
});
|
2016-10-18 14:03:31 -04:00
|
|
|
|
2017-10-26 14:03:48 -04:00
|
|
|
this.bulkUpdateSidebar = new IssuableBulkUpdateSidebar();
|
2016-07-24 16:45:11 -04:00
|
|
|
}
|
2017-10-26 14:03:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static resetIncomingEmailToken() {
|
|
|
|
$('.incoming-email-token-reset').on('click', (e) => {
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
type: 'PUT',
|
|
|
|
url: $('.incoming-email-token-reset').attr('href'),
|
|
|
|
dataType: 'json',
|
|
|
|
success(response) {
|
2017-08-24 02:20:36 -04:00
|
|
|
$('#issuable_email').val(response.new_address).focus();
|
2017-10-26 14:03:48 -04:00
|
|
|
},
|
|
|
|
beforeSend() {
|
|
|
|
$('.incoming-email-token-reset').text('resetting...');
|
|
|
|
},
|
|
|
|
complete() {
|
|
|
|
$('.incoming-email-token-reset').text('reset it');
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|