diff --git a/app/controllers/content-report.js b/app/controllers/content-report.js index 1ec690d..c9dda1d 100644 --- a/app/controllers/content-report.js +++ b/app/controllers/content-report.js @@ -25,7 +25,6 @@ class ContentReportController extends SiteController { const router = express.Router(); dtp.app.use('/content-report', router); - router.use(this.dtp.services.gabTV.channelMiddleware()); router.use(async (req, res, next) => { res.locals.currentView = 'content-report'; return next(); diff --git a/app/controllers/home.js b/app/controllers/home.js index 25b54fa..2eb9fd5 100644 --- a/app/controllers/home.js +++ b/app/controllers/home.js @@ -23,9 +23,6 @@ class HomeController extends SiteController { const router = express.Router(); dtp.app.use('/', router); - router.use(this.dtp.services.gabTV.channelMiddleware()); - router.use(this.dtp.services.venue.channelMiddleware()); - router.use(async (req, res, next) => { res.locals.currentView = 'home'; return next(); diff --git a/app/controllers/page.js b/app/controllers/page.js index 6bede6e..902b460 100644 --- a/app/controllers/page.js +++ b/app/controllers/page.js @@ -21,9 +21,6 @@ class PageController extends SiteController { const router = express.Router(); dtp.app.use('/page', router); - router.use(this.dtp.services.gabTV.channelMiddleware()); - router.use(this.dtp.services.venue.channelMiddleware()); - router.use(async (req, res, next) => { res.locals.currentView = 'page'; return next(); diff --git a/app/controllers/post.js b/app/controllers/post.js index 43a882f..f020de7 100644 --- a/app/controllers/post.js +++ b/app/controllers/post.js @@ -36,9 +36,6 @@ class PostController extends SiteController { return next(); } - router.use(this.dtp.services.gabTV.channelMiddleware()); - router.use(this.dtp.services.venue.channelMiddleware()); - router.use(async (req, res, next) => { res.locals.currentView = 'home'; return next(); diff --git a/app/controllers/venue.js b/app/controllers/venue.js index 5efcd74..b3e6cdf 100644 --- a/app/controllers/venue.js +++ b/app/controllers/venue.js @@ -18,8 +18,6 @@ class VenueController extends SiteController { const router = express.Router(); - router.use(this.dtp.services.venue.channelMiddleware()); - this.dtp.app.use('/venue', async (req, res, next) => { res.locals.currentView = 'venue'; return next(); diff --git a/app/views/venue/components/channel-card.pug b/app/views/venue/components/channel-card.pug index b569eea..25b2c9d 100644 --- a/app/views/venue/components/channel-card.pug +++ b/app/views/venue/components/channel-card.pug @@ -1,4 +1,5 @@ -mixin renderVenueChannelCard (channel) +mixin renderVenueChannelCard (channel, options) + - options = Object.assign({ withDescription: false }, options); .uk-card.uk-card-default.uk-card-small.uk-card-hover.uk-margin if channel.currentStatus && channel.currentStatus.liveThumbnail @@ -12,9 +13,13 @@ mixin renderVenueChannelCard (channel) if channel.currentStatus && channel.currentStatus.liveEpisode && channel.currentStatus.liveEpisode.title .uk-card-body - .uk-text-bold.uk-text-truncate + .uk-text-bold.uk-text-truncate(style="font-size: 1.2em; line-height: 1;") a(href="/venue", uk-tooltip= `Watch "${channel.currentStatus.liveEpisode.title}" now!`)= channel.currentStatus.liveEpisode.title - .uk-text-small + + if options.withDescription + .uk-margin(style="font-size: 1em; line-height: 1.2; max-height: 4.8em; overflow: auto;")!= marked.parse(channel.currentStatus.liveEpisode.description) + + .uk-text-small.uk-article-meta div(uk-grid).uk-grid-small.uk-flex-between .uk-width-auto div Started: #{moment(channel.currentStatus.liveEpisode.created).fromNow()} diff --git a/app/views/venue/components/channel-grid.pug b/app/views/venue/components/channel-grid.pug index 367a3e9..6b26479 100644 --- a/app/views/venue/components/channel-grid.pug +++ b/app/views/venue/components/channel-grid.pug @@ -1,10 +1,11 @@ include ./channel-card include ./channel-list-item -mixin renderVenueChannelGrid (channels) +mixin renderVenueChannelGrid (channels, options) - var onlineChannels = channels.filter((channel) => channel.currentStatus && (channel.currentStatus.status === 'live')) var offlineChannels = channels.filter((channel) => !channel.currentStatus || (channel.currentStatus.status !== 'live')) + options = Object.assign({ withDescription: false }, options); div(uk-grid) div(class="uk-width-1-1 uk-width-2-3@s") @@ -14,7 +15,7 @@ mixin renderVenueChannelGrid (channels) div(uk-grid).uk-grid-small each channel of onlineChannels div(class="uk-width-1-1 uk-width-1-2@s uk-width-1-3@l") - +renderVenueChannelCard(channel) + +renderVenueChannelCard(channel, options) else div There are no live channels. Please check back later! @@ -25,6 +26,6 @@ mixin renderVenueChannelGrid (channels) ul.uk-list.uk-list-divider each channel of offlineChannels li - +renderVenueChannelListItem(channel) + +renderVenueChannelListItem(channel, options) else div There are no offline channels. \ No newline at end of file diff --git a/app/views/venue/index.pug b/app/views/venue/index.pug index 7f0e1f2..49952eb 100644 --- a/app/views/venue/index.pug +++ b/app/views/venue/index.pug @@ -8,4 +8,4 @@ block content .uk-container.uk-container-expand .uk-margin-large - +renderVenueChannelGrid(channels) \ No newline at end of file + +renderVenueChannelGrid(channels, { withDescription: true }) \ No newline at end of file diff --git a/dtp-sites.js b/dtp-sites.js index 2625f11..bea4945 100644 --- a/dtp-sites.js +++ b/dtp-sites.js @@ -24,12 +24,17 @@ module.config = { registerMiddleware: async (dtp, app) => { module.log.info('registering Page service middleware'); - const { page: pageService } = module.services; - const { siteLink: siteLinkService } = module.services; - + const { + gabTV: gabTvService, + page: pageService, + siteLink: siteLinkService, + venue: venueService, + } = module.services; app.use( pageService.menuMiddleware.bind(pageService), siteLinkService.middleware(), + venueService.channelMiddleware(), + gabTvService.channelMiddleware() ); }, };