Skip to content

Commit

Permalink
👌 [#2242] PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenbal committed Mar 28, 2024
1 parent 82f9fa0 commit 91b2ef0
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 32 deletions.
6 changes: 3 additions & 3 deletions src/open_inwoner/accounts/tests/test_profile_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from django.conf import settings
from django.template.defaultfilters import date as django_date
from django.test import override_settings
from django.urls import reverse
from django.urls import reverse, reverse_lazy
from django.utils.translation import gettext as _

import requests_mock
Expand Down Expand Up @@ -1146,8 +1146,8 @@ def test_render_form_limit_newsletters_to_admin_selection(self, m):
@override_settings(
ROOT_URLCONF="open_inwoner.cms.tests.urls", MIDDLEWARE=PATCHED_MIDDLEWARE
)
class MyAppointmentsTests(ClearCachesMixin, WebTest):
appointments_url = reverse("profile:appointments")
class UserAppointmentsTests(ClearCachesMixin, WebTest):
appointments_url = reverse_lazy("profile:appointments")

def setUp(self):
super().setUp()
Expand Down
4 changes: 2 additions & 2 deletions src/open_inwoner/accounts/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
from .password_reset import PasswordResetView
from .profile import (
EditProfileView,
MyAppointmentsView,
MyCategoriesView,
MyDataView,
MyNotificationsView,
MyProfileView,
NewsletterSubscribeView,
UserAppointmentsView,
)
from .registration import CustomRegistrationView, NecessaryFieldsUserView

Expand Down Expand Up @@ -81,7 +81,7 @@
"MyNotificationsView",
"MyProfileView",
"NewsletterSubscribeView",
"MyAppointmentsView",
"UserAppointmentsView",
"CustomRegistrationView",
"NecessaryFieldsUserView",
"CustomEHerkenningOIDCAuthenticationCallbackView",
Expand Down
2 changes: 1 addition & 1 deletion src/open_inwoner/accounts/views/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def form_valid(self, form):
return HttpResponseRedirect(self.get_success_url())


class MyAppointmentsView(
class UserAppointmentsView(
LogMixin, LoginRequiredMixin, CommonPageMixin, BaseBreadcrumbMixin, TemplateView
):
template_name = "pages/profile/appointments.html"
Expand Down
4 changes: 2 additions & 2 deletions src/open_inwoner/cms/plugins/cms_plugins/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from .appointments import MyAppointmentsPlugin
from .appointments import UserAppointmentsPlugin
from .userfeed import UserFeedPlugin
from .videoplayer import VideoPlayerPlugin

__all__ = [
"MyAppointmentsPlugin",
"UserAppointmentsPlugin",
"UserFeedPlugin",
"VideoPlayerPlugin",
]
6 changes: 3 additions & 3 deletions src/open_inwoner/cms/plugins/cms_plugins/appointments.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool

from open_inwoner.cms.plugins.models.appointments import MyAppointments
from open_inwoner.cms.plugins.models.appointments import UserAppointments
from open_inwoner.qmatic.client import NoServiceConfigured, QmaticClient

logger = logging.getLogger(__name__)


@plugin_pool.register_plugin
class MyAppointmentsPlugin(CMSPluginBase):
model = MyAppointments
class UserAppointmentsPlugin(CMSPluginBase):
model = UserAppointments
module = _("General")
name = _("My appointments")
render_template = "cms/plugins/appointments/appointments.html"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.2.10 on 2024-03-26 14:04
# Generated by Django 4.2.10 on 2024-03-28 10:07

from django.db import migrations, models
import django.db.models.deletion
Expand All @@ -13,7 +13,7 @@ class Migration(migrations.Migration):

operations = [
migrations.CreateModel(
name="MyAppointments",
name="UserAppointments",
fields=[
(
"cmsplugin_ptr",
Expand Down
4 changes: 2 additions & 2 deletions src/open_inwoner/cms/plugins/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from .appointments import MyAppointments
from .appointments import UserAppointments
from .userfeed import UserFeed
from .videoplayer import VideoPlayer

__all__ = [
"MyAppointments",
"UserAppointments",
"UserFeed",
"VideoPlayer",
]
2 changes: 1 addition & 1 deletion src/open_inwoner/cms/plugins/models/appointments.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from cms.models import CMSPlugin


class MyAppointments(CMSPlugin):
class UserAppointments(CMSPlugin):
title = models.CharField(
_("Title"),
max_length=250,
Expand Down
13 changes: 7 additions & 6 deletions src/open_inwoner/cms/plugins/tests/test_appointments.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.test import TestCase
from django.test import TestCase, override_settings
from django.urls import reverse

import requests_mock
Expand All @@ -7,17 +7,18 @@
from open_inwoner.cms.tests import cms_tools
from open_inwoner.qmatic.tests.data import QmaticMockData

from ..cms_plugins import MyAppointmentsPlugin
from ..cms_plugins import UserAppointmentsPlugin


@requests_mock.Mocker()
class TestMyAppointmentsPlugin(TestCase):
@override_settings(ROOT_URLCONF="open_inwoner.cms.tests.urls")
class TestUserAppointmentsPlugin(TestCase):
def test_plugin(self, m):
data = QmaticMockData()
data.setUpMocks(m)

html, context = cms_tools.render_plugin(
MyAppointmentsPlugin, plugin_data={}, user=data.user
UserAppointmentsPlugin, plugin_data={}, user=data.user
)

appointments = context["appointments"]
Expand All @@ -34,9 +35,9 @@ def test_plugin(self, m):
self.assertEqual(len(items), 2)

aanvraag_paspoort_date = PQ(items.find("p.tabled__value")[0]).text()
aanvraag_paspoort_title = PQ(items.find(".appointments__heading")[0]).text()
aanvraag_paspoort_title = PQ(items.find(".plugin-card__heading")[0]).text()
aanvraag_id_kaart_date = PQ(items.find("p.tabled__value")[1]).text()
aanvraag_id_kaart_title = PQ(items.find(".appointments__heading")[1]).text()
aanvraag_id_kaart_title = PQ(items.find(".plugin-card__heading")[1]).text()

self.assertEqual(aanvraag_paspoort_date, "1 januari 2020 om 13:00 uur")
self.assertEqual(aanvraag_paspoort_title, "Aanvraag paspoort")
Expand Down
2 changes: 1 addition & 1 deletion src/open_inwoner/cms/plugins/tests/test_userfeed.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_plugin(self):
title = items.find("p.tabled__value").text()
self.assertEqual(title, "Test message")

message = items.find(".userfeed__heading").text()
message = items.find(".plugin-card__heading").text()
self.assertEqual(message, "Hello")

action_url = items[0].attrib["href"]
Expand Down
4 changes: 2 additions & 2 deletions src/open_inwoner/cms/profile/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
DocumentPrivateMediaView,
EditProfileView,
InviteAcceptView,
MyAppointmentsView,
MyCategoriesView,
MyDataView,
MyNotificationsView,
MyProfileView,
NecessaryFieldsUserView,
NewsletterSubscribeView,
UserAppointmentsView,
)
from open_inwoner.accounts.views.actions import ActionDeleteView

Expand Down Expand Up @@ -108,6 +108,6 @@
NewsletterSubscribeView.as_view(),
name="newsletters",
),
path("appointments", MyAppointmentsView.as_view(), name="appointments"),
path("appointments", UserAppointmentsView.as_view(), name="appointments"),
path("", MyProfileView.as_view(), name="detail"),
]
2 changes: 1 addition & 1 deletion src/open_inwoner/conf/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@
"ProductFinderPlugin",
"ProductLocationPlugin",
"UserFeedPlugin",
"MyAppointmentsPlugin",
"UserAppointmentsPlugin",
],
"text_only_plugins": ["LinkPlugin"],
"name": _("Content"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.appointments {
.card__body {
span.button:last-child {
bottom: var(--spacing-large) !important;
}
}
.appointments > .plugin-card > .card > .card__body > span.button:last-child {
bottom: var(--spacing-large);
}

0 comments on commit 91b2ef0

Please sign in to comment.