Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.34 #13

Merged
merged 13 commits into from
Sep 16, 2024
Merged

1.34 #13

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
!/manage.py
!/package.json
!/package-lock.json
!/postcss.config.js
!/requirements.dev.txt
!/requirements.txt
!/rollup.config.mjs
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ jobs:
- name: Run build
run: |
npm run build
python manage.py compilescss
python manage.py collectstatic --ignore=*.scss
python manage.py collectstatic
- name: Run tests
run: python manage.py test bookmarks.e2e --pattern="e2e_test_*.py"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ typings/
### Custom
# Rollup compilation output
/bookmarks/static/bundle.js*
# SASS compilation output
# CSS compilation output
/bookmarks/static/theme-*.css*
# Collected static files for deployment
/static
Expand Down
45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,50 @@
# Changelog

## v1.34.0 (16/09/2024)

### What's Changed
* Fix several issues around browser back navigation by @sissbruecker in https://github.com/sissbruecker/linkding/pull/825
* Speed up response times for certain actions by @sissbruecker in https://github.com/sissbruecker/linkding/pull/829
* Implement IPv6 capability by @itz-Jana in https://github.com/sissbruecker/linkding/pull/826

### New Contributors
* @itz-Jana made their first contribution in https://github.com/sissbruecker/linkding/pull/826

**Full Changelog**: https://github.com/sissbruecker/linkding/compare/v1.33.0...v1.34.0

---

## v1.33.0 (14/09/2024)

### What's Changed
* Theme improvements by @sissbruecker in https://github.com/sissbruecker/linkding/pull/822
* Speed up navigation by @sissbruecker in https://github.com/sissbruecker/linkding/pull/824
* Rename "SingeFileError" to "SingleFileError" by @curiousleo in https://github.com/sissbruecker/linkding/pull/823
* Bump svelte from 4.2.12 to 4.2.19 by @dependabot in https://github.com/sissbruecker/linkding/pull/806

### New Contributors
* @curiousleo made their first contribution in https://github.com/sissbruecker/linkding/pull/823

**Full Changelog**: https://github.com/sissbruecker/linkding/compare/v1.32.0...v1.33.0

---

## v1.32.0 (10/09/2024)

### What's Changed
* Allow configuring landing page for unauthenticated users by @sissbruecker in https://github.com/sissbruecker/linkding/pull/808
* Allow configuring guest user profile by @sissbruecker in https://github.com/sissbruecker/linkding/pull/809
* Return bookmark tags in RSS feeds by @sissbruecker in https://github.com/sissbruecker/linkding/pull/810
* Additional filter parameters for RSS feeds by @sissbruecker in https://github.com/sissbruecker/linkding/pull/811
* Allow pre-filling notes in new bookmark form by @sissbruecker in https://github.com/sissbruecker/linkding/pull/812
* Fix inconsistent tag order in bookmarks by @sissbruecker in https://github.com/sissbruecker/linkding/pull/819
* Fix auto-tagging when URL includes port by @sissbruecker in https://github.com/sissbruecker/linkding/pull/820


**Full Changelog**: https://github.com/sissbruecker/linkding/compare/v1.31.1...v1.32.0

---

## v1.31.1 (30/08/2024)

### What's Changed
Expand Down
Binary file added assets/logo-inset.afdesign
Binary file not shown.
7 changes: 4 additions & 3 deletions bookmarks/e2e/e2e_test_bookmark_details_modal.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ def test_edit_return_url(self):
with self.page.expect_navigation():
details_modal.get_by_text("Edit").click()

# Cancel edit, verify return url
with self.page.expect_navigation(url=self.live_server_url + url):
# Cancel edit, verify return to details url
details_url = url + f"&details={bookmark.id}"
with self.page.expect_navigation(url=self.live_server_url + details_url):
self.page.get_by_text("Nevermind").click()

def test_delete(self):
Expand Down Expand Up @@ -167,7 +168,7 @@ def test_create_snapshot_remove_snapshot(self):
# Has new snapshots
expect(snapshot).to_be_visible()

# Create snapshot
# Remove snapshot
asset_list.get_by_text("Remove", exact=False).click()
asset_list.get_by_text("Confirm", exact=False).click()

Expand Down
37 changes: 0 additions & 37 deletions bookmarks/e2e/e2e_test_bookmark_details_view.py

This file was deleted.

6 changes: 2 additions & 4 deletions bookmarks/e2e/e2e_test_tag_cloud_modal.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from django.test import override_settings
from django.urls import reverse
from playwright.sync_api import sync_playwright, expect, Locator
from playwright.sync_api import sync_playwright, expect

from bookmarks.e2e.helpers import LinkdingE2ETestCase
from bookmarks.models import Bookmark


class TagCloudModalE2ETestCase(LinkdingE2ETestCase):
Expand All @@ -26,7 +24,7 @@ def test_show_modal_close_modal(self):
# verify modal is visible
modal = page.locator(".modal")
expect(modal).to_be_visible()
expect(modal.locator(".modal-title")).to_have_text("Tags")
expect(modal.locator("h2")).to_have_text("Tags")

# close with close button
modal.locator("button.close").click()
Expand Down
5 changes: 4 additions & 1 deletion bookmarks/frontend/api.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export class ApiClient {
export class Api {
constructor(baseUrl) {
this.baseUrl = baseUrl;
}
Expand Down Expand Up @@ -27,3 +27,6 @@ export class ApiClient {
.then((data) => data.results);
}
}

const apiBaseUrl = document.documentElement.dataset.apiBaseUrl || "";
export const api = new Api(apiBaseUrl);
13 changes: 10 additions & 3 deletions bookmarks/frontend/behaviors/bookmark-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ class BookmarkItem extends Behavior {
super(element);

// Toggle notes
const notesToggle = element.querySelector(".toggle-notes");
if (notesToggle) {
notesToggle.addEventListener("click", this.onToggleNotes.bind(this));
this.onToggleNotes = this.onToggleNotes.bind(this);
this.notesToggle = element.querySelector(".toggle-notes");
if (this.notesToggle) {
this.notesToggle.addEventListener("click", this.onToggleNotes);
}

// Add tooltip to title if it is truncated
Expand All @@ -20,6 +21,12 @@ class BookmarkItem extends Behavior {
});
}

destroy() {
if (this.notesToggle) {
this.notesToggle.removeEventListener("click", this.onToggleNotes);
}
}

onToggleNotes(event) {
event.preventDefault();
event.stopPropagation();
Expand Down
34 changes: 23 additions & 11 deletions bookmarks/frontend/behaviors/bulk-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,22 @@ class BulkEdit extends Behavior {
constructor(element) {
super(element);

this.active = false;
this.active = element.classList.contains("active");

this.init = this.init.bind(this);
this.onToggleActive = this.onToggleActive.bind(this);
this.onToggleAll = this.onToggleAll.bind(this);
this.onToggleBookmark = this.onToggleBookmark.bind(this);
this.onActionSelected = this.onActionSelected.bind(this);

this.init();
// Reset when bookmarks are refreshed
document.addEventListener("refresh-bookmark-list-done", () => this.init());
// Reset when bookmarks are updated
document.addEventListener("bookmark-list-updated", this.init);
}

destroy() {
this.removeListeners();
document.removeEventListener("bookmark-list-updated", this.init);
}

init() {
Expand All @@ -31,13 +37,9 @@ class BulkEdit extends Behavior {
this.element.querySelectorAll(".bulk-edit-checkbox:not(.all) input"),
);

// Remove previous listeners if elements are the same
this.activeToggle.removeEventListener("click", this.onToggleActive);
this.actionSelect.removeEventListener("change", this.onActionSelected);
this.allCheckbox.removeEventListener("change", this.onToggleAll);
this.bookmarkCheckboxes.forEach((checkbox) => {
checkbox.removeEventListener("change", this.onToggleBookmark);
});
// Add listeners, ensure there are no dupes by possibly removing existing listeners
this.removeListeners();
this.addListeners();

// Reset checkbox states
this.reset();
Expand All @@ -47,8 +49,9 @@ class BulkEdit extends Behavior {
const total = totalHolder?.dataset.bookmarksTotal || 0;
const totalSpan = this.selectAcross.querySelector("span.total");
totalSpan.textContent = total;
}

// Add new listeners
addListeners() {
this.activeToggle.addEventListener("click", this.onToggleActive);
this.actionSelect.addEventListener("change", this.onActionSelected);
this.allCheckbox.addEventListener("change", this.onToggleAll);
Expand All @@ -57,6 +60,15 @@ class BulkEdit extends Behavior {
});
}

removeListeners() {
this.activeToggle.removeEventListener("click", this.onToggleActive);
this.actionSelect.removeEventListener("change", this.onActionSelected);
this.allCheckbox.removeEventListener("change", this.onToggleAll);
this.bookmarkCheckboxes.forEach((checkbox) => {
checkbox.removeEventListener("change", this.onToggleBookmark);
});
}

onToggleActive() {
this.active = !this.active;
if (this.active) {
Expand Down
24 changes: 12 additions & 12 deletions bookmarks/frontend/behaviors/confirm-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@ import { Behavior, registerBehavior } from "./index";
class ConfirmButtonBehavior extends Behavior {
constructor(element) {
super(element);
element.dataset.type = element.type;
element.dataset.name = element.name;
element.dataset.value = element.value;
element.removeAttribute("type");
element.removeAttribute("name");
element.removeAttribute("value");
element.addEventListener("click", this.onClick.bind(this));

this.onClick = this.onClick.bind(this);
element.addEventListener("click", this.onClick);
}

destroy() {
Behavior.interacting = false;
this.reset();
this.element.removeEventListener("click", this.onClick);
}

onClick(event) {
Expand Down Expand Up @@ -53,9 +50,9 @@ class ConfirmButtonBehavior extends Behavior {
cancelButton.addEventListener("click", this.reset.bind(this));

const confirmButton = document.createElement(this.element.nodeName);
confirmButton.type = this.element.dataset.type;
confirmButton.name = this.element.dataset.name;
confirmButton.value = this.element.dataset.value;
confirmButton.type = this.element.type;
confirmButton.name = this.element.name;
confirmButton.value = this.element.value;
confirmButton.innerText = question ? "Yes" : "Confirm";
confirmButton.className = buttonClasses;
confirmButton.addEventListener("click", this.reset.bind(this));
Expand All @@ -70,7 +67,10 @@ class ConfirmButtonBehavior extends Behavior {
reset() {
setTimeout(() => {
Behavior.interacting = false;
this.container.remove();
if (this.container) {
this.container.remove();
this.container = null;
}
this.element.classList.remove("d-none");
});
}
Expand Down
62 changes: 62 additions & 0 deletions bookmarks/frontend/behaviors/details-modal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { Behavior, registerBehavior } from "./index";

class DetailsModalBehavior extends Behavior {
constructor(element) {
super(element);

this.onClose = this.onClose.bind(this);
this.onKeyDown = this.onKeyDown.bind(this);

this.overlayLink = element.querySelector("a:has(.modal-overlay)");
this.buttonLink = element.querySelector("a:has(button.close)");

this.overlayLink.addEventListener("click", this.onClose);
this.buttonLink.addEventListener("click", this.onClose);
document.addEventListener("keydown", this.onKeyDown);
}

destroy() {
this.overlayLink.removeEventListener("click", this.onClose);
this.buttonLink.removeEventListener("click", this.onClose);
document.removeEventListener("keydown", this.onKeyDown);
}

onKeyDown(event) {
// Skip if event occurred within an input element
const targetNodeName = event.target.nodeName;
const isInputTarget =
targetNodeName === "INPUT" ||
targetNodeName === "SELECT" ||
targetNodeName === "TEXTAREA";

if (isInputTarget) {
return;
}

if (event.key === "Escape") {
this.onClose(event);
}
}

onClose(event) {
event.preventDefault();
this.element.classList.add("closing");
this.element.addEventListener(
"animationend",
(event) => {
if (event.animationName === "fade-out") {
this.element.remove();

const closeUrl = this.overlayLink.href;
Turbo.visit(closeUrl, {
action: "replace",
frame: "details-modal",
});
}
},
{ once: true },
);
}
}

registerBehavior("ld-details-modal", DetailsModalBehavior);
Loading
Loading