From a811624bcd27185891cf58ee5c749293a76a5c54 Mon Sep 17 00:00:00 2001 From: Lodewiges Date: Sat, 15 Mar 2025 21:52:39 +0100 Subject: [PATCH 1/2] Intial commit --- app/abilities/photo.js | 5 +---- app/components/forms/photo-album-form.hbs | 13 +++++++++---- app/models/photo-album.js | 10 +++++++++- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/app/abilities/photo.js b/app/abilities/photo.js index 92ee0cff6..14ecfea50 100644 --- a/app/abilities/photo.js +++ b/app/abilities/photo.js @@ -6,10 +6,7 @@ export default class Photo extends Ability { } get canShowPhotoComments() { - return ( - this.session.hasPermission('photo-comment.read') || - this.model.photoAlbum.get('publiclyVisible') - ); + return this.session.hasPermission('photo-comment.read'); } get canShowPhotoTags() { diff --git a/app/components/forms/photo-album-form.hbs b/app/components/forms/photo-album-form.hbs index fe13348ae..fdcf79b1b 100644 --- a/app/components/forms/photo-album-form.hbs +++ b/app/components/forms/photo-album-form.hbs @@ -15,12 +15,17 @@ @property='date' @label='Datum van activiteit' /> - + - + {{#if @model.publiclyVisible}}
diff --git a/app/models/photo-album.js b/app/models/photo-album.js index f063eb8fb..4f09869f0 100644 --- a/app/models/photo-album.js +++ b/app/models/photo-album.js @@ -4,7 +4,7 @@ export default class PhotoAlbum extends Model { // Properties @attr title; @attr('date-only') date; - @attr({ defaultValue: false }) publiclyVisible; + @attr visibility; // Relations @hasMany photos; @@ -47,6 +47,14 @@ export default class PhotoAlbum extends Model { return this.photos.length; } + get visibilityOptions() { + return [ + { value: 'public', label: 'Iedereen' }, + { value: 'alumni', label: 'Leden & oudleden' }, + { value: 'author', label: 'Leden' }, + ]; + } + // Methods isOwner(user) { if (user.get('id') === this.author.get('id')) { From e0d8016fdfb4e7d617e51a8bd102cdcf69550030 Mon Sep 17 00:00:00 2001 From: lodewiges <131907615+lodewiges@users.noreply.github.com> Date: Thu, 24 Apr 2025 10:58:44 +0200 Subject: [PATCH 2/2] improve Lint --- app/components/forms/photo-album-form.hbs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/components/forms/photo-album-form.hbs b/app/components/forms/photo-album-form.hbs index fdcf79b1b..e97ffd534 100644 --- a/app/components/forms/photo-album-form.hbs +++ b/app/components/forms/photo-album-form.hbs @@ -15,8 +15,8 @@ @property='date' @label='Datum van activiteit' /> - - + - + /> + {{#if @model.publiclyVisible}}
@@ -97,4 +97,4 @@
-
\ No newline at end of file +