Skip to content

Commit

Permalink
platform-mail: update styling & fix issue with email clients when sen…
Browse files Browse the repository at this point in the history
…der is missing
  • Loading branch information
vellip committed Jan 14, 2025
1 parent 3d68103 commit f0e0468
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 36 deletions.
6 changes: 6 additions & 0 deletions changelog/8683.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### Changed
- New design for platform mail form
- sender field is now required to prevent issues with email clients
- CKEditor styling for redesign
- change default values for fields in platform email form

4 changes: 4 additions & 0 deletions meinberlin/apps/platformemails/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ class Meta:
"people in summer."
),
}

def __init__(self, **kwargs):
super().__init__(**kwargs)
self.fields["sender"].required = True
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
{% extends "a4dashboard/base_dashboard.html" %}
{% extends "base.html" %}
{% load i18n %}
{% block title %}
{% translate 'Create platform email' %}
{% translate 'Create platform email' %}
{% endblock title %}
{% block content %}
<div class="container">
<div class="offset-lg-3 col-lg-6">
<h1>{% translate 'Create platform email' %}</h1>
<p class="form-hint">
{% blocktranslate %}This email will be sent to all registered and verified users of mein.berlin.de.{% endblocktranslate %}
</p>
<form novalidate
enctype="multipart/form-data"
action="{{ request.path }}"
method="post">
{% csrf_token %}
{{ form.media }}
<div class="l-tiles-2">
{% include 'a4forms/includes/form_field.html' with field=form.sender_name %}
{% include 'a4forms/includes/form_field.html' with field=form.sender %}
</div>
{% include 'a4forms/includes/form_field.html' with field=form.subject %}
{% include 'a4forms/includes/form_field.html' with field=form.body %}
<div class="u-spacer-bottom">
<input type="submit"
class="btn btn--primary"
name="send"
value="{% translate 'Send' %}" />
<a href="{% url 'wagtail_serve' '' %}" class="btn btn--light">{% translate 'Cancel' %}</a>
</div>
</form>
</div>
</div>
<div class="narrow-wrapper">
<h1 class="mb-1">{% translate 'Create platform email' %}</h1>
<p>
{% blocktranslate %}This email will be sent to all registered and verified users of mein.berlin.de.{% endblocktranslate %}
</p>
<form novalidate
enctype="multipart/form-data"
action="{{ request.path }}"
method="post">
{% csrf_token %}
{{ form.media }}
<div class="l-tiles-2">
{% include 'meinberlin_contrib/includes/form_field.html' with field=form.sender_name %}
{% include 'meinberlin_contrib/includes/form_field.html' with field=form.sender %}
</div>
{% include 'meinberlin_contrib/includes/form_field.html' with field=form.subject %}
{% include 'meinberlin_contrib/includes/form_field.html' with field=form.body %}

<div class="narrow-wrapper__secondary-cta narrow-wrapper__secondary-cta--left">
<a href="{% url 'wagtail_serve' '' %}">{% translate 'Cancel' %}</a>
</div>
<button type="submit" class="button button--full-width" name="send">{% translate 'Send' %}</button>
</form>
</div>
{% endblock content %}
7 changes: 2 additions & 5 deletions meinberlin/apps/platformemails/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from django.conf import settings
from django.contrib import auth
from django.contrib import messages
from django.http.response import HttpResponseRedirect
Expand All @@ -24,11 +23,9 @@ class PlatformEmailCreateView(rules_mixins.PermissionRequiredMixin, generic.Crea
def get_form_kwargs(self):
kwargs = super().get_form_kwargs()

sender_name = settings.WAGTAIL_SITE_NAME

kwargs["initial"] = {
"sender_name": sender_name,
"sender": settings.CONTACT_EMAIL,
"sender_name": "mein.berlin.de",
"sender": "[email protected]",
}
return kwargs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
}
}

.narrow-wrapper__secondary-cta--left {
padding-left: 0;
margin-left: 0;
text-align: left;
}

.narrow-wrapper__footer {
padding: 1em 0 3em;

Expand All @@ -30,4 +36,4 @@
padding: 1.2em 0 4.6em;
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.ck .ck-toolbar {
border: 2px solid black !important;
border-bottom: none !important;
}

.ck .ck-editor__editable {
border: 2px solid black !important;
}
1 change: 1 addition & 0 deletions meinberlin/assets/scss/style_user_facing.scss
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,6 @@
@import "components_user_facing/adhocracy4/a4-textarea-with-counter";

// ck-editor
@import "components_user_facing/ck-editor/base";
@import "components_user_facing/ck-editor/collapsible-fragment";
@import "components_user_facing/ck-editor/iframe";
4 changes: 4 additions & 0 deletions meinberlin/assets/scss/styles_user_facing/_utility.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
margin-top: 0.5em;
}

.mb-1 {
margin-bottom: .5em;
}

.mb-2 {
margin-bottom: 1em;
}
Expand Down

0 comments on commit f0e0468

Please sign in to comment.