From 9a5691c46a186a2fb0a68f844957be6412ae56dd Mon Sep 17 00:00:00 2001 From: carolina Date: Tue, 6 Aug 2013 14:18:23 +0200 Subject: [PATCH 1/9] Add to leftsidebar link to photos index + thumbnails from last 3 photos --- app/controllers/people_controller.rb | 2 +- app/controllers/photos_controller.rb | 2 +- app/views/people/_profile_sidebar.html.haml | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index 85d06471e..8c08e7211 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -81,7 +81,7 @@ class PeopleController < ApplicationController @aspect = :profile @stream = Stream::Person.new(current_user, @person, :max_time => max_time) @profile = @person.profile - + @photos = Photo.where(author_id: @profile.id).limit(3).order('created_at desc') unless params[:format] == "json" # hovercard if current_user @block = current_user.blocks.where(:person_id => @person.id).first diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index c70a4a920..f6ca113fb 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -14,7 +14,7 @@ class PhotosController < ApplicationController def index @post_type = :photos @person = Person.find_by_guid(params[:person_id]) - + @photos = Photo.where(author_id: @person.id).limit(3).order('created_at desc') if @person @contact = current_user.contact_for(@person) diff --git a/app/views/people/_profile_sidebar.html.haml b/app/views/people/_profile_sidebar.html.haml index 4821a0965..c76b4f985 100644 --- a/app/views/people/_profile_sidebar.html.haml +++ b/app/views/people/_profile_sidebar.html.haml @@ -44,5 +44,14 @@ =t('.born') = birthday_format(person.birthday) + %li + - unless @photos.blank? + %h4 + = link_to t('_photos'), person_photos_path(person) + - for photo in @photos + = image_tag(photo.url(:thumb_small)) + + + %br %br From d107e7d11dacc24b187d93c0999076fb85aabe33 Mon Sep 17 00:00:00 2001 From: carolina Date: Tue, 6 Aug 2013 14:34:56 +0200 Subject: [PATCH 2/9] Changelog.md changed --- Changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 3222f5af9..62e06fb08 100644 --- a/Changelog.md +++ b/Changelog.md @@ -55,7 +55,7 @@ * Uncheck 'make contacts visible to each other' by default when adding new aspect. [#4343](https://github.com/diaspora/diaspora/issues/4343) * Add possibility to ask for Bitcoin donations [#4375](https://github.com/diaspora/diaspora/pull/4375) * Remove posts, comments and private conversations from the mobile site. [#4408](https://github.com/diaspora/diaspora/pull/4408) [#4409](https://github.com/diaspora/diaspora/pull/4409) - +* Added a link to user photos and thumbnails are shown in the left side bar [#4347](https://github.com/diaspora/diaspora/issues/4347) # 0.1.1.0 From a7bfc542e1854aef45fb324f5d229508912adcf7 Mon Sep 17 00:00:00 2001 From: carolina Date: Wed, 7 Aug 2013 12:53:11 +0200 Subject: [PATCH 3/9] Add view_all link below photo thumbnails --- app/views/people/_profile_sidebar.html.haml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/views/people/_profile_sidebar.html.haml b/app/views/people/_profile_sidebar.html.haml index c76b4f985..9fc21ef57 100644 --- a/app/views/people/_profile_sidebar.html.haml +++ b/app/views/people/_profile_sidebar.html.haml @@ -43,15 +43,14 @@ %h4 =t('.born') = birthday_format(person.birthday) - %li - unless @photos.blank? %h4 - = link_to t('_photos'), person_photos_path(person) + = t('_photos') - for photo in @photos = image_tag(photo.url(:thumb_small)) - - - + %br + = link_to t('layouts.header.view_all'), person_photos_path(person) + %br %br From d7e6ec8a4c430ed1811a4ed7d12c18f316286de7 Mon Sep 17 00:00:00 2001 From: carolina Date: Wed, 7 Aug 2013 18:33:04 +0200 Subject: [PATCH 4/9] Add photo count --- app/controllers/people_controller.rb | 2 +- app/views/people/_profile_sidebar.html.haml | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index 8c08e7211..cdbc9ba77 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -81,7 +81,7 @@ class PeopleController < ApplicationController @aspect = :profile @stream = Stream::Person.new(current_user, @person, :max_time => max_time) @profile = @person.profile - @photos = Photo.where(author_id: @profile.id).limit(3).order('created_at desc') + @photos = Photo.where(author_id: @profile.id).order('created_at desc') unless params[:format] == "json" # hovercard if current_user @block = current_user.blocks.where(:person_id => @person.id).first diff --git a/app/views/people/_profile_sidebar.html.haml b/app/views/people/_profile_sidebar.html.haml index 9fc21ef57..dc0a3cace 100644 --- a/app/views/people/_profile_sidebar.html.haml +++ b/app/views/people/_profile_sidebar.html.haml @@ -18,7 +18,8 @@ %br %br -if contact.sharing? || person == current_user.person - %ul#profile_information + %ul#aspect_nav.left_nav + - unless person.bio.blank? %li %h4 @@ -47,7 +48,10 @@ - unless @photos.blank? %h4 = t('_photos') - - for photo in @photos + .contact_count + = " #{@photos.count}" + - @thumbs = @photos.limit(3) + - for photo in @thumbs = image_tag(photo.url(:thumb_small)) %br = link_to t('layouts.header.view_all'), person_photos_path(person) From 44d76fc6da62a4c840be383db2f0b2a88e213ed8 Mon Sep 17 00:00:00 2001 From: mokus Date: Thu, 8 Aug 2013 11:31:03 +0200 Subject: [PATCH 5/9] rename contact_count to item_count --- app/assets/stylesheets/application.css.sass | 34 ++++++++++----------- app/assets/stylesheets/rtl.css.scss | 2 +- app/views/contacts/_aspect_listings.haml | 8 ++--- app/views/people/_profile_sidebar.html.haml | 6 ++-- 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/app/assets/stylesheets/application.css.sass b/app/assets/stylesheets/application.css.sass index 8e73e2222..a2434bab7 100644 --- a/app/assets/stylesheets/application.css.sass +++ b/app/assets/stylesheets/application.css.sass @@ -2068,6 +2068,19 @@ ul#requested-scopes .scope-description :display none +.item_count + :width 16px + :line-height 16px + :text-align center + @include border-radius(4px) + :color #999 + :background + :color #eee + :display inline-block + :font + :size 11px + :weight 700 + ul.left_nav :margin 0 :bottom 15px @@ -2100,9 +2113,7 @@ ul.left_nav > a:not(.sub_selected) :color #333 - .contact_count - :font - :weight 700 + .item_count :color #666 a.aspect_selector, @@ -2155,22 +2166,9 @@ ul.left_nav :display none &:hover @include opacity(1) - - .contact_count - :width 16px - :line-height 16px - :text-align center - @include border-radius(4px) - :margin-top 1px - :color #999 - :background - :color #eee - :display inline-block - :font - :size 11px - + a.home_selector - .contact_count + .item_count :float right ul.sub_nav diff --git a/app/assets/stylesheets/rtl.css.scss b/app/assets/stylesheets/rtl.css.scss index 8cacfa335..41e003541 100644 --- a/app/assets/stylesheets/rtl.css.scss +++ b/app/assets/stylesheets/rtl.css.scss @@ -297,7 +297,7 @@ ul.comments li.posted .controls .delete { left: 10px; } -ul.left_nav .contact_count, ul.left_nav .edit { +ul.left_nav .item_count, ul.left_nav .edit { float: left; } diff --git a/app/views/contacts/_aspect_listings.haml b/app/views/contacts/_aspect_listings.haml index 05d5a9348..120f6bf21 100644 --- a/app/views/contacts/_aspect_listings.haml +++ b/app/views/contacts/_aspect_listings.haml @@ -6,7 +6,7 @@ %li.all_aspects{:class => ("active" if params["set"] != "all" && params["set"] != "only_sharing" && !@spotlight)} %a.home_selector{:href => contacts_path, :class => ("sub_selected" if params["a_id"])} = t('contacts.index.my_contacts') - .contact_count + .item_count = my_contacts_count %ul.sub_nav @@ -15,7 +15,7 @@ .icons-check_yes_ok{:class => ("invisible" if params["a_id"].to_i != aspect.id) } %a.community_aspect_selector{:href => contacts_path(:a_id => aspect.id)} = aspect - .contact_count + .item_count = aspect.contacts.size %li @@ -24,7 +24,7 @@ %li.all_contacts{:class => ("active" if params["set"] == "all" || params["set"] == "only_sharing")} %a.home_selector{:href => contacts_path(:set => "all"), :class => ("sub_selected" if params["set"] == "only_sharing")} = t('contacts.index.all_contacts') - .contact_count + .item_count = all_contacts_count %ul.sub_nav @@ -32,6 +32,6 @@ .icons-check_yes_ok{:class => ("invisible" if params["set"] == "only_sharing")} %a.community_aspect_selector{:href => contacts_path(:set => "only_sharing")} = t('contacts.index.only_sharing_with_me') - .contact_count + .item_count = only_sharing_count diff --git a/app/views/people/_profile_sidebar.html.haml b/app/views/people/_profile_sidebar.html.haml index dc0a3cace..efbcf2528 100644 --- a/app/views/people/_profile_sidebar.html.haml +++ b/app/views/people/_profile_sidebar.html.haml @@ -18,7 +18,7 @@ %br %br -if contact.sharing? || person == current_user.person - %ul#aspect_nav.left_nav + %ul#profile_information - unless person.bio.blank? %li @@ -48,8 +48,8 @@ - unless @photos.blank? %h4 = t('_photos') - .contact_count - = " #{@photos.count}" + .item_count + = "#{@photos.count}" - @thumbs = @photos.limit(3) - for photo in @thumbs = image_tag(photo.url(:thumb_small)) From 8df8855ac0f48171f5a65027a05adf6045fe81c4 Mon Sep 17 00:00:00 2001 From: mokus Date: Thu, 8 Aug 2013 12:34:13 +0200 Subject: [PATCH 6/9] remove the limit 3 for @photos in photo controller --- app/controllers/photos_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index f6ca113fb..1773e274d 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -14,7 +14,7 @@ class PhotosController < ApplicationController def index @post_type = :photos @person = Person.find_by_guid(params[:person_id]) - @photos = Photo.where(author_id: @person.id).limit(3).order('created_at desc') + @photos = Photo.where(author_id: @person.id).order('created_at desc') if @person @contact = current_user.contact_for(@person) From fd05d30f2018a629aefcffdf75205ef4a81a1b53 Mon Sep 17 00:00:00 2001 From: carolina Date: Mon, 12 Aug 2013 16:00:39 +0200 Subject: [PATCH 7/9] Add tests for photo link in profile side bar --- features/profile_photos.feature | 27 +++++++++++++++++++++++++++ features/support/paths.rb | 2 ++ 2 files changed, 29 insertions(+) create mode 100644 features/profile_photos.feature diff --git a/features/profile_photos.feature b/features/profile_photos.feature new file mode 100644 index 000000000..435cb704e --- /dev/null +++ b/features/profile_photos.feature @@ -0,0 +1,27 @@ +@javascript +Feature: show photos + + Background: + Given following users exist: + | username | email | + | Bob Jones | bob@bob.bob | + | Alice Smith | alice@alice.alice | + | Robert Grimm | robert@grimm.grimm | + And I sign in as "robert@grimm.grimm" + + Given I expand the publisher + And I have turned off jQuery effects + And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload" + And I press "Share" + + Scenario: see my own photos + And I am on "robert@grimm.grimm"'s page + When I follow "View all" + Then I should be on person_photos page + + Scenario: I cannot see photos of people who don't share with me + When I sign in as "alice@alice.alice" + And I am on "robert@grimm.grimm"'s page + Then I should not see "photos" within "div#profile" + + diff --git a/features/support/paths.rb b/features/support/paths.rb index b3553e141..fd18b67be 100644 --- a/features/support/paths.rb +++ b/features/support/paths.rb @@ -1,6 +1,8 @@ module NavigationHelpers def path_to(page_name) case page_name + when /^person_photos page$/ + person_photos_path(@me.person) when /^the home(?: )?page$/ stream_path when /^step (\d)$/ From f3817b996e12ee2fd1263a21df04138c80919589 Mon Sep 17 00:00:00 2001 From: carolina Date: Sun, 18 Aug 2013 23:37:20 +0200 Subject: [PATCH 8/9] Modify photos unless condition and loop through thumbnails and test --- app/views/people/_profile_sidebar.html.haml | 5 ++--- features/profile_photos.feature | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/views/people/_profile_sidebar.html.haml b/app/views/people/_profile_sidebar.html.haml index efbcf2528..57d53db4c 100644 --- a/app/views/people/_profile_sidebar.html.haml +++ b/app/views/people/_profile_sidebar.html.haml @@ -45,13 +45,12 @@ =t('.born') = birthday_format(person.birthday) %li - - unless @photos.blank? + - if @photos.present? %h4 = t('_photos') .item_count = "#{@photos.count}" - - @thumbs = @photos.limit(3) - - for photo in @thumbs + - @photos.limit(3).each do |photo| = image_tag(photo.url(:thumb_small)) %br = link_to t('layouts.header.view_all'), person_photos_path(person) diff --git a/features/profile_photos.feature b/features/profile_photos.feature index 435cb704e..91a56c4ee 100644 --- a/features/profile_photos.feature +++ b/features/profile_photos.feature @@ -15,8 +15,8 @@ Feature: show photos And I press "Share" Scenario: see my own photos - And I am on "robert@grimm.grimm"'s page When I follow "View all" + And I am on "robert@grimm.grimm"'s page Then I should be on person_photos page Scenario: I cannot see photos of people who don't share with me From babcc1e66b28aab24a0c1fe6a50332a3aa9aaaf1 Mon Sep 17 00:00:00 2001 From: mokus Date: Mon, 19 Aug 2013 12:26:50 +0200 Subject: [PATCH 9/9] update profile_photo test and selenium version to make tests pass on firefox 23 --- features/profile_photos.feature | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/features/profile_photos.feature b/features/profile_photos.feature index 91a56c4ee..1f7c05f6a 100644 --- a/features/profile_photos.feature +++ b/features/profile_photos.feature @@ -7,16 +7,16 @@ Feature: show photos | Bob Jones | bob@bob.bob | | Alice Smith | alice@alice.alice | | Robert Grimm | robert@grimm.grimm | - And I sign in as "robert@grimm.grimm" + And I sign in as "robert@grimm.grimm" Given I expand the publisher - And I have turned off jQuery effects - And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload" - And I press "Share" + And I have turned off jQuery effects + And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload" + And I press "Share" Scenario: see my own photos - When I follow "View all" - And I am on "robert@grimm.grimm"'s page + When I am on "robert@grimm.grimm"'s page + And I follow "View all" Then I should be on person_photos page Scenario: I cannot see photos of people who don't share with me