Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
berg committed Sep 5, 2013
2 parents f953032 + b47f60c commit 72ee9a4
Show file tree
Hide file tree
Showing 16 changed files with 113 additions and 41 deletions.
4 changes: 4 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ nconf.add('asset_map', {type: 'file', file: asset_map_path});
var express = require('express');
var jade = require('jade');
var app = express();
var raven = require('raven');
var server = require('http').createServer(app);
var redisurl = require('./ohe/redisurl');
var RedisStore = require('connect-redis')(express);
Expand All @@ -23,6 +24,7 @@ var _ = require('underscore');
var multiprocess = nconf.get('deploy:multiprocess');
var connect_to_stream = nconf.get('deploy:master') || !multiprocess;
var on_heroku = nconf.get('deploy:heroku');
var SENTRY_DSN = nconf.get('sentry:dsn');

if (on_heroku) {
nconf.set('sessions:redis_url', process.env.REDISTOGO_URL);
Expand Down Expand Up @@ -99,6 +101,7 @@ app.configure(function () {
app.use(express.bodyParser());
app.use("/static", express['static'](__dirname + '/static'));
app.use(app.router);
app.use(raven.middleware.express(SENTRY_DSN));
app.use(express.errorHandler());
});

Expand All @@ -115,6 +118,7 @@ app.get('/channel/:channel_id', routes.index);
app.get('/new-message', routes.index);
app.get('/return', routes.oauth_return);
app.get('/logout', routes.logout);
app.get('/logout-and-login', routes.logout_and_login);
app.get('/healthcheck', routes.healthcheck);
app.get('/camofy-url', routes.camofy_url);
app.get('/file-url', routes.file_url);
Expand Down
3 changes: 3 additions & 0 deletions config.sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@
"camo": {
"host": "",
"key": ""
},
"sentry": {
"dsn": ""
}
}
3 changes: 2 additions & 1 deletion ohe/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ exports.get_authenticate_url = function (req) {
response_type: 'code',
redirect_uri: redirect_uri,
scope: scope,
client_id: client_id
client_id: client_id,
new_onboarding: 1
});
};

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
"private": true,
"dependencies": {
"nconf": "0.6.5",
"express": "3.0.3",
"express": "3.2.4",
"event-stream": "3.0.7",
"request": "2.12.0",
"connect-redis": "1.4.5",
"jade": "0.28.1",
"redis": "0.8.2",
"underscore": "1.4.2",
"http-proxy": "0.8.4",
"hiredis": "0.1.14"
"hiredis": "0.1.15",
"raven": "0.5.1"
},
"engines": {
"node": "0.8.x",
Expand Down
6 changes: 6 additions & 0 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ exports.logout = function (req, res) {
});
};

exports.logout_and_login = function (req, res) {
auth.logout(req, function () {
res.redirect(auth.get_authenticate_url(req));
});
}

