Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 6893b19f3c
Fetching contributors…

Cannot retrieve contributors at this time

246 lines (215 sloc) 8.256 kb
<!DOCTYPE html>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this file,
- You can obtain one at http://mozilla.org/MPL/2.0/. -->
<html lang="en">
<head>
<meta charset="utf-8">
<title>Welcome to MoTown</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<% if (!user) { %>
<meta http-equiv="refresh" content="1">
<% } %>
<link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" >
<link href="/stylesheets/sidebar.css" rel="stylesheet" type="text/css" media="screen">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script src="/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="https://browserid.org/include.js" type="text/javascript"></script>
<script src="/javascripts/application.js" type="text/javascript"></script>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="https://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- Le fav and touch icons
<link rel="shortcut icon" href="../assets/ico/favicon.ico">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png"> -->
<script type="text/javascript">
var storyTemplate = null;
var contactTemplate = null;
var port = null;
var resetContactListOnNextUpdate = true;
<% if (user){ %>
var my = {
'id': <%= user.id%>,
'nick': "<%= user.nick.replace('\"', '\\"')%>" //' <- that bit is to keep the syntax highlighter happy
};
<% } %>
var handlers = {
'sidebar.user-info': function(user){
$('#me img').attr('src', user.portrait);
},
'user.signout': function(){
window.location.reload();
},
'feed.story': function(data){
var li = storyTemplate.clone();
li.attr('id', data.id);
if (data['image']){
var img = li.find('img.thumbnail');
img.attr('src', data.image.url);
img.attr('alt', data.image.title);
}
else{
li.find('img.thumbnail').remove();
}
li.find('p').text(data.title);
li.click(function(){
window.open(data.href, "motown_sidebar");
});
$('.feed ul').prepend(li);
li.show();
while($('.feed ul li').length > 30){
$('.feed ul li:last-child').remove();
}
},
'contacts.reset': function(){
resetContactListOnNextUpdate = true;
},
'contacts.userStatusUpdate': function(contact){
// TODO: worry about networks.
dump("Received contact update: " + contact.realName + " (" + contact.status + ")\n");
// TODO: add my own status in the UI somewhere.
if (contact.id == my.id)
return;
if (resetContactListOnNextUpdate){
resetContactListOnNextUpdate = false;
$('.contacts ul').empty();
}
var li = $('#contact_' + contact.id);
if (li.length == 0){
li = contactTemplate.clone();
li.attr('id', 'contact_' + contact.id);
$('.contacts ul').append(li);
}
li.find('a').text(contact.realName).attr('href', 'https://mozillians.org/en-US/search?q=' + contact.nick);
li.find('img').attr('src', contact.gravatar + "?s=30");
if (contact.status){
li.find('svg').hide();
var button = li.find('.status button');
var btnClasses = statusClasses[contact.status];
if (!btnClasses){
btnClasses = statusClasses['default'];
}
button.attr('class', btnClasses);
button.text(contact.status);
button.show();
}
else{
li.find('svg').show();
li.find('.status button').hide();
}
li.show();
},
'contacts.userOffline': function(contact){
$('#contact_' + contact.id).remove();
}
};
var statusClasses = {
afk: 'btn btn-mini btn-info',
away: 'btn btn-mini btn-info',
lunch: 'btn btn-mini btn-info',
zzz: 'btn btn-mini btn-inverse',
offline: 'btn btn-mini btn-inverse',
meeting: 'btn btn-mini btn-warning',
mtg: 'btn btn-mini btn-warning',
otp: 'btn btn-mini btn-warning',
dnd: 'btn btn-mini btn-error',
busy: 'btn btn-mini btn-error',
'default': 'btn btn-mini'
}
function init(){
dump('Initializing Story UI\n');
storyTemplate = $('#story_template');
storyTemplate.removeAttr('id');
$('.feed ul').empty();
contactTemplate = $('#contact_template');
contactTemplate.removeAttr('id');
$('.contacts ul').empty();
$('#top_bar a').click(function(){
window.open(this.href, 'settings');
return false;
});
port = navigator.mozSocial.getWorker().port;
port.postMessage({topic: 'sidebar.registration'});
port.onmessage = function(e) {
var data = e.data;
var handler = handlers[data.topic];
if (handler){
handler(data.data);
}
else{
dump("Unhandled message: " + e.topic + "\n");
}
};
dump("Sidebar initialized.\n");
}
$(function(){
// If user is logged in.
if (<%= (user != null) %>){
$('body').addClass('authenticated');
init();
}
else{
$('body').addClass('anonymous');
}
});
</script>
</head>
<body>
<div id="signin">
<h1>Welcome to MoTown</h1>
<h2><a href="/" target="_NEW">Get Started</a></h2>
</div>
<div id="ui">
<div id="top_bar" class="fixed-top-bar">
<h1>MoTown</h1>
</div>
<div class="feed">
<ul>
<li class="story" id="story_template">
<img
class="thumbnail"
alt="placeholder alt"
height="30"
width="30"
src="https://secure.gravatar.com/avatar/xx?s=30" />
<p>bronson commented on issue 531 on twitter/bootstrap</p>
</li>
</ul>
</div>
<div class="contacts">
<div class="header">
<h2>Contacts</h2>
<span>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<circle cx="15" cy="15" r="5" stroke="black" stroke-width="0" fill="green" />
</svg>
<button class="btn btn-mini" data-toggle="dropdown" style="display:none;"></button>
</span>
</h2>
<ul>
<li id="contact_template">
<img
class="thumbnail"
alt="Gravatar"
height="30"
width="30"
src="http://www.gravatar.com/avatar/xx?s=30" />
<a href="https://mozillians.org/en-US/search?q=wex">Simon Wex</a>
<span class="status">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<circle cx="15" cy="15" r="5" stroke-width="0" fill="green" />
</svg>
<button class="btn btn-mini" data-toggle="dropdown"></button>
</span>
</li>
</ul>
</div>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.