diff --git a/app/controllers/requests_controller.rb b/app/controllers/requests_controller.rb index 3f98eefb5..56ffae0e4 100644 --- a/app/controllers/requests_controller.rb +++ b/app/controllers/requests_controller.rb @@ -22,15 +22,7 @@ class RequestsController < ApplicationController include RequestsHelper respond_to :html - respond_to :json, :only => :index - def index - @remote_requests = Request.for_user current_user - @request = Request.new - - respond_with @remote_requests - end - def destroy if params[:accept] if params[:aspect_id] diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index b466841d0..55a74683e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -38,7 +38,19 @@ class UsersController < ApplicationController def update @user = User.find_by_id params[:id] + prep_image_url(params[:user]) + @user.update_profile params[:user] respond_with(@user, :location => root_url) end + + private + + def prep_image_url(params) + if params[:profile][:image_url].empty? + params[:profile].delete(:image_url) + else + params[:profile][:image_url] = "http://" + request.host + ":" + request.port.to_s + params[:profile][:image_url] + end + end end diff --git a/app/models/user.rb b/app/models/user.rb index 43c2d3d06..cefa4e4d4 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -213,8 +213,6 @@ class User ########### Profile ###################### def update_profile(params) - params[:profile].delete(:image_url) if params[:profile][:image_url].empty? - if self.person.update_attributes(params) push_to_aspects profile, :all true diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 3108a0097..3b823e54e 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -67,7 +67,6 @@ = text_field_tag 'q' %li= link_to current_user.real_name, current_user.person - %li= link_to "requests (#{@request_count})", requests_path, :class => new_request(@request_count) %li= link_to "edit profile", edit_user_path(current_user) %li= link_to "logout", destroy_user_session_path @@ -102,7 +101,3 @@ .span-19.prepend-5.last = render "posts/debug" - - #notification_badge.requests - = link_to "requests (#{@request_count})", requests_path - diff --git a/app/views/requests/_request.html.haml b/app/views/requests/_request.html.haml deleted file mode 100644 index f003958e2..000000000 --- a/app/views/requests/_request.html.haml +++ /dev/null @@ -1,42 +0,0 @@ --# Copyright 2010 Diaspora Inc. --# --# This file is part of Diaspora. --# --# Diaspora is free software: you can redistribute it and/or modify --# it under the terms of the GNU Affero General Public License as published by --# the Free Software Foundation, either version 3 of the License, or --# (at your option) any later version. --# --# Diaspora is distributed in the hope that it will be useful, --# but WITHOUT ANY WARRANTY; without even the implied warranty of --# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --# GNU Affero General Public License for more details. --# --# You should have received a copy of the GNU Affero General Public License --# along with Diaspora. If not, see . --# - - -:javascript - $(document).ready(function(){ - $(".aspect_selector").change( function() { - var id = $(this).children(":selected").val(); - $(this).parent().children(".accept").html( "Accept"); - }); - }); - - -%li.message{:id => request.id} - - %span.from - = link_to "#{request.person.real_name}", '#' - - %ul.request_buttons - %select{ :class => "aspect_selector", :style=>"display:inline;"} - %option Add to aspect - %option - - for aspect in current_user.aspects - %option{:value => aspect.id}= aspect.name - %li.accept= link_to 'Accept', request_path(request, :accept => true), :method => :delete, :class => "button" - %li.ignore= link_to 'Ignore', request_path(request), :confirm => 'Are you sure?', :method => :delete, :class => "button" - diff --git a/app/views/requests/edit.html.haml b/app/views/requests/edit.html.haml deleted file mode 100644 index 94e6fd172..000000000 --- a/app/views/requests/edit.html.haml +++ /dev/null @@ -1,27 +0,0 @@ --# Copyright 2010 Diaspora Inc. --# --# This file is part of Diaspora. --# --# Diaspora is free software: you can redistribute it and/or modify --# it under the terms of the GNU Affero General Public License as published by --# the Free Software Foundation, either version 3 of the License, or --# (at your option) any later version. --# --# Diaspora is distributed in the hope that it will be useful, --# but WITHOUT ANY WARRANTY; without even the implied warranty of --# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --# GNU Affero General Public License for more details. --# --# You should have received a copy of the GNU Affero General Public License --# along with Diaspora. If not, see . --# - - -- title "Edit Request" - -= render 'form' - -%p - = link_to "Show", request_path(@person_request) - | - = link_to "View All", request_path diff --git a/app/views/requests/index.html.haml b/app/views/requests/index.html.haml deleted file mode 100644 index c56c2aa4a..000000000 --- a/app/views/requests/index.html.haml +++ /dev/null @@ -1,32 +0,0 @@ --# Copyright 2010 Diaspora Inc. --# --# This file is part of Diaspora. --# --# Diaspora is free software: you can redistribute it and/or modify --# it under the terms of the GNU Affero General Public License as published by --# the Free Software Foundation, either version 3 of the License, or --# (at your option) any later version. --# --# Diaspora is distributed in the hope that it will be useful, --# but WITHOUT ANY WARRANTY; without even the implied warranty of --# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --# GNU Affero General Public License for more details. --# --# You should have received a copy of the GNU Affero General Public License --# along with Diaspora. If not, see . --# - - -%h1.big_text - .back - = link_to "⇧ home", root_path - Requests - -%h3= "currently #{@request_count} requests" -%ul#stream - - for request in @remote_requests - = render "request", :request => request - -#content_bottom - .back - = link_to "⇧ home", root_path diff --git a/app/views/requests/show.html.haml b/app/views/requests/show.html.haml deleted file mode 100644 index 8026a593e..000000000 --- a/app/views/requests/show.html.haml +++ /dev/null @@ -1,30 +0,0 @@ --# Copyright 2010 Diaspora Inc. --# --# This file is part of Diaspora. --# --# Diaspora is free software: you can redistribute it and/or modify --# it under the terms of the GNU Affero General Public License as published by --# the Free Software Foundation, either version 3 of the License, or --# (at your option) any later version. --# --# Diaspora is distributed in the hope that it will be useful, --# but WITHOUT ANY WARRANTY; without even the implied warranty of --# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --# GNU Affero General Public License for more details. --# --# You should have received a copy of the GNU Affero General Public License --# along with Diaspora. If not, see . --# - - -- title "Request" - -%p - = @request.inspect - -%p - = link_to "Edit", edit_request_path(@request) - | - = link_to "Destroy", @request, :confirm => 'Are you sure?', :method => :delete - | - = link_to "View All", requests_path diff --git a/app/views/shared/_aspect_nav.haml b/app/views/shared/_aspect_nav.haml index 503c66988..306f3e801 100644 --- a/app/views/shared/_aspect_nav.haml +++ b/app/views/shared/_aspect_nav.haml @@ -32,7 +32,7 @@ = link_to "All Aspects", root_url %li{ :style => "margin-right:0;" } - = link_to "manage", edit_aspect_path(Aspect.first), :class => "edit_aspect_button", :title => "Manage your Aspects" + = link_to ( (@request_count == 0)? "manage" : "manage (#{@request_count})"), edit_aspect_path(Aspect.first), :class => "edit_aspect_button", :class => new_request(@request_count), :title => "Manage your Aspects" .yo{ :style => "display:none;"} #add_aspect_pane diff --git a/app/views/users/edit.html.haml b/app/views/users/edit.html.haml index 3df6e1edf..20c30ea11 100644 --- a/app/views/users/edit.html.haml +++ b/app/views/users/edit.html.haml @@ -35,11 +35,11 @@ = p.hidden_field :image_url, :value => @profile.image_url, :id => 'image_url_field' - for photo in @photos - if photo.url(:thumb_medium) == @profile.image_url - %div.small_photo{:id => request.host + photo.url(:thumb_medium), :class=>'selected'} + %div.small_photo{:id => photo.url(:thumb_medium), :class=>'selected'} = check_box_tag 'checked_photo', true, true = link_to image_tag(photo.url(:thumb_medium)), "#" - else - %div.small_photo{:id => request.host + photo.url(:thumb_medium)} + %div.small_photo{:id => photo.url(:thumb_medium)} = check_box_tag 'checked_photo' = link_to image_tag(photo.url(:thumb_medium)), "#" =will_paginate @photos diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index cb12a343f..2b4494e09 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -483,6 +483,8 @@ h1.big_text { background-color: #efefef; } #aspect_nav ul > li.selected a a { color: black; } + #aspect_nav .new_requests { + color: red; } #global_search { display: inline; diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 89dfc2cda..83c218a40 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -654,7 +654,8 @@ h1.big_text :color #efefef a :color #000 - + .new_requests + :color red #global_search :display inline