featured users section
This commit is contained in:
parent
d55a21c458
commit
e42d7273a8
11 changed files with 156 additions and 13 deletions
|
|
@ -37,6 +37,17 @@ class ContactsController < ApplicationController
|
||||||
render :layout => false
|
render :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def featured
|
||||||
|
@featured = true
|
||||||
|
@people = []
|
||||||
|
if diaspora_ids = AppConfig[:featured_users]
|
||||||
|
@people = diaspora_ids.inject [] do |people, id|
|
||||||
|
person = Webfinger.new(id).fetch
|
||||||
|
people << person unless person.blank?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def sort_and_paginate_profiles contacts
|
def sort_and_paginate_profiles contacts
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
-# the COPYRIGHT file.
|
-# the COPYRIGHT file.
|
||||||
|
|
||||||
%ul#aspect_nav.left_nav
|
%ul#aspect_nav.left_nav
|
||||||
%li.all_aspects{:class => ("active" if params["set"] != "all" && params["set"] != "only_sharing")}
|
%li.all_aspects{:class => ("active" if params["set"] != "all" && params["set"] != "only_sharing" && !defined?(@featured))}
|
||||||
%a.home_selector{:href => controller_index_path, :class => ("sub_selected" if params["a_id"])}
|
%a.home_selector{:href => controller_index_path, :class => ("sub_selected" if params["a_id"])}
|
||||||
.contact_count
|
.contact_count
|
||||||
= my_contacts_count
|
= my_contacts_count
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,11 @@
|
||||||
-# the COPYRIGHT file.
|
-# the COPYRIGHT file.
|
||||||
|
|
||||||
#no_posts.empty_message{:class => ("hidden" unless post_count == 0)}
|
#no_posts.empty_message{:class => ("hidden" unless post_count == 0)}
|
||||||
%h4
|
%h4{:style => "text-align:center;"}
|
||||||
= t('.start_talking')
|
= t('.you_have_no_contacts')
|
||||||
= link_to t('.try_adding_some_more_contacts'), contacts_path
|
%br
|
||||||
|
%br
|
||||||
|
= t('.try_adding_some_more_contacts')
|
||||||
|
!= t('.or_featured', :link => link_to(t(".featured_users") , featured_path))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
37
app/views/contacts/featured.haml
Normal file
37
app/views/contacts/featured.haml
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
-# Copyright (c) 2010, Diaspora Inc. This file is
|
||||||
|
-# licensed under the Affero General Public License version 3 or later. See
|
||||||
|
-# the COPYRIGHT file.
|
||||||
|
|
||||||
|
- content_for :page_title do
|
||||||
|
= t('.featured_users')
|
||||||
|
|
||||||
|
- content_for :head do
|
||||||
|
= include_javascripts :people
|
||||||
|
|
||||||
|
#section_header
|
||||||
|
%h2
|
||||||
|
= t('contacts.index.title')
|
||||||
|
|
||||||
|
= render 'shared/contact_sidebar'
|
||||||
|
|
||||||
|
.span-18.last
|
||||||
|
%h3
|
||||||
|
= t('.featured_users')
|
||||||
|
%br
|
||||||
|
|
||||||
|
#featured_users
|
||||||
|
- @people.each do |person|
|
||||||
|
.user_card
|
||||||
|
= person_image_link(person, :size => :thumb_large)
|
||||||
|
%h4
|
||||||
|
= person.name
|
||||||
|
|
||||||
|
.tags
|
||||||
|
- 5.times do |n|
|
||||||
|
- 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 }
|
||||||
|
|
@ -2,21 +2,17 @@
|
||||||
-# licensed under the Affero General Public License version 3 or later. See
|
-# licensed under the Affero General Public License version 3 or later. See
|
||||||
-# the COPYRIGHT file.
|
-# the COPYRIGHT file.
|
||||||
|
|
||||||
|
|
||||||
- content_for :page_title do
|
- content_for :page_title do
|
||||||
= t('.title')
|
= t('.title')
|
||||||
|
|
||||||
- content_for :head do
|
- content_for :head do
|
||||||
= include_javascripts :people
|
= include_javascripts :people
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#section_header
|
#section_header
|
||||||
%h2
|
%h2
|
||||||
= t('.title')
|
= t('.title')
|
||||||
|
|
||||||
.span-5.append-1
|
= render 'shared/contact_sidebar'
|
||||||
= render 'aspects/aspect_listings'
|
|
||||||
|
|
||||||
.span-18.last
|
.span-18.last
|
||||||
#people_stream.stream.contacts
|
#people_stream.stream.contacts
|
||||||
|
|
|
||||||
17
app/views/shared/_contact_sidebar.html.haml
Normal file
17
app/views/shared/_contact_sidebar.html.haml
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
-# Copyright (c) 2010, Diaspora Inc. This file is
|
||||||
|
-# licensed under the Affero General Public License version 3 or later. See
|
||||||
|
-# the COPYRIGHT file.
|
||||||
|
|
||||||
|
.span-5.append-1
|
||||||
|
= render 'aspects/aspect_listings'
|
||||||
|
|
||||||
|
%hr
|
||||||
|
|
||||||
|
%ul.left_nav
|
||||||
|
- if AppConfig[:featured_users]
|
||||||
|
%li{:class => ("active" if defined?(@featured))}
|
||||||
|
= link_to t('contacts.featured.featured_users'), "/featured", :class => "element_selector"
|
||||||
|
/%li
|
||||||
|
/ = link_to "Invite friends", "#", :class => "element_selector"
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -131,7 +131,11 @@ defaults: &defaults
|
||||||
single_process_mode: true
|
single_process_mode: true
|
||||||
|
|
||||||
# Use paypal for recurring donations
|
# Use paypal for recurring donations
|
||||||
paypal_hosted_button_id: ''
|
paypal_hosted_button_id: ""
|
||||||
|
|
||||||
|
# Featured users
|
||||||
|
# (expressed as an array of Diaspora IDs)
|
||||||
|
featured_users:
|
||||||
|
|
||||||
# Use this section to override default settings in specific environments
|
# Use this section to override default settings in specific environments
|
||||||
development:
|
development:
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,10 @@ en:
|
||||||
edit_aspect: "edit aspect"
|
edit_aspect: "edit aspect"
|
||||||
no_posts_message:
|
no_posts_message:
|
||||||
start_talking: "Nobody has said anything yet!"
|
start_talking: "Nobody has said anything yet!"
|
||||||
try_adding_some_more_contacts: "Try adding some more contacts."
|
you_have_no_contacts: "You haven't added any contacts yet!"
|
||||||
|
try_adding_some_more_contacts: "You can search (top) or invite (right) more contacts."
|
||||||
|
or_featured: "Or you can share with %{link}"
|
||||||
|
featured_users: "featured users"
|
||||||
aspect_listings:
|
aspect_listings:
|
||||||
add_an_aspect: "+ Add an aspect"
|
add_an_aspect: "+ Add an aspect"
|
||||||
|
|
||||||
|
|
@ -220,6 +223,8 @@ en:
|
||||||
only_sharing_with_me: "Only sharing with me"
|
only_sharing_with_me: "Only sharing with me"
|
||||||
remove_person_from_aspect: "Remove %{person_name} from \"%{aspect_name}\""
|
remove_person_from_aspect: "Remove %{person_name} from \"%{aspect_name}\""
|
||||||
many_people_are_you_sure: "Are you sure you want to start a private conversation with more than %{suggested_limit} contacts? Posting to this aspect may be a better way to contact them."
|
many_people_are_you_sure: "Are you sure you want to start a private conversation with more than %{suggested_limit} contacts? Posting to this aspect may be a better way to contact them."
|
||||||
|
featured:
|
||||||
|
featured_users: "Featured Users"
|
||||||
|
|
||||||
conversations:
|
conversations:
|
||||||
index:
|
index:
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,7 @@ Diaspora::Application.routes.draw do
|
||||||
resources :aspect_memberships, :only => [:destroy, :create, :update]
|
resources :aspect_memberships, :only => [:destroy, :create, :update]
|
||||||
resources :post_visibilities, :only => [:update]
|
resources :post_visibilities, :only => [:update]
|
||||||
|
|
||||||
|
get 'featured' => "contacts#featured"
|
||||||
resources :people, :except => [:edit, :update] do
|
resources :people, :except => [:edit, :update] do
|
||||||
resources :status_messages
|
resources :status_messages
|
||||||
resources :photos
|
resources :photos
|
||||||
|
|
|
||||||
|
|
@ -2870,7 +2870,8 @@ ul.left_nav
|
||||||
|
|
||||||
a.aspect_selector,
|
a.aspect_selector,
|
||||||
a.home_selector,
|
a.home_selector,
|
||||||
a.tag_selector
|
a.tag_selector,
|
||||||
|
a.element_selector
|
||||||
&:active
|
&:active
|
||||||
:cursor -webkit-grabbing
|
:cursor -webkit-grabbing
|
||||||
:cursor -moz-grabbing
|
:cursor -moz-grabbing
|
||||||
|
|
@ -2879,6 +2880,7 @@ ul.left_nav
|
||||||
a.aspect_selector,
|
a.aspect_selector,
|
||||||
a.home_selector,
|
a.home_selector,
|
||||||
a.tag_selector,
|
a.tag_selector,
|
||||||
|
a.element_selector,
|
||||||
.root_element
|
.root_element
|
||||||
:display block
|
:display block
|
||||||
:width 100%
|
:width 100%
|
||||||
|
|
@ -2889,7 +2891,8 @@ ul.left_nav
|
||||||
|
|
||||||
a.aspect_selector,
|
a.aspect_selector,
|
||||||
a.home_selector,
|
a.home_selector,
|
||||||
a.tag_selector
|
a.tag_selector,
|
||||||
|
a.element_selector
|
||||||
&:hover
|
&:hover
|
||||||
@include border-radius(2px)
|
@include border-radius(2px)
|
||||||
|
|
||||||
|
|
@ -3154,3 +3157,44 @@ ul.left_nav
|
||||||
:margin
|
:margin
|
||||||
:top 30px
|
:top 30px
|
||||||
|
|
||||||
|
#featured_users
|
||||||
|
.avatar
|
||||||
|
:height 140px
|
||||||
|
:width 140px
|
||||||
|
|
||||||
|
.user_card
|
||||||
|
@include border-radius(3px)
|
||||||
|
@include box-shadow(0,1px,5px,#ccc)
|
||||||
|
:padding 10px
|
||||||
|
:bottom 30px
|
||||||
|
:margin
|
||||||
|
:bottom 15px
|
||||||
|
:right 10px
|
||||||
|
|
||||||
|
:position relative
|
||||||
|
|
||||||
|
:min-height 220px
|
||||||
|
|
||||||
|
:vertical-align top
|
||||||
|
|
||||||
|
:border 1px solid #ccc
|
||||||
|
:display inline-block
|
||||||
|
|
||||||
|
:width 140px
|
||||||
|
|
||||||
|
.tags
|
||||||
|
:color #999
|
||||||
|
|
||||||
|
h4
|
||||||
|
:margin
|
||||||
|
:bottom 0
|
||||||
|
:padding
|
||||||
|
:bottom 2px
|
||||||
|
|
||||||
|
.dropdown
|
||||||
|
:width 100%
|
||||||
|
|
||||||
|
.add_user_to_aspect
|
||||||
|
:bottom 12px
|
||||||
|
:right 5px
|
||||||
|
:position absolute
|
||||||
|
|
|
||||||
|
|
@ -325,4 +325,28 @@ describe PeopleController do
|
||||||
get :retrieve_remote, :diaspora_handle => @user.diaspora_handle
|
get :retrieve_remote, :diaspora_handle => @user.diaspora_handle
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#featued' do
|
||||||
|
it 'succeeds' do
|
||||||
|
get :featured
|
||||||
|
response.should be_success
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'gets queries for users in the app config' do
|
||||||
|
AppConfig[:featured_users] = [alice.diaspora_handle]
|
||||||
|
|
||||||
|
get :featured
|
||||||
|
assigns[:people].should == [alice.person]
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'fetches the webfinger profiles' do
|
||||||
|
AppConfig[:featured_users] = [alice.diaspora_handle]
|
||||||
|
|
||||||
|
wf = mock
|
||||||
|
wf.should_receive(:fetch)
|
||||||
|
Webfinger.should_receive(:new).with(alice.diaspora_handle).and_return(wf)
|
||||||
|
|
||||||
|
get :featured
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue