added tlk.io chatroom

This commit is contained in:
Sacha Greif 2012-09-24 08:53:13 +09:00
parent 278739ca2e
commit d30faba624
8 changed files with 129 additions and 7 deletions

View file

@ -132,7 +132,15 @@ $.fn.exists = function () {
currentUserIsAdmin = function(){
return Session.get('currentUserIsAdmin');
}
getSetting = function(setting){
var settings=Settings.find().fetch()[0];
if(settings){
return settings[setting];
}
return '';
}
EpicEditorOptions={
container: 'editor',
basePath: '/editor',

View file

@ -140,6 +140,49 @@ body {
width: 100%;
z-index: 50; }
/* line 33, ../sass/partials/_main.scss */
#tlkio {
position: fixed;
top: 0px;
right: -280px;
-webkit-transition: ease-out right 300ms;
-webkit-transition-delay: 0ms;
-moz-transition: ease-out right 300ms 0ms;
-o-transition: ease-out right 300ms 0ms;
transition: ease-out right 300ms 0ms;
z-index: 1000;
background: #333; }
/* line 40, ../sass/partials/_main.scss */
#tlkio.open {
right: 0px;
-webkit-box-shadow: -1px 0px 5px rgba(0, 0, 0, 0.15);
-moz-box-shadow: -1px 0px 5px rgba(0, 0, 0, 0.15);
box-shadow: -1px 0px 5px rgba(0, 0, 0, 0.15); }
/* line 44, ../sass/partials/_main.scss */
#tlkio .open-chat {
display: block;
background: #7ac0e4;
-webkit-border-radius: 3px 3px 0px 0px;
-moz-border-radius: 3px 3px 0px 0px;
-ms-border-radius: 3px 3px 0px 0px;
-o-border-radius: 3px 3px 0px 0px;
border-radius: 3px 3px 0px 0px;
position: absolute;
top: 50%;
right: 264px;
text-transform: uppercase;
color: white;
padding: 3px 10px;
-webkit-transform: rotate(270deg);
-moz-transform: rotate(270deg);
-ms-transform: rotate(270deg);
-o-transform: rotate(270deg);
transform: rotate(270deg);
-webkit-box-shadow: -1px 0px 1px rgba(0, 0, 0, 0.15);
-moz-box-shadow: -1px 0px 1px rgba(0, 0, 0, 0.15);
box-shadow: -1px 0px 1px rgba(0, 0, 0, 0.15);
z-index: 1001; }
/* line 1, ../sass/partials/_typography.scss */
body, textarea, input, button, input[type="submit"], input[type="button"] {
font-family: "Proxima Nova Soft", "proxima-nova-soft", "PT SANS", "Helvetica Neue", Helvetica, sans-serif;

View file

@ -29,4 +29,30 @@ body{
height:100%;
width:100%;
z-index:50;
}
#tlkio{
position:fixed;
top:0px;
right:-280px;
@include single-transition(ease-out, right, 300ms, 0ms);
z-index:1000;
background:#333;
&.open{
right:0px;
@include box-shadow(-1px 0px 5px black(0.15));
}
.open-chat{
display:block;
background:$blue;
@include border-radius(3px 3px 0px 0px);
position:absolute;
top:50%;
right:264px;
text-transform:uppercase;
color:white;
padding:3px 10px;
@include rotate(270deg);
@include box-shadow(-1px 0px 1px black(0.15));
z-index:1001;
}
}

View file

@ -1,4 +1,10 @@
<template name="footer">
{{#if tlkio_channel}}
{{#constant}}
<div id="tlkio" data-channel="{{tlkio_channel}}" style="width:280px;height:100%;"><a href="http://tlk.io/telescope" class="open-chat">chat</a>
</div>
{{/constant}}
{{/if}}
<div class="footer grid">
</div>
{{{analytics_code}}}

View file

@ -1,6 +1,38 @@
Template.footer.analytics_code = function(){
var setting=Settings.find().fetch()[0];
if(setting){
return setting.analytics_code;
return getSetting('analytics_code');
}
Template.footer.tlkio_channel = function(){
return getSetting('tlkio_channel');
}
Template.footer.rendered = function(){
console.log(document.getElementById('tlkio'));
}
Template.footer.events = {
'click .open-chat': function(e){
e.preventDefault();
if(!window.chat_loaded){
if(getSetting('tlkio_channel')){
var target_element = document.getElementById('tlkio'),
channel_name = target_element.getAttribute('data-channel'),
custom_css_path = target_element.getAttribute('data-theme'),
iframe = document.createElement('iframe');
var iframe_src = 'http://embed.tlk.io/' + channel_name;
if (custom_css_path && custom_css_path.length > 0) {
iframe_src += ('?custom_css_path=' + custom_css_path);
}
iframe.setAttribute('src', iframe_src);
iframe.setAttribute('width', '100%');
iframe.setAttribute('height', '100%');
iframe.setAttribute('frameborder', '0');
target_element.appendChild(iframe);
}
window.chat_loaded=true;
}
$('#tlkio').toggleClass('open');
}
}

View file

@ -24,6 +24,10 @@
<label>Analytics Code</label>
<div class="controls"><textarea id="analytics_code" name="analytics_code">{{analytics_code}}</textarea></div>
</div>
<div class="control-group">
<label><a href="http://tlk.io" target="_blank">Tlk.io</a> channel</label>
<div class="controls"><input id="tlkio_channel" name="tlkio_channel" type="text" value="{{tlkio_channel}}" /></div>
</div>
<div class="form-actions">
<input type="submit" class="button" value="Submit" />
</div>

View file

@ -6,6 +6,7 @@ Template.settings.events = {
var title= $('#title').val();
var theme = $('#theme').val();
var analytics_code = $('#analytics_code').val();
var tlkio_channel = $('#tlkio_channel').val();
var prevSetting=Settings.find().fetch()[0];
if(prevSetting){
@ -13,7 +14,8 @@ Template.settings.events = {
$set: {
title: title,
theme: theme,
analytics_code: analytics_code
analytics_code: analytics_code,
tlkio_channel: tlkio_channel
}
}, function(){
throwError("Settings have been updated");
@ -22,7 +24,8 @@ Template.settings.events = {
var settingId = Settings.insert({
title: title,
theme: theme,
analytics_code: analytics_code
analytics_code: analytics_code,
tlkio_channel: tlkio_channel
}, function(){
throwError("Settings have been created");
});

View file

@ -2,7 +2,7 @@
"meteor": {
"git": "https://github.com/meteor/meteor.git",
"branch": "auth",
"commit": "c322737de733b37ca6959a9be679a88f9f6b213a"
"commit": "69110dec0f90877a9294057a4572876d0dae37e0"
},
"dependencies": {
"basePackages": {