From 21bd875a3f93f850e51b92fac260c22007c370d3 Mon Sep 17 00:00:00 2001 From: maxwell Date: Wed, 21 Jul 2010 16:38:33 -0700 Subject: [PATCH] MS DG request bar fix, and some other small tweaks --- app/controllers/requests_controller.rb | 3 ++- app/helpers/requests_helper.rb | 2 +- app/views/layouts/application.html.haml | 2 +- app/views/photos/_photo.haml | 5 ++++- app/views/requests/_form.haml | 7 ++----- app/views/requests/_new_request.haml | 6 ++---- public/stylesheets/application.css | 4 ++++ public/stylesheets/sass/application.sass | 5 +++++ 8 files changed, 21 insertions(+), 13 deletions(-) diff --git a/app/controllers/requests_controller.rb b/app/controllers/requests_controller.rb index 1f01180dc..d4b2384fc 100644 --- a/app/controllers/requests_controller.rb +++ b/app/controllers/requests_controller.rb @@ -25,7 +25,8 @@ class RequestsController < ApplicationController end def create - url = relationship_flow(params[:request][:destination_url]).values.first + url = relationship_flow(params[:request][:destination_url])[:friend] + @request = current_user.send_friend_request_to(url) unless url.include?('@')|| url == '' if @request flash[:notice] = "a friend request was sent to #{@request.destination_url}" diff --git a/app/helpers/requests_helper.rb b/app/helpers/requests_helper.rb index 96e1872a9..617cafd1b 100644 --- a/app/helpers/requests_helper.rb +++ b/app/helpers/requests_helper.rb @@ -36,7 +36,7 @@ module RequestsHelper def relationship_flow(identifier) unless identifier.include?( '@') - return identifier + return {:friend => identifier} end f = Redfinger.finger(identifier) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 6ddbfe23b..85ca17c53 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -32,7 +32,7 @@ #session_action - if user_signed_in? - = current_user.real_name + = link_to_person current_user | = link_to "requests (#{@request_count})", requests_path, :class => new_request(@request_count) | diff --git a/app/views/photos/_photo.haml b/app/views/photos/_photo.haml index 8ee7948bf..fb7008122 100644 --- a/app/views/photos/_photo.haml +++ b/app/views/photos/_photo.haml @@ -3,7 +3,10 @@ %span.from = link_to_person post.person - %b posted a new photo + %b + posted a new photo to + = link_to post.album.name, object_path(post.album) + %br = link_to (image_tag post.image.url(:thumb_medium)), object_path(post) diff --git a/app/views/requests/_form.haml b/app/views/requests/_form.haml index 319265e29..de088d363 100644 --- a/app/views/requests/_form.haml +++ b/app/views/requests/_form.haml @@ -1,9 +1,6 @@ -= form_for @request do |f| += form_for @request do |f| = f.error_messages - %p - = f.label :destination_url + .field_with_submit = f.text_field :destination_url - - %p = f.submit diff --git a/app/views/requests/_new_request.haml b/app/views/requests/_new_request.haml index d44bdcea0..da924b05e 100644 --- a/app/views/requests/_new_request.haml +++ b/app/views/requests/_new_request.haml @@ -1,9 +1,7 @@ = form_for @request do |f| = f.error_messages - %p - enter a diaspora url, diaspora username, or random email address: - = f.label :destination_url + enter a diaspora url, diaspora username, or random email address: + .field_with_submit = f.text_field :destination_url - %p = f.submit diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index bd1de6ff0..e046187a0 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -344,3 +344,7 @@ ul#publisher_content_pickers li { border-radius: 3px; -webkit-border-radius: 3px; -moz-border-radius: 3px; } + +.field_with_submit input[type='text'] { + width: 85%; + display: inline; } diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 947229982..eb19e5297 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -416,3 +416,8 @@ ul#publisher_content_pickers li :-webkit-border-radius 3px :-moz-border-radius 3px +.field_with_submit + input[type='text'] + :width 85% + :display inline +