Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Feature/image rights #17

Merged
merged 4 commits into from
Apr 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .sequelizerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// .sequelizerc

const path = require('path');

module.exports = {
'config': path.resolve('config', 'database.json'),
'models-path': path.resolve('src', 'models'),
'seeders-path': path.resolve('db', 'seeders'),
'migrations-path': path.resolve('db', 'migrations')
};
14 changes: 14 additions & 0 deletions db/migrations/20200304230644-user-image-consent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';

module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.addColumn('users', 'imageRightsConsent', {
type: Sequelize.DataTypes.BOOLEAN,
field: 'image_rights_consent'
})
},

down: (queryInterface, Sequelize) => {
return queryInterface.removeColumn('users', 'imageRightsConsent');
}
};
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ node:
- ./config:/var/www/config
- ./src:/var/www/src
- ./package.json:/var/www/package.json
- ./.sequelizerc:/var/www/.sequelizerc
- ./db:/var/www/db
links:
- postgresql

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"saga-logger": "0.0.8",
"saga-managed-error": "1.0.0",
"sequelize": "4.32.2",
"sequelize-cli": "5.5.1",
"serve-favicon": "2.4.5",
"shortid": "2.2.13",
"svg-captcha": "^1.4.0"
Expand Down
3 changes: 2 additions & 1 deletion src/controllers/perso/profil.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ module.exports.create = async (params, meta, req, res) => {
email: params.email,
phoneNumber: params.phoneNumber,
github: params.github,
bio: params.bio
bio: params.bio,
imageRightsConsent: params.hasOwnProperty('imageRightsConsent') && params.imageRightsConsent === 'on'
}, {
where: {
passportId: params.id
Expand Down
6 changes: 6 additions & 0 deletions src/models/Users.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ module.exports = (sequelize, DataTypes) => { // NOSONAR
field: 'house_rules'
},

// User grant rights to display their profile pic on the web
imageRightsConsent: {
type: DataTypes.BOOLEAN,
field: 'image_rights_consent'
},

registerValidate: {
type: DataTypes.BOOLEAN,
field: 'register_validate'
Expand Down
9 changes: 7 additions & 2 deletions src/views/membre.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@
</div>
<br />
<div class="name">
<h3 class="title"><%- member.firstName %> <%- member.lastName %></h3>
<h3 class="title">
<%- member.firstName %> <%- member.lastName %>
<% if(user.shortId === member.shortId) { %>
<a class="btn btn-primary btn-sm align-top" href="/perso/profil" style="line-height: normal;"><i class="fa fa-edit"></i> Éditer</a>
<% }%>
</h3>
<% if(member.github) { %>
<a href="https://github.com/<%- member.github %>" target="_blank" class="btn btn-just-icon btn-link btn-dribbble"><i class="fa fa-github"></i></a>
<a href="https://github.com/<%- member.github %>" target="_blank" class="btn btn-link btn-dribbble"><i class="fa fa-github fa-lg"></i> @<%- member.github %></a>
<% } %>
</div>
</div>
Expand Down
10 changes: 9 additions & 1 deletion src/views/perso/profil.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<div class="form-group row">
<label for="github" class="col-4 col-form-label">Nom d'utilisateur Github</label>
<div class="col-8">
<input id="github" name="github" value="<%= user.github %>" class="form-control here" required="required" type="text">
<input id="github" name="github" value="<%= user.github %>" class="form-control here" type="text">
</div>
</div>
<div class="form-group row">
Expand All @@ -65,6 +65,14 @@
<textarea id="bio" name="bio" cols="40" rows="4" class="form-control"><%= user.bio %></textarea>
</div>
</div>
<hr/>
<b>Vie privée</b>
<div class="form-group">
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" name="imageRightsConsent" id="imageRightsConsent" <% if(user.imageRightsConsent) { %>checked<% } %>>
<label class="custom-control-label" for="imageRightsConsent">J'autorise la diffusion sur openfab.be de photos/vidéos sur lesquelles j'apparais</label>
</div>
</div>
<div class="form-group row">
<div class="offset-4 col-8">
<button name="submit" type="submit" class="btn btn-secondary">Mettre &agrave; jour mon profil</button>
Expand Down