From 7cb94ec6a1b0ddfe4c55e4e4db48923665969458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szepes=20N=C3=B3ra?= Date: Mon, 16 Nov 2020 12:03:17 +0100 Subject: [PATCH] adjust fix for #139 --- app/controllers/demonstrator/detail.js | 8 ++++++++ app/templates/demonstrator/detail.hbs | 9 ++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/controllers/demonstrator/detail.js b/app/controllers/demonstrator/detail.js index 8a75341..691ab8e 100644 --- a/app/controllers/demonstrator/detail.js +++ b/app/controllers/demonstrator/detail.js @@ -7,8 +7,11 @@ export default Ember.Controller.extend({ session: Ember.inject.service('session'), classNames: ['demonstrator-group'], + noGroupToShow: false, + // TODO: move to models/eventTemplate.js when the Events attribute is filtered in the get call. sortedEventsByCourseCode: Ember.computed('model', function () { + this.set("noGroupToShow", false); return new RSVP.Promise((resolve, reject) => { if (this.get('model.id')) { this.get('store').query('event', { @@ -47,6 +50,10 @@ export default Ember.Controller.extend({ finalEventsByCourseCode[sorted.courseCode] = separatedEventsByCourseCode[sorted.courseCode]; }); + if(Object.keys(finalEventsByCourseCode).length === 0) { + this.set("noGroupToShow", true); + } + resolve(finalEventsByCourseCode); }, err => { console.error(err); @@ -54,6 +61,7 @@ export default Ember.Controller.extend({ }); } else { + this.set("noGroupToShow", true); resolve({}); } }); diff --git a/app/templates/demonstrator/detail.hbs b/app/templates/demonstrator/detail.hbs index 9cc9269..79f4423 100644 --- a/app/templates/demonstrator/detail.hbs +++ b/app/templates/demonstrator/detail.hbs @@ -10,6 +10,9 @@ {{#each-in eventsByDate as |date events|}} {{demonstrator-group-data currentEventTemplate=model events=(await events) evaluateEvent=(action 'evaluateEvent')}} {{/each-in}} - {{else}} - Nincs megjeleníthető laborcsoport. -{{/each-in}} \ No newline at end of file +{{/each-in}} + +{{#if noGroupToShow}} +
+ Nincs megjeleníthető laborcsoport. +{{/if}} \ No newline at end of file