-
-
Notifications
You must be signed in to change notification settings - Fork 33
Gdpr #1646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Gdpr #1646
Changes from 19 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
4475d23
WIP
9b69460
WIP
1497c84
add switch
brunobesson 5bb4027
fix
brunobesson 63cd59f
Move GDPR handling to a plugin
brunobesson d988987
Handle date of consent
brunobesson a9ed1f9
a little bit of styling
brunobesson f4b8c82
wait for first interaction to display banner
brunobesson 8d15bf1
fix: copy object
brunobesson 83c2600
move link in menu
brunobesson d54e886
Add method to set whole config
brunobesson c45861f
Add privacy icon
brunobesson f984f15
handle addthis for GDPR
brunobesson 6e47f6b
Enhance text (french for now)
brunobesson 0e14fe7
translate banner buttons
brunobesson 361d2fb
add missing translate directives
brunobesson feacb8d
remove ga debug
brunobesson 1e93bf3
english text + small fixes
brunobesson 8ad927b
fix codacy issue
brunobesson c9245d5
Update src/components/gdpr/GdprBanner.vue
brunobesson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| <template> | ||
| <div> | ||
| <div class="gdpr-content" :class="{ active: active }"> | ||
| <h4 class="title" v-translate>Control the use of your personal data</h4> | ||
| <div class="message"> | ||
| <span v-translate class="has-text-justified"> | ||
| Our website uses cookies provided by ourselves and third parties. Some cookies are necessary for the website, | ||
| while you can adjust others at any time, in particular those that allow us to understand the performance of | ||
| our website and to offer you social media features. You can accept or reject all, or | ||
| </span> | ||
| <a @click="showGdprModal()" v-translate>configure your choices</a>. | ||
| </div> | ||
| <div class="buttons mt-2 is-flex is-justify-content-flex-end"> | ||
| <button @click="acceptGdpr(false)" class="button is-danger" v-translate>Deny all</button> | ||
| <button @click="acceptGdpr(true)" class="button is-primary" v-translate>Allow all</button> | ||
| </div> | ||
| </div> | ||
| <gdpr-modal ref="GdprModal"></gdpr-modal> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script> | ||
| import GdprModal from './GdprModal.vue'; | ||
|
|
||
| export default { | ||
| components: { GdprModal }, | ||
|
|
||
| data() { | ||
| return { | ||
| userHasInteracted: false, | ||
| }; | ||
| }, | ||
|
|
||
| computed: { | ||
| active: function () { | ||
| return !this.$gdpr.get() && this.userHasInteracted; | ||
| }, | ||
| }, | ||
|
|
||
| beforeMount() { | ||
| window.addEventListener('scroll', this.firstUserInteraction); | ||
| window.addEventListener('keydown', this.firstUserInteraction); | ||
| window.addEventListener('resize', this.firstUserInteraction); | ||
| window.addEventListener('click', this.firstUserInteraction); | ||
| }, | ||
|
|
||
| mounted() { | ||
| this.$root.$on('showGdpr', () => this.showGdprModal()); | ||
| }, | ||
|
|
||
| methods: { | ||
| showGdprModal() { | ||
| this.$refs.GdprModal.show(this.gdprValue); | ||
| }, | ||
|
|
||
| acceptGdpr(accept) { | ||
| this.$gdpr.setAll(accept); | ||
| }, | ||
|
|
||
| firstUserInteraction() { | ||
| window.removeEventListener('scroll', this.firstUserInteraction); | ||
| window.removeEventListener('keydown', this.firstUserInteraction); | ||
| window.removeEventListener('resize', this.firstUserInteraction); | ||
| window.removeEventListener('click', this.firstUserInteraction); | ||
|
|
||
| this.userHasInteracted = true; | ||
| }, | ||
| }, | ||
| }; | ||
| </script> | ||
|
|
||
| <style lang="scss" scoped> | ||
| @import '@/assets/sass/variables.scss'; | ||
|
|
||
| .gdpr-content { | ||
| z-index: 30; | ||
| position: fixed; | ||
| top: 0; | ||
| padding: 10px; | ||
|
|
||
| margin: 0 auto; | ||
| flex-direction: column; | ||
| display: flex; | ||
| background-color: white; | ||
| box-shadow: none; | ||
| transform: translateY(-100%); | ||
| transition: all 0.25s ease-in-out; | ||
|
|
||
| &.active { | ||
| box-shadow: rgba(0, 0, 0, 0.3) 1px 1px 6px 0; | ||
| transform: translateY(0); | ||
| } | ||
| } | ||
|
|
||
| @media screen and (min-width: $desktop) { | ||
| .gdpr-content { | ||
| width: 50%; | ||
| left: calc(25% - 10px); | ||
|
|
||
| border-bottom-left-radius: 4px; | ||
| border-bottom-right-radius: 4px; | ||
| } | ||
| } | ||
| </style> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| <template> | ||
| <modal-window ref="modalWindow"> | ||
| <div slot="header" class="has-text-centered"> | ||
| <fa-icon icon="user-shield"></fa-icon> | ||
| <span v-translate>Configure cookies</span> | ||
| </div> | ||
|
|
||
| <div class="columns"> | ||
| <div class="column"> | ||
| <h2 class="is-size-3" v-translate>Necessary cookies</h2> | ||
| <p v-translate> | ||
| Necessary cookies are essential for the proper functioning of our website and cannot be disabled. They are | ||
| sent to your computer or device when you ask for a specific action or service, e.g. when you log in, fill out | ||
| a form or define your cookie preferences. If you configure your computer to block these cookies or to warn you | ||
| of their existence, our website will not function fully. | ||
| </p> | ||
| </div> | ||
| <div class="column"> | ||
| <div class="is-flex is-justify-content-space-between is-align-items-baseline"> | ||
| <h2 class="is-size-3" v-translate>Statistical cookies</h2> | ||
| <div class="field"> | ||
| <input | ||
| type="checkbox" | ||
| id="statistics" | ||
| name="statistics" | ||
| class="switch is-rounded" | ||
| v-model="gdpr.statistics" | ||
| /> | ||
| <label for="statistics"></label> | ||
| </div> | ||
| </div> | ||
| <p v-translate> | ||
| Thanks to the statistical cookies provided by ourselves and other companies, we can evaluate the visit on our | ||
| website and know the sources of traffic. Data we obtain help us understand what visitors like and improve our | ||
| website. If you reject them, we cannot improve your experience. | ||
| </p> | ||
| <div class="is-flex is-justify-content-space-between is-align-items-baseline"> | ||
| <h2 class="is-size-3" v-translate>Social cookies</h2> | ||
| <div class="field"> | ||
| <input type="checkbox" id="social" name="social" class="switch is-rounded" v-model="gdpr.social" /> | ||
| <label for="social"></label> | ||
| </div> | ||
| </div> | ||
| <p v-translate> | ||
| These cookies allow you to interact from camptocamp.org website with social media modules and share content of | ||
| the website with other people or let them know of your consultation or opinion on it, e.g. when you click on | ||
| the "Share" module. By disabling these cookies, you won't be able to share content from camptocamp.org on | ||
| social networks. | ||
| </p> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div slot="footer" class="buttons is-flex is-justify-content-flex-end"> | ||
| <button class="button" @click="hide" v-translate>Cancel</button> | ||
| <button class="button is-primary" @click="submit" v-translate>Submit</button> | ||
| </div> | ||
| </modal-window> | ||
| </template> | ||
|
|
||
| <script> | ||
| export default { | ||
| data() { | ||
| return { | ||
| gdpr: { | ||
| statistics: false, | ||
| social: false, | ||
| }, | ||
| }; | ||
| }, | ||
|
|
||
| methods: { | ||
| show() { | ||
| this.gdpr = JSON.parse(JSON.stringify(this.$gdpr.get())) || { statistics: false, social: false }; | ||
| this.$refs.modalWindow.show(); | ||
| }, | ||
|
|
||
| hide() { | ||
| this.$refs.modalWindow.hide(); | ||
| }, | ||
|
|
||
| submit() { | ||
| this.$gdpr.set(this.gdpr); | ||
| this.hide(); | ||
| }, | ||
| }, | ||
| }; | ||
| </script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| export default function install(Vue) { | ||
| const gdprVm = new Vue({ | ||
| name: 'Gdpr', | ||
|
|
||
| data() { | ||
| return { gdprValue: undefined }; | ||
| }, | ||
|
|
||
| created() { | ||
| try { | ||
| let storedValue = this.$localStorage.get('choice'); | ||
| // if choice is over a year, consent must be asked again | ||
| if (Date.now() - (storedValue?.date ?? 0) > 1000 * 60 * 60 * 24 * 365) { | ||
| storedValue = null; | ||
| } | ||
| this.gdprValue = storedValue; | ||
| } catch (err) { | ||
| this.gdprValue = undefined; | ||
| } | ||
|
|
||
| if (this.gdprValue?.statistics) { | ||
| this.$ga.enable(); | ||
| } | ||
| }, | ||
|
|
||
| methods: { | ||
| get() { | ||
| return this.gdprValue; | ||
| }, | ||
|
|
||
| set(newValue) { | ||
| if (newValue) { | ||
| this.gdprValue = { ...newValue, date: Date.now() }; | ||
| this.$localStorage.set('choice', this.gdprValue); | ||
| } else { | ||
| this.gdprValue = undefined; | ||
| } | ||
|
|
||
| if (newValue?.statistics) { | ||
| this.$ga.enable(); | ||
| } else { | ||
| this.$ga.disable(); | ||
| } | ||
| }, | ||
|
|
||
| setAll(accept) { | ||
| this.set(accept ? { statistics: true, social: true } : { statistics: false, social: false }); | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| Vue.prototype.$gdpr = gdprVm; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.