exports.healthcheck = function (req, res) {
res.send('healthcheck=OK');
};
Expand Down
Binary file removed static/images/appdotnet-omega.png
Binary file not shown.
Binary file modified static/images/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/images/omega-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion static/js/channels.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,5 +172,11 @@
$scope.getRoster = function () {
return $scope.selectedUsers;
};
}]);
}]).directive('channelListEntry', function () {
return {
restrict: 'E',
replace: true,
templateUrl: 'channel-list-entry.html'
};
});
})();
14 changes: 13 additions & 1 deletion static/js/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,19 @@
restrict: 'E',
controller: 'MessageFormCtrl',
replace: true,
templateUrl: 'message-form.html'
templateUrl: 'message-form.html',
link: function (scope, element) {
$(element).keypress(function (e) {
// prevent Enter key from opening file attachment dialog when
// Send button is disabled
if (e.which === 13) { // Enter key
var submit_btn = $(element).find('button[value="submit"]');
if (submit_btn.attr('disabled') === 'disabled') {
return false;
}
}
});
}
};
}).directive('messageContainer', ['utils', '$http', function (utils, $http) {
return {
Expand Down
2 changes: 1 addition & 1 deletion static/js/ohe.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
var error = function (response) {
var status = response.status;
if (status === 401) {
window.location.href = window.location.href;
window.location.pathname = '/logout-and-login';
}
return $q.reject(response);
};
Expand Down
31 changes: 29 additions & 2 deletions static/scss/_ohe.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
$grayHighlight: #FBFBFB;

html.omega {
.nav.header .logo {
background-image: url("/static/images/appdotnet-omega.png");
.nav.header {
.logo {
background-image: url("/static/images/omega-logo.png");
width: 146px;
height: 32px;
background-size: 146px 32px;
margin-top: 23px;
}
&.logged-out .logo {
margin-bottom: 23px;
}
}
.navbar .nav .active > a {
background-color: $grayHighlight;
Expand All @@ -14,6 +23,24 @@ html.omega {
font-size: 14px;
}
}
html.breakpoint-retina {
.nav.header .logo {
background-image: url("/static/images/[email protected]");
}
}
html.breakpoint-phone {
.nav.header {
.logo {
margin: 6px 0 0 0;
width: 32px;
height: 32px;
}
&.logged-out .logo {
margin-bottom: 6px;
}
}
}


.logged-in-block a {
outline: 0;
Expand Down
25 changes: 25 additions & 0 deletions static/templates/channel-list-entry.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<a href="{{ channel.detail_url() }}">
<div class="row {{channel.has_unread && 'unread'}} channel">
<div class='pull-left img-block'>
<img width=50 height=50 alt='channel icon {{ channel.get_visible_user().username }}' ng-src="{{ channel.get_visible_user().avatar_image.url }}?w=50">
</div>
<div class='content-block'>
<div class='timestamp pull-right'>
<small class='muted'>{{ channel.recent_message.created_at | date:'MMM-d h:mm a' }}</small>
</div>
<div class='users'>
<span ng-repeat="user in channel.get_users()">
<span ng-show="user.is_complete">
{{ user.username }}<span ng-show="!$last">, </span>
</span>
</span>
</div>
<div class='recent-message'>
<small class='muted'>
<span ui-if="channel.recent_message.user.id == user_id">&larr; </span>
{{channel.recent_message.text}}
</small>
</div>
</div>
</div>
</a>
51 changes: 19 additions & 32 deletions static/templates/channel-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,25 @@
</div>
<div class="channel-list yui3-u-2-3 m-yui3-u-1">
<div class="row-fluid">
<div class='ul-container yui3-u-1'>
<ul class='unstyled'>
<li ng-repeat="channel in (selectedNav == 'inbox' && channel_list || muted_channel_list) | orderBy:['-has_unread', '-recent_message.created_at'] | limitTo:((selectedNav == 'inbox' && num_channels_to_show) || muted_channel_list.length)" ng-class="{'last':$last}">
<a href="{{ channel.detail_url() }}">
<div class="row {{channel.has_unread && 'unread'}} channel">
<div class='pull-left img-block'>
<img width=50 height=50 alt='channel icon {{ channel.get_visible_user().username }}' ng-src="{{ channel.get_visible_user().avatar_image.url }}?w=50">
</div>
<div class='content-block'>
<div class='timestamp pull-right'>
<small class='muted'>{{ channel.recent_message.created_at | date:'MMM-d h:mm a' }}</small>
</div>
<div class='users'>
<span ng-repeat="user in channel.get_users()">
<span ng-show="user.is_complete">
{{ user.username }}<span ng-show="!$last">, </span>
</span>
</span>
</div>
<div class='recent-message'>
<small class='muted'>
<span ui-if="channel.recent_message.user.id == user_id">&larr; </span>
{{channel.recent_message.text}}
</small>
</div>
</div>
</div>
</a>
</li>
<li class='show-older-channels ta-center' ng-show="selectedNav == 'inbox' && has_more_channels() && channel_list.length >= channel_fetch_size"><a href='#' ng-click="loadOlderChannels()">Show Older <i class='icon-chevron-down'></i></a></li>
<div class='no-channels' ng-show="!channel_list || channel_list.length == 0">No messages yet</div>
</ul>
<div class='ul-container yui3-u-1' ng-switch on="selectedNav">
<div ng-switch-default>
<ul class='unstyled'>
<li ng-repeat="channel in channel_list | orderBy:['-has_unread', '-recent_message.created_at'] | limitTo: num_channels_to_show" ng-class="{'last':$last}">
<channel-list-entry></channel-list-entry>
</li>
<li class='show-older-channels ta-center' ng-show="has_more_channels()">
<a href='#' ng-click="loadOlderChannels()">Show Older <i class='icon-chevron-down'></i></a>
</li>
<div class='no-channels' ng-show="!channel_list || channel_list.length == 0">No messages yet</div>
</ul>
</div>
<div ng-switch-when="muted">
<ul class='unstyled'>
<li ng-repeat="channel in muted_channel_list | orderBy:['-has_unread', '-recent_message.created_at']" ng-class="{'last':$last}">
<channel-list-entry></channel-list-entry>
</li>
</ul>
</div>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion views/index.jade
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ html(lang="en", ng-app="ohe", class="omega new-app-dot-net")

body
div.wrapper
div.nav.header.yui3-u-1
div(class="#{is_authenticated ? '' : 'logged-out'} nav header yui3-u-1")
div.container
div.yui3-u-1.clearfix
a.pull-left.logo(href="/")
Expand Down

0 comments on commit 72ee9a4

Please sign in to comment.