Skip to content

Commit afab4fd

Browse files
authored
Banner ui (#231)
* Bright colors to stand out * Cookie opt-out and explicit/implicit opt-in * Cookies WIP * Don't dismiss cookie banner when you alter road * Cookie banner stay away * Add allowCookies again * Remove settingauthcookies * !==
1 parent e73f1dd commit afab4fd

File tree

3 files changed

+38
-10
lines changed

3 files changed

+38
-10
lines changed

package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"vue-cookies": "^1.5.12",
3737
"vue-router": "^3.0.4",
3838
"vue-scrolling-table": "^0.2.2",
39+
"vue-timers": "^2.0.2",
3940
"vuetify": "^1.5.12"
4041
},
4142
"devDependencies": {

src/pages/MainPage.vue

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,9 @@
226226
@click.native="$event.stopPropagation()"
227227
/>
228228

229-
<v-footer v-if="!dismissedOld || (!cookiesAllowed && !dismissedCookies)" fixed class="py-1 px-2" style="height: unset;">
229+
<v-footer v-if="!dismissedOld || !dismissedCookies" fixed style="height: unset;">
230230
<v-layout column>
231-
<v-flex v-if="!dismissedOld">
231+
<v-flex v-if="!dismissedOld" class = "lime accent-1 py-1 px-2">
232232
<v-layout row align-center>
233233
<v-flex>
234234
Looking for the old courseroad? Visit the old website <a target="_blank" href="https://courseroad.mit.edu/old">here</a> and export your roads!
@@ -240,20 +240,22 @@
240240
</v-flex>
241241
</v-layout>
242242
</v-flex>
243-
<v-divider v-if="!dismissedOld && !cookiesAllowed && !dismissedCookies" class="ma-1" />
244-
<v-flex v-if="!cookiesAllowed && !dismissedCookies">
243+
<v-divider v-if="!dismissedOld && !dismissedCookies" />
244+
<v-flex v-if="!dismissedCookies" class = "lime accent-3 py-1 px-2">
245245
<v-layout row align-center>
246246
<v-flex>
247-
This site uses cookies and session storage to store your data and login token. Click OK to consent to the use of cookies.
247+
This website uses cookies and session storage to store your data and login token, and important features like saving roads will not work without them.
248+
<span v-if = "cookiesAllowed === undefined">By continuing to use this website or clicking "I accept", you consent to the use of cookies.</span>
249+
<span v-if = "cookiesAllowed !== undefined">By continuing to use this website, you have consented to the use of cookies, but may opt out by clicking the button to the right.</span>
248250
</v-flex>
249251
<v-flex shrink>
250-
<v-btn small depressed color="primary" class="ma-1" @click="allowCookies">
251-
OK
252+
<v-btn small depressed color="primary" class="ma-1" @click="allowCookies(); dismissCookies();">
253+
I accept
252254
</v-btn>
253255
</v-flex>
254256
<v-flex shrink>
255-
<v-btn small icon flat class="ma-1" @click="dismissedCookies = true;">
256-
<v-icon>close</v-icon>
257+
<v-btn small depressed class = "ma-1" @click="disallowCookies">
258+
Opt out
257259
</v-btn>
258260
</v-flex>
259261
</v-layout>
@@ -314,7 +316,7 @@ export default {
314316
saveWarnings: [],
315317
conflictDialog: false,
316318
conflictInfo: undefined,
317-
cookiesAllowed: false,
319+
cookiesAllowed: undefined,
318320
searchInput: '',
319321
showSearch: false,
320322
classInfoStack: [],
@@ -373,6 +375,8 @@ export default {
373375
roads: {
374376
handler: function (newRoads, oldRoads) {
375377
this.justLoaded = false;
378+
this.cookiesAllowed = true;
379+
this.$refs.authcomponent.allowCookies();
376380
if (this.activeRoad !== '') {
377381
this.updateFulfillment();
378382
}
@@ -433,6 +437,10 @@ export default {
433437
this.dismissedOld = JSON.parse(this.$cookies.get('dismissedOld'));
434438
this.cookiesAllowed = true;
435439
}
440+
if(this.$cookies.isKey('dismissedCookies')) {
441+
this.dismissedCookies = JSON.parse(this.$cookies.get('dismissedCookies'));
442+
this.cookiesAllowed = true;
443+
}
436444
437445
// developer.mit.edu version commented out because I couldn't get it to work. filed an issue to resolve it.
438446
// axios.get('https://mit-course-catalog-v2.cloudhub.io/coursecatalog/v2/terms/2018FA/subjects', {headers:{client_id:'01fce9ed7f9d4d26939a68a4126add9b', client_secret:'D4ce51aA6A32421DA9AddF4188b93255'}})
@@ -566,6 +574,14 @@ export default {
566574
this.cookiesAllowed = true;
567575
this.$cookies.set('dismissedOld', this.dismissedOld);
568576
},
577+
disallowCookies: function() {
578+
this.cookiesAllowed = false;
579+
this.dismissCookies();
580+
var cookieKeys = this.$cookies.keys();
581+
for(var k = 0; k < cookieKeys.length; k++) {
582+
this.$cookies.remove(cookieKeys[k]);
583+
}
584+
},
569585
updateLocal: function (id) {
570586
this.$refs.authcomponent.updateLocal(id);
571587
},
@@ -697,6 +713,12 @@ export default {
697713
this.$cookies.set('dismissedOld', true);
698714
}
699715
},
716+
dismissCookies: function() {
717+
this.dismissedCookies = true;
718+
if(this.cookiesAllowed) {
719+
this.$cookies.set('dismissedCookies', true);
720+
}
721+
},
700722
clickSearch: function(event) {
701723
this.searchOpen = !this.searchOpen;
702724
},

0 commit comments

Comments
 (0)