Skip to content
Extraits de code Groupes Projets
Valider a23df47d rédigé par Raphael's avatar Raphael
Parcourir les fichiers

Trying to merge in the pivots changes that we want in master

parent 0459631d
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Affichage de
avec 36 ajouts et 129 suppressions
class ApplicationController < ActionController::Base
protect_from_forgery :except => :receive
layout 'application'
before_filter :set_friends_and_status, :count_requests
......
......@@ -23,19 +23,5 @@ class UsersController < ApplicationController
end
end
def create
@user = User.instantiate(params[:user])
if @user.created_at && @user.person.created_at
flash[:notice] = "Successfully signed up."
redirect_to root_path
else
render :action => 'new'
end
end
def new
@user = User.new
end
end
......@@ -16,8 +16,7 @@ class User
many :groups, :class_name => 'Group'
before_validation_on_create :assign_key
before_validation :do_bad_things
after_validation_on_create :setup_person
######## Making things work ########
key :email, String
......@@ -297,12 +296,6 @@ class User
###Helpers############
def self.instantiate( opts = {} )
opts[:person][:email] = opts[:email]
opts[:person][:serialized_key] = generate_key
User.create( opts)
end
def terse_url
terse= self.url.gsub(/https?:\/\//, '')
terse.gsub!(/www\./, '')
......@@ -310,10 +303,6 @@ class User
terse
end
def do_bad_things
self.password_confirmation = self.password
end
def visible_person_by_id( id )
id = ensure_bson id
return self.person if id == self.person.id
......@@ -329,6 +318,13 @@ class User
id = ensure_bson person.id
groups.select {|group| group.person_ids.include? id}
end
def setup_person
self.person.serialized_key ||= generate_key.export
self.person.email = email
self.person.save!
end
protected
def assign_key
......
......@@ -5,5 +5,6 @@
= f.label :email
%br/
= f.text_field :email
%p= f.submit "Resend confirmation instructions"
%p
= f.submit "Resend confirmation instructions"
= render :partial => "devise/shared/links"
......@@ -10,5 +10,6 @@
= f.label :password_confirmation
%br/
= f.password_field :password_confirmation
%p= f.submit "Change my password"
%p
= f.submit "Change my password"
= render :partial => "devise/shared/links"
......@@ -5,5 +5,6 @@
= f.label :email
%br/
= f.text_field :email
%p= f.submit "Send me reset password instructions"
%p
= f.submit "Send me reset password instructions"
= render :partial => "devise/shared/links"
......@@ -20,7 +20,8 @@
%i (we need your current password to confirm your changes)
%br/
= f.password_field :current_password
%p= f.submit "Update"
%p
= f.submit "Update"
%h3 Cancel my account
%p
Unhappy? #{link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete}.
......
......@@ -14,7 +14,7 @@
= f.password_field :password_confirmation
= f.fields_for :person do |p|
= p.hidden_field :url, :value => request.path
= p.hidden_field :url, :value => request.host
= p.fields_for :profile do |pr|
%p
......
= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f|
%p
= f.label :email
= f.text_field :email
%br
%p
= f.label :password
= f.password_field :password
/%p
/- if devise_mapping.rememberable?
/ = f.check_box :remember_me
/ = f.label :remember_me
= f.submit "Sign in"
%p
= f.submit "Sign in"
= render :partial => "devise/shared/links"
......@@ -5,5 +5,6 @@
= f.label :email
%br/
= f.text_field :email
%p= f.submit "Resend unlock instructions"
%p
= f.submit "Resend unlock instructions"
= render :partial => "devise/shared/links"
%h1
welcome home,
welcome,
= current_user.profile.first_name
- @group.nil? ? group_id = nil : group_id = @group.id
......
......@@ -15,10 +15,10 @@ Diaspora::Application.routes.draw do |map|
#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 => "get_to_the_choppa", :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 'get_to_the_choppa', :to => 'devise/registrations#new', :as => "new_user_registration"
devise_for :users
match 'login', :to => 'devise/sessions#new', :as => "new_user_session"
match 'logout', :to => 'devise/sessions#destroy', :as => "destroy_user_session"
match 'get_to_the_choppa', :to => 'devise/registrations#new', :as => "new_user_registration"
#public routes
#
......
package :nginx do
package :nginx, :provides=> :webserver do
description 'Nginx HTTP server'
version '0.7.67'
source "http://nginx.org/download/nginx-#{version}.tar.gz"
requires :nginx_dependencies
end
package :nginx_conf, :provides=> :webserver do
package :nginx_conf do
description 'Nginx conf file'
transfer "#{File.dirname(__FILE__)}/../conf/nginx.conf", '/usr/local/conf/nginx.conf', :render => true do
pre :install, "mkdir -p /usr/local/sbin/conf/"
end
requires :nginx
end
package :nginx_dependencies do
......@@ -18,35 +17,3 @@ package :nginx_dependencies do
apt %w( libc6 libpcre3 libpcre3-dev libssl0.9.8)
source "http://zlib.net/zlib-1.2.5.tar.gz"
end
=begin
package :mongrel do
description 'Mongrel Application Server'
gem 'mongrel'
version '1.1.5'
end
package :mongrel_cluster, :provides => :appserver do
description 'Cluster Management for Mongrel'
gem 'mongrel_cluster'
version '1.0.5'
requires :mongrel
end
package :apache, :provides => :webserver do
description 'Apache 2 HTTP Server'
version '2.2.15'
source "http://download.nextag.com/apache/httpd/httpd-#{version}.tar.bz2" do
enable %w( mods-shared=all proxy proxy-balancer proxy-http rewrite cache headers ssl deflate so )
prefix "/opt/local/apache2-#{version}"
post :install, 'install -m 755 support/apachectl /etc/init.d/apache2', 'update-rc.d -f apache2 defaults'
end
requires :apache_dependencies
end
package :apache_dependencies do
description 'Apache 2 HTTP Server Build Dependencies'
apt %w( openssl libtool mawk zlib1g-dev libssl-dev )
end
=end
#!/usr/bin/env sprinkle -s
# Annotated Example Sprinkle Rails deployment script
#
# This is an example Sprinkle script configured to install Rails from gems, Apache, Ruby,
# Sphinx and Git from source, and mysql and Git dependencies from apt on an Ubuntu system.
#
# Installation is configured to run via capistrano (and an accompanying deploy.rb recipe script).
# Source based packages are downloaded and built into /usr/local on the remote system.
#
# A sprinkle script is separated into 3 different sections. Packages, policies and deployment:
# Packages (separate files for brevity)
#
# Defines the world of packages as we know it. Each package has a name and
# set of metadata including its installer type (eg. apt, source, gem, etc). Packages can have
# relationships to each other via dependencies.
require "#{File.dirname(__FILE__)}/packages/essential"
require "#{File.dirname(__FILE__)}/packages/database"
require "#{File.dirname(__FILE__)}/packages/server"
require "#{File.dirname(__FILE__)}/packages/scm"
require "#{File.dirname(__FILE__)}/packages/ruby"
#require "#{File.dirname(__FILE__)}/packages/unfortunately_essential"
# Policies
#
# Names a group of packages (optionally with versions) that apply to a particular set of roles:
#
# Associates the rails policy to the application servers. Contains rails, and surrounding
# packages. Note, appserver, database, webserver and search are all virtual packages defined above.
# If there's only one implementation of a virtual package, it's selected automatically, otherwise
# the user is requested to select which one to use.
policy :diaspora, :roles => [:tom, :backer] do
policy :diaspora, :roles => [:tom,:backer] do
# requires :clean_dreamhost
requires :tools
requires :rubygems
......@@ -43,16 +17,9 @@ policy :diaspora, :roles => [:tom, :backer] do
requires :webserver
requires :scm
requires :vim
requires :nginx_conf
end
# Deployment
#
# Defines script wide settings such as a delivery mechanism for executing commands on the target
# system (eg. capistrano), and installer defaults (eg. build locations, etc):
#
# Configures spinkle to use capistrano for delivery of commands to the remote machines (via
# the named 'deploy' recipe). Also configures 'source' installer defaults to put package gear
# in /usr/local
deployment do
......@@ -73,5 +40,3 @@ deployment do
end
end
# End of script, given the above information, Spinkle will apply the defined policy on all roles using the
# deployment settings specified.
......@@ -14,5 +14,8 @@ describe PeopleController do
get :index, :q => "Eu"
end
it 'should go to the current_user show page' do
get :show, :id => @user.person.id
end
end
......@@ -6,20 +6,6 @@ describe User do
@group = @user.group(:name => 'heroes')
end
it 'should instantiate with a person and be valid' do
user = User.instantiate(:email => "bob@bob.com",
:password => "password",
:password_confirmation => "password",
:person =>
{:profile => {
:first_name => "bob",
:last_name => "grimm"}})
user.save.should be true
user.person.should_not be nil
user.person.profile.should_not be nil
end
describe 'profiles' do
it 'should be able to update their profile and send it to their friends' do
Factory.create(:person)
......@@ -32,6 +18,4 @@ describe User do
@user.profile.image_url.should == "http://clown.com"
end
end
end
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter