Skip to content

Commit 12ce748

Browse files
committed
Add notification select all/none button
Also add wording to clarify that crate owners may turn notifications on or off for each crate.
1 parent acf4333 commit 12ce748

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

app/controllers/me/index.js

+12
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ export default Controller.extend({
2121
emailNotificationsError: false,
2222
emailNotificationsSuccess: false,
2323

24+
setAllEmailNotifications(value) {
25+
this.get('ownedCrates').forEach(c => {
26+
c.set('email_notifications', value);
27+
});
28+
},
29+
2430
actions: {
2531
async saveEmailNotifications() {
2632
try {
@@ -45,6 +51,12 @@ export default Controller.extend({
4551
});
4652
}
4753
},
54+
emailNotificationsSelectAll() {
55+
this.setAllEmailNotifications(true);
56+
},
57+
emailNotificationsSelectNone() {
58+
this.setAllEmailNotifications(false);
59+
},
4860
startNewToken() {
4961
this.store.createRecord('api-token', {
5062
created_at: new Date(Date.now() + 2000),

app/styles/me.scss

+4
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@
143143
}
144144
}
145145

146+
.button-container {
147+
margin-right: 1rem;
148+
}
149+
146150
ul {
147151
padding: 0;
148152
@include flex-grow(1);

app/templates/me/index.hbs

+11-1
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,19 @@
3030

3131
<p>
3232
To aid detection of unauthorized crate changes, we email you each time a new version of a crate you own is pushed.
33-
By receiving and reading these emails, you help protect the Rust ecosystem.
33+
By receiving and reading these emails, you help protect the Rust ecosystem. You may also choose to turn these
34+
emails off for any of your crates listed below.
3435
</p>
3536

37+
<div class='row'>
38+
<div class='button-container'>
39+
<button type='button' class='yellow-button small' {{action 'emailNotificationsSelectAll'}}>Select All</button>
40+
</div>
41+
<div class='button-container'>
42+
<button type='button' class='yellow-button small' {{action 'emailNotificationsSelectNone'}}>Deselect All</button>
43+
</div>
44+
</div>
45+
3646
<div class='row'>
3747
<ul>
3848
{{#each ownedCrates as |ownedCrate|}}

0 commit comments

Comments
 (0)