aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIke2019-10-25 21:24:31 +0200
committerIke2019-10-25 21:25:09 +0200
commitdffd7ec9dd715ff084b4e168df5f712fff06bf0d (patch)
treec4737f2c8c12585e897e88cf0c4467a0659ce1b9
parent310517fa101910d88e4ee6cfd2fa760f6d9c72ff (diff)
Implement embedded webchat
Diffstat (limited to '')
-rw-r--r--assets/css/_room.less7
-rw-r--r--model/Room.php13
-rw-r--r--template/assemblies/chat.phtml6
3 files changed, 25 insertions, 1 deletions
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()): ?>
+ <div>
+ <iframe class="webchatframe" src="<?=h($room->getWebchatUrl())?>"></iframe>
+ </div>
+<? endif ?>
+
<? if($room->hasIrc()): ?>
<div>
<a class="btn btn-primary irclink" href="<?=h($room->getIrcUrl())?>" target="_blank">