Merge branch 'master' of github.com:diaspora/diaspora

This commit is contained in:
ilya 2010-09-14 11:14:10 -07:00
commit cb12e497f6
12 changed files with 45 additions and 39 deletions

View file

@ -24,15 +24,15 @@ class AlbumsController < ApplicationController
respond_to :json, :only => [:index, :show] respond_to :json, :only => [:index, :show]
def index def index
@aspect = current_user.aspect_by_id( params[:aspect] ) unless params[:aspect] == 'all'
@albums = current_user.albums_by_aspect(@aspect).paginate @albums = current_user.albums_by_aspect(@aspect).paginate
respond_with @albums respond_with @albums, :aspect => @aspect
end end
def create def create
aspect = params[:album][:to]
@album = current_user.post(:album, params[:album]) @album = current_user.post(:album, params[:album])
flash[:notice] = "You've created an album called #{@album.name}." flash[:notice] = "You've created an album called #{@album.name}."
respond_with @album redirect_to :action => :show, :id => @album.id, :aspect => aspect
end end
def new def new

View file

@ -36,7 +36,12 @@ class ApplicationController < ActionController::Base
def set_friends_and_status def set_friends_and_status
if current_user if current_user
@aspect = :all if params[:aspect] == nil || params[:aspect] == 'all'
@aspect = :all
else
@aspect = current_user.aspect_by_id( params[:aspect])
end
@aspects = current_user.aspects @aspects = current_user.aspects
@friends = current_user.friends @friends = current_user.friends
end end

View file

@ -53,8 +53,8 @@ class AspectsController < ApplicationController
respond_with @aspect respond_with @aspect
end end
def edit def manage
@aspects = current_user.aspects @aspect = :manage
@remote_requests = Request.for_user current_user @remote_requests = Request.for_user current_user
end end

View file

@ -20,11 +20,11 @@
module ApplicationHelper module ApplicationHelper
def current_aspect?(aspect) def current_aspect?(aspect)
@aspect != :all && @aspect.id == aspect.id !@aspect.is_a?(Symbol) && @aspect.id == aspect.id
end end
def object_path(object) def object_path(object, opts = {})
eval("#{object.class.to_s.underscore}_path(object)") eval("#{object.class.to_s.underscore}_path(object, opts)")
end end
def object_fields(object) def object_fields(object)

View file

@ -17,17 +17,16 @@
-# -#
.album{:id => post.id, :class => ("mine" if current_user.owns?(post))} .album{:id => post.id, :class => ("mine" if current_user.owns?(post))}
%div.name %div.name
= link_to post.name, object_path(post) = link_to post.name, object_path(post, :aspect => @aspect)
%div.time %div.time
by by
= link_to ((current_user.person == post.person)? 'you' : post.person.real_name), person_path(post.person) = link_to ((current_user.person == post.person)? 'you' : post.person.real_name), person_path(post.person)
%br %br
= link_to(how_long_ago(post), object_path(post)) = link_to(how_long_ago(post), object_path(post, :aspect => @aspect))
%div.image_cycle %div.image_cycle
- for photo in post.photos[0..3] - for photo in post.photos[0..3]
= link_to (image_tag photo.url(:thumb_large)), album_path(post) = link_to (image_tag photo.url(:thumb_large)), album_path(post, :aspect => @aspect)

View file

@ -24,7 +24,7 @@
}); });
= content_for :page_title do = content_for :page_title do
= link_to "◂ Home", aspects_path = link_to "◂ Home", aspects_path, :aspect => params[:aspect]
- content_for :left_pane do - content_for :left_pane do
= render "shared/aspect_friends" = render "shared/aspect_friends"

View file

@ -25,7 +25,7 @@
}); });
= content_for :page_title do = content_for :page_title do
= link_to "◂ Albums", albums_path = link_to "◂ Albums", albums_path(:aspect => @aspect)
- content_for :left_pane do - content_for :left_pane do
= render "shared/aspect_friends" = render "shared/aspect_friends"

View file

@ -39,7 +39,7 @@
%ul %ul
- content_for :publish do - content_for :publish do
.new_aspect= link_to("add a new aspect", "#add_aspect_pane", :id => "add_aspect_button", :title => "Add a new relation") = link_to("add a new aspect", "#add_aspect_pane", :id => "add_aspect_button", :class => "new_aspect button", :title => "Add a new aspect")

View file

@ -68,26 +68,7 @@
%li= link_to "logout", destroy_user_session_path %li= link_to "logout", destroy_user_session_path
= render "shared/aspect_nav" = render "shared/aspect_nav"
= render "shared/sub_header"
#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
.container .container
.span-5.last .span-5.last

View file

@ -27,8 +27,8 @@
%li{:class => ("selected" if @aspect == :all)} %li{:class => ("selected" if @aspect == :all)}
= link_to "All Aspects", root_url = link_to "All Aspects", root_url
%li{ :style => "margin-right:0;" } %li{ :style => "margin-right:0;", :class => ("selected" if @aspect == :manage)}
= 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" = 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;"} .yo{ :style => "display:none;"}
#add_aspect_pane #add_aspect_pane

View file

@ -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

View file

@ -27,7 +27,8 @@ Diaspora::Application.routes.draw do
resources :photos, :except => [:index] resources :photos, :except => [:index]
resources :albums 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_friends', :to => 'aspects#move_friends', :as => 'move_friends'
match 'aspects/move_friend', :to => 'aspects#move_friend', :as => 'move_friend' match 'aspects/move_friend', :to => 'aspects#move_friend', :as => 'move_friend'