RS, DG; DashboardsController has been eliminated.

This commit is contained in:
Raphael 2010-08-10 11:36:00 -07:00
parent cd875d06db
commit a48fbaaf59
6 changed files with 13 additions and 20 deletions

View file

@ -1,14 +0,0 @@
class DashboardsController < ApplicationController
before_filter :authenticate_user!
include ApplicationHelper
def index
if params[:group]
@people_ids = @group.people.map {|p| p.id}
@posts = Post.paginate :person_id => @people_ids, :order => 'created_at DESC'
else
@posts = Post.paginate :page => params[:page], :order => 'created_at DESC'
end
end
end

View file

@ -1,12 +1,16 @@
class GroupsController < ApplicationController class GroupsController < ApplicationController
before_filter :authenticate_user! before_filter :authenticate_user!
def index
@posts = Post.paginate :page => params[:page], :order => 'created_at DESC'
end
def create def create
@group = current_user.group(params[:group]) @group = current_user.group(params[:group])
if @group.created_at if @group.created_at
flash[:notice] = "Successfully created group." flash[:notice] = "Successfully created group."
redirect_to root_url redirect_to @group
else else
render :action => 'new' render :action => 'new'
end end
@ -24,7 +28,10 @@ class GroupsController < ApplicationController
end end
def show def show
@people_ids = @group.people.map {|p| p.id}
@posts = Post.paginate :person_id => @people_ids, :order => 'created_at DESC'
@group = Group.first(:id => params[:id]) @group = Group.first(:id => params[:id])
render :index
end end
def edit def edit

View file

@ -25,14 +25,14 @@ class PhotosController < ApplicationController
end end
def destroy def destroy
@photo = Photo.where(:id => params[:id]).first @photo = Photo.first(:id => params[:id])
@photo.destroy @photo.destroy
flash[:notice] = "Successfully deleted photo." flash[:notice] = "Successfully deleted photo."
redirect_to @photo.album redirect_to @photo.album
end end
def show def show
@photo = Photo.where(:id => params[:id]).first @photo = Photo.first(:id => params[:id])
@album = @photo.album @album = @photo.album
end end

View file

@ -1,8 +1,8 @@
#group #group
%ul %ul
- for group in @groups - for group in @groups
%li{:class => ("selected" if group.id.to_s == params[:group])} %li{:class => ("selected" if group.id.to_s == params[:id])}
= link_to group.name, root_path(:group =>group.id) = link_to group.name, group
%li#add_group_button.new_group= link_to "NEW GROUP", "#" %li#add_group_button.new_group= link_to "NEW GROUP", "#"

View file

@ -32,5 +32,5 @@ Diaspora::Application.routes.draw do |map|
match 'hcard', :to => 'publics#hcard' match 'hcard', :to => 'publics#hcard'
#root #root
root :to => 'dashboards#index' root :to => 'groups#index'
end end