diff --git a/app/controllers/dashboards_controller.rb b/app/controllers/dashboards_controller.rb deleted file mode 100644 index 6801f734f74bda3127baa571fd7b7331182e35fb..0000000000000000000000000000000000000000 --- a/app/controllers/dashboards_controller.rb +++ /dev/null @@ -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 diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index e12809fb68664ce234d88b1c49306d325077ebdf..27f5ae782830705603fb27defe4fa2217cbe6cce 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -1,12 +1,16 @@ class GroupsController < ApplicationController before_filter :authenticate_user! + def index + @posts = Post.paginate :page => params[:page], :order => 'created_at DESC' + end + def create @group = current_user.group(params[:group]) if @group.created_at flash[:notice] = "Successfully created group." - redirect_to root_url + redirect_to @group else render :action => 'new' end @@ -24,7 +28,10 @@ class GroupsController < ApplicationController end 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]) + render :index end def edit diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index 128115d6af62f907c256b000303e21ea1d008736..9956902133dba51e44394e183c9af7e371d9dae7 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -25,14 +25,14 @@ class PhotosController < ApplicationController end def destroy - @photo = Photo.where(:id => params[:id]).first + @photo = Photo.first(:id => params[:id]) @photo.destroy flash[:notice] = "Successfully deleted photo." redirect_to @photo.album end def show - @photo = Photo.where(:id => params[:id]).first + @photo = Photo.first(:id => params[:id]) @album = @photo.album end diff --git a/app/views/dashboards/index.html.haml b/app/views/groups/index.html.haml similarity index 100% rename from app/views/dashboards/index.html.haml rename to app/views/groups/index.html.haml diff --git a/app/views/shared/_group_nav.haml b/app/views/shared/_group_nav.haml index a9869015000394adca0e9528efea47c620b36d57..78202558138b2b286008a18beb14218afa10ead2 100644 --- a/app/views/shared/_group_nav.haml +++ b/app/views/shared/_group_nav.haml @@ -1,8 +1,8 @@ #group %ul - for group in @groups - %li{:class => ("selected" if group.id.to_s == params[:group])} - = link_to group.name, root_path(:group =>group.id) + %li{:class => ("selected" if group.id.to_s == params[:id])} + = link_to group.name, group %li#add_group_button.new_group= link_to "NEW GROUP", "#" diff --git a/config/routes.rb b/config/routes.rb index 50811fa7341dbc6cacf0a3fce38e1abae95d94e5..fb7d71fc60494bc0b392cec269d165976f910870 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -32,5 +32,5 @@ Diaspora::Application.routes.draw do |map| match 'hcard', :to => 'publics#hcard' #root - root :to => 'dashboards#index' + root :to => 'groups#index' end