DG MS; added homecontroller to take care of landing page and aspects index redirecting in regards to user's logged in state.
This commit is contained in:
parent
a7c1733093
commit
056dc7d3ba
7 changed files with 110 additions and 39 deletions
15
app/controllers/home_controller.rb
Normal file
15
app/controllers/home_controller.rb
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
class HomeController < ApplicationController
|
||||
|
||||
def show
|
||||
if current_user
|
||||
redirect_to aspects_path
|
||||
else
|
||||
render :show
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -1,26 +1,38 @@
|
|||
/%h1 This is a technology preview, do not provide any private information.
|
||||
/%h3 your account may be deleted until we move into a more stable development period.
|
||||
/%h3 USE AT YOUR OWN RISK!!
|
||||
-# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
.span-22.prepend-1.last
|
||||
.span-10.append-1.last
|
||||
.floating
|
||||
%h3
|
||||
= t('.login')
|
||||
= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f|
|
||||
#user
|
||||
%p.username
|
||||
= f.label :username , t('username')
|
||||
= f.text_field :username
|
||||
%p.user_network
|
||||
="@#{APP_CONFIG[:terse_pod_url]}"
|
||||
|
||||
#landing_content
|
||||
%p
|
||||
= f.label :password , t('password')
|
||||
= f.password_field :password
|
||||
/%p
|
||||
/- if devise_mapping.rememberable?
|
||||
/ = f.check_box :remember_me
|
||||
/ = f.label :remember_me , t('.remember_me')
|
||||
= f.submit t('.sign_in')
|
||||
|
||||
%p
|
||||
= render :partial => "devise/shared/links"
|
||||
%p
|
||||
= link_to t('.have_a_problem'), 'http://diaspora.shapado.com/'
|
||||
|
||||
.span-13.last
|
||||
%h1
|
||||
This is a technology preview, do not provide any private information.
|
||||
%h3
|
||||
your account may be deleted until we move into a more stable development period.
|
||||
%h3
|
||||
USE AT YOUR OWN RISK!!
|
||||
|
||||
#diaspora_description.section
|
||||
%p
|
||||
Share what you want, with who you want.
|
||||
|
||||
#signup_field.section
|
||||
= render 'shared/mail_signup_form'
|
||||
|
||||
#login_field.section
|
||||
already have an account?
|
||||
= link_to "log in here", "#"
|
||||
|
||||
.span-24.last{:style=>"text-align:center;"}
|
||||
%ul#press_logos
|
||||
%li= link_to image_tag("press_logos/nyt.png"), "http://www.nytimes.com/2010/05/12/nyregion/12about.html", :title => "The New York Times"
|
||||
%li= link_to image_tag("press_logos/nymag.gif"), "http://nymag.com/news/features/establishments/68512/", :title => "New York Magazine"
|
||||
%li= link_to image_tag("press_logos/mashable.jpeg"), "http://mashable.com/2010/08/26/facebook-alternative-diaspora-launches-september-15/", :title => "Mashable"
|
||||
%li= link_to image_tag("press_logos/techcrunch.gif"), "http://techcrunch.com/2010/09/15/diaspora-revealed/", :title => "TechCrunch"
|
||||
|
|
|
|||
25
app/views/home/show.html.haml
Normal file
25
app/views/home/show.html.haml
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
-# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
.span-22.prepend-1.last
|
||||
|
||||
#landing_content
|
||||
|
||||
#diaspora_description.section
|
||||
%p
|
||||
Share what you want, with who you want.
|
||||
|
||||
#signup_field.section
|
||||
= render 'shared/mail_signup_form'
|
||||
|
||||
#login_field.section
|
||||
already have an account?
|
||||
= link_to "log in here", "#"
|
||||
|
||||
.span-24.last{:style=>"text-align:center;"}
|
||||
%ul#press_logos
|
||||
%li= link_to image_tag("press_logos/nyt.png"), "http://www.nytimes.com/2010/05/12/nyregion/12about.html", :title => "The New York Times"
|
||||
%li= link_to image_tag("press_logos/nymag.gif"), "http://nymag.com/news/features/establishments/68512/", :title => "New York Magazine"
|
||||
%li= link_to image_tag("press_logos/mashable.jpeg"), "http://mashable.com/2010/08/26/facebook-alternative-diaspora-launches-september-15/", :title => "Mashable"
|
||||
%li= link_to image_tag("press_logos/techcrunch.gif"), "http://techcrunch.com/2010/09/15/diaspora-revealed/", :title => "TechCrunch"
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
- flash.each do |name, msg|
|
||||
= content_tag :div, msg, :id => "flash_#{name}"
|
||||
|
||||
%header.landing_page
|
||||
%header
|
||||
.container{:style => "position:relative;"}
|
||||
|
||||
#notification
|
||||
|
|
@ -64,11 +64,11 @@
|
|||
ALPHA
|
||||
|
||||
- unless current_user
|
||||
.right{:style => "top:70px;"}
|
||||
.right
|
||||
%ul#landing_nav
|
||||
%li= link_to "blog", "http://blog.joindiaspora.com"
|
||||
%li= link_to "developers", "https://github.com/diaspora/diaspora"
|
||||
%li= link_to "login", "#"
|
||||
%li= link_to "login", new_user_session_path
|
||||
- else
|
||||
#global_search
|
||||
= form_tag(people_path, :method => 'get') do
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ Diaspora::Application.routes.draw do
|
|||
resources :status_messages, :only => [:create, :destroy, :show]
|
||||
resources :comments, :except => [:index]
|
||||
resources :requests, :except => [:edit, :update]
|
||||
resources :photos, :except => [:index]
|
||||
resources :photos, :except => [:index]
|
||||
resources :services
|
||||
|
||||
resources :people
|
||||
|
|
@ -26,6 +26,7 @@ Diaspora::Application.routes.draw do
|
|||
match 'getting_started', :to => 'users#getting_started', :as => 'getting_started'
|
||||
match 'users/export', :to => 'users#export'
|
||||
match 'users/export_photos', :to => 'users#export_photos'
|
||||
match 'login', :to => 'users#sign_up'
|
||||
resources :users, :except => [:create, :new, :show]
|
||||
|
||||
match 'aspects/move_contact', :to => 'aspects#move_contact', :as => 'move_contact'
|
||||
|
|
@ -40,9 +41,6 @@ Diaspora::Application.routes.draw do
|
|||
match 'set_backer_number', :to => "dev_utilities#set_backer_number"
|
||||
match 'set_profile_photo', :to => "dev_utilities#set_profile_photo"
|
||||
|
||||
#signup
|
||||
match 'get_to_the_choppa', :to => redirect("/users/sign_up")
|
||||
|
||||
#public routes
|
||||
match 'webfinger', :to => 'publics#webfinger'
|
||||
match 'hcard/users/:id', :to => 'publics#hcard'
|
||||
|
|
@ -51,6 +49,7 @@ Diaspora::Application.routes.draw do
|
|||
match 'hub', :to => 'publics#hub'
|
||||
match 'log', :to => "dev_utilities#log"
|
||||
|
||||
|
||||
#root
|
||||
root :to => 'aspects#index'
|
||||
root :to => 'home#show'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -132,15 +132,6 @@ header
|
|||
:border none
|
||||
:color #fff
|
||||
|
||||
&.landing_page
|
||||
:height 100px
|
||||
#diaspora_text
|
||||
:font
|
||||
:size 40px
|
||||
:text-shadow 0 2px 3px #000
|
||||
:position absolute
|
||||
:top 40px
|
||||
|
||||
ul#user_menu
|
||||
:overflow hidden
|
||||
:white-space nowrap
|
||||
|
|
|
|||
29
spec/controllers/home_controller_spec.rb
Normal file
29
spec/controllers/home_controller_spec.rb
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe HomeController do
|
||||
render_views
|
||||
|
||||
before do
|
||||
@user = make_user
|
||||
sign_in @user
|
||||
sign_out @user
|
||||
end
|
||||
|
||||
describe '#show' do
|
||||
it 'should show a login link if no user is not logged in' do
|
||||
get :show
|
||||
response.body.should include("log in")
|
||||
end
|
||||
|
||||
it 'should redirect to aspects index if user is logged in' do
|
||||
sign_in @user
|
||||
get :show
|
||||
response.should redirect_to aspects_path
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
Loading…
Reference in a new issue