diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index b260095f2..e8dd82889 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -53,8 +53,8 @@ class AspectsController < ApplicationController respond_with @aspect end - def edit - @aspects = current_user.aspects + def manage + @aspect = :manage @remote_requests = Request.for_user current_user end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 234cf80ee..a43854240 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -20,7 +20,7 @@ module ApplicationHelper def current_aspect?(aspect) - @aspect != :all && @aspect.id == aspect.id + !@aspect.is_a?(Symbol) && @aspect.id == aspect.id end def object_path(object, opts = {}) diff --git a/app/views/aspects/edit.html.haml b/app/views/aspects/manage.html.haml similarity index 100% rename from app/views/aspects/edit.html.haml rename to app/views/aspects/manage.html.haml diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 0d510228c..9e24a380a 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -68,26 +68,7 @@ %li= link_to "logout", destroy_user_session_path = render "shared/aspect_nav" - - #aspect_header - .container - .span-5.last - - if @person - %h1 - = @person.real_name - - else - - if @aspect == :all - %h1 - = link_to "All Aspects", root_path - - else - %h1 - = link_to @aspect.name, @aspect - - .page_title - = yield :page_title - - .span-19.last{ :style => "position:relative;" } - = yield :publish + = render "shared/sub_header" .container .span-5.last diff --git a/app/views/shared/_aspect_nav.haml b/app/views/shared/_aspect_nav.haml index 72378b84d..f7f29b97f 100644 --- a/app/views/shared/_aspect_nav.haml +++ b/app/views/shared/_aspect_nav.haml @@ -27,8 +27,8 @@ %li{:class => ("selected" if @aspect == :all)} = link_to "All Aspects", root_url - %li{ :style => "margin-right:0;" } - = 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" + %li{ :style => "margin-right:0;", :class => ("selected" if @aspect == :manage)} + = link_to ( (@request_count == 0)? "manage" : "manage (#{@request_count})"), {:controller => :aspects, :action => :manage}, :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/shared/_sub_header.haml b/app/views/shared/_sub_header.haml new file mode 100644 index 000000000..badf8783d --- /dev/null +++ b/app/views/shared/_sub_header.haml @@ -0,0 +1,20 @@ +#aspect_header + .container + .span-5.last + - if @person + %h1 + = @person.real_name + - else + %h1 + - if @aspect == :all + = link_to "All Aspects", root_path + - elsif @aspect == :manage + = link_to "Manage Aspects", root_path + - else + = link_to @aspect.name, @aspect + + .page_title + = yield :page_title + + .span-19.last{ :style => "position:relative;" } + = yield :publish diff --git a/config/routes.rb b/config/routes.rb index ef64b8d5e..c949d232d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -27,7 +27,8 @@ Diaspora::Application.routes.draw do resources :photos, :except => [:index] resources :albums - resources :aspects + match 'aspects/manage', :to => 'aspects#manage' + resources :aspects, :except => [:edit] match 'aspects/move_friends', :to => 'aspects#move_friends', :as => 'move_friends' match 'aspects/move_friend', :to => 'aspects#move_friend', :as => 'move_friend'