-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add first steps for room feature * rooms useable when logged in * some minor changed to logged in view of room adverts * added public view of room forum * made header slightly bigger * small fixes * small fixes * small fixes * small linting fixes * fixed ordering of adverts on public site * reverted testing settings * Implemented comments in PR * Fixed legacy ember component usage and added translation of error message * Fixed future merge conflicts with branch feature/public/indentity * fixed long text creating long item * fix backdrop * fix all newly introduced action helper usages * use glimmer instaed of ember component * Removed header.js and fixed form not submitting anymore * re-commit harmless change 😄 * I am stupid * change input type * format where availableFrom is shown --------- Co-authored-by: DrumsnChocolate <[email protected]>
- Loading branch information
1 parent
037e0f2
commit c7bb827
Showing
52 changed files
with
946 additions
and
128 deletions.
There are no files selected for viewing
This file contains 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,31 @@ | ||
import { isNone } from '@ember/utils'; | ||
import { Ability } from 'ember-can'; | ||
|
||
export default class RoomAdvert extends Ability { | ||
get canCreate() { | ||
return this.session.hasPermission('room-advert.create'); | ||
} | ||
|
||
get canShow() { | ||
return this.session.hasPermission('room-advert.read'); | ||
} | ||
|
||
get canDestroy() { | ||
return ( | ||
this.session.hasPermission('room-advert.destroy') || | ||
this.isRoomAdvertOwner(this.model) | ||
); | ||
} | ||
|
||
get canEdit() { | ||
return ( | ||
this.session.hasPermission('room-advert.update') || | ||
this.isRoomAdvertOwner(this.model) | ||
); | ||
} | ||
|
||
isRoomAdvertOwner(roomAdvert) { | ||
const { currentUser } = this.session; | ||
return !isNone(currentUser) && roomAdvert.isOwner(currentUser); | ||
} | ||
} |
This file contains 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 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,76 @@ | ||
<div class='col-md-12 room-advert-card {{if @collapsed "collapsed mb-5 col-xl-10 mx-xl-auto"}}' {{on "click" (fn this.open @roomAdvert)}}> | ||
<div class='d-flex justify-content-center'> | ||
<div class='card mb-0 w-100 {{if @collapsed "mx-lg-5"}}'> | ||
{{#if (not @collapsed)}} | ||
<div class="advert-modal-header card-header card-header--overlay"> | ||
<img class="card-img-top" src="{{@roomAdvert.coverPhotoUrl}}"> | ||
<div class="card-title-bar gradient-overlay"> | ||
<h1 class="card-title title ms-3 mb-2">{{@roomAdvert.houseName}}</h1> | ||
</div> | ||
</div> | ||
{{/if}} | ||
<div class='card-body m-4 fs-5'> | ||
<div class="row"> | ||
<div class="pe-4 col-12 col-md-6 mb-3"> | ||
{{#if @collapsed}} | ||
<div class="width-fit-content"> | ||
<h2 class="text-secondary me-5">{{@roomAdvert.houseName}}</h2> | ||
<hr class="border border-secondary bg-secondary border-3 opacity-100 mt-0" /> | ||
</div> | ||
{{/if}} | ||
<table> | ||
{{#if @roomAdvert.location}} | ||
<tr> | ||
<th class="pe-3 text-secondary">{{t 'component.public.roomForum.location'}}</th> | ||
<td> | ||
<a | ||
href='https://maps.google.com/?q={{@roomAdvert.location}}' | ||
target='_blank' | ||
> | ||
{{@roomAdvert.location}} | ||
</a> | ||
</td> | ||
</tr> | ||
{{/if}} | ||
{{#if @roomAdvert.availableFrom}} | ||
<tr> | ||
<th class="pe-3 text-secondary">{{t 'component.public.roomForum.availableFrom'}}</th> | ||
<td>{{moment-format @roomAdvert.availableFrom 'DD-M-YYYY'}}</td> | ||
</tr> | ||
{{/if}} | ||
<tr> | ||
<th class="pe-3 text-secondary">{{t 'component.public.roomForum.contact'}}</th> | ||
<td> | ||
{{#if (is-phone @roomAdvert.contact)}} | ||
<a href='tel:{{@roomAdvert.contact}}'>{{@roomAdvert.contact}}</a> | ||
{{else if (is-email @roomAdvert.contact)}} | ||
<a href='mailto:{{@roomAdvert.contact}}'>{{@roomAdvert.contact}}</a> | ||
{{else if (is-url @roomAdvert.contact)}} | ||
<a href='{{@roomAdvert.contact}}' target='_blank'>{{@roomAdvert.contact}}</a> | ||
{{else}} | ||
{{@roomAdvert.contact}} | ||
{{/if}} | ||
</td> | ||
</tr> | ||
</table> | ||
</div> | ||
{{#if (and @roomAdvert.coverPhotoUrl @collapsed)}} | ||
<img src={{@roomAdvert.coverPhotoUrl}} class='col-12 col-md-6 mb-3 object-fit-cover'/> | ||
{{/if}} | ||
</div> | ||
<p class='card-text description overflow-hidden mb-1' data-test-room-advert-description> | ||
{{markdown-to-html | ||
@roomAdvert.descriptionCamofied | ||
extensions='youtubeEmbed bootstrapTable' | ||
}} | ||
<div class="{{if @collapsed "fade-to-white-background"}}"></div> | ||
</p> | ||
{{#if @collapsed}} | ||
<button class="btn btn-secondary float-end fw-bold mt-1" type="button" {{on "click" (fn this.open @roomAdvert)}}> | ||
Lees meer... | ||
</button> | ||
{{/if}} | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
This file contains 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,11 @@ | ||
import Component from '@glimmer/component'; | ||
import { action } from '@ember/object'; | ||
|
||
export default class PublicRoomAdvertCardComponent extends Component { | ||
@action | ||
open(advert) { | ||
if (this.args.open) { | ||
this.args.open(advert); | ||
} | ||
} | ||
} |
This file contains 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,72 @@ | ||
<div class='card'> | ||
<div class='card-header card-header--overlay'> | ||
<img class='card-img-top' src={{@roomAdvert.coverPhotoUrlOrDefault}} /> | ||
|
||
<div class='card-title-bar gradient-overlay'> | ||
|
||
<div class='card-titles'> | ||
<h2 class='card-title' data-test-room-advert-house-name> | ||
{{@roomAdvert.houseName}} | ||
</h2> | ||
<h3 class='card-subtitle'> | ||
<span class='subtitle-author' data-test-room-advert-author> | ||
<LinkTo | ||
@route='users.user' | ||
@model={{@roomAdvert.author.id}} | ||
class='link-to card-subtitle-link' | ||
> | ||
{{@roomAdvert.author.fullName}} | ||
</LinkTo> | ||
</span> | ||
</h3> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class='row card-subheader-row ms-0 me-0'> | ||
{{#if @roomAdvert.location}} | ||
<div class='col-12 col-md-6 card-subheader-item align-items-center p-3'> | ||
<b>Locatie: </b> | ||
<a | ||
href='https://maps.google.com/?q={{@roomAdvert.location}}' | ||
target='_blank' | ||
> | ||
{{@roomAdvert.location}} | ||
</a> | ||
</div> | ||
{{/if}} | ||
|
||
{{#if @roomAdvert.availableFrom}} | ||
<div class='col-12 col-md-6 card-subheader-item align-items-center p-3'> | ||
<b>Beschikbaar vanaf: </b> | ||
{{moment-format @roomAdvert.availableFrom 'DD-M-YYYY'}} | ||
</div> | ||
{{/if}} | ||
</div> | ||
|
||
<div class='card-body'> | ||
<p class='card-text' data-test-room-advert-description> | ||
{{markdown-to-html | ||
@roomAdvert.descriptionCamofied | ||
extensions='youtubeEmbed bootstrapTable' | ||
}} | ||
</p> | ||
</div> | ||
|
||
{{#if @roomAdvert.contact}} | ||
<div class='row card-sub-bottom-row ms-0 me-0'> | ||
<div class='col-12 card-sub-item align-items-center p-3'> | ||
<b>Contact: </b> | ||
{{#if (is-phone @roomAdvert.contact)}} | ||
<a href='tel:{{@roomAdvert.contact}}'>{{@roomAdvert.contact}}</a> | ||
{{else if (is-email @roomAdvert.contact)}} | ||
<a href='mailto:{{@roomAdvert.contact}}'>{{@roomAdvert.contact}}</a> | ||
{{else if (is-url @roomAdvert.contact)}} | ||
<a href='{{@roomAdvert.contact}}' target='_blank'>{{@roomAdvert.contact}}</a> | ||
{{else}} | ||
{{@roomAdvert.contact}} | ||
{{/if}} | ||
</div> | ||
</div> | ||
{{/if}} | ||
</div> |
This file contains 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,81 @@ | ||
<div class='card'> | ||
<div class='card-header'> | ||
<h5>{{if @model.isNew 'Kamer advertentie aanmaken' 'Kamer advertentie wijzigen'}}</h5> | ||
</div> | ||
<div class='card-body'> | ||
<form {{action @onSubmit on='submit'}}> | ||
<ModelForm::TextInput | ||
@model={{@model}} | ||
@property='houseName' | ||
@label='Huisnaam' | ||
@required={{true}} | ||
@maxlength={{50}} | ||
/> | ||
<ModelForm::FileInput | ||
@model={{@model}} | ||
@property='coverPhoto' | ||
@label='Coverfoto' | ||
@loadedCallback={{@onCoverPhotoLoaded}} | ||
/> | ||
<ModelForm::TextInput | ||
@model={{@model}} | ||
@property='contact' | ||
@label='Contact (e-mailadres, telefoonnummer of link)' | ||
@required={{true}} | ||
@maxlength={{50}} | ||
/> | ||
<ModelForm::TextInput | ||
@model={{@model}} | ||
@property='location' | ||
@label='Locatie' | ||
@maxlength={{100}} | ||
/> | ||
<ModelForm::DateInput | ||
@model={{@model}} | ||
@property='availableFrom' | ||
@label='Beschikbaar vanaf' | ||
@required={{true}} | ||
/> | ||
<ModelForm::CheckboxInput | ||
@model={{@model}} | ||
@property='publiclyVisible' | ||
@label='Zichtbaar voor externen' | ||
/> | ||
|
||
{{#if @model.publiclyVisible}} | ||
<div class="row"> | ||
<div class="col-sm-10 offset-sm-2"> | ||
<div class='alert alert-warning' role='alert'> | ||
Een publieke kamer advertentie is ook zichtbaar voor niet-leden. Houd hier | ||
rekening mee in je advertentie. | ||
<br /> | ||
Plaats je een coverfoto met mensen er op? Zorg dan wel dat je | ||
toestemming van deze mensen hebt. | ||
</div> | ||
</div> | ||
</div> | ||
{{/if}} | ||
|
||
<ModelForm::MdInput | ||
@model={{@model}} | ||
@property='description' | ||
@label='Beschrijving' | ||
@required={{true}} | ||
@inputIdentifier='article-form-content' | ||
/> | ||
|
||
<ModelForm::FormActions | ||
@errors={{@model.errors}} | ||
@errorMessage={{@errorMessage}} | ||
> | ||
<button | ||
{{on 'click' @onCancel}} | ||
type="button" | ||
class='btn btn-default' | ||
> | ||
Annuleren | ||
</button> | ||
</ModelForm::FormActions> | ||
</form> | ||
</div> | ||
</div> |
This file contains 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
Oops, something went wrong.