From 6a6f27f94d6abda8f67e0adebf31dcbc2daa8659 Mon Sep 17 00:00:00 2001 From: Emmanuel Prochasson Date: Wed, 17 Jul 2013 18:07:47 +0800 Subject: [PATCH] attempt at CSS-ing. --- .meteor/packages | 1 + TODO | 9 ++++-- client/css/style.less | 11 +++++++ client/{lexicon => helpers}/lexicon.js | 4 +++ client/helpers/presence.js | 13 +++++---- client/main.html | 1 + client/main.js | 37 ++++++++++++++---------- client/views/home/home.html | 9 ++++-- client/views/includes/header.html | 19 +++++++----- client/views/newsfeed/newsfeed.html | 18 +++++++----- client/views/widgets/online_friends.html | 33 +++++++++++---------- server/publications.js | 6 ++++ test/unit/client/message.js | 0 13 files changed, 104 insertions(+), 57 deletions(-) create mode 100644 client/css/style.less rename client/{lexicon => helpers}/lexicon.js (94%) create mode 100644 test/unit/client/message.js diff --git a/.meteor/packages b/.meteor/packages index 31c5fab..1d5feca 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -19,3 +19,4 @@ spin publish-with-relations paginated-subscription filepicker +less diff --git a/TODO b/TODO index 8f3a308..be52be7 100644 --- a/TODO +++ b/TODO @@ -2,12 +2,15 @@ Browse/search users User geolocalisation. Make sure logout users are redirected to the front page, always. -Make sure non login users don't get much subscription nor database insert. + Check user security: do not allow user to change all their profile. Check filepicker secret/security thingy. Not sure it's cool. Setting page -Thing needs serious design work. -Complete Lexicon... \ No newline at end of file +Thing needs serious design work. Finish notification template (for single notification) +Complete Lexicon... + +Subscription process + email validation. +Check input security (not too long, invalid characters, injection...). \ No newline at end of file diff --git a/client/css/style.less b/client/css/style.less new file mode 100644 index 0000000..6239aae --- /dev/null +++ b/client/css/style.less @@ -0,0 +1,11 @@ + +// Mixins +.border-box{ + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +body { + font-family: 'Karla', sans-serif; +} \ No newline at end of file diff --git a/client/lexicon/lexicon.js b/client/helpers/lexicon.js similarity index 94% rename from client/lexicon/lexicon.js rename to client/helpers/lexicon.js index 66c6fd9..d7c17f2 100644 --- a/client/lexicon/lexicon.js +++ b/client/helpers/lexicon.js @@ -45,4 +45,8 @@ Meteor.i18nMessages.messages = { Meteor.i18nMessages.button = { close: 'Close' +}; + +Meteor.i18nMessages.friends = { + friends_online: 'Friends online' }; \ No newline at end of file diff --git a/client/helpers/presence.js b/client/helpers/presence.js index de433d0..65ad3bb 100644 --- a/client/helpers/presence.js +++ b/client/helpers/presence.js @@ -17,10 +17,11 @@ Meteor.Presence = { // Update last seen date. Meteor.autorun(function(){ Session.get('last-presence-at'); // Just to hit the context. - - Meteor.call('setUserPresence', function(err,res){ - if(err){ - console.log('setUserPresence: huho'); - } - }) + if(Meteor.userId()){ + Meteor.call('setUserPresence', function(err,res){ + if(err){ + console.log('setUserPresence: huho'); + } + }) + } }); diff --git a/client/main.html b/client/main.html index b1b476f..b59a8dc 100644 --- a/client/main.html +++ b/client/main.html @@ -1,5 +1,6 @@ Socialite + diff --git a/client/main.js b/client/main.js index c665f3a..8715605 100644 --- a/client/main.js +++ b/client/main.js @@ -1,21 +1,29 @@ Meteor.startup(function(){ - // All my data - Meteor.subscribe('myData', function(){ - Session.set('settings', Meteor.user().settings||{}); - }); - Meteor.subscribe('myPictures'); - Meteor.subscribe('myNotifications'); - Meteor.subscribe('myFriendList'); + Deps.autorun(function(){ + // All my data. Provide only to logged-in users. + if(!Meteor.loggingIn() && Meteor.userId()){ + Meteor.subscribe('myData', function(){ + Session.set('settings', Meteor.user().settings||{}); + }); + Meteor.subscribe('myPictures'); + Meteor.subscribe('myNotifications'); + + Meteor.subscribe('myFriendList'); + myNewsFeedHandle = Meteor.subscribeWithPagination('myNewsfeed', Newsfeed.activitiesPerPage); - myNewsFeedHandle = Meteor.subscribeWithPagination('myNewsfeed', Newsfeed.activitiesPerPage); + // My conversations + conversationsHandle = Meteor.subscribeWithPagination('myConversations', 3); - // My conversations - conversationsHandle = Meteor.subscribeWithPagination('myConversations', 3); + oneConversationHandle = Meteor.subscribeWithPagination('oneConversation', function(){ + return Session.get('currentConversation') || null; + }, Messages.messagePerPage); - oneConversationHandle = Meteor.subscribeWithPagination('oneConversation', function(){ - return Session.get('currentConversation') || null; - }, Messages.messagePerPage); + // Questions for the profile form. + Meteor.subscribe('questions'); + + } + }); // When visiting someone's profile Deps.autorun(function () { @@ -26,8 +34,5 @@ Meteor.startup(function(){ }, Activities.activitiesPerPage); }); - // Questions for the profile form. - Meteor.subscribe('questions'); - // Meteor.subscribe('adminShowEveryone'); }); \ No newline at end of file diff --git a/client/views/home/home.html b/client/views/home/home.html index 70616ed..983c294 100644 --- a/client/views/home/home.html +++ b/client/views/home/home.html @@ -1,6 +1,11 @@ \ No newline at end of file diff --git a/client/views/includes/header.html b/client/views/includes/header.html index 11ed7bf..ba60d73 100644 --- a/client/views/includes/header.html +++ b/client/views/includes/header.html @@ -7,23 +7,28 @@
  • Profile
  • -
  • - Settings +
  • +
  • - {{#if currentUser}} + + {{/if}} + - {{/if}} - + \ No newline at end of file diff --git a/client/views/newsfeed/newsfeed.html b/client/views/newsfeed/newsfeed.html index df46048..db18e28 100644 --- a/client/views/newsfeed/newsfeed.html +++ b/client/views/newsfeed/newsfeed.html @@ -1,10 +1,12 @@ \ No newline at end of file diff --git a/client/views/widgets/online_friends.html b/client/views/widgets/online_friends.html index f201c7b..d9e3d8c 100644 --- a/client/views/widgets/online_friends.html +++ b/client/views/widgets/online_friends.html @@ -1,20 +1,23 @@ \ No newline at end of file diff --git a/server/publications.js b/server/publications.js index 10766fa..5701aa5 100644 --- a/server/publications.js +++ b/server/publications.js @@ -72,6 +72,9 @@ Meteor.publish('myNewsfeed', function(limit){ }); Meteor.publish("oneConversation", function(conversation, limit){ + if(!this.userId){ + return; + } if(conversation){ var conv = Conversations.findOne(conversation); if(conv.owner == this.userId){ @@ -98,6 +101,9 @@ Meteor.publish("oneConversation", function(conversation, limit){ Meteor.publish("myFriendList", function(limit){ // load a very light version of the friendlist // Not very reactive. + if(!this.userId){ + return; + } if(this.userId){ Meteor.publishWithRelations({ diff --git a/test/unit/client/message.js b/test/unit/client/message.js new file mode 100644 index 0000000..e69de29