From 278bc8b93cc2ed1cee418c92e3bacad3d6bd3bb0 Mon Sep 17 00:00:00 2001 From: Thomas Menari Date: Thu, 24 Jan 2013 01:02:50 +0000 Subject: [PATCH 1/3] add initial yearbook feature --- modules/profile/pages.js | 11 +++++++ views/profile/profile_grid.jade | 51 +++++++++++++++++++++++++++++++++ views/users/connections.jade | 1 + 3 files changed, 63 insertions(+) create mode 100644 views/profile/profile_grid.jade diff --git a/modules/profile/pages.js b/modules/profile/pages.js index 379892c..543567e 100644 --- a/modules/profile/pages.js +++ b/modules/profile/pages.js @@ -21,6 +21,17 @@ var pages = function(dbot) { 'profile': profile, 'stats': stats.channels, }); + }, + + '/grid/:connection': function(req, res) { + var connection = req.params.connection; + var profiles = dbot.db.profiles[connection]; + + res.render('profile_grid', { + 'name': dbot.config.name, + 'connection': connection, + 'profiles': profiles, + }); } } }; diff --git a/views/profile/profile_grid.jade b/views/profile/profile_grid.jade new file mode 100644 index 0000000..b462288 --- /dev/null +++ b/views/profile/profile_grid.jade @@ -0,0 +1,51 @@ +extends ../layout + +block content + script(type="text/javascript", src="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js") + + script + $(document).ready(function(){ + // Allowing forcing of string stats data to sort as numeric + jQuery.extend( jQuery.fn.dataTableExt.oSort, { + "forcenum-pre": function ( a ) { + a = a.replace("\,", ""); + return parseFloat( a ); + }, + + "forcenum-asc": function ( a, b ) { + return a - b; + }, + + "forcenum-desc": function ( a, b ) { + return b - a; + } + } ); + + $('.tip').tooltip(); + $('.data').dataTable({ + "aoColumnDefs": [ + { "sType": "forcenum", + "asSorting": [ "desc", "asc" ], + "aTargets": [ 1, 2, 3, 4, 5 ] } + ], + "bPaginate": false, + "bFilter": false, + "bLengthChange": false, + "oLanguage": { + "sInfo": "", + "sInfoEmpty": "", + "sInfoFiltered": "" + }, + }); + }); + + div.page-header.profile_page-header + h1 + #{connection} + div.span9 + each profile, key in profiles + if profile.hasOwnProperty('profile') && profile.profile.avatar + div.span2 + a(href='/profile/'+connection+'/'+encodeURIComponent(key)) + h3= profile.profile.primary + img.profile_avatar(src="#{profile.profile.avatar}") diff --git a/views/users/connections.jade b/views/users/connections.jade index f6750fb..023376b 100644 --- a/views/users/connections.jade +++ b/views/users/connections.jade @@ -7,3 +7,4 @@ block content #modulelinks -each connection in connections a.module(href='/channels/'+connection) #{connection} + a.module(href='/grid/'+connection) #{connection} headshots From dbac28cad698fa169d0cb74a4d0737155f3e49dd Mon Sep 17 00:00:00 2001 From: Thomas Menari Date: Thu, 24 Jan 2013 01:06:05 +0000 Subject: [PATCH 2/3] oops --- views/profile/profile_grid.jade | 58 ++++++--------------------------- 1 file changed, 10 insertions(+), 48 deletions(-) diff --git a/views/profile/profile_grid.jade b/views/profile/profile_grid.jade index b462288..df63fc5 100644 --- a/views/profile/profile_grid.jade +++ b/views/profile/profile_grid.jade @@ -1,51 +1,13 @@ extends ../layout block content - script(type="text/javascript", src="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js") - - script - $(document).ready(function(){ - // Allowing forcing of string stats data to sort as numeric - jQuery.extend( jQuery.fn.dataTableExt.oSort, { - "forcenum-pre": function ( a ) { - a = a.replace("\,", ""); - return parseFloat( a ); - }, - - "forcenum-asc": function ( a, b ) { - return a - b; - }, - - "forcenum-desc": function ( a, b ) { - return b - a; - } - } ); - - $('.tip').tooltip(); - $('.data').dataTable({ - "aoColumnDefs": [ - { "sType": "forcenum", - "asSorting": [ "desc", "asc" ], - "aTargets": [ 1, 2, 3, 4, 5 ] } - ], - "bPaginate": false, - "bFilter": false, - "bLengthChange": false, - "oLanguage": { - "sInfo": "", - "sInfoEmpty": "", - "sInfoFiltered": "" - }, - }); - }); - - div.page-header.profile_page-header - h1 - #{connection} - div.span9 - each profile, key in profiles - if profile.hasOwnProperty('profile') && profile.profile.avatar - div.span2 - a(href='/profile/'+connection+'/'+encodeURIComponent(key)) - h3= profile.profile.primary - img.profile_avatar(src="#{profile.profile.avatar}") + div.page-header.profile_page-header + h1 + #{connection} + div.span9 + each profile, key in profiles + if profile.hasOwnProperty('profile') && profile.profile.avatar + div.span2 + a(href='/profile/'+connection+'/'+encodeURIComponent(key)) + h3= profile.profile.primary + img.profile_avatar(src="#{profile.profile.avatar}") From 3c4974d5efcbaf8d7b13963903b7b56fecfc38f9 Mon Sep 17 00:00:00 2001 From: Thomas Menari Date: Thu, 24 Jan 2013 19:39:28 +0000 Subject: [PATCH 3/3] make more l33t --- modules/profile/pages.js | 2 +- public/styles.css | 31 +++++++++++++++++++++++++++++++ views/profile/profile.jade | 3 +++ views/profile/profile_grid.jade | 11 ++++++----- views/users/connections.jade | 2 +- 5 files changed, 42 insertions(+), 7 deletions(-) diff --git a/modules/profile/pages.js b/modules/profile/pages.js index 543567e..96acbed 100644 --- a/modules/profile/pages.js +++ b/modules/profile/pages.js @@ -23,7 +23,7 @@ var pages = function(dbot) { }); }, - '/grid/:connection': function(req, res) { + '/profile/:connection': function(req, res) { var connection = req.params.connection; var profiles = dbot.db.profiles[connection]; diff --git a/public/styles.css b/public/styles.css index 900c548..671d5c3 100644 --- a/public/styles.css +++ b/public/styles.css @@ -193,3 +193,34 @@ li.option-votes { text-align: left; margin-bottom: 10px; } + +/** + * spaceinvader's thumbnails + */ +span.nicks { + display: none; + color: #fff; + text-decoration: none; + position: absolute; + left: 0px; + top: 10px; + width: 100%; +} +div.imgwrap { + background-color: #000; + position: relative; +} +div.imgwrap > img { + -webkit-transition: all 0.2s ease-in-out; + -moz-transition: all 0.2s ease-in-out; + -o-transition: all 0.2s ease-in-out; + transition: all 0.2s ease-in-out; +} + +.thumbnail:hover > div.imgwrap > img { + opacity: 0.5; +} + +.thumbnail:hover > div.imgwrap > span.nicks { + display: inline; +} diff --git a/views/profile/profile.jade b/views/profile/profile.jade index 04b018d..414dee5 100644 --- a/views/profile/profile.jade +++ b/views/profile/profile.jade @@ -92,3 +92,6 @@ block content #{chan.fields.wpl.data} td #{chan.fields.in_mentions.data} + ul.pager + li.previous + a(href='/profile/'+connection) ← Back to #{connection}. diff --git a/views/profile/profile_grid.jade b/views/profile/profile_grid.jade index df63fc5..ad7a5a1 100644 --- a/views/profile/profile_grid.jade +++ b/views/profile/profile_grid.jade @@ -4,10 +4,11 @@ block content div.page-header.profile_page-header h1 #{connection} - div.span9 + ul.thumbnails each profile, key in profiles if profile.hasOwnProperty('profile') && profile.profile.avatar - div.span2 - a(href='/profile/'+connection+'/'+encodeURIComponent(key)) - h3= profile.profile.primary - img.profile_avatar(src="#{profile.profile.avatar}") + li.span2 + a.thumbnail(href='/profile/'+connection+'/'+encodeURIComponent(key)) + div.imgwrap + img(src="#{profile.profile.avatar}", alt="#{key}'s photo") + span.nicks #{profile.profile.primary} diff --git a/views/users/connections.jade b/views/users/connections.jade index 023376b..27681e9 100644 --- a/views/users/connections.jade +++ b/views/users/connections.jade @@ -7,4 +7,4 @@ block content #modulelinks -each connection in connections a.module(href='/channels/'+connection) #{connection} - a.module(href='/grid/'+connection) #{connection} headshots + a.module(href='/profile/'+connection) #{connection} headshots