You can now add contacts from tags#show. Also, a CSS change to help us start refactoring: there's now a class to the body that you can set with content_for :body_class. This lets you scope CSS to a particular page. Started breaking out smaller CSS files.

This commit is contained in:
Sarah Mei 2011-03-19 20:53:55 -07:00
parent 1bd693eb14
commit 0b1fa4d014
11 changed files with 101 additions and 30 deletions

View file

@ -75,7 +75,7 @@
- elsif current_user
%link{:rel => "alternate", :href => "#{current_user.public_url}", :type => "application/atom+xml", :title => "#{t('.public_feed', :name => current_user.name)}"}
%body
%body{:class => "#{yield(:body_class)}"}
- unless @landing_page
#notification

View file

@ -2,17 +2,18 @@
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
- content_for :page_title do
- if params[:name]
= "##{params[:name]}"
- else
= t('.whatup', :pod => @pod_url)
- content_for :head do
= include_javascripts :home
- content_for :body_class do
= "tags_show"
.span-24.last
%h1.tag
= "##{params[:name]}"
@ -35,6 +36,10 @@
- for person in @people
.stream_element{:id => person.id}
= person_image_link(person)
- if current_user
.right
= render :partial => 'people/relationship_action',
:locals => { :person => person, :contact => current_user.contact_for(person), :request => nil}
.content
%span.from
=person_link(person)

View file

@ -68,6 +68,7 @@ stylesheets:
- public/stylesheets/application.css
- public/stylesheets/ui.css
- public/stylesheets/autocomplete.css
- public/stylesheets/tags.css
- public/stylesheets/vendor/facebox.css
- public/stylesheets/vendor/fileuploader.css
- public/stylesheets/vendor/tipsy.css

View file

@ -7,10 +7,7 @@ Feature: sending and receiving requests
When I sign in as "bob@bob.bob"
And I am on "alice@alice.alice"'s page
And I press the first ".share_with.button" within "#author_info"
And I press the first ".add.button" within "#facebox #aspects_list ul > li:first-child"
#And I debug
And I wait for the ajax to finish
Then I should see a ".added.button" within "#facebox #aspects_list ul > li:first-child"
And I add the person to my first aspect
Then I go to the destroy user session page
Scenario: accepting a contact request

View file

@ -139,5 +139,21 @@ When /^I search for "([^\"]*)"$/ do |search_term|
var e = jQuery.Event("keypress");
e.keyCode = 13;
$("#q").trigger(e);
JS
JS
end
Then /^I should( not)? see the contact dialog$/ do |not_see|
if not_see
wait_until { !page.find("#facebox").visible? }
else
wait_until { page.find("#facebox .share_with") && page.find("#facebox .share_with").visible? }
end
end
When /^I add the person to my first aspect$/ do
steps %Q{
And I press the first ".add.button" within "#facebox #aspects_list ul > li:first-child"
And I wait for the ajax to finish
Then I should see a ".added.button" within "#facebox #aspects_list ul > li:first-child"
}
end

View file

@ -149,3 +149,12 @@ When /^I log out$/ do
When "I click on my name in the header"
When "I follow \"logout\""
end
Given /^there is a user "([^\"]*)" who's tagged "([^\"]*)"$/ do |full_name, tag|
username = full_name.gsub(/\W/,"").underscore
Given "a user named \"#{full_name}\" with email \"#{username}@example.com\""
user = User.find_by_username(username)
user.profile.tag_string = tag
user.profile.build_tags
user.profile.save!
end

View file

@ -1,8 +1,27 @@
@javascript
Feature: Interacting with tags
Scenario: Searching for a tag
Given I am signed in
Background:
Given there is a user "Samuel Beckett" who's tagged "#rockstar"
And I am signed in
And I am on the homepage
And I search for "#rockstar"
Then I should be on the tag page for "rockstar"
Scenario: Searching for a tag
When I search for "#rockstar"
Then I should be on the tag page for "rockstar"
And I should see "Samuel Beckett"
Scenario: adding a contact from a tag page
When I search for "#rockstar"
Then I should see "start sharing"
But I should not see "Pending request"
When I follow "start sharing"
Then I should see the contact dialog
When I add the person to my first aspect
And I follow "done editing"
Then I should not see the contact dialog
When I search for "#rockstar"
Then I should not see "start sharing"
But I should see "Pending request"

View file

@ -2,8 +2,6 @@
// licensed under the Affero General Public License version 3 or later. See
// the COPYRIGHT file.
@font-face
:font-family 'BrandonGrotesqueLightRegular'
:src url('brandongrotesque_light/Brandon_light-webfont.eot')

View file

@ -0,0 +1,12 @@
// Copyright (c) 2010, Diaspora Inc. This file is
// licensed under the Affero General Public License version 3 or later. See
// the COPYRIGHT file.
.tags_show
.side_stream
.stream_element
.right
:display inline
:font-size 10px
.button
:font-size 10px

View file

@ -7,10 +7,11 @@ require 'spec_helper'
describe TagsController do
render_views
before do
@user = alice
end
describe '#show' do
before do
@user = alice
end
context 'signed in' do
before do
sign_in :user, @user
@ -21,17 +22,34 @@ describe TagsController do
end
end
it 'restricts the posts by tag' do
posts = []
2.times do
posts << @user.post(:status_message, :text => "#what", :public => true, :to => 'all')
context "not signed in" do
context "when there are people to display" do
before do
@user.profile.tag_string = "#whatevs"
@user.profile.build_tags
@user.profile.save!
get :show, :name => "whatevs"
end
it "succeeds" do
response.should be_success
end
it "assigns the right set of people" do
assigns(:people).should == [@user.person]
end
end
2.times do
@user.post(:status_message, :text => "#hello", :public => true, :to => 'all')
context "when there are posts to display" do
before do
@post = @user.post(:status_message, :text => "#what", :public => true, :to => 'all')
@user.post(:status_message, :text => "#hello", :public => true, :to => 'all')
get :show, :name => 'what'
end
it "succeeds" do
response.should be_success
end
it "assigns the right set of posts" do
assigns[:posts].should == [@post]
end
end
get :show, :name => 'what'
assigns[:posts].should =~ posts
end
end
end

View file

@ -12,10 +12,6 @@ FixtureBuilder.configure do |fbuilder|
bob = Factory(:user_with_aspect, :username => "bob")
Factory(:aspect, :name => "empty", :user => bob)
alice.profile.tag_string = '#rockstar'
alice.profile.build_tags
alice.profile.save!
connect_users(bob, bob.aspects.first, alice, alice.aspects.first)
connect_users(bob, bob.aspects.first, eve, eve.aspects.first)
end