From fc73c02c3aec200b0a39080bd97dfb1f88142469 Mon Sep 17 00:00:00 2001 From: Raphael Date: Thu, 9 Dec 2010 20:01:19 -0800 Subject: [PATCH 1/4] Fix hashes_for_person spec --- spec/models/request_spec.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/models/request_spec.rb b/spec/models/request_spec.rb index 1d53941da..0f6bc89ca 100644 --- a/spec/models/request_spec.rb +++ b/spec/models/request_spec.rb @@ -13,7 +13,7 @@ describe Request do describe 'validations' do before do - @request = Request.instantiate(:from => user.person, :to => user2.person, :into => aspect) + @request = Request.instantiate(:from => user.person, :to => user2.person, :into => aspect) end it 'is valid' do @request.should be_valid @@ -43,14 +43,14 @@ describe Request do end it 'is not to yourself' do - @request = Request.instantiate(:from => user.person, :to => user.person, :into => aspect) + @request = Request.instantiate(:from => user.person, :to => user.person, :into => aspect) @request.should_not be_valid end end describe 'scopes' do before do - @request = Request.instantiate(:from => user.person, :to => user2.person, :into => aspect) + @request = Request.instantiate(:from => user.person, :to => user2.person, :into => aspect) @request.save end describe '.from' do @@ -84,7 +84,7 @@ describe Request do user.request_from_me?(request).should be_true end - it 'recognized when a request is not from me' do + it 'recognized when a request is not from me' do user2.request_from_me?(request).should be_false end end @@ -119,7 +119,7 @@ describe Request do @hash = @hashes.first end it 'gives back requests' do - @hash[:request].should == Request.from(@user2).to(@user).first + @hash[:request].should == Request.from(@user2).to(@user).first(:sent => false) end it 'gives back people' do @hash[:sender].should == @user2.person @@ -130,7 +130,7 @@ describe Request do end describe 'xml' do before do - @request = Request.new(:from => user.person, :to => user2.person, :into => aspect) + @request = Request.new(:from => user.person, :to => user2.person, :into => aspect) @xml = @request.to_xml.to_s end describe 'serialization' do From 5731f32cfe97e0eb8bb563317ab83241d41b6133 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Thu, 9 Dec 2010 19:55:47 -0800 Subject: [PATCH 2/4] add correct page titles --- app/controllers/application_controller.rb | 4 ++-- app/helpers/application_helper.rb | 10 ++++++++++ app/views/aspects/manage.html.haml | 3 +++ app/views/aspects/show.html.haml | 3 +++ app/views/layouts/application.html.haml | 5 +---- app/views/people/_edit.html.haml | 2 ++ app/views/people/index.html.haml | 3 +++ app/views/people/show.html.haml | 2 ++ app/views/services/index.html.haml | 3 +++ app/views/users/edit.html.haml | 3 +++ 10 files changed, 32 insertions(+), 6 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1ad96a17f..084d3e8df 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -24,13 +24,13 @@ class ApplicationController < ActionController::Base def mobile_except_ipad if is_mobile_device? if request.env["HTTP_USER_AGENT"].include? "iPad" - session[:mobile_view] = false + session[:mobile_view] = false else session[:mobile_view] = true end end end - + def count_requests @request_count = current_user.requests_for_me.count if current_user end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 89e6121cf..94e49b23c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -9,6 +9,16 @@ module ApplicationHelper false end + def page_title text=nil + title = "" + if text.blank? + title = "#{current_user.name} | " if current_user + else + title = "#{text} | " + end + title += "DIASPORA*" + end + def aspects_with_post aspects, post aspects.select do |a| post.aspect_ids.include?(a.id) diff --git a/app/views/aspects/manage.html.haml b/app/views/aspects/manage.html.haml index ecd4be3cf..379e2f3c1 100644 --- a/app/views/aspects/manage.html.haml +++ b/app/views/aspects/manage.html.haml @@ -5,6 +5,9 @@ - content_for :head do = include_javascripts :aspects +- content_for :page_title do + = "Manage aspects" + #section_header %h2=t('.manage_aspects') .right{:style=>"top:0;"} diff --git a/app/views/aspects/show.html.haml b/app/views/aspects/show.html.haml index 480eff296..da066c2b0 100644 --- a/app/views/aspects/show.html.haml +++ b/app/views/aspects/show.html.haml @@ -2,6 +2,9 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. +- content_for :page_title do + = @aspect.name + .span-24.last %h2{:style=>"position:relative;margin-bottom:0;"} = @aspect diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index ade8de03b..ae70a18a0 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -8,10 +8,7 @@ %meta{:charset => 'utf-8'} %title - - if current_user - = "#{current_user.name} | DIASPORA*" - - else - DIASPORA* + = page_title yield(:page_title) %meta{'http-equiv' => 'X-UA-Compatible', :content => 'IE=edge,chrome=1'} diff --git a/app/views/people/_edit.html.haml b/app/views/people/_edit.html.haml index 1fa379815..6935b4601 100644 --- a/app/views/people/_edit.html.haml +++ b/app/views/people/_edit.html.haml @@ -2,6 +2,8 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. +- content_for :page_title do + = "Edit profile" = form_tag person_path(@person), :method => :put, :multipart => true, :id => 'update_profile_form' do %h3 diff --git a/app/views/people/index.html.haml b/app/views/people/index.html.haml index a0560df61..b607a02ea 100644 --- a/app/views/people/index.html.haml +++ b/app/views/people/index.html.haml @@ -2,6 +2,9 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. +- content_for :page_title do + = "Search" + .span-15.prepend-5.last %h2 -if params[:q].blank? diff --git a/app/views/people/show.html.haml b/app/views/people/show.html.haml index df078a437..97dc45177 100644 --- a/app/views/people/show.html.haml +++ b/app/views/people/show.html.haml @@ -2,6 +2,8 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. +- content_for :page_title do + = @person.name .span-24.last #author_info diff --git a/app/views/services/index.html.haml b/app/views/services/index.html.haml index 883ae1eba..345ebd885 100644 --- a/app/views/services/index.html.haml +++ b/app/views/services/index.html.haml @@ -2,6 +2,9 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. +- content_for :page_title do + = "Edit services" + #section_header %h2 = t('settings') diff --git a/app/views/users/edit.html.haml b/app/views/users/edit.html.haml index 3b1cd7cdd..087f4d814 100644 --- a/app/views/users/edit.html.haml +++ b/app/views/users/edit.html.haml @@ -2,6 +2,9 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. +- content_for :page_title do + = "Edit account" + :javascript $(document).ready(function(){ $("#settings_nav li > a").live("click", function() { From 624cb45ee25834cad831543dd9ac98901fb52815 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Thu, 9 Dec 2010 20:08:09 -0800 Subject: [PATCH 3/4] fixed aspect nav FF bug --- public/stylesheets/sass/application.sass | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 7cd934d21..b5304d0cb 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -931,16 +931,21 @@ label #aspect_nav :margin :top 8px - :bottom 4px + :bottom 0 + :bottom 0 :color #000 ul + :position relative :padding 0 - :bottom 2px + :bottom 3px + :margin + :bottom 0 > li :display inline :margin 0 + :padding 4px 0 a :-webkit-border-radius 3px 3px 0 0 :-moz-border-radius 3px 3px 0 0 @@ -965,6 +970,8 @@ label :text-shadow 0 1px 0 #eee :font :weight bold + :padding + :bottom 6px :background :color rgb(252,252,252) From abcd3ca5b007546550177d4449169a31679b9c65 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Thu, 9 Dec 2010 20:13:46 -0800 Subject: [PATCH 4/4] time ago in words down to seconds --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 94e49b23c..e58c66960 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -83,7 +83,7 @@ module ApplicationHelper end def how_long_ago(obj) - "#{time_ago_in_words(obj.created_at)} #{t('ago')}" + "#{time_ago_in_words(obj.created_at, true)} #{t('ago')}" end def person_url(person)