WIP : This module is usable but it needs more love :)
** 0.2.x version are for ZF2 ; 0.3.x and further for ZF3/Laminas **
composer require dgac/mattermostmodule
Add module in your application modules
Use
mattermostmessenger.local.php.distto add your configuration
Add CSS files to your view.
- Bootstrap 3
- Font Awesome 5
Example :
echo$this->headLink()
->appendStylesheet($this->basePath() . '/<path to your bootstrap>/bootstrap.min.css')
->appendStylesheet($this->basePath() . '/assets/css/font-awesome.all.min.css')
->appendStylesheet($this->basePath() . '/assets/css/mattermostchat.css');Add javascript dependencies (see bower.json)
- JQuery
- JQuery-UI
- Bootstrap 3
- Moment.js : http://momentjs.com/
- List.js : http://listjs.com/
- Marked : https://github.com/chjj/marked
- JS Cookie : https://github.com/js-cookie/js-cookie
Example :
echo$this->headScript()
->appendFile($this->basePath() . '/<path to your jquery>/jquery.min.js')
->appendFile($this->basePath() . '/<path to your jquery-ui>/jquery-ui.min.js')
->appendFile($this->basePath() . '/<path to your bootstrap>/bootstrap.min.js')
->appendFile($this->basePath() . '/<path to your momentjs>/moment.min.js')
->appendFile($this->basePath() . '/<path to your list.js>/list.min.js')
->appendFile($this->basePath() . '/<path to your marked.js>/marked.min.js')
->appendFile($this->basePath() . '/<path to your js-cookie>/js-cookie.js')
->appendFile($this->basePath() . '/assets/js/mattermostchat.js');- Use view helper :
<divclass="chat-container"><?php echo $this->mattermost();?></div>- And finally configure the Jquery UI Widget :
$('.chat-container').mattermost({baseUrl: '<?php echo $this->basePath(); ?>',userName: '<?php echo $this->mattermost['login'];?>',teamName: '<?php echo $this->mattermost['team_id'];?>',channelId: '<?php echo $this->mattermost['defaultchannelid'];?>',token: '<?php echo $this->mattermost['token'];?>',serverUrl: '<?php echo $this->mattermost['server_url'];?>'});