mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-01 17:38:38 +00:00
Extract Topbar controller
This commit is contained in:
parent
f7c8466231
commit
2054be7bd4
5 changed files with 41 additions and 38 deletions
31
assets/controllers/topbar_controller.js
Normal file
31
assets/controllers/topbar_controller.js
Normal file
|
@ -0,0 +1,31 @@
|
|||
import { Controller } from '@hotwired/stimulus';
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = ['addUrl', 'addUrlInput', 'search', 'searchInput', 'actions'];
|
||||
|
||||
showAddUrl() {
|
||||
this.actionsTarget.style.display = 'none';
|
||||
this.addUrlTarget.style.display = 'flex';
|
||||
this.searchTarget.style.display = 'none';
|
||||
this.addUrlInputTarget.focus();
|
||||
}
|
||||
|
||||
submittingUrl(e) {
|
||||
e.currentTarget.disabled = true;
|
||||
this.addUrlInputTarget.readOnly = true;
|
||||
this.addUrlInputTarget.blur();
|
||||
}
|
||||
|
||||
showSearch() {
|
||||
this.actionsTarget.style.display = 'none';
|
||||
this.addUrlTarget.style.display = 'none';
|
||||
this.searchTarget.style.display = 'flex';
|
||||
this.searchInputTarget.focus();
|
||||
}
|
||||
|
||||
showActions() {
|
||||
this.actionsTarget.style.display = 'flex';
|
||||
this.addUrlTarget.style.display = 'none';
|
||||
this.searchTarget.style.display = 'none';
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue