From cd726c0ba72dff29811126a3a3e2fc884e45b476 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Wed, 27 Oct 2010 12:21:25 -0700 Subject: [PATCH] users#getting_started route -> getting_started. getting_started is now a mini-template referring to partials in users/getting_started/ --- app/controllers/people_controller.rb | 2 +- app/controllers/users_controller.rb | 20 +++-- app/views/users/getting_started.html.haml | 28 +++++++ app/views/users/getting_started/1.html.haml | 75 ------------------- app/views/users/getting_started/2.html.haml | 71 ------------------ app/views/users/getting_started/3.html.haml | 44 ----------- app/views/users/getting_started/4.html.haml | 63 ---------------- .../users/getting_started/_step_1.html.haml | 56 ++++++++++++++ .../users/getting_started/_step_2.html.haml | 38 ++++++++++ .../users/getting_started/_step_3.html.haml | 23 ++++++ .../users/getting_started/_step_4.html.haml | 44 +++++++++++ config/locales/diaspora/en.yml | 2 +- config/routes.rb | 2 +- public/stylesheets/sass/application.sass | 8 ++ 14 files changed, 209 insertions(+), 267 deletions(-) create mode 100644 app/views/users/getting_started.html.haml delete mode 100644 app/views/users/getting_started/1.html.haml delete mode 100644 app/views/users/getting_started/2.html.haml delete mode 100644 app/views/users/getting_started/3.html.haml delete mode 100644 app/views/users/getting_started/4.html.haml create mode 100644 app/views/users/getting_started/_step_1.html.haml create mode 100644 app/views/users/getting_started/_step_2.html.haml create mode 100644 app/views/users/getting_started/_step_3.html.haml create mode 100644 app/views/users/getting_started/_step_4.html.haml diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index cb3d974a2..5a7737bac 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -49,7 +49,7 @@ class PeopleController < ApplicationController end if params[:getting_started] - redirect_to getting_started_path(params[:getting_started].to_i+1) + redirect_to getting_started_path(:step => params[:getting_started].to_i+1) else redirect_to edit_person_path end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index faa40e425..3ecf933b1 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -65,18 +65,16 @@ class UsersController < ApplicationController end def getting_started - @aspect = :getting_started - @user = current_user - @person = @user.person - @profile = current_user.profile - @photos = current_user.visible_posts(:person_id => current_user.person.id, :_type => 'Photo').paginate :page => params[:page], :order => 'created_at DESC' - @services = current_user.services + @aspect = :getting_started + @user = current_user + @person = @user.person + @profile = @user.profile + @photos = @user.visible_posts(:person_id => current_user.person.id, :_type => 'Photo').paginate :page => params[:page], :order => 'created_at DESC' + @services = @user.services - if params[:id].to_i < 5 - render "users/getting_started/#{params[:id]}" - else - render "users/getting_started/1" - end + @step = ((params[:step].to_i>0)&&(params[:step].to_i<5)) ? params[:step].to_i : 1 + @step ||= 1 + render "users/getting_started" end def export diff --git a/app/views/users/getting_started.html.haml b/app/views/users/getting_started.html.haml new file mode 100644 index 000000000..6f69c8de2 --- /dev/null +++ b/app/views/users/getting_started.html.haml @@ -0,0 +1,28 @@ +-# Copyright (c) 2010, Diaspora Inc. This file is +-# licensed under the Affero General Public License version 3 or later. See +-# the COPYRIGHT file. + + +.span-8.append-1.last + %h1{:style => "text-align:right;"} + = "Welcome to Diaspora!" + .description + Do the stuff below to further complete some things. + + %h3{:style => "text-align:right;"} + = link_to "Edit your profile", getting_started_path(:step => 1) + %br + = link_to "Define your aspects", getting_started_path(:step => 2) + %br + = link_to "Connect your services", getting_started_path(:step => 3) + %br + +.span-15.last + .floating + = render "users/getting_started/step_#{@step}", :current_user => current_user + + - if @step > 1 + = link_to "Back", getting_started_path(:step => @step-1), :class => "button", :id => "previous_step" + +.bottom_notification + = link_to "skip getting started →", '#', :id => "getting_started_skip" diff --git a/app/views/users/getting_started/1.html.haml b/app/views/users/getting_started/1.html.haml deleted file mode 100644 index 8cfb0e747..000000000 --- a/app/views/users/getting_started/1.html.haml +++ /dev/null @@ -1,75 +0,0 @@ --# Copyright (c) 2010, Diaspora Inc. This file is --# licensed under the Affero General Public License version 3 or later. See --# the COPYRIGHT file. - - -.span-8.append-1.last{:style => "text-align:right;"} - %h1 - = "Welcome to Diaspora!" - .description - Do the stuff below to further complete some things. - - %h3 - = link_to "Edit your profile", getting_started_path(1), :class => 'selected' - %br - = link_to "Define your aspects", getting_started_path(2) - %br - = link_to "Connect your services", getting_started_path(3) - %br - -.span-15.last - .floating - = form_for @person do |person| - %h3 - Your Profile - .description - This info will be available to whomever you connect with on Diaspora. - - = person.error_messages - - = person.fields_for :profile do |profile| - %h4 - Your name - = profile.text_field :first_name, :value => @profile.first_name, :placeholder => "First name" - = profile.text_field :last_name, :value => @profile.last_name, :placeholder => "Last name" - - %h4 - Your birthday - %br - = date_select person, :birthday, :order => [:month, :day, :year], :start_year => 1930, :end_year => Time.now.year - - %h4 - Your bio - = profile.text_area :bio, :value => @profile.bio, :rows => 5, :placeholder => "Fill me out" - - %h4 - Your photo - %div#image_picker - = profile.hidden_field :image_url, :value => (@profile.image_url if @profile.image_url), :id => 'image_url_field' - - - unless @photos.nil? || @photos.empty? - - for photo in @photos - - if @profile.image_url && @profile.image_url.include?(photo.url(:thumb_medium)) - %div.small_photo{:id => photo.url(:thumb_medium), :class=>'selected'} - = check_box_tag 'checked_photo', true, true - = link_to image_tag(photo.url(:thumb_medium)), "#" - - else - %div.small_photo{:id => photo.url(:thumb_medium)} - = check_box_tag 'checked_photo' - = link_to image_tag(photo.url(:thumb_medium)), "#" - - - else - =t('.you_dont_have_any_photos') - = link_to t('.albums'), albums_path(:aspect => 'all') - =t('.page_to_upload_some') - - =will_paginate @photos - - = hidden_field_tag :getting_started, 1 - - - .submit_block - = person.submit "Save and continue →" - -.bottom_notification - = link_to "skip getting started →", '#', :id => "getting_started_skip" diff --git a/app/views/users/getting_started/2.html.haml b/app/views/users/getting_started/2.html.haml deleted file mode 100644 index 479523d3d..000000000 --- a/app/views/users/getting_started/2.html.haml +++ /dev/null @@ -1,71 +0,0 @@ --# Copyright (c) 2010, Diaspora Inc. This file is --# licensed under the Affero General Public License version 3 or later. See --# the COPYRIGHT file. - - -- content_for :head do - :javascript - $("#new_aspect").live("submit", function(){ - var newAspectName = $(this).children("#aspect_name").val(); - $("ul.aspects").prepend($("
  • " + newAspectName + "
  • ").fadeIn(200)); - $("#aspect_nav").find("ul").first().find("li:last").before($("
  • " + newAspectName + "
  • ").fadeIn(200)); - }); - - $(".aspects li").find(".delete").live("click", function(){ - var aspectElement = $(this).parent("li"); - aspectElement.fadeOut(300, function(){aspectElement.remove();}); - }); - -.span-8.append-1.last{:style => "text-align:right;"} - %h1 - = "Welcome to Diaspora!" - .description - Do the stuff below to further complete some things. - - %h3.nav - = link_to "Edit your profile", getting_started_path(1) - %br - = link_to "Define your aspects", getting_started_path(2) - %br - = link_to "Connect your services", getting_started_path(3) - %br - -.span-15.last - .floating - %h3 - Your aspects - .description - Diaspora aspects are mappings of your real-life aspects. You can manage these later by clicking the manage tab on the top right. Your aspects are unique to you, and not visible by others. - - %h4 - Aspect name - - form_for Aspect.new, :remote => true do |aspect| - = aspect.text_field :name, :style => "display:inline;" - = aspect.submit "Add" - - %ul.aspects - - for aspect in @aspects - %li{:style=>"position:relative;"} - = aspect - .friend_pictures.horizontal - - for friend in aspect.people - = person_image_link(friend) - - = link_to (image_tag('add_friend_button.png', :title => "add to #{aspect}")), "#add_request_pane", :class => 'add_request_button' - - .fancybox_content - #add_request_pane - = render "requests/new_request", :aspect => aspect, :getting_started => 2 - - = link_to "x", aspect_path(aspect), :confirm => "are you sure?", :method => :delete, :remote => true, :class => "delete right" - - %br - %br - - .submit_block - = link_to "Back", getting_started_path(1), :class => "button" - = link_to "Save and continue →", getting_started_path(3), :class => "button" - - -.bottom_notification - = link_to "skip getting started →", '#' diff --git a/app/views/users/getting_started/3.html.haml b/app/views/users/getting_started/3.html.haml deleted file mode 100644 index 0ce946d7f..000000000 --- a/app/views/users/getting_started/3.html.haml +++ /dev/null @@ -1,44 +0,0 @@ --# Copyright (c) 2010, Diaspora Inc. This file is --# licensed under the Affero General Public License version 3 or later. See --# the COPYRIGHT file. - - - -.span-8.append-1.last - %h1{:style => "text-align:right;"} - = "Welcome to Diaspora!" - .description - Do the stuff below to further complete some things. - - %h3{:style => "text-align:right;"} - = link_to "Edit your profile", getting_started_path(1) - %br - = link_to "Define your aspects", getting_started_path(2) - %br - = link_to "Connect your services", getting_started_path(3) - %br - -.span-15.last - .floating - %h3 - Your services - .description - Connect your existing social networks to your Diaspora account. You will be able to post publically through your Everyone tab when you select "public." - %ul#stream - - for service in @services - %h3 - %b= service.provider - logged in as - %b - = service.nickname - = link_to "disconnect", service, :confirm => "disconnect #{service.provider}?", :method => :delete - - %h4= link_to "Connect to twitter", "/auth/twitter" if SERVICES['twitter']['consumer_key']!= "" - %h4= link_to "Connect to facebook", "/auth/facebook" if SERVICES['facebook']['app_id'] !="" - - .submit_block - = link_to "Back", getting_started_path(2), :class => "button" - = link_to "Save and continue →", getting_started_path(4), :class => "button" - -.bottom_notification - = link_to "skip getting started →", '#' diff --git a/app/views/users/getting_started/4.html.haml b/app/views/users/getting_started/4.html.haml deleted file mode 100644 index d635bf9c2..000000000 --- a/app/views/users/getting_started/4.html.haml +++ /dev/null @@ -1,63 +0,0 @@ --# Copyright (c) 2010, Diaspora Inc. This file is --# licensed under the Affero General Public License version 3 or later. See --# the COPYRIGHT file. - - -- content_for :head do - - if current_user.getting_started == true - :javascript - $.ajax({ - type: "PUT", - url: "/users/#{current_user.id}", - data: {"user":{"getting_started":'false'}} - }) - -.span-8.append-1.last - %h1{:style => "text-align:right;"} - = "Welcome to Diaspora!" - .description - Do the stuff below to further complete some things. - - %h3{:style => "text-align:right;"} - = link_to "Edit your profile", getting_started_path(1) - %br - = link_to "Define your aspects", getting_started_path(2) - %br - = link_to "Connect your services", getting_started_path(3) - %br - -.span-15.last - .floating - %h1 - = "You're all set up, #{current_user.person.profile.first_name}!" - .description - You're now ready to start sharing with - %ul.inline_aspect_listing - - for aspect in @aspects - %li= aspect - - %br - %br - - %h3 - = link_to "Continue on to your everyone page, an overview of all of your aspects.", root_path - - %br - %br - %br - - %p - You can change your profile any time by clicking - %b edit profile - in your user menu (top right). - %p - You can connect/disconnect your services any time by clicking - %b edit account - in your user menu (top right). - %p - You can manage your aspects any time by clicking the - %b manage - tab. Your contacts can also be added while on a particular aspect page, as well. - - .submit_block - = link_to "Back", getting_started_path(3), :class => "button" diff --git a/app/views/users/getting_started/_step_1.html.haml b/app/views/users/getting_started/_step_1.html.haml new file mode 100644 index 000000000..d57d0b119 --- /dev/null +++ b/app/views/users/getting_started/_step_1.html.haml @@ -0,0 +1,56 @@ +-# Copyright (c) 2010, Diaspora Inc. This file is +-# licensed under the Affero General Public License version 3 or later. See +-# the COPYRIGHT file. + + += form_for @person do |person| + %h3 + Your Profile + .description + This info will be available to whomever you connect with on Diaspora. + + = person.error_messages + + = person.fields_for :profile do |profile| + %h4 + Your name + = profile.text_field :first_name, :value => @profile.first_name, :placeholder => "First name" + = profile.text_field :last_name, :value => @profile.last_name, :placeholder => "Last name" + + %h4 + Your birthday + %br + = date_select person, :birthday, :order => [:month, :day, :year], :start_year => 1930, :end_year => Time.now.year + + %h4 + Your bio + = profile.text_area :bio, :value => @profile.bio, :rows => 5, :placeholder => "Fill me out" + + %h4 + Your photo + %div#image_picker + = profile.hidden_field :image_url, :value => (@profile.image_url if @profile.image_url), :id => 'image_url_field' + + - unless @photos.nil? || @photos.empty? + - for photo in @photos + - if @profile.image_url && @profile.image_url.include?(photo.url(:thumb_medium)) + %div.small_photo{:id => photo.url(:thumb_medium), :class=>'selected'} + = check_box_tag 'checked_photo', true, true + = link_to image_tag(photo.url(:thumb_medium)), "#" + - else + %div.small_photo{:id => photo.url(:thumb_medium)} + = check_box_tag 'checked_photo' + = link_to image_tag(photo.url(:thumb_medium)), "#" + + - else + =t('.you_dont_have_any_photos') + = link_to t('.albums'), albums_path(:aspect => 'all') + =t('.page_to_upload_some') + + =will_paginate @photos + + = hidden_field_tag :getting_started, @step + + .submit_block + = person.submit "Save and continue →" + diff --git a/app/views/users/getting_started/_step_2.html.haml b/app/views/users/getting_started/_step_2.html.haml new file mode 100644 index 000000000..503ab8f5f --- /dev/null +++ b/app/views/users/getting_started/_step_2.html.haml @@ -0,0 +1,38 @@ +-# Copyright (c) 2010, Diaspora Inc. This file is +-# licensed under the Affero General Public License version 3 or later. See +-# the COPYRIGHT file. + + +%h3 + Your aspects + .description + Diaspora aspects are mappings of your real-life aspects. You can manage these later by clicking the manage tab on the top right. Your aspects are unique to you, and not visible by others. + +%h4 + Aspect name + - form_for Aspect.new, :remote => true do |aspect| + = aspect.text_field :name, :style => "display:inline;" + = aspect.submit "Add" + +%ul.aspects + - for aspect in @aspects + %li{:style=>"position:relative;"} + = aspect + .friend_pictures.horizontal + - for friend in aspect.people + = person_image_link(friend) + + = link_to (image_tag('add_friend_button.png', :title => "add to #{aspect}")), "#add_request_pane", :class => 'add_request_button' + + .fancybox_content + #add_request_pane + = render "requests/new_request", :aspect => aspect, :getting_started => 2 + + = link_to "x", aspect_path(aspect), :confirm => "are you sure?", :method => :delete, :remote => true, :class => "delete right" + +%br +%br + +.submit_block + = link_to "Save and continue →", getting_started_path(:step => 3), :class => "button" + diff --git a/app/views/users/getting_started/_step_3.html.haml b/app/views/users/getting_started/_step_3.html.haml new file mode 100644 index 000000000..18789da19 --- /dev/null +++ b/app/views/users/getting_started/_step_3.html.haml @@ -0,0 +1,23 @@ +-# Copyright (c) 2010, Diaspora Inc. This file is +-# licensed under the Affero General Public License version 3 or later. See +-# the COPYRIGHT file. + + +%h3 + Your services + .description + Connect your existing social networks to your Diaspora account. You will be able to post publically through your Everyone tab when you select "public." +%ul#stream + - for service in @services + %h3 + %b= service.provider + logged in as + %b= service.nickname + = link_to "disconnect", service, :confirm => "disconnect #{service.provider}?", :method => :delete + +%h4= link_to "Connect to twitter", "/auth/twitter" if SERVICES['twitter']['consumer_key']!= "" +%h4= link_to "Connect to facebook", "/auth/facebook" if SERVICES['facebook']['app_id'] !="" + +.submit_block + = link_to "Save and continue →", getting_started_path(:step => 4), :class => "button" + diff --git a/app/views/users/getting_started/_step_4.html.haml b/app/views/users/getting_started/_step_4.html.haml new file mode 100644 index 000000000..b5ca7b274 --- /dev/null +++ b/app/views/users/getting_started/_step_4.html.haml @@ -0,0 +1,44 @@ +-# Copyright (c) 2010, Diaspora Inc. This file is +-# licensed under the Affero General Public License version 3 or later. See +-# the COPYRIGHT file. + + +- if current_user.getting_started == true + :javascript + $.ajax({ + type: "PUT", + url: "/users/#{current_user.id}", + data: {"user":{"getting_started":'false'}} + }) + +%h1 + = "You're all set up, #{current_user.person.profile.first_name}!" + .description + You're now ready to start sharing with + %ul.inline_aspect_listing + - for aspect in @aspects + %li= aspect + +%br +%br + +%h3 + = link_to "Continue on to your everyone page, an overview of all of your aspects.", root_path + +%br +%br +%br + +%p + You can change your profile any time by clicking + %b edit profile + in your user menu (top right). +%p + You can connect/disconnect your services any time by clicking + %b edit account + in your user menu (top right). +%p + You can manage your aspects any time by clicking the + %b manage + tab. Your contacts can also be added while on a particular aspect page, as well. + diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 0165b8262..9695c0237 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -118,7 +118,7 @@ en: editing_profile: "Editing profile" destroy: "Account successfully closed." getting_started: - '1': + 'step_1': albums: "Albums" you_dont_have_any_photos: "You don't have any photos! Go to the" page_to_upload_some: "page to upload some." diff --git a/config/routes.rb b/config/routes.rb index 39b3f76ec..c72ed855f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -18,7 +18,7 @@ Diaspora::Application.routes.draw do :invitations => "invitations"} # added public route to user match 'public/:username', :to => 'users#public' - match 'users/getting_started/:id', :to => 'users#getting_started', :as => 'getting_started' + match 'getting_started', :to => 'users#getting_started', :as => 'getting_started' match 'users/export', :to => 'users#export' match 'users/import', :to => 'users#import' match 'users/export_photos', :to => 'users#export_photos' diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 14829f35c..315b8a41f 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -1300,6 +1300,9 @@ ul.aspects :bottom 13px :right 12px + form + :display relative + .bottom_notification :position fixed :bottom 0 @@ -1348,3 +1351,8 @@ ul.aspects :content "and " &:after :content "." + +#previous_step + :position absolute + :left 12px + :bottom 12px