mirror of
https://github.com/aquatix/digimarks.git
synced 2025-12-06 23:05:10 +01:00
Edit/Add bookmark modal
This commit is contained in:
@@ -322,6 +322,7 @@ th, td {
|
|||||||
/*padding: 1em;*/
|
/*padding: 1em;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[data-theme='nebula'] :modal,
|
||||||
[data-theme='nebula'] .card,
|
[data-theme='nebula'] .card,
|
||||||
[data-theme='nebula'] button,
|
[data-theme='nebula'] button,
|
||||||
[data-theme='nebula'] .button,
|
[data-theme='nebula'] .button,
|
||||||
@@ -329,6 +330,7 @@ th, td {
|
|||||||
[data-theme='nebula'] select,
|
[data-theme='nebula'] select,
|
||||||
[data-theme='nebula'] textarea,
|
[data-theme='nebula'] textarea,
|
||||||
[data-theme='nebula'] table,
|
[data-theme='nebula'] table,
|
||||||
|
[data-theme='nebula-dark'] :modal,
|
||||||
[data-theme='nebula-dark'] .card,
|
[data-theme='nebula-dark'] .card,
|
||||||
[data-theme='nebula-dark'] button,
|
[data-theme='nebula-dark'] button,
|
||||||
[data-theme='nebula-dark'] .button,
|
[data-theme='nebula-dark'] .button,
|
||||||
@@ -427,6 +429,16 @@ th, td {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Modal, e.g. for showing info or filling in a form; on top of the other content */
|
||||||
|
|
||||||
|
:modal {
|
||||||
|
color: var(--text-color);
|
||||||
|
background-color: var(--background-color);
|
||||||
|
border: 2px solid var(--border-color);
|
||||||
|
border-radius: var(--border-radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Footer */
|
/** Footer */
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
|
|||||||
@@ -1,17 +1,13 @@
|
|||||||
document.addEventListener('alpine:init', () => {
|
document.addEventListener('alpine:init', () => {
|
||||||
Alpine.store('digimarks', {
|
Alpine.store('digimarks', {
|
||||||
/** Main digimarks application, state etc */
|
/** Main digimarks application, state etc */
|
||||||
// userKey: Alpine.$persist(0).as('userKey'),
|
|
||||||
userKey: -1,
|
userKey: -1,
|
||||||
/* cache consists of cache[userKey] = {'bookmarks': [], 'tags': [], ??} */
|
/* cache consists of cache[userKey] = {'bookmarks': [], 'tags': [], ??} */
|
||||||
cache: Alpine.$persist({}).as('cache'),
|
cache: Alpine.$persist({}).as('cache'),
|
||||||
|
|
||||||
bookmarks: [],
|
bookmarks: [],
|
||||||
|
|
||||||
/* Bookmark that is being edited, used to fill the form etc */
|
/* nebula (drop-shadows), bbs (monospace, right lines), silo (like bbs but dark) ?? */
|
||||||
bookmark_to_edit: null,
|
|
||||||
|
|
||||||
/* nebula (dropshadows), bbs (monospace, right lines), silo (like bbs but dark) ?? */
|
|
||||||
themes: ['nebula', 'nebula-dark', 'bbs', 'silo'],
|
themes: ['nebula', 'nebula-dark', 'bbs', 'silo'],
|
||||||
theme: Alpine.$persist('nebula').as('theme'),
|
theme: Alpine.$persist('nebula').as('theme'),
|
||||||
|
|
||||||
@@ -19,6 +15,8 @@ document.addEventListener('alpine:init', () => {
|
|||||||
show_bookmarks_list: Alpine.$persist(true).as('show_bookmarks_list'),
|
show_bookmarks_list: Alpine.$persist(true).as('show_bookmarks_list'),
|
||||||
show_bookmarks_cards: Alpine.$persist(false).as('show_bookmarks_cards'),
|
show_bookmarks_cards: Alpine.$persist(false).as('show_bookmarks_cards'),
|
||||||
show_tags: Alpine.$persist(false).as('show_tags'),
|
show_tags: Alpine.$persist(false).as('show_tags'),
|
||||||
|
/* Bookmark that is being edited, used to fill the form, etc. */
|
||||||
|
bookmarkToEdit: Alpine.$persist(null).as('bookmarkToEdit'),
|
||||||
|
|
||||||
/* Loading indicator */
|
/* Loading indicator */
|
||||||
loading: false,
|
loading: false,
|
||||||
@@ -196,7 +194,6 @@ document.addEventListener('alpine:init', () => {
|
|||||||
|
|
||||||
async toggleTagPage() {
|
async toggleTagPage() {
|
||||||
/* Show or hide the tag page instead of the bookmarks */
|
/* Show or hide the tag page instead of the bookmarks */
|
||||||
console.log('Toggle tag page');
|
|
||||||
this.show_bookmarks = !this.show_bookmarks;
|
this.show_bookmarks = !this.show_bookmarks;
|
||||||
this.show_tags = !this.show_bookmarks;
|
this.show_tags = !this.show_bookmarks;
|
||||||
},
|
},
|
||||||
@@ -209,9 +206,16 @@ document.addEventListener('alpine:init', () => {
|
|||||||
async startAddingBookmark() {
|
async startAddingBookmark() {
|
||||||
/* Open 'add bookmark' page */
|
/* Open 'add bookmark' page */
|
||||||
console.log('Start adding bookmark');
|
console.log('Start adding bookmark');
|
||||||
this.bookmark_to_edit = {
|
this.bookmarkToEdit = {
|
||||||
'url': ''
|
'url': ''
|
||||||
}
|
}
|
||||||
|
// this.show_bookmark_details = true;
|
||||||
|
const editFormDialog = document.getElementById("editFormDialog");
|
||||||
|
editFormDialog.showModal();
|
||||||
|
},
|
||||||
|
async saveBookmark() {
|
||||||
|
console.log('Saving bookmark');
|
||||||
|
// this.show_bookmark_details = false;
|
||||||
},
|
},
|
||||||
async addBookmark() {
|
async addBookmark() {
|
||||||
/* Post new bookmark to the backend */
|
/* Post new bookmark to the backend */
|
||||||
|
|||||||
@@ -28,8 +28,7 @@
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<section x-cloak x-show="$store.digimarks.show_bookmarks && !$store.digimarks.bookmark_to_edit"
|
<section x-cloak x-show="$store.digimarks.show_bookmarks" x-transition.opacity>
|
||||||
x-transition.opacity>
|
|
||||||
<h1 x-bind:title="$store.digimarks.userKey">Bookmarks</h1>
|
<h1 x-bind:title="$store.digimarks.userKey">Bookmarks</h1>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@@ -123,8 +122,7 @@
|
|||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section x-cloak x-show="$store.digimarks.show_tags && !$store.digimarks.bookmark_to_edit"
|
<section x-cloak x-show="$store.digimarks.show_tags" x-transition.opacity>
|
||||||
x-transition.opacity>
|
|
||||||
<h1>Tags</h1>
|
<h1>Tags</h1>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
@@ -147,7 +145,13 @@
|
|||||||
</table>
|
</table>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section x-cloak x-show="$store.digimarks.bookmark_to_edit" x-transition.opacity>
|
<dialog x-cloak id="editFormDialog"
|
||||||
|
x-transition:enter="modal-enter"
|
||||||
|
x-transition:enter-start="modal-enter"
|
||||||
|
x-transition:enter-end="modal-enter-active"
|
||||||
|
x-transition:leave="modal-leave-active"
|
||||||
|
x-transition:leave-start="modal-enter-active"
|
||||||
|
x-transition:leave-end="modal-enter">
|
||||||
<h1>Add/Edit bookmark</h1>
|
<h1>Add/Edit bookmark</h1>
|
||||||
{#
|
{#
|
||||||
<div class="card-panel {{ theme.ERRORMESSAGE_BACKGROUND }}">
|
<div class="card-panel {{ theme.ERRORMESSAGE_BACKGROUND }}">
|
||||||
@@ -166,14 +170,20 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
#}
|
#}
|
||||||
<form>
|
<form method="dialog">
|
||||||
<input type="text" name="">
|
<input type="text" name="">
|
||||||
<label>
|
<p>
|
||||||
<input type="checkbox" name="strip" id="strip"/>
|
<label>
|
||||||
<span>Strip parameters from url (like <em>?utm_source=social</em> - can break the link!)</span>
|
<input type="checkbox" name="strip" id="strip"/>
|
||||||
</label>
|
<span>Strip parameters from url (like <em>?utm_source=social</em> - can break the link!)</span>
|
||||||
|
</label>
|
||||||
|
</p>
|
||||||
|
<div>
|
||||||
|
<button value="cancel">Cancel</button>
|
||||||
|
<button @click="$store.digimarks.saveBookmark()">Save</button>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</dialog>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
</article>
|
</article>
|
||||||
|
|||||||
Reference in New Issue
Block a user