diff --git a/app/helpers/stream_helper.rb b/app/helpers/stream_helper.rb index c8b0f3e930491446ab05058df3e36fc3da817b18..6eead06ddcc6ef8e4987e76cdb11847777b8fab4 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 1910875b7c4587a60be02cc4d8bc5a90705101b4..005764d9abc5a4458144f1d2c851c65f935edd12 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 fce9a8d92fe2fdf34b0b6ac5f8aeabc75f4b67f4..5edbaf940db14969121cb53f7e0afaf544bbca7f 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 0000000000000000000000000000000000000000..03b16b315583f2012a5e2b9208bb9ef58b16755a --- /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 841eaaa7f64181ec7b0ce0bd222f9a8aea639208..2aec6a526dddbf6fe62ac316f7221c22baab4c54 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 e3a9811897adada2b7d10d028edf306e174bf0c7..1f2b587fe8a08c9cfef37bc14657987a0ab37f71 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 e4da04ccd4bcb69183d0548fc37092d1d85609c5..9df52ea42015d04a1dd6b32693cf48609fb69765 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 b879f042cc6b570ebe5a6f0dcd867df73bc5bcb5..551b565d43fb820fe579c433cc004c6947a328a8 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