Enable eslint in star and remove from main.js
This commit is contained in:
parent
a6b33275c0
commit
696ffac0ec
2 changed files with 21 additions and 20 deletions
|
@ -116,7 +116,6 @@ import './right_sidebar';
|
||||||
import './search';
|
import './search';
|
||||||
import './search_autocomplete';
|
import './search_autocomplete';
|
||||||
import './smart_interval';
|
import './smart_interval';
|
||||||
import './star';
|
|
||||||
import './subscription';
|
import './subscription';
|
||||||
import './subscription_select';
|
import './subscription_select';
|
||||||
import initBreadcrumbs from './breadcrumb';
|
import initBreadcrumbs from './breadcrumb';
|
||||||
|
|
|
@ -1,27 +1,29 @@
|
||||||
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-unused-vars, one-var, no-var, one-var-declaration-per-line, prefer-arrow-callback, no-new, max-len */
|
|
||||||
import Flash from './flash';
|
import Flash from './flash';
|
||||||
import { __, s__ } from './locale';
|
import { __, s__ } from './locale';
|
||||||
|
|
||||||
export default class Star {
|
export default class Star {
|
||||||
constructor() {
|
constructor() {
|
||||||
$('.project-home-panel .toggle-star').on('ajax:success', function(e, data, status, xhr) {
|
$('.project-home-panel .toggle-star')
|
||||||
var $starIcon, $starSpan, $this, toggleStar;
|
.on('ajax:success', function handleSuccess(e, data) {
|
||||||
$this = $(this);
|
const $this = $(this);
|
||||||
$starSpan = $this.find('span');
|
const $starSpan = $this.find('span');
|
||||||
$starIcon = $this.find('i');
|
const $starIcon = $this.find('i');
|
||||||
toggleStar = function(isStarred) {
|
|
||||||
$this.parent().find('.star-count').text(data.star_count);
|
function toggleStar(isStarred) {
|
||||||
if (isStarred) {
|
$this.parent().find('.star-count').text(data.star_count);
|
||||||
$starSpan.removeClass('starred').text(s__('StarProject|Star'));
|
if (isStarred) {
|
||||||
$starIcon.removeClass('fa-star').addClass('fa-star-o');
|
$starSpan.removeClass('starred').text(s__('StarProject|Star'));
|
||||||
} else {
|
$starIcon.removeClass('fa-star').addClass('fa-star-o');
|
||||||
$starSpan.addClass('starred').text(__('Unstar'));
|
} else {
|
||||||
$starIcon.removeClass('fa-star-o').addClass('fa-star');
|
$starSpan.addClass('starred').text(__('Unstar'));
|
||||||
|
$starIcon.removeClass('fa-star-o').addClass('fa-star');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
toggleStar($starSpan.hasClass('starred'));
|
toggleStar($starSpan.hasClass('starred'));
|
||||||
}).on('ajax:error', function(e, xhr, status, error) {
|
})
|
||||||
new Flash('Star toggle failed. Try again later.', 'alert');
|
.on('ajax:error', () => {
|
||||||
});
|
Flash('Star toggle failed. Try again later.', 'alert');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue