diff --git a/app/abilities/room-advert.js b/app/abilities/room-advert.js
new file mode 100644
index 000000000..d54caeaf6
--- /dev/null
+++ b/app/abilities/room-advert.js
@@ -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);
+ }
+}
diff --git a/app/components/cards/article-card.hbs b/app/components/cards/article-card.hbs
index a126dae8c..8558b4fd7 100644
--- a/app/components/cards/article-card.hbs
+++ b/app/components/cards/article-card.hbs
@@ -102,7 +102,7 @@
{{#if useMaxHeight}}
{{t 'component.public.roomForum.location'}} | ++ + {{@roomAdvert.location}} + + | +
---|---|
{{t 'component.public.roomForum.availableFrom'}} | +{{moment-format @roomAdvert.availableFrom 'DD-M-YYYY'}} | +
{{t 'component.public.roomForum.contact'}} | ++ {{#if (is-phone @roomAdvert.contact)}} + {{@roomAdvert.contact}} + {{else if (is-email @roomAdvert.contact)}} + {{@roomAdvert.contact}} + {{else if (is-url @roomAdvert.contact)}} + {{@roomAdvert.contact}} + {{else}} + {{@roomAdvert.contact}} + {{/if}} + | +
+ {{markdown-to-html + @roomAdvert.descriptionCamofied + extensions='youtubeEmbed bootstrapTable' + }} +
+ + {{#if @collapsed}} + + {{/if}} ++ {{markdown-to-html + @roomAdvert.descriptionCamofied + extensions='youtubeEmbed bootstrapTable' + }} +
+