From a7eab9e50c7e9951d7ad418dcad9b7ae6996f20a Mon Sep 17 00:00:00 2001 From: danielvincent Date: Fri, 13 Aug 2010 23:20:39 -0700 Subject: [PATCH 1/5] minor section header tweaks (album stuff) --- app/views/albums/edit.html.haml | 3 +-- app/views/albums/index.html.haml | 3 +-- app/views/albums/show.html.haml | 3 +-- app/views/photos/show.html.haml | 3 +-- app/views/shared/_group_nav.haml | 3 +-- public/stylesheets/application.css | 16 +++++++--------- public/stylesheets/sass/application.sass | 15 +++++++-------- 7 files changed, 19 insertions(+), 27 deletions(-) diff --git a/app/views/albums/edit.html.haml b/app/views/albums/edit.html.haml index 1580c9cae..b505cf76b 100644 --- a/app/views/albums/edit.html.haml +++ b/app/views/albums/edit.html.haml @@ -1,6 +1,5 @@ +.back= link_to "⇧ #{@album.name}", @album %h1.big_text - .back - = link_to "⇧ #{@album.name}", @album = "Editing #{@album.name}" diff --git a/app/views/albums/index.html.haml b/app/views/albums/index.html.haml index 59db9c376..47d2f68a9 100644 --- a/app/views/albums/index.html.haml +++ b/app/views/albums/index.html.haml @@ -1,6 +1,5 @@ +.back= link_to "⇧ home", root_path %h1.big_text - .back - = link_to "⇧ home", root_path Albums .right = link_to 'New Album', '#new_album_pane', {:class => "button", :id => "add_album_button"} diff --git a/app/views/albums/show.html.haml b/app/views/albums/show.html.haml index a2cded0c9..b63dea9de 100644 --- a/app/views/albums/show.html.haml +++ b/app/views/albums/show.html.haml @@ -1,6 +1,5 @@ +.back= link_to '⇧ albums', albums_path %h1.big_text - .back - = link_to '⇧ albums', albums_path = @album.name diff --git a/app/views/photos/show.html.haml b/app/views/photos/show.html.haml index 9cae263dd..05443591f 100644 --- a/app/views/photos/show.html.haml +++ b/app/views/photos/show.html.haml @@ -1,6 +1,5 @@ +.back= link_to "⇧ #{@album.name}", album_path(@album) %h1.big_text - .back - = link_to "⇧ #{@album.name}", album_path(@album) = @photo.image .right diff --git a/app/views/shared/_group_nav.haml b/app/views/shared/_group_nav.haml index 479e1b967..66f4fa0bd 100644 --- a/app/views/shared/_group_nav.haml +++ b/app/views/shared/_group_nav.haml @@ -14,9 +14,8 @@ #friend_pictures - for friend in @group.people = person_image_link(friend) + = link_to "+", "#add_request_pane", :id => 'add_request_button', :class => "add_new" - .add_new - = link_to "+", "#add_request_pane", :id => 'add_request_button' .yo{:style => 'display:none'} #add_request_pane = render "requests/new_request" diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 7ce7663ea..05a80acf2 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -377,8 +377,7 @@ ul#publisher_content_pickers li { h1.big_text { position: relative; line-height: auto; - border-bottom: 1px solid #666666; - text-align: center; } + border-bottom: 1px solid #666666; } .big_text .right { top: -8px; } @@ -391,7 +390,6 @@ h1.big_text { float: right; } .back { - position: absolute; font-size: 12px; font-weight: normal; } @@ -449,12 +447,12 @@ h1.big_text { width: 40px; background-color: #222222; text-align: center; - font-size: 40px; } - #group #friend_pictures .add_new a { - display: block; - position: absolute; - top: -13px; - left: 7px; } + font-size: 40px; + line-height: 33px; + top: -9px; } + #group #friend_pictures .add_new:hover { + background: #999999; + color: black; } #group #friend_pictures img { display: none; height: 40px; } diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 841f12a97..516d7a566 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -469,8 +469,6 @@ h1.big_text :border //:top 2px solid #666 :bottom 1px solid #666 - :text - :align center .big_text .right @@ -484,7 +482,6 @@ h1.big_text :float right .back - :position absolute :font :size 12px :weight normal @@ -563,11 +560,13 @@ h1.big_text :color #222 :text-align center :font-size 40px - a - :display block - :position absolute - :top -13px - :left 7px + :line-height 33px + :top -9px + + &:hover + :background #999 + :color #000 + img :display none :height 40px From c81ea5a632d160f81b0952bd5c8859f2528c8dfe Mon Sep 17 00:00:00 2001 From: danielvincent Date: Sat, 14 Aug 2010 00:09:49 -0700 Subject: [PATCH 2/5] minor changes --- app/uploaders/image_uploader.rb | 2 +- app/views/layouts/application.html.haml | 45 ++++++++---------------- public/stylesheets/application.css | 34 +++++++++++------- public/stylesheets/sass/application.sass | 33 ++++++++++++----- 4 files changed, 60 insertions(+), 54 deletions(-) diff --git a/app/uploaders/image_uploader.rb b/app/uploaders/image_uploader.rb index e118e0f84..2a55e3059 100644 --- a/app/uploaders/image_uploader.rb +++ b/app/uploaders/image_uploader.rb @@ -24,7 +24,7 @@ class ImageUploader < CarrierWave::Uploader::Base end version :thumb_large do - process :resize_to_fill => [300,200] + process :resize_to_fill => [300,300] end version :scaled_full do diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 979538d54..62d0c4eb1 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -29,45 +29,28 @@ = javascript_include_tag 'jquery.html5_upload' %body + - flash.each do |name, msg| + = content_tag :div, msg, :id => "flash_#{name}" + %header .container - - flash.each do |name, msg| - = content_tag :div, msg, :id => "flash_#{name}" + #session_action + - if user_signed_in? + %ul#user_menu + %li.name= link_to current_user.real_name, current_user.person + %li= link_to "requests (#{@request_count})", requests_path, :class => new_request(@request_count) + %li= link_to "settings", edit_user_path(current_user) + %li= link_to "logout", destroy_user_session_path + - else + = link_to "login", new_user_session_path + #diaspora_text{:href => root_path} = link_to "DIASPORA*", root_path %span.sub_text PREVIEW - - #session_action - - if user_signed_in? - = link_to current_user.real_name, current_user.person - | - = link_to "requests (#{@request_count})", requests_path, :class => new_request(@request_count) - | - = link_to "logout", destroy_user_session_path - - else - = link_to "login", new_user_session_path - = render "shared/group_nav" - - .container - - if user_signed_in? - #user_name - = link_to(person_image_tag(current_user), root_path) - %h1 - = link_to current_user.real_name, root_path - %span#latest_message - = my_latest_message - %span{:style => "font-size: small", :id => 'latest_message_time'} - - unless @latest_status_message.nil? - = "- #{how_long_ago @latest_status_message}" - - %ul.nav - %li= link_to "home", root_path - %li= link_to "photos", albums_path - %li= "|" - %li= link_to "edit profile", edit_user_path(current_user) + = link_to "photos", albums_path .container .span-24.last diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 05a80acf2..0d8edc7da 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -66,7 +66,7 @@ a { header { position: relative; margin: -2em; - margin-bottom: 30px; + margin-bottom: 20px; color: #555555; background-color: #2b2726; background-color: black; @@ -88,11 +88,8 @@ header { float: right; text-shadow: 0 1px 0 black; padding-right: 10px; } - header #session_action a { - color: #777777; - border: none; } - header #session_action a.new_requests { - color: #df0101; } + header #session_action a.new_requests { + color: #df0101; } #show_filters { z-index: 100; @@ -144,10 +141,9 @@ h1 { font-size: 21px; font-weight: bold; line-height: 36px; } - h1 p.description, h1 span.description { + h1 p.description, h1 span.description, h1 .description { font-weight: 200; - color: #999999; - padding: 0.1em; } + color: #999999; } h3 { position: relativex; @@ -352,7 +348,7 @@ ul#publisher_content_pickers li { /* cycle it! */ .album { position: relative; - height: 200px; + height: 300px; width: 300px; display: inline-block; } .album .name { @@ -378,9 +374,8 @@ h1.big_text { position: relative; line-height: auto; border-bottom: 1px solid #666666; } - -.big_text .right { - top: -8px; } + h1.big_text .right { + top: -6px; } #content_bottom .right { top: -5px; } @@ -462,3 +457,16 @@ h1.big_text { display: none; left: -25px; top: 4px; } + +#user_menu { + background: #333333; + padding: 5px; + margin: 0; + list-style: none; } + #user_menu a { + color: #999999; } + #user_menu > li { + display: inline; + margin-right: 1em; } + #user_menu > li:last-child { + margin-right: 0; } diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 516d7a566..9ef450368 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -70,7 +70,7 @@ a header :position relative :margin -2em - :bottom 30px + :bottom 20px :color #555 :background :color #2B2726 @@ -101,8 +101,6 @@ header :float right :text-shadow 0 1px 0 #000 a - :color #777 - :border none &.new_requests :color #DF0101 :padding-right 10px @@ -168,11 +166,10 @@ h1 :weight bold :line-height 36px - p.description, span.description + p.description, span.description, .description :font :weight 200 :color #999 - :padding 0.1em h3 :position relativex @@ -432,7 +429,7 @@ ul#publisher_content_pickers li .album :position relative - :height 200px + :height 300px :width 300px :display inline-block @@ -467,12 +464,11 @@ h1.big_text :position relative :line-height auto :border - //:top 2px solid #666 :bottom 1px solid #666 -.big_text .right - :top -8px + :top -6px + #content_bottom .right :top -5px @@ -577,3 +573,22 @@ h1.big_text :left -25px :top 4px +#user_menu + :background #333 + :padding 5px + :margin 0 + :list-style none + + a + :color #999 + + > li + :display inline + :margin + :right 1em + + &:last-child + :margin + :right 0 + + From 18cd4b858aa0b6e8dbbfaef3f2be1684323ed663 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Sat, 14 Aug 2010 00:27:43 -0700 Subject: [PATCH 3/5] broke out group index and show --- app/controllers/groups_controller.rb | 1 - app/views/groups/index.html.haml | 4 ++++ app/views/groups/show.html.haml | 7 +++++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 app/views/groups/show.html.haml diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 27f5ae782..f3da1ec8a 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -31,7 +31,6 @@ class GroupsController < ApplicationController @people_ids = @group.people.map {|p| p.id} @posts = Post.paginate :person_id => @people_ids, :order => 'created_at DESC' @group = Group.first(:id => params[:id]) - render :index end def edit diff --git a/app/views/groups/index.html.haml b/app/views/groups/index.html.haml index daaaaaabc..b3b4d2acb 100644 --- a/app/views/groups/index.html.haml +++ b/app/views/groups/index.html.haml @@ -1,3 +1,7 @@ +%h1 + welcome home, + = current_user.profile.first_name + = render "shared/publisher" %ul#stream - for post in @posts diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml new file mode 100644 index 000000000..daaaaaabc --- /dev/null +++ b/app/views/groups/show.html.haml @@ -0,0 +1,7 @@ += render "shared/publisher" +%ul#stream + - for post in @posts + = render type_partial(post), :post => post +#pagination + = will_paginate @posts + From 80b81c1ae1c92607d0f08879ff7f1bf6398c3b6b Mon Sep 17 00:00:00 2001 From: danielvincent Date: Sun, 15 Aug 2010 19:28:59 -0700 Subject: [PATCH 4/5] comment now validates presence of text. also, removed unused method overriding ==. --- app/models/comment.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/models/comment.rb b/app/models/comment.rb index 66ce23b55..0323b0d6a 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -18,10 +18,8 @@ class Comment key :person_id, ObjectId belongs_to :person, :class_name => "Person" - - def ==(other) - (self.message == other.message) && (self.person.email == other.person.email) - end + + validates_presence_of :text def push_upstream push_to([post.person]) @@ -34,7 +32,6 @@ class Comment #ENCRYPTION before_validation :sign_if_mine, :sign_if_my_post - #validates_true_for :creator_signature, :logic => lambda {self.verify_creator_signature} validates_true_for :post_creator_signature, :logic => lambda {self.verify_post_creator_signature} xml_accessor :creator_signature From f1f827120bac45db5be4b0ed4a21519834b9a127 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Sun, 15 Aug 2010 21:03:19 -0700 Subject: [PATCH 5/5] intentional failing test in user for tomorrow. --- app/models/group.rb | 2 ++ app/models/user.rb | 3 ++- spec/lib/diaspora_parser_spec.rb | 24 +++++++++++++++++++++++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/app/models/group.rb b/app/models/group.rb index 0f40d6d9b..6b8f18921 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -5,9 +5,11 @@ class Group key :person_ids, Array key :request_ids, Array + key :post_ids, Array many :people, :in => :person_ids, :class_name => 'Person' many :requests, :in => :request_ids, :class_name => 'Request' + many :posts, :in => :post_ids, :class_name => 'Post' belongs_to :user, :class_name => 'User' diff --git a/app/models/user.rb b/app/models/user.rb index 7f353e5ca..0090e59d6 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -162,7 +162,8 @@ class User person.profile = object person.save elsif object.verify_creator_signature == true - Rails.logger.debug("Saving object with success: #{object.save}") + Rails.logger.debug("Saving object: #{object}") + object.save object.socket_to_uid( id) if object.respond_to? :socket_to_uid end end diff --git a/spec/lib/diaspora_parser_spec.rb b/spec/lib/diaspora_parser_spec.rb index 07de46d02..3e4344a64 100644 --- a/spec/lib/diaspora_parser_spec.rb +++ b/spec/lib/diaspora_parser_spec.rb @@ -12,6 +12,29 @@ describe Diaspora::Parser do @person = Factory.create(:person_with_private_key, :email => "bill@gates.com") @user2 = Factory.create(:user) end + + + it "should associate the post with a group" do + @user.activate_friend(@person, @group) + + status_message = Factory.build(:status_message, :message => "hey!", :person => @person) + @user.receive status_message.to_diaspora_xml + + + # mongomapper doesn't support joins, meaning we can't do a query + # on user.groups. + # should this code below be a function of a user? + # something like self.find_group_for(friend_id) ? + groups = @user.groups + groups.shift while not groups[0].person_ids.include?(@person.id) + group = groups[0] + #### + + @group.posts.count.should == 1 + end + + + describe 'with encryption' do before do unstub_mocha_stubs @@ -38,7 +61,6 @@ describe Diaspora::Parser do " @user.receive xml Post.count.should == 0 - end end