From bf34ee71b33073597cd1cf726fca64fce98f26f7 Mon Sep 17 00:00:00 2001
From: roberto
Date: Mon, 6 Jan 2025 17:07:18 +0100
Subject: [PATCH] Item sharing
---
.../000014_create_bm_item_shares_table.up.sql | 3 +-
assets/static/js/main.js | 5 +++
assets/templates/items/share.tmpl | 11 +++---
before-compile.sh | 4 ++
cmd/web/items_handlers.go | 39 +++++++++++++------
models/itemshare.go | 12 +++---
6 files changed, 49 insertions(+), 25 deletions(-)
create mode 100755 before-compile.sh
diff --git a/assets/migrations/000014_create_bm_item_shares_table.up.sql b/assets/migrations/000014_create_bm_item_shares_table.up.sql
index 5752507..5dffb96 100644
--- a/assets/migrations/000014_create_bm_item_shares_table.up.sql
+++ b/assets/migrations/000014_create_bm_item_shares_table.up.sql
@@ -2,8 +2,7 @@ CREATE TABLE "bm_item_shares" (
"id" INTEGER,
"token" TEXT NOT NULL UNIQUE,
"item_id" INTEGER DEFAULT '',
- "read" INTEGER DEFAULT '',
- "update" INTEGER DEFAULT '',
+ "permission_edit" INTEGER DEFAULT '',
"start_datetime" TEXT DEFAULT '',
"end_datetime" TEXT DEFAULT '',
"password" TEXT DEFAULT '',
diff --git a/assets/static/js/main.js b/assets/static/js/main.js
index 5d3dcd2..41f1663 100644
--- a/assets/static/js/main.js
+++ b/assets/static/js/main.js
@@ -261,6 +261,11 @@ document.addEventListener("DOMContentLoaded", function(event){
document.getElementById("dialog").showModal();
});
+ document.body.addEventListener("closeModalDialog", function(evt){
+ document.getElementById('dialog').close();
+ document.getElementById('dialog').remove();
+ });
+
document.body.addEventListener("quickboxNoteClear", function(evt){
document.getElementById("quickbox-notetext").value = ''
});
diff --git a/assets/templates/items/share.tmpl b/assets/templates/items/share.tmpl
index cc33488..f81d4d5 100644
--- a/assets/templates/items/share.tmpl
+++ b/assets/templates/items/share.tmpl
@@ -11,13 +11,13 @@
@@ -27,7 +27,7 @@
{{ .baseUrl }}/
-
+
@@ -36,15 +36,14 @@