From dffd7ec9dd715ff084b4e168df5f712fff06bf0d Mon Sep 17 00:00:00 2001 From: Ike Date: Fri, 25 Oct 2019 21:24:31 +0200 Subject: Implement embedded webchat --- assets/css/_room.less | 7 +++++++ model/Room.php | 13 ++++++++++++- template/assemblies/chat.phtml | 6 ++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/assets/css/_room.less b/assets/css/_room.less index 3202a87..8a0e6a4 100644 --- a/assets/css/_room.less +++ b/assets/css/_room.less @@ -64,6 +64,13 @@ body.room { .button-variant(white; @twitter; darken(@twitter, 5%);); } } + + > iframe.webchatframe { + width: 100%; + min-height: 12em; + height: 30vh; + border: 1px solid #ddd; + } } } diff --git a/model/Room.php b/model/Room.php index e5163a5..1fdbf7b 100644 --- a/model/Room.php +++ b/model/Room.php @@ -154,9 +154,20 @@ class Room ); } + public function hasWebchat() { + return $this->getConference()->get('ROOMS.'.$this->getSlug().'.WEBCHAT') && $this->getConference()->has('WEBCHAT_URL'); + } + + public function getWebchatUrl() { + return sprintf( + $this->getConference()->get('ROOMS.'.$this->getSlug().'.WEBCHAT_URL', $this->getConference()->get('WEBCHAT_URL')), + rawurlencode($this->getSlug()) + ); + } + public function hasChat() { - return $this->hasTwitter() || $this->hasIrc(); + return $this->hasTwitter() || $this->hasIrc() || $this->hasWebchat(); } diff --git a/template/assemblies/chat.phtml b/template/assemblies/chat.phtml index 8498c45..238565c 100644 --- a/template/assemblies/chat.phtml +++ b/template/assemblies/chat.phtml @@ -1,3 +1,9 @@ + if($room->hasWebchat()): ?> +