save movies release date in BDD, remove unused badge, add help to export movie from letterboxd
This commit is contained in:
20
assets/controllers/import_help_controller.js
Normal file
20
assets/controllers/import_help_controller.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import { Controller } from '@hotwired/stimulus';
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = ['overlay'];
|
||||
|
||||
open(event) {
|
||||
event.stopPropagation();
|
||||
this.overlayTarget.hidden = false;
|
||||
}
|
||||
|
||||
close() {
|
||||
this.overlayTarget.hidden = true;
|
||||
}
|
||||
|
||||
closeOnBackdrop(event) {
|
||||
if (event.target === this.overlayTarget) {
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Controller } from '@hotwired/stimulus';
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = ['item', 'importBtn', 'badge'];
|
||||
static targets = ['item', 'importBtn'];
|
||||
|
||||
connect() {
|
||||
this._poll();
|
||||
@@ -50,7 +50,6 @@ export default class extends Controller {
|
||||
this.importBtnTarget.disabled = false;
|
||||
this.importBtnTarget.textContent = 'Importer ses films';
|
||||
this._removeStatus();
|
||||
this.badgeTarget.hidden = true;
|
||||
}
|
||||
|
||||
_showActive(data) {
|
||||
@@ -62,7 +61,6 @@ export default class extends Controller {
|
||||
: 0;
|
||||
|
||||
this._setStatus(`${progress}% — ${data.totalFilms} films`, 'active');
|
||||
this.badgeTarget.hidden = true;
|
||||
}
|
||||
|
||||
_showCompleted(data) {
|
||||
@@ -71,14 +69,12 @@ export default class extends Controller {
|
||||
|
||||
const imported = data.totalFilms - data.failedFilms;
|
||||
this._setStatus(`Dernier import : ${imported}/${data.totalFilms} films`, 'completed');
|
||||
this.badgeTarget.hidden = true;
|
||||
}
|
||||
|
||||
_showFailed() {
|
||||
this.importBtnTarget.disabled = false;
|
||||
this.importBtnTarget.textContent = 'Importer ses films';
|
||||
this._setStatus('Dernier import : échoué', 'failed');
|
||||
this.badgeTarget.hidden = true;
|
||||
}
|
||||
|
||||
_setStatus(text, type) {
|
||||
|
||||
Reference in New Issue
Block a user