-
Notifications
You must be signed in to change notification settings - Fork 4
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
Feature: Room adverts #804
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
a1f616a
add first steps for room feature
Ellen-Wittingen 85cb911
rooms useable when logged in
Ellen-Wittingen dfbfdfa
some minor changed to logged in view of room adverts
Ellen-Wittingen 56f2bb3
added public view of room forum
Ellen-Wittingen 89c036b
Merge branch 'staging' into feature/rooms
Ellen-Wittingen ad59ee9
made header slightly bigger
Ellen-Wittingen bbee53b
Merge branch 'staging' into feature/rooms
Ellen-Wittingen 99c9339
small fixes
Ellen-Wittingen cbbd172
small fixes
Ellen-Wittingen a3736ba
small fixes
Ellen-Wittingen 9faf396
small linting fixes
Ellen-Wittingen 7f98493
fixed ordering of adverts on public site
Ellen-Wittingen 4378cbf
reverted testing settings
Ellen-Wittingen b1cf259
Implemented comments in PR
Ellen-Wittingen f126e30
Fixed legacy ember component usage and added translation of error mes…
Ellen-Wittingen ad52486
Merge branch 'staging' into feature/rooms
Ellen-Wittingen 92e50ba
Fixed future merge conflicts with branch feature/public/indentity
Ellen-Wittingen 3c58d9c
Merge branch 'staging' into feature/rooms
DrumsnChocolate 7ac4c83
fixed long text creating long item
Ellen-Wittingen cc77b4a
Merge branch 'staging' into feature/rooms
DrumsnChocolate 340ea09
Merge branch 'staging' into feature/rooms
DrumsnChocolate 40c5956
fix backdrop
DrumsnChocolate 364cf50
fix all newly introduced action helper usages
DrumsnChocolate 9ff38fb
use glimmer instaed of ember component
DrumsnChocolate f6fff65
Removed header.js and fixed form not submitting anymore
Ellen-Wittingen 1cf3933
Merge branch 'staging' into feature/rooms
DrumsnChocolate 8752650
re-commit harmless change :smile:
DrumsnChocolate 287a475
I am stupid
DrumsnChocolate e9af9e4
change input type
DrumsnChocolate 66ac883
format where availableFrom is shown
DrumsnChocolate 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
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the action helper is outdated. see https://guides.emberjs.com/release/upgrading/current-edition/action-on-and-fn/
I think this should work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are a lot of occurrences of the
action
helper in this PR, I won't comment on them all but it is important to get rid of them before this PR is mergedThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I did not see this. I just changed one back to <form {{action @onsubmit on='submit'}}> because it did not work. See my last commit