From 91139a8a9c0ca1c23f5d274458fa0279ca0c7b59 Mon Sep 17 00:00:00 2001 From: Adam Murray Date: Thu, 3 Mar 2022 15:20:47 +0000 Subject: [PATCH 1/5] Fix: Version unlock button now remains in slideout --- CHANGELOG.rst | 1 + .../admin/unlock_icon.html | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index aee5276..79b0e36 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,7 @@ Changelog Unreleased ========== +* Version mixin unlock icon remains in sideframe 1.0.0 (2022-02-16) ================== diff --git a/djangocms_version_locking/templates/djangocms_version_locking/admin/unlock_icon.html b/djangocms_version_locking/templates/djangocms_version_locking/admin/unlock_icon.html index cb7a269..42542d5 100644 --- a/djangocms_version_locking/templates/djangocms_version_locking/admin/unlock_icon.html +++ b/djangocms_version_locking/templates/djangocms_version_locking/admin/unlock_icon.html @@ -1,9 +1,12 @@ {% load static i18n %} - + +inactive {% else %} - +js-versioning-action +{% if keepsideframe|default_if_none:True %}js-versioning-keep-sideframe {% else %}js-versioning-close-sideframe {% endif %} +" href="{{ unlock_url }}" {% endif %} - - + title="{% trans "Unlock" %}"> + + \ No newline at end of file From 69b2fe03fd6a593854a74e7c803b7c03162147bc Mon Sep 17 00:00:00 2001 From: Adam Murray Date: Thu, 3 Mar 2022 15:53:51 +0000 Subject: [PATCH 2/5] Fix: Added test cases for keepinsideframe changes --- tests/test_admin_monkey_patch.py | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/test_admin_monkey_patch.py b/tests/test_admin_monkey_patch.py index b94eb48..567860c 100644 --- a/tests/test_admin_monkey_patch.py +++ b/tests/test_admin_monkey_patch.py @@ -249,6 +249,47 @@ def test_edit_action_link_disabled_state(self): self.assertIn("inactive", actual_disabled_state) +class VersionLockEditActionSideFrameTestCase(CMSTestCase): + def setUp(self): + self.superuser = self.get_superuser() + self.user_author = self._create_user("author", is_staff=True, is_superuser=False) + self.versionable = PollsCMSConfig.versioning[0] + self.version_admin = admin.site._registry[self.versionable.version_model_proxy] + + def test_version_unlock_enabled_keep_side_frame(self): + """ + When clicking on an versionables enabled unlock icon, the sideframe is kept open + """ + version = factories.PollVersionFactory(created_by=self.user_author) + author_request = RequestFactory() + author_request.user = self.user_author + otheruser_request = RequestFactory() + otheruser_request.user = self.superuser + + actual_enabled_state = self.version_admin._get_unlock_link(version, otheruser_request) + + self.assertNotIn("inactive", actual_enabled_state) + + # The url link should keep the sideframe open + self.assertIn("js-versioning-keep-sideframe", actual_enabled_state) + self.assertNotIn("js-versioning-close-sideframe", actual_enabled_state) + + def test_version_unlock_disabled_keep_side_frame(self): + """ + When clicking on an versionables enabled lock icon, the sideframe is kept open + """ + version = factories.PollVersionFactory(created_by=self.user_author) + author_request = RequestFactory() + author_request.user = self.user_author + + actual_enabled_state = self.version_admin._get_unlock_link(version, author_request) + + self.assertIn("inactive", actual_enabled_state) + + # The url link should keep the sideframe open + self.assertNotIn("js-versioning-keep-sideframe", actual_enabled_state) + + class VersionLockMediaMonkeyPatchTestCase(CMSTestCase): def setUp(self): From 667b197b25596a6e0a6ecc4d8814d31b995e848b Mon Sep 17 00:00:00 2001 From: Adam Murray Date: Fri, 11 Mar 2022 10:59:30 +0000 Subject: [PATCH 3/5] Fix: Removed uneccessary test case --- tests/test_admin_monkey_patch.py | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/tests/test_admin_monkey_patch.py b/tests/test_admin_monkey_patch.py index 567860c..9c41cea 100644 --- a/tests/test_admin_monkey_patch.py +++ b/tests/test_admin_monkey_patch.py @@ -274,21 +274,6 @@ def test_version_unlock_enabled_keep_side_frame(self): self.assertIn("js-versioning-keep-sideframe", actual_enabled_state) self.assertNotIn("js-versioning-close-sideframe", actual_enabled_state) - def test_version_unlock_disabled_keep_side_frame(self): - """ - When clicking on an versionables enabled lock icon, the sideframe is kept open - """ - version = factories.PollVersionFactory(created_by=self.user_author) - author_request = RequestFactory() - author_request.user = self.user_author - - actual_enabled_state = self.version_admin._get_unlock_link(version, author_request) - - self.assertIn("inactive", actual_enabled_state) - - # The url link should keep the sideframe open - self.assertNotIn("js-versioning-keep-sideframe", actual_enabled_state) - class VersionLockMediaMonkeyPatchTestCase(CMSTestCase): From c5745cca5859328c2f95dd420130abd8f7448ad1 Mon Sep 17 00:00:00 2001 From: Adam Murray Date: Fri, 11 Mar 2022 11:41:15 +0000 Subject: [PATCH 4/5] Fix: Updated test name to reflect changes --- tests/test_admin_monkey_patch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_admin_monkey_patch.py b/tests/test_admin_monkey_patch.py index 9c41cea..c3932f6 100644 --- a/tests/test_admin_monkey_patch.py +++ b/tests/test_admin_monkey_patch.py @@ -256,7 +256,7 @@ def setUp(self): self.versionable = PollsCMSConfig.versioning[0] self.version_admin = admin.site._registry[self.versionable.version_model_proxy] - def test_version_unlock_enabled_keep_side_frame(self): + def test_version_unlock_keep_side_frame(self): """ When clicking on an versionables enabled unlock icon, the sideframe is kept open """ From 2d46bdc6cdc7bb1f4ad3b881bfc3a6a68e7bf598 Mon Sep 17 00:00:00 2001 From: Adam Murray Date: Mon, 14 Mar 2022 13:40:39 +0000 Subject: [PATCH 5/5] Fix: Remoced unneccessary test criteria --- tests/test_admin_monkey_patch.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/test_admin_monkey_patch.py b/tests/test_admin_monkey_patch.py index c3932f6..7c282b1 100644 --- a/tests/test_admin_monkey_patch.py +++ b/tests/test_admin_monkey_patch.py @@ -268,8 +268,6 @@ def test_version_unlock_keep_side_frame(self): actual_enabled_state = self.version_admin._get_unlock_link(version, otheruser_request) - self.assertNotIn("inactive", actual_enabled_state) - # The url link should keep the sideframe open self.assertIn("js-versioning-keep-sideframe", actual_enabled_state) self.assertNotIn("js-versioning-close-sideframe", actual_enabled_state)