From 619f5fd56e6dafe853a62bc32e58c8b712739049 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 6 Oct 2011 12:27:02 -0700 Subject: [PATCH] move featured users to the other side and make a little sidebar widget for it --- app/helpers/stream_helper.rb | 1 - app/views/aspects/index.html.haml | 5 ----- app/views/contacts/featured.haml | 14 +------------- app/views/featured_users/_user.html.haml | 13 +++++++++++++ app/views/shared/_right_sections.html.haml | 9 +++++++++ config/locales/diaspora/en.yml | 2 ++ lib/base_stream.rb | 12 ++++++++++++ public/stylesheets/sass/application.sass | 2 ++ 8 files changed, 39 insertions(+), 19 deletions(-) create mode 100644 app/views/featured_users/_user.html.haml diff --git a/app/helpers/stream_helper.rb b/app/helpers/stream_helper.rb index c8b0f3e93..6eead06dd 100644 --- a/app/helpers/stream_helper.rb +++ b/app/helpers/stream_helper.rb @@ -29,7 +29,6 @@ module StreamHelper else stream.posts.last.send(stream.order.to_sym).to_i end - end def time_for_sort post diff --git a/app/views/aspects/index.html.haml b/app/views/aspects/index.html.haml index 1910875b7..005764d9a 100644 --- a/app/views/aspects/index.html.haml +++ b/app/views/aspects/index.html.haml @@ -26,11 +26,6 @@ .li %b= link_to t('.mentions'), mentions_path, :class => 'home_selector' - .section - %ul.left_nav - .li - %b= link_to t('.featured_users'), featured_path, :class => 'home_selector' - .section#followed_tags_listing = render 'tags/followed_tags_listings' diff --git a/app/views/contacts/featured.haml b/app/views/contacts/featured.haml index fce9a8d92..5edbaf940 100644 --- a/app/views/contacts/featured.haml +++ b/app/views/contacts/featured.haml @@ -22,16 +22,4 @@ #featured_users - unless @people.blank? - @people.each do |person| - .user_card - = person_image_link(person, :size => :thumb_large) - %h4 - = person.name - - .tags - - person.profile.tags.each do |tg| - = "##{tg}" - - .add_user_to_aspect - = render :partial => 'people/relationship_action', - :locals => { :person => person, :contact => current_user.contact_for(person), - :current_user => current_user } + = render 'featured_users/user', :person => person diff --git a/app/views/featured_users/_user.html.haml b/app/views/featured_users/_user.html.haml new file mode 100644 index 000000000..03b16b315 --- /dev/null +++ b/app/views/featured_users/_user.html.haml @@ -0,0 +1,13 @@ +.user_card + = person_image_link(person, :size => :thumb_large) + %h4 + = person.name + + .tags + - person.profile.tags.each do |tg| + = "##{tg}" + + .add_user_to_aspect + = render :partial => 'people/relationship_action', + :locals => { :person => person, :contact => current_user.contact_for(person), + :current_user => current_user } diff --git a/app/views/shared/_right_sections.html.haml b/app/views/shared/_right_sections.html.haml index 841eaaa7f..2aec6a526 100644 --- a/app/views/shared/_right_sections.html.haml +++ b/app/views/shared/_right_sections.html.haml @@ -22,6 +22,15 @@ = t('aspects.index.cubbies.explanation') = link_to t('aspects.index.cubbies.learn_more'), token_path +- if @stream.has_featured_users? + .section + .title.no_icon + %h5 + =t('aspects.index.community_members') + .content#featured_users + = render 'featured_users/user', :person => @stream.random_featured_user + = link_to t('aspects.index.see_more_from_us'), featured_path, :id => 'view_all_contacts_link' + .section .title = image_tag('/images/icons/question.png') diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index e3a981189..1f2b587fe 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -159,6 +159,8 @@ en: index: mentions: "Mentions" featured_users: "Featured Users" + community_members: "Cool Diaspora* members" + see_more_from_us: "See more of the D* community." donate: "Donate" keep_us_running: "Keep %{pod} running fast and buy servers their coffee fix with a monthly donation!" your_aspects: "Your Aspects" diff --git a/lib/base_stream.rb b/lib/base_stream.rb index e4da04ccd..9df52ea42 100644 --- a/lib/base_stream.rb +++ b/lib/base_stream.rb @@ -8,6 +8,13 @@ class BaseStream end + def random_featured_user + Person.find_by_diaspora_handle(featured_diaspora_id) + end + + def has_featured_users? + featured_diaspora_id.present? + end #requied to implement said stream def link(opts={}) @@ -75,4 +82,9 @@ class BaseStream @order = order_string @order ||= 'created_at' end + + private + def featured_diaspora_id + @featured_diaspora_id ||= AppConfig[:featured_users].sample(1) + end end diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index b879f042c..551b565d4 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -2963,6 +2963,8 @@ ul.left_nav .unfollow_icon :display inline-block + .user_card + :margin-left 8px .stream_container :min-height 500px