Skip to content

Commit

Permalink
Add ability to filter message recipients by activity (mozilla#3325)
Browse files Browse the repository at this point in the history
This is a continuation of what was started in mozilla#3314. It implements the remaining bits of the Compose screen in the Messaging Center, namely Activity filters.
  • Loading branch information
mathjazz authored Sep 13, 2024
1 parent d838000 commit b8db57f
Show file tree
Hide file tree
Showing 8 changed files with 427 additions and 206 deletions.
2 changes: 1 addition & 1 deletion pontoon/base/static/css/check-box.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
text-align: left;

.check-box {
padding: 8px 0;
padding: 4px 0;
}

.check-box:last-child {
Expand Down
7 changes: 5 additions & 2 deletions pontoon/base/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ input[type='password'],
input[type='url'],
input[type='number'],
input[type='email'],
input[type='date'],
textarea {
background: var(--input-background-1);
border: 1px solid var(--main-border-1);
Expand Down Expand Up @@ -1152,13 +1153,15 @@ body > form,
}

.check-box .fa:before {
color: var(--status-error);
content: '';
color: var(--toggle-color-1);
content: '';
font-weight: normal;
}

.check-box.enabled .fa:before {
color: var(--status-translated);
content: '';
font-weight: bold;
}

#helpers > section ul {
Expand Down
4 changes: 4 additions & 0 deletions pontoon/contributors/static/css/settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@
font-style: italic;
}

#main .check-list .check-box {
padding: 8px 0;
}

#main .appearance .field .help {
margin: 0 0 -12px;
}
Expand Down
13 changes: 13 additions & 0 deletions pontoon/messaging/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,16 @@ class MessageForm(forms.Form):
projects = forms.CharField(
validators=[validators.validate_comma_separated_integer_list]
)

translation_minimum = forms.IntegerField(required=False, min_value=0)
translation_maximum = forms.IntegerField(required=False, min_value=0)
translation_from = forms.DateField(required=False)
translation_to = forms.DateField(required=False)

review_minimum = forms.IntegerField(required=False, min_value=0)
review_maximum = forms.IntegerField(required=False, min_value=0)
review_from = forms.DateField(required=False)
review_to = forms.DateField(required=False)

login_from = forms.DateField(required=False)
login_to = forms.DateField(required=False)
23 changes: 16 additions & 7 deletions pontoon/messaging/static/css/messaging.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@
}

#compose {
padding: 20px;
box-sizing: border-box;

h3 {
color: var(--white-1);
font-size: 22px;
letter-spacing: 0;
margin-bottom: 20px;

.stress {
color: var(--status-translated);
Expand All @@ -19,6 +16,7 @@

.controls {
margin: 0;
text-align: right;
}

.errors {
Expand All @@ -33,7 +31,7 @@
}

#send-message > section {
margin: 20px 0;
padding: 20px;
}

.check-list {
Expand Down Expand Up @@ -64,16 +62,27 @@
.field {
color: var(--light-grey-7);
font-size: 16px;
margin-bottom: 20px;
margin-bottom: 10px;
text-align: left;
}

.field.half {
float: left;
width: 285px;
}

.field.half:nth-child(2n) {
float: right;
}

label {
display: block;
margin-bottom: 5px;
}

input[type='text'],
input[type='date'],
input[type='number'],
textarea {
background: var(--black-3);
float: none;
Expand All @@ -88,7 +97,7 @@
height: 150px;
}

.message-editor .subtitle {
.message-content .subtitle {
color: var(--light-grey-7);
float: right;
font-size: 13px;
Expand Down
29 changes: 28 additions & 1 deletion pontoon/messaging/static/js/messaging.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ $(function () {

const isValidProject = $form.find('[name=projects]').val();

const isValidTranslationMinimum = $form
.find('#translation-minimum')[0]
.checkValidity();
const isValidTranslationMaximum = $form
.find('#translation-maximum')[0]
.checkValidity();
const isValidReviewMinimum = $form
.find('#review-minimum')[0]
.checkValidity();
const isValidReviewMaximum = $form
.find('#review-maximum')[0]
.checkValidity();

$form.find('.errors').css('visibility', 'hidden');

function showErrorIfNotValid(isValid, selector) {
Expand All @@ -46,14 +59,28 @@ $(function () {
showErrorIfNotValid(isValidRole, '.filter-user-role');
showErrorIfNotValid(isValidLocale, '.filter-locale');
showErrorIfNotValid(isValidProject, '.filter-project');
showErrorIfNotValid(
isValidTranslationMinimum,
'.filter-translation > .minimum',
);
showErrorIfNotValid(
isValidTranslationMaximum,
'.filter-translation > .maximum',
);
showErrorIfNotValid(isValidReviewMinimum, '.filter-review > .minimum');
showErrorIfNotValid(isValidReviewMaximum, '.filter-review > .maximum');

return (
isValidType &&
isValidSubject &&
isValidBody &&
isValidRole &&
isValidLocale &&
isValidProject
isValidProject &&
isValidTranslationMinimum &&
isValidTranslationMaximum &&
isValidReviewMinimum &&
isValidReviewMaximum
);
}

Expand Down
Loading

0 comments on commit b8db57f

Please sign in to comment.