Erstes Commit

This commit is contained in:
2026-02-19 18:37:05 +01:00
commit 74a5b5bbb7
97 changed files with 1792 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
---
title: "Add Bookmark"
---
<main x-data="{
store: null,
categories: [],
name: '',
url: '',
categoryId: '',
newcategory: '',
async saveBookmark() {
if (!this.categoryId)
this.categoryId = this.categories[0].id;
if (!this.name || !this.url || (!this.categoryId && !this.newcategory))
return;
if (this.newcategory)
this.categoryId = await this.store.createBookmarkCategory(this.newcategory);
const result = await this.store.createBookmark(
this.categoryId, this.name, this.url
);
if (result)
window.close();
},
async init() {
this.store = Alpine.store('alphabreed');
this.store.backUrl = '/bookmarks/add/';
const params = new URLSearchParams(window.location.search);
this.name = params.get('name') || '';
this.url = params.get('url') || '';
const tokenOK = await this.store.checkToken();
if (tokenOK)
this.categories = await this.store.getBookmarkCategories();
}
}">
<div id="addcontent">
<div class="field textfield">
<label for="bookmarkname">Bookmark name</label>
<input id="bookmarkname" type="text" x-model="name">
</div>
<div class="field textfield">
<label for="bookmarkurl">URL</label>
<input id="bookmarkurl" type="text" x-model="url">
</div>
<div class="field selectfield">
<label for="bookmarkcategory">Category</label>
<select id="bookmarkcategory" x-model="categoryId">
<template x-for="category in categories" :key="category.id">
<option :value="category.id" x-text="category.name" :selected="category.id == categoryId">
</template>
</select>
</div>
<div class="field textfield">
<label for="bookmarknewcategory">New category</label>
<input id="bookmarknewcategory" type="text" x-model="newcategory">
</div>
<div class="field buttons">
<button @click="saveBookmark()">Save</button>
</div>
</div>
</main>