Skip to content
Draft
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
5 changes: 1 addition & 4 deletions app/abilities/photo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
17 changes: 11 additions & 6 deletions app/components/forms/photo-album-form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,17 @@
@property='date'
@label='Datum van activiteit'
/>
<ModelForm::CheckboxInput
<item>
<ModelForm::RadioGroup
@model={{@model}}
@property='publiclyVisible'
@label='Zichtbaar voor externen'
/>

@property='visibility'
@options={{this.visibilityOptions}}
@inputLayout='vertical'
@label='Zichtbaar voor'
@inputIdentifier='photoCategory'
@class='sort-radio-group'
/>
</item>
{{#if @model.publiclyVisible}}
<div class="row">
<div class="col-sm-10 offset-sm-2">
Expand Down Expand Up @@ -92,4 +97,4 @@
</ModelForm::FormActions>
</form>
</div>
</div>
</div>
10 changes: 9 additions & 1 deletion app/models/photo-album.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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')) {
Expand Down
Loading