MS IZ merging diffs

This commit is contained in:
maxwell 2010-08-10 12:37:04 -07:00
commit 0ffe893f8a
15 changed files with 62 additions and 62 deletions

View file

@ -19,7 +19,7 @@ class ApplicationController < ActionController::Base
if current_user
@groups = current_user.groups
@friends = current_user.friends
@latest_status_message = StatusMessage.newest_for(current_user)
@latest_status_message = StatusMessage.newest_for(current_user.person)
@group = params[:group] ? current_user.groups.first(:id => params[:group]) : current_user.groups.first
end
end

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

View file

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

View file

@ -25,4 +25,20 @@ class UsersController < ApplicationController
render :action => 'edit'
end
end
def create
@user = User.new(params[:user])
if @user.save!
flash[:notice] = "Successfully signed up."
redirect_to root_path
else
render :action => 'new'
end
end
def new
@user = User.new
end
end

View file

@ -23,6 +23,7 @@ module SocketsHelper
action_hash[:photo_hash] = object.thumb_hash
elsif object.is_a? StatusMessage
action_hash[:status_message_hash] = object.latest_hash
action_hash[:status_message_hash][:mine?] = true if object.person.owner_id == uid
end
action_hash.to_json

View file

@ -22,7 +22,7 @@ class StatusMessage < Post
end
def latest_hash
{:mine? => self.person == User.owner, :text => message}
{ :text => message}
end
end

View file

@ -64,6 +64,7 @@
function processStatusMessage(className, html, messageHash){
processPost(className, html);
console.log(messageHash)
if(messageHash['mine?']){
updateMyLatestStatus(messageHash);
}

View file

@ -52,9 +52,9 @@
= link_to current_user.real_name, root_path
%span#latest_message
= my_latest_message
- unless @latest_status_message.nil?
%span{:style => "font-size: small", :id => 'latest_message_time'}
= " - #{how_long_ago @latest_status_message}"
%span{:style => "font-size: small", :id => 'latest_message_time'}
- unless @latest_status_message.nil?
= "- #{how_long_ago @latest_status_message}"
%ul.nav
%li= link_to "home", root_path

View file

@ -44,14 +44,8 @@
- flash.each do |name, msg|
= content_tag :div, msg, :id => "flash_#{name}"
- if User.owner
%div#huge_text
welcome back,
%span
= User.owner.real_name.downcase
= yield
-else
%div#huge_text
%span
you need to add a user first!
%div#huge_text
diaspora
= yield
= link_to "signup", "/signup"

View file

@ -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", "#"

View file

@ -12,17 +12,16 @@ Diaspora::Application.routes.draw do |map|
match "/images/files/*path" => "gridfs#serve"
match 'warzombie', :to => "dev_utilities#warzombie"
match 'zombiefriends', :to => "dev_utilities#zombiefriends"
match 'warzombie', :to => "dev_utilities#warzombie"
match 'zombiefriends', :to => "dev_utilities#zombiefriends"
match 'zombiefriendaccept', :to => "dev_utilities#zombiefriendaccept"
#routes for devise, not really sure you will need to mess with this in the future, lets put default,
#non mutable stuff in anohter file
devise_for :users, :path_names => {:sign_up => "signup", :sign_in => "login", :sign_out => "logout"}
match 'login', :to => 'devise/sessions#new', :as => "new_user_session"
match 'logout', :to => 'devise/sessions#destroy', :as => "destroy_user_session"
#match 'signup', :to => 'devise/registrations#new', :as => "new_user_registration"
resources :users
match 'login', :to => 'devise/sessions#new', :as => "new_user_session"
match 'logout', :to => 'devise/sessions#destroy', :as => "destroy_user_session"
match 'signup', :to => 'devise/registrations#new', :as => "new_user_registration"
#public routes
#
@ -32,5 +31,5 @@ Diaspora::Application.routes.draw do |map|
match '.well-known/host-meta',:to => 'publics#host_meta'
match 'receive/users/:id', :to => 'publics#receive'
#root
root :to => 'dashboards#index'
root :to => 'groups#index'
end

View file

@ -1,24 +1,20 @@
$(document).ready( function() {
$(document).ready( function() {
$("#publisher_content_pickers .status_message").click(selectPublisherTab);
$("#publisher_content_pickers .bookmark").click(selectPublisherTab);
$("#publisher_content_pickers .blog").click(selectPublisherTab);
$("#publisher_content_pickers .photo").click(selectPublisherTab);
$("#new_status_message").submit(function() {
});
$("#publisher_content_pickers .status_message").click(selectPublisherTab);
$("#publisher_content_pickers .bookmark").click(selectPublisherTab);
$("#publisher_content_pickers .blog").click(selectPublisherTab);
$("#publisher_content_pickers .photo").click(selectPublisherTab);
function selectPublisherTab(evt){
evt.preventDefault();
var form_id = "#new_" + this.className
if( $(form_id).css("display") == "none" ) {
$("#publisher_content_pickers").children("li").removeClass("selected");
$("#publisher_form form").fadeOut(50);
function selectPublisherTab(evt){
evt.preventDefault();
var form_id = "#new_" + this.className
if( $(form_id).css("display") == "none" ) {
$("#publisher_content_pickers").children("li").removeClass("selected");
$("#publisher_form form").fadeOut(50);
$(this).toggleClass("selected");
$(form_id).delay(50).fadeIn(200);
}
$(this).toggleClass("selected");
$(form_id).delay(50).fadeIn(200);
}
}
});
});

View file

@ -1,6 +1,6 @@
require File.dirname(__FILE__) + '/../spec_helper'
include ApplicationHelper
describe DashboardsController do
describe GroupsController do
render_views
before do
@user = Factory.create(:user)