tagging profiles complete
This commit is contained in:
parent
1988e195fb
commit
c608c70ca7
25 changed files with 158 additions and 95 deletions
|
|
@ -22,6 +22,9 @@ class PostsController < ApplicationController
|
|||
@posts = @posts.tagged_with(params[:tag])
|
||||
@posts = @posts.includes(:comments, :photos).paginate(:page => params[:page], :per_page => 15, :order => 'created_at DESC')
|
||||
|
||||
profiles = Profile.tagged_with(params[:tag]).select('profiles.id')
|
||||
@people = Person.where(:id => profiles.map{|p| p.id}).limit(15)
|
||||
|
||||
@fakes = PostsFake.new(@posts)
|
||||
@commenting_disabled = true
|
||||
@pod_url = AppConfig[:pod_uri].host
|
||||
|
|
|
|||
|
|
@ -19,14 +19,18 @@ class ProfilesController < ApplicationController
|
|||
|
||||
if current_user.update_profile params[:profile]
|
||||
flash[:notice] = I18n.t 'profiles.update.updated'
|
||||
if params[:getting_started]
|
||||
redirect_to getting_started_path(:step => params[:getting_started].to_i+1)
|
||||
else
|
||||
redirect_to current_user.person
|
||||
end
|
||||
else
|
||||
flash[:error] = I18n.t 'profiles.update.failed'
|
||||
end
|
||||
|
||||
if params[:getting_started]
|
||||
redirect_to getting_started_path(:step => params[:getting_started].to_i+1)
|
||||
else
|
||||
redirect_to edit_profile_path
|
||||
if params[:getting_started]
|
||||
redirect_to getting_started_path(:step => params[:getting_started])
|
||||
else
|
||||
redirect_to edit_profile_path
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ class Profile < ActiveRecord::Base
|
|||
|
||||
acts_as_taggable_on :tags
|
||||
extract_tags_from :tag_string
|
||||
validates_length_of :tag_list, :maximum => 5
|
||||
|
||||
xml_attr :diaspora_handle
|
||||
xml_attr :first_name
|
||||
|
|
|
|||
|
|
@ -10,7 +10,10 @@
|
|||
|
|
||||
= link_to_if(session[:sort_order] == 'updated_at', t('.post_time'), aspects_path(:a_ids => params[:a_ids], :sort_order => 'created_at' ))
|
||||
#main_stream.stream{:data => {:guids => aspect_ids.join(',')}}
|
||||
= render 'shared/stream', :posts => fakes
|
||||
%a.paginate
|
||||
= t("more")
|
||||
- if posts.length > 0
|
||||
= render 'shared/stream', :posts => fakes
|
||||
%a.paginate
|
||||
= t("more")
|
||||
- else
|
||||
= render 'aspects/no_posts_message', :post_count => posts.length
|
||||
= will_paginate posts
|
||||
|
|
|
|||
|
|
@ -39,9 +39,8 @@
|
|||
.avatar
|
||||
= owner_image_tag(:thumb_small)
|
||||
= link_to current_user.name, '#'
|
||||
%li= link_to t('.view_profile'), current_user.person
|
||||
%li= link_to t('.edit_profile'), edit_profile_path
|
||||
%li= link_to t('.account_settings'), edit_user_path(current_user)
|
||||
%li= link_to t('.profile'), current_user.person
|
||||
%li= link_to t('.settings'), edit_user_path(current_user)
|
||||
%li= link_to t('.logout'), destroy_user_session_path
|
||||
|
||||
-unless @landing_page
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@
|
|||
-# the COPYRIGHT file.
|
||||
|
||||
.stream_element{:id => person.id}
|
||||
|
||||
.right{:style=>"display:inline;"}
|
||||
.right
|
||||
- if person.owner_id == current_user.id
|
||||
= t('.thats_you')
|
||||
- elsif contact && !contact.pending
|
||||
|
|
|
|||
|
|
@ -37,13 +37,6 @@
|
|||
|
||||
-if user_signed_in? && ((contact.persisted? && !contact.pending?) || person == current_user.person || @incoming_request)
|
||||
%ul#profile_information
|
||||
- unless person.profile.tags.blank?
|
||||
%li
|
||||
%h4
|
||||
tags
|
||||
= person.profile.format_tags(person.profile.tag_string)
|
||||
|
||||
|
||||
- unless person.profile.bio.blank?
|
||||
%li
|
||||
%h4
|
||||
|
|
|
|||
|
|
@ -18,9 +18,7 @@
|
|||
%span.term
|
||||
= params[:q]
|
||||
|
||||
|
||||
.span-15.append-1
|
||||
|
||||
- if @hashes.empty?
|
||||
%p
|
||||
=t('.no_one_found')
|
||||
|
|
|
|||
|
|
@ -56,8 +56,10 @@
|
|||
|
||||
%h3
|
||||
= @person.name
|
||||
.description
|
||||
%span.diaspora_handle
|
||||
= @person.diaspora_handle
|
||||
.description
|
||||
= @person.profile.format_tags(@person.profile.tag_string)
|
||||
%hr
|
||||
|
||||
- if @posts.count > 0
|
||||
|
|
|
|||
|
|
@ -2,22 +2,37 @@
|
|||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
- content_for :page_title do
|
||||
= t('.whatup', :pod => @pod_url)
|
||||
|
||||
- content_for :page_title do
|
||||
- if params[:tag]
|
||||
= "##{params[:tag]}"
|
||||
|
||||
- else
|
||||
= t('.whatup', :pod => @pod_url)
|
||||
|
||||
- content_for :head do
|
||||
= include_javascripts :home
|
||||
|
||||
%h1
|
||||
- if params[:tag]
|
||||
= t('.posts_tagged_with', :tag => params[:tag])
|
||||
- else
|
||||
= t('.whatup', :pod => @pod_url)
|
||||
.span-24.last
|
||||
%h1
|
||||
- if params[:tag]
|
||||
= "##{params[:tag]}"
|
||||
|
||||
- else
|
||||
= t('.whatup', :pod => @pod_url)
|
||||
|
||||
.span-15
|
||||
#main_stream.stream
|
||||
= render 'shared/stream', :posts => @fakes
|
||||
%a.paginate
|
||||
= t("more")
|
||||
- if @fakes.length > 0
|
||||
= render 'shared/stream', :posts => @fakes
|
||||
%a.paginate
|
||||
= t("more")
|
||||
- else
|
||||
nobody likes ##{params[:tag]}.
|
||||
= will_paginate @posts
|
||||
|
||||
.prepend-2.span-7.last
|
||||
%h3
|
||||
People tagged with ##{params[:tag]}
|
||||
.side_stream
|
||||
= render :collection => @people, :partial => 'people/person'
|
||||
|
|
|
|||
|
|
@ -6,17 +6,16 @@
|
|||
= t('.edit_profile')
|
||||
|
||||
= form_tag profile_path(profile), :method => :put, :multipart => true, :id => 'update_profile_form' do
|
||||
%h3
|
||||
= t('profiles.edit.your_profile')
|
||||
.description
|
||||
= t('profiles.edit.info_available_to')
|
||||
= render 'profiles/edit_public', :profile => profile, :aspect => aspect, :person => person
|
||||
|
||||
= error_messages_for profile
|
||||
%hr
|
||||
%br
|
||||
%h3
|
||||
= t('profiles.edit.your_private_profile')
|
||||
|
||||
%h4
|
||||
= t('profiles.edit.your_name')
|
||||
= text_field_tag 'profile[first_name]', profile.first_name, :placeholder => t('profiles.edit.first_name')
|
||||
= text_field_tag 'profile[last_name]', profile.last_name, :placeholder => t('profiles.edit.last_name')
|
||||
= t('profiles.edit.your_bio')
|
||||
= text_area_tag 'profile[bio]', profile.bio, :rows => 5, :placeholder => t('fill_me_out')
|
||||
|
||||
%h4
|
||||
= t('profiles.edit.your_gender')
|
||||
|
|
@ -29,28 +28,14 @@
|
|||
= select_date profile.birthday, :prompt => true,
|
||||
:default => true, :order => t('date.order'), :start_year => 2000, :end_year => 1930, :prefix => 'profile[date]'
|
||||
|
||||
%h4
|
||||
= t('profiles.edit.your_tags')
|
||||
= text_field_tag 'profile[tags]', profile.tag_string, :placeholder => t('.your_tags_placeholder')
|
||||
|
||||
%h4
|
||||
= t('profiles.edit.your_bio')
|
||||
= text_area_tag 'profile[bio]', profile.bio, :rows => 5, :placeholder => t('fill_me_out')
|
||||
|
||||
%h4
|
||||
= t('profiles.edit.your_photo')
|
||||
= render 'photos/new_profile_photo', :aspect => aspect, :person => person
|
||||
%b
|
||||
|
||||
%h4
|
||||
= t('search')
|
||||
%p{:class=>"checkbox_select"}
|
||||
= label_tag 'profile[searchable]', t('profiles.edit.allow_search')
|
||||
= check_box_tag 'profile[searchable]', true, profile.searchable
|
||||
|
||||
= hidden_field_tag :getting_started, step if step
|
||||
%br
|
||||
|
||||
.submit_block
|
||||
=yield(:submit_block)
|
||||
|
||||
|
||||
|
|
|
|||
22
app/views/profiles/_edit_public.html.haml
Normal file
22
app/views/profiles/_edit_public.html.haml
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
-# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
%h3
|
||||
= t('profiles.edit.your_public_profile')
|
||||
|
||||
= error_messages_for profile
|
||||
|
||||
%h4
|
||||
= t('profiles.edit.your_name')
|
||||
= text_field_tag 'profile[first_name]', profile.first_name, :placeholder => t('profiles.edit.first_name')
|
||||
= text_field_tag 'profile[last_name]', profile.last_name, :placeholder => t('profiles.edit.last_name')
|
||||
|
||||
%h4
|
||||
= t('profiles.edit.your_tags')
|
||||
= text_field_tag 'profile[tags]', profile.tag_string, :placeholder => t('profiles.edit.your_tags_placeholder')
|
||||
|
||||
%h4
|
||||
= t('profiles.edit.your_photo')
|
||||
= render 'photos/new_profile_photo', :aspect => aspect, :person => person
|
||||
%br
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
%li=link_to t('account'), edit_user_path(current_user)
|
||||
%li=link_to t('_services'), services_path
|
||||
|
||||
.span-19.prepend-5.last
|
||||
.span-12.prepend-5.last
|
||||
- content_for :submit_block do
|
||||
= link_to t('cancel'), edit_user_path(current_user)
|
||||
= t('or')
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@
|
|||
= person.name
|
||||
|
||||
#person_nav_links
|
||||
= link_to t('layouts.header.view_profile'), person_path(person)
|
||||
= link_to t('layouts.header.profile'), person_path(person)
|
||||
= link_to t('_photos'), person_photos_path(person)
|
||||
|
|
|
|||
|
|
@ -3,14 +3,9 @@
|
|||
-# the COPYRIGHT file.
|
||||
|
||||
|
||||
- if posts.length > 0
|
||||
-# for post in posts
|
||||
= render 'shared/stream_element', :post => post, :all_aspects => @all_aspects, :commenting_disabled => defined?(@commenting_disabled)
|
||||
= render :partial => 'shared/stream_element',
|
||||
:collection => posts,
|
||||
:as => :post,
|
||||
:locals => {:all_aspects => @all_aspects,
|
||||
:commenting_disabled => defined?(@commenting_disabled)}
|
||||
= render :partial => 'shared/stream_element',
|
||||
:collection => posts,
|
||||
:as => :post,
|
||||
:locals => {:all_aspects => @all_aspects,
|
||||
:commenting_disabled => defined?(@commenting_disabled)}
|
||||
|
||||
- else
|
||||
= render 'aspects/no_posts_message', :post_count => posts.length
|
||||
|
|
|
|||
|
|
@ -13,16 +13,16 @@
|
|||
%li=link_to t('account'), edit_user_path(current_user)
|
||||
%li=link_to t('_services'), services_path
|
||||
|
||||
.span-19.prepend-5.last
|
||||
.span-12.prepend-5.last
|
||||
%h2
|
||||
= t('account')
|
||||
|
||||
.span-8.append-2
|
||||
.span-5.append-1
|
||||
%h3
|
||||
= t('.your_handle')
|
||||
%p
|
||||
%b= current_user.diaspora_handle
|
||||
.span-8.last
|
||||
.span-5.last
|
||||
%h3
|
||||
= t('.your_email')
|
||||
%p
|
||||
|
|
@ -117,14 +117,14 @@
|
|||
%br
|
||||
|
||||
|
||||
#account_data.span-9.append-2
|
||||
#account_data.span-5.append-2
|
||||
%h3
|
||||
= t('.export_data')
|
||||
= link_to t('.download_xml'), users_export_path, :class => "button"
|
||||
%br
|
||||
= link_to t('.download_photos'), users_export_photos_path, :class => "button"
|
||||
|
||||
.span-8.last
|
||||
.span-5.last
|
||||
%h3
|
||||
= t('.close_account')
|
||||
= link_to t('.close_account'), current_user,
|
||||
|
|
|
|||
|
|
@ -2,8 +2,21 @@
|
|||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
- content_for :submit_block do
|
||||
= submit_tag "#{t('users.getting_started.save_and_continue')} →"
|
||||
= render :partial => 'profiles/edit', :locals => {:person => @person,
|
||||
:profile => @profile, :aspect => @aspect, :step => @step}
|
||||
|
||||
= form_tag profile_path(@profile), :method => :put, :multipart => true, :id => 'update_profile_form' do
|
||||
%div{:style => "width:360px"}
|
||||
= render 'profiles/edit_public', :profile => @profile, :aspect => @aspect, :person => @person
|
||||
= hidden_field_tag :getting_started, @step
|
||||
|
||||
%h4
|
||||
= t('search')
|
||||
%p{:class=>"checkbox_select"}
|
||||
= label_tag 'profile[searchable]', t('profiles.edit.allow_search')
|
||||
= check_box_tag 'profile[searchable]', true, @profile.searchable
|
||||
|
||||
%br
|
||||
%br
|
||||
%br
|
||||
|
||||
.submit_block
|
||||
= submit_tag "#{t('users.getting_started.save_and_continue')} →"
|
||||
|
|
|
|||
|
|
@ -246,9 +246,8 @@ en:
|
|||
|
||||
layouts:
|
||||
header:
|
||||
view_profile: "view profile"
|
||||
edit_profile: "edit profile"
|
||||
account_settings: "account settings"
|
||||
profile: "profile"
|
||||
settings: "settings"
|
||||
logout: "logout"
|
||||
blog: "blog"
|
||||
login: "login"
|
||||
|
|
@ -402,15 +401,15 @@ en:
|
|||
|
||||
profiles:
|
||||
edit:
|
||||
info_available_to: "This info will be available to whomever you connect with on Diaspora."
|
||||
your_profile: "Your profile"
|
||||
your_public_profile: "Your public profile"
|
||||
your_private_profile: "Your private profile"
|
||||
your_name: "Your name"
|
||||
first_name: "First name"
|
||||
last_name: "Last name"
|
||||
your_gender: "Your gender"
|
||||
your_birthday: "Your birthday"
|
||||
your_tags: "You: in 5 tags"
|
||||
your_tags_placeholder: "i.e. #ironing #knitting #kittens #knees #doors"
|
||||
your_tags_placeholder: "i.e. #diaspora #ironing #kittens #music"
|
||||
your_bio: "Your bio"
|
||||
your_photo: "Your photo"
|
||||
update_profile: "Update Profile"
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ Feature: invitation acceptance
|
|||
And I should see "getting_started_logo"
|
||||
When I fill in "profile_first_name" with "O"
|
||||
And I fill in "profile_last_name" with "Hai"
|
||||
And I fill in "profile_gender" with "guess!"
|
||||
And I fill in "profile_tags" with "#beingawesome"
|
||||
And I press "Save and continue"
|
||||
Then I should see "Profile updated"
|
||||
And I should see "Would you like to find your Facebook friends on Diaspora?"
|
||||
|
|
@ -30,7 +30,7 @@ Feature: invitation acceptance
|
|||
And I should see "getting_started_logo"
|
||||
When I fill in "profile_first_name" with "O"
|
||||
And I fill in "profile_last_name" with "Hai"
|
||||
And I fill in "profile_gender" with "guess!"
|
||||
And I fill in "profile_tags" with "#tags"
|
||||
And I press "Save and continue"
|
||||
Then I should see "Profile updated"
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Feature: Change password
|
|||
Scenario: Change my password
|
||||
Given I am signed in
|
||||
And I click on my name in the header
|
||||
And I follow "account settings"
|
||||
And I follow "settings"
|
||||
Then I should be on my account settings page
|
||||
When I put in my password in "user_current_password"
|
||||
And I fill in "user_password" with "newsecret"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ Feature: Close Account
|
|||
Scenario: user closes account
|
||||
Given I am signed in
|
||||
When I click on my name in the header
|
||||
And I follow "account settings"
|
||||
And I follow "settings"
|
||||
And I click ok in the confirm dialog to appear next
|
||||
And I follow "Close Account"
|
||||
Then I should be on the home page
|
||||
|
|
@ -30,7 +30,7 @@ Feature: Close Account
|
|||
And I log out
|
||||
Then I sign in as "bob@bob.bob"
|
||||
When I click on my name in the header
|
||||
And I follow "account settings"
|
||||
And I follow "settings"
|
||||
And I click ok in the confirm dialog to appear next
|
||||
And I follow "Close Account"
|
||||
Then I sign in as "alice@alice.alice"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@ Feature: editing your profile
|
|||
Background:
|
||||
Given I am signed in
|
||||
And I click on my name in the header
|
||||
And I follow "edit profile"
|
||||
And I follow "profile"
|
||||
And I follow "Edit my profile"
|
||||
Then I should be on my edit profile page
|
||||
|
||||
Scenario: editing gender with a textbox
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ Feature: new user registration
|
|||
Scenario: new user goes through the setup wizard
|
||||
When I fill in "profile_first_name" with "O"
|
||||
And I fill in "profile_last_name" with "Hai"
|
||||
And I fill in "profile_gender" with "guess!"
|
||||
And I fill in "profile_tags" with "#gender"
|
||||
And I press "Save and continue"
|
||||
And I wait for "step 2" to load
|
||||
Then I should see "Profile updated"
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ $background: rgb(252,252,252)
|
|||
body
|
||||
:padding 2em
|
||||
:margin 0
|
||||
:top 50px
|
||||
:top 60px
|
||||
:background-color $background
|
||||
a
|
||||
:color #107FC9
|
||||
|
|
@ -327,6 +327,8 @@ header
|
|||
h4,
|
||||
h5
|
||||
:display inline-block
|
||||
:margin
|
||||
:bottom 10px
|
||||
|
||||
&.show
|
||||
a
|
||||
|
|
@ -781,7 +783,7 @@ textarea
|
|||
:size 14px
|
||||
:padding 0.3em
|
||||
:display block
|
||||
:width 66%
|
||||
:width 100%
|
||||
:border 1px solid #ccc
|
||||
:height auto
|
||||
|
||||
|
|
@ -2744,3 +2746,27 @@ ul.show_comments
|
|||
|
||||
#contact_visibility_padlock:hover
|
||||
:opacity 0.7
|
||||
|
||||
.side_stream
|
||||
.avatar
|
||||
:float left
|
||||
.right
|
||||
:display none
|
||||
|
||||
.stream_element:hover
|
||||
.right
|
||||
:display none
|
||||
|
||||
.tag
|
||||
:background
|
||||
:color lighten($blue, 47%)
|
||||
:font
|
||||
:weight bold
|
||||
|
||||
.diaspora_handle
|
||||
:font
|
||||
:size 12px
|
||||
:weight normal
|
||||
:color #999
|
||||
:margin
|
||||
:left 6px
|
||||
|
|
|
|||
|
|
@ -151,6 +151,11 @@ describe Profile do
|
|||
person = Factory.create(:person)
|
||||
@object = person.profile
|
||||
end
|
||||
it 'allows 5 tags' do
|
||||
@object.tag_string = '#one #two #three #four #five #six'
|
||||
@object.build_tags
|
||||
@object.valid?.should be_false
|
||||
end
|
||||
it_should_behave_like 'it is taggable'
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue