From f3771240a329f104a66a3f0083711e81c7a2a69c Mon Sep 17 00:00:00 2001 From: Sam Nicholls Date: Wed, 23 Jan 2013 19:13:10 +0000 Subject: [PATCH] Basic Profiles [#184] --- modules/profile/commands.js | 8 +++++++- modules/profile/config.json | 2 ++ public/styles.css | 18 ++++++++++++++---- views/layout.jade | 2 +- views/profile/profile.jade | 20 +++++++++++++++++--- 5 files changed, 41 insertions(+), 9 deletions(-) diff --git a/modules/profile/commands.js b/modules/profile/commands.js index a836c2d..d92a4f4 100644 --- a/modules/profile/commands.js +++ b/modules/profile/commands.js @@ -17,7 +17,13 @@ var commands = function(dbot){ "~test_setprop": function(event){ if(event.params[1] && event.params[2]){ - dbot.db.profiles[event.server][event.user.toLowerCase()].profile[event.params[1]] = event.params[2]; + if(_.has(this.config.schema.profile, event.params[1])){ + dbot.db.profiles[event.server][event.user.toLowerCase()].profile[event.params[1]] = event.params[2]; + event.reply("Property set, maybe?"); + } + else{ + event.reply("Invalid property. Go home."); + } } } } diff --git a/modules/profile/config.json b/modules/profile/config.json index 0082dd3..48b297b 100644 --- a/modules/profile/config.json +++ b/modules/profile/config.json @@ -7,6 +7,8 @@ "primary": null, "name": null, "tagline": null, + "avatar": null, + "bio": null, "favourites": { "colour": null } diff --git a/public/styles.css b/public/styles.css index d89d330..900c548 100644 --- a/public/styles.css +++ b/public/styles.css @@ -31,7 +31,6 @@ p { } div#page { - width: 90%; margin: 0 auto 0 auto; } @@ -55,9 +54,8 @@ div#title a { } div#main { - position: relative; - padding: 15px 5px; - margin: 0px; + position: relative; + padding: 10px 5px; font-size: 21px; text-align:center; background: #FFF; @@ -183,3 +181,15 @@ li.option-votes { .sorting_asc_disabled { background: url('http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/images/sort_asc_disabled.png') no-repeat center right; } .sorting_desc_disabled { background: url('http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/images/sort_desc_disabled.png') no-repeat center right; } + +/** + * Bootstrap Overrides + */ +.profile_page-header{ + margin: 5px 0 10px 0; +} + +.profile_row{ + text-align: left; + margin-bottom: 10px; +} diff --git a/views/layout.jade b/views/layout.jade index 321bb07..bb3cf2e 100644 --- a/views/layout.jade +++ b/views/layout.jade @@ -12,7 +12,7 @@ html(lang='en') div#page div#title a(href='/') #{name} web interface - div#main + div.container#main block content script(type="text/javascript", src="/bootstrap/js/bootstrap.min.js") script(type="text/javascript", src="/d3/d3.v3.min.js") diff --git a/views/profile/profile.jade b/views/profile/profile.jade index 191147b..04b018d 100644 --- a/views/profile/profile.jade +++ b/views/profile/profile.jade @@ -39,11 +39,25 @@ block content }); }); - div.page-header + div.page-header.profile_page-header h1 #{primary} - - div#row + small + "#{profile.tagline}" + + div.row.profile_row#profile_data + div.span3 + if profile.avatar + img.profile_avatar(src="#{profile.avatar}") + else + img.profile_avatar(src="http://placehold.it/270x180&text=Hello,%20World") + div.span9 + h4 Bio + p #{profile.bio} + + hr + h3 Channel Statistics + div#profile_datatable table.table.table-hover.data thead tr