-{% endif %}
\ No newline at end of file
+ {% if details.is_editable %}
+
+
+
+ {% endif %}
+
\ No newline at end of file
diff --git a/bookmarks/templates/bookmarks/details_modal.html b/bookmarks/templates/bookmarks/details_modal.html
index d3581870..51551b05 100644
--- a/bookmarks/templates/bookmarks/details_modal.html
+++ b/bookmarks/templates/bookmarks/details_modal.html
@@ -1,7 +1,6 @@
diff --git a/bookmarks/tests/test_bookmark_details_modal.py b/bookmarks/tests/test_bookmark_details_modal.py
index b9a70653..83c79830 100644
--- a/bookmarks/tests/test_bookmark_details_modal.py
+++ b/bookmarks/tests/test_bookmark_details_modal.py
@@ -105,6 +105,12 @@ def test_access(self):
def test_access_with_sharing(self):
self.details_route_sharing_access_test(self.get_view_name(), True)
+ def test_assets_access(self):
+ self.details_route_access_test("bookmarks:details_assets", True)
+
+ def test_assets_access_with_sharing(self):
+ self.details_route_sharing_access_test("bookmarks:details_assets", True)
+
def test_displays_title(self):
# with title
bookmark = self.setup_bookmark(title="Test title")
@@ -753,6 +759,27 @@ def test_remove_asset(self):
self.assertEqual(response.status_code, 404)
self.assertTrue(BookmarkAsset.objects.filter(id=asset.id).exists())
+ @override_settings(LD_ENABLE_SNAPSHOTS=True)
+ def test_assets_refresh_when_having_pending_asset(self):
+ bookmark = self.setup_bookmark()
+ asset = self.setup_asset(bookmark, status=BookmarkAsset.STATUS_COMPLETE)
+ fetch_url = reverse("bookmarks:details_assets", args=[bookmark.id])
+
+ # no pending asset
+ soup = self.get_details(bookmark)
+ files_section = self.find_section(soup, "Files")
+ assets_wrapper = files_section.find("div", {"ld-fetch": fetch_url})
+ self.assertIsNone(assets_wrapper)
+
+ # with pending asset
+ asset.status = BookmarkAsset.STATUS_PENDING
+ asset.save()
+
+ soup = self.get_details(bookmark)
+ files_section = self.find_section(soup, "Files")
+ assets_wrapper = files_section.find("div", {"ld-fetch": fetch_url})
+ self.assertIsNotNone(assets_wrapper)
+
@override_settings(LD_ENABLE_SNAPSHOTS=True)
def test_create_snapshot(self):
with patch.object(
diff --git a/bookmarks/urls.py b/bookmarks/urls.py
index 61a9e99b..147c7b75 100644
--- a/bookmarks/urls.py
+++ b/bookmarks/urls.py
@@ -44,6 +44,11 @@
views.bookmarks.details_modal,
name="details_modal",
),
+ path(
+ "bookmarks//details_assets",
+ views.bookmarks.details_assets,
+ name="details_assets",
+ ),
# Assets
path(
"assets/",
diff --git a/bookmarks/views/bookmarks.py b/bookmarks/views/bookmarks.py
index d79aeffd..4cc4ee5c 100644
--- a/bookmarks/views/bookmarks.py
+++ b/bookmarks/views/bookmarks.py
@@ -172,6 +172,10 @@ def details_modal(request, bookmark_id: int):
return _details(request, bookmark_id, "bookmarks/details_modal.html")
+def details_assets(request, bookmark_id: int):
+ return _details(request, bookmark_id, "bookmarks/details/assets.html")
+
+
def convert_tag_string(tag_string: str):
# Tag strings coming from inputs are space-separated, however services.bookmarks functions expect comma-separated
# strings
diff --git a/bookmarks/views/partials/contexts.py b/bookmarks/views/partials/contexts.py
index c58ed3b7..b0de00f9 100644
--- a/bookmarks/views/partials/contexts.py
+++ b/bookmarks/views/partials/contexts.py
@@ -390,3 +390,6 @@ def __init__(self, request: WSGIRequest, bookmark: Bookmark):
self.assets = [
BookmarkAssetItem(asset) for asset in bookmark.bookmarkasset_set.all()
]
+ self.has_pending_assets = any(
+ asset.status == BookmarkAsset.STATUS_PENDING for asset in self.assets
+ )
diff --git a/web-types.json b/web-types.json
index cb5e6caa..f0c7ec1c 100644
--- a/web-types.json
+++ b/web-types.json
@@ -26,6 +26,20 @@
"required": false
}
},
+ {
+ "name": "ld-select",
+ "description": "The content element(s) to select from the fetched content, for example `#main-content`",
+ "value": {
+ "required": false
+ }
+ },
+ {
+ "name": "ld-interval",
+ "description": "Automatically fetches the content of the given URL at the given interval, in seconds",
+ "value": {
+ "required": false
+ }
+ },
{
"name": "ld-fire",
"description": "Fires one or more events once a behavior, such as ld-fetch or ld-form, is finished",