From 278a74f1f92f83b02bcc89bdd3cbf98472a5c8e9 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Fri, 15 Oct 2010 11:07:11 -0700 Subject: [PATCH 01/26] draft --- app/controllers/users_controller.rb | 4 + app/views/users/getting_started.html.haml | 93 +++++++++++++++++++++++ config/routes.rb | 1 + public/stylesheets/sass/application.sass | 15 ++++ 4 files changed, 113 insertions(+) create mode 100644 app/views/users/getting_started.html.haml diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 9c1bb3e9c..630335d86 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -65,6 +65,10 @@ class UsersController < ApplicationController end end + def getting_started + render 'users/getting_started' + end + def export exporter = Diaspora::Exporter.new(Diaspora::Exporters::XML) send_data exporter.execute(current_user), :filename => "#{current_user.username}_diaspora_data.xml", :type => :xml diff --git a/app/views/users/getting_started.html.haml b/app/views/users/getting_started.html.haml new file mode 100644 index 000000000..405c62dbc --- /dev/null +++ b/app/views/users/getting_started.html.haml @@ -0,0 +1,93 @@ +-# Copyright (c) 2010, Diaspora Inc. This file is +-# licensed under the Affero General Public License version 3 or later. See +-# the COPYRIGHT file. + + + +%h1 + = "Welcome, #{current_user.real_name}!" + + .description + Do the stuff below to further complete some things. + +%h2 + %u + Edit your profile + ➔ + Define your aspects ➔ + Find your friends + + +%h3 + Your Profile + .description + This info will be available to whomever you connect with on Diaspora. + +%h4 + Your name + = text_field_tag :first_name, nil, :placeholder => "First name" + = text_field_tag :last_name, nil, :placeholder => "Last name" + +%h4 + Your birthday + %br + = select_date + +%h4 + Your bio + = text_area_tag :bio, nil, :placeholder => "Fill me out" + +%h4 + Your photo + %br + = file_field_tag :photo + + +%br +%br +%br +%h2 + Edit your profile ➔ + %u + Define your aspects + ➔ + Find your friends + +%h3 + Your aspects + .description + These will be blah blah blah blah and some stuff. + +%h4 + Aspect name + = text_field_tag :aspect_name, nil, :placeholder => "New aspect" + +%br +%br +%br +%h2 + Edit your profile ➔ + Define your aspects ➔ + %u + Find your friends + + +%h3 + Your friends + .description + Find your friends on Diaspora, Facebook, or send them an invite via email. + +.span-5 + %h4 + On Diaspora + = text_field_tag :diaspora_handle, nil, :placeholder => "Diaspora handle" + +.span-5 + %h4 + On Facebook + = text_field_tag :facebook_handle, nil, :placeholder => "Name" + +.span-5 + %h4 + Invite + = text_field_tag :email, nil, :placeholder => "Email" diff --git a/config/routes.rb b/config/routes.rb index b9b05ca65..b1d68fff7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -18,6 +18,7 @@ Diaspora::Application.routes.draw do :invitations => "invitations"} # added public route to user match 'public/:username', :to => 'users#public' + match 'users/getting_started', :to => 'users#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 c4da5d4fc..88999049a 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -1136,6 +1136,21 @@ ul#settings_nav :size 80px :display inline-block +h1,h2,h3 + .description + :font + :size 70% + :weight 100 + :color #ccc + :margin + :top 5px + +h2,h3 + .description + :font + :size 80% + :weight 200 + input[type="search"] :-webkit-appearance textfield From 31713d9597fb7a00393323676ac87385d7f454d0 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Fri, 15 Oct 2010 13:20:02 -0700 Subject: [PATCH 02/26] html5 placeholder text --- app/views/users/getting_started.html.haml | 2 +- public/stylesheets/sass/application.sass | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/views/users/getting_started.html.haml b/app/views/users/getting_started.html.haml index 405c62dbc..530c4038e 100644 --- a/app/views/users/getting_started.html.haml +++ b/app/views/users/getting_started.html.haml @@ -90,4 +90,4 @@ .span-5 %h4 Invite - = text_field_tag :email, nil, :placeholder => "Email" + = text_field_tag :email, nil, :placeholder => "Email", :type => "email" diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 88999049a..07b5c78a9 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -596,9 +596,7 @@ li.message .from .right :color #ccc -input[type='text'], -input[type='password'], -input[type="search"], +input:not([type='submit']), textarea :font :family 'Arial', 'Helvetica', sans-serif From b52afdd93cfb58e1a57ae6252c0285353d9e856c Mon Sep 17 00:00:00 2001 From: danielvincent Date: Fri, 15 Oct 2010 15:04:59 -0700 Subject: [PATCH 03/26] changed account and profile partials to better reflect styling changes --- app/views/users/_account.haml | 49 ++++++++------- app/views/users/_profile.haml | 80 ++++++++++++------------ public/stylesheets/sass/application.sass | 14 ++--- 3 files changed, 69 insertions(+), 74 deletions(-) diff --git a/app/views/users/_account.haml b/app/views/users/_account.haml index e76ae6cc6..2e3391f2c 100644 --- a/app/views/users/_account.haml +++ b/app/views/users/_account.haml @@ -3,39 +3,40 @@ -# the COPYRIGHT file. -%h2 Account +%h3 + Your Account + .description + Connect Diaspora to publish to other applications, export your data, or close your account. -= link_to "invite friends", new_user_invitation_path(current_user) += form_for @user do |user| + %h4 + Change Password + = user.error_messages -%br -%br -%br - -%h3 Change Password -= form_for @user do |f| - = f.error_messages - - %p - = f.label :password, "New Password" - = f.password_field :password - %p - = f.label :password_confirmation - = f.password_field :password_confirmation + = user.password_field :password, :placeholder => "New password" + = user.password_field :password_confirmation, :placeholder => "Password confirmation" .submit_block = link_to "Cancel", edit_user_path(current_user) or - = f.submit 'Change password' + = user.submit 'Change password' -%h3 Export Data -= link_to "download my xml", users_export_path, :class => "button" -= link_to "download my photos", users_export_photos_path, :class => "button" +%h4 + Export Data + %br + %br + = link_to "Download my account", users_export_path, :class => "button" + = link_to "Download my photos", users_export_photos_path, :class => "button" %br %br %br -%h3 Close Account -= link_to "Close Account", current_user, - :confirm => "Are you sure?", :method => :delete, - :class => "button" +%h4 + Close Account + .description + Closing your account will delete all of your posts, friends, and settings. You will be removed from this server. + %br + = link_to "Close Account", current_user, + :confirm => "Are you sure?", :method => :delete, + :class => "button" diff --git a/app/views/users/_profile.haml b/app/views/users/_profile.haml index cbb2b6d6a..f57c775cb 100644 --- a/app/views/users/_profile.haml +++ b/app/views/users/_profile.haml @@ -3,56 +3,56 @@ -# the COPYRIGHT file. -%h2 Profile -= form_for @user do |f| - = f.error_messages += form_for @user do |user| + %h3 + Your Profile + .description + This info will be available to whomever you connect with on Diaspora. - = f.fields_for :profile do |p| + = user.error_messages - %h3="#{t('.picture')}" - %div#image_picker - = p.hidden_field :image_url, :value => (@profile.image_url if @profile.image_url), :id => 'image_url_field' + = user.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" - - 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)), "#" + %h4 + Your birthday + %br + = select_date - - else - =t('.you_dont_have_any_photos') - = link_to t('.albums'), albums_path(:aspect => 'all') - =t('.page_to_upload_some') + %h4 + Your bio + = text_area_tag :bio, nil, :placeholder => "Fill me out" - =will_paginate @photos + %h4 + Your photo + %div#image_picker + = profile.hidden_field :image_url, :value => (@profile.image_url if @profile.image_url), :id => 'image_url_field' - %br + - 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 - %h3="#{t('.info')}" - %p - %b - ="#{t('.diaspora_username')}:" - = @user.diaspora_handle - %p - = p.label :first_name - = p.text_field :first_name, :value => @profile.first_name - %p - = p.label :last_name - = p.text_field :last_name, :value => @profile.last_name .submit_block = link_to t('.cancel'), edit_user_path(current_user) = t('.or') - = f.submit t('.update_profile') - -#content_bottom - .back - = link_to "⇧ #{t('.home')}", root_path - + = user.submit t('.update_profile') diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 07b5c78a9..1414e73ec 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -393,10 +393,6 @@ li.message form :position relative - :font - :size 120% - :margin 1em - :left 0em #user_name :margin @@ -615,8 +611,6 @@ textarea .submit_block :text :align right - :font - :size 12px form p :position relative @@ -694,6 +688,8 @@ label :display inline #image_picker + :margin + :top 5px .small_photo :height 100px :position relative @@ -1134,16 +1130,14 @@ ul#settings_nav :size 80px :display inline-block -h1,h2,h3 +h1,h2,h3,h4 .description :font :size 70% :weight 100 :color #ccc - :margin - :top 5px -h2,h3 +h2,h3,h4 .description :font :size 80% From f23d19923061d23a1cf7ca75de67f3441c6da4dc Mon Sep 17 00:00:00 2001 From: danielvincent Date: Fri, 15 Oct 2010 16:40:16 -0700 Subject: [PATCH 04/26] added slider to getting started flow --- app/views/layouts/application.html.haml | 1 + app/views/users/getting_started.html.haml | 132 ++++++------- public/javascripts/easySlider1.7.js | 226 ++++++++++++++++++++++ public/javascripts/view.js | 10 + public/stylesheets/sass/application.sass | 9 + 5 files changed, 312 insertions(+), 66 deletions(-) create mode 100644 public/javascripts/easySlider1.7.js diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 0e21eb7de..22a5a4f8a 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -30,6 +30,7 @@ = javascript_include_tag 'fileuploader' = javascript_include_tag 'view', 'image_picker', 'stream' + = javascript_include_tag 'easySlider1.7' = render 'js/websocket_js' diff --git a/app/views/users/getting_started.html.haml b/app/views/users/getting_started.html.haml index 530c4038e..b0ea13a36 100644 --- a/app/views/users/getting_started.html.haml +++ b/app/views/users/getting_started.html.haml @@ -10,84 +10,84 @@ .description Do the stuff below to further complete some things. -%h2 - %u - Edit your profile - ➔ - Define your aspects ➔ - Find your friends +#slider + %ul + %li + %h2 + %u + Edit your profile + ➔ + Define your aspects ➔ + Find your friends -%h3 - Your Profile - .description - This info will be available to whomever you connect with on Diaspora. + %h3 + Your Profile + .description + This info will be available to whomever you connect with on Diaspora. -%h4 - Your name - = text_field_tag :first_name, nil, :placeholder => "First name" - = text_field_tag :last_name, nil, :placeholder => "Last name" + %h4 + Your name + = text_field_tag :first_name, nil, :placeholder => "First name" + = text_field_tag :last_name, nil, :placeholder => "Last name" -%h4 - Your birthday - %br - = select_date + %h4 + Your birthday + %br + = select_date -%h4 - Your bio - = text_area_tag :bio, nil, :placeholder => "Fill me out" + %h4 + Your bio + = text_area_tag :bio, nil, :placeholder => "Fill me out" -%h4 - Your photo - %br - = file_field_tag :photo + %h4 + Your photo + %br + = file_field_tag :photo -%br -%br -%br -%h2 - Edit your profile ➔ - %u - Define your aspects - ➔ - Find your friends + %li + %h2 + Edit your profile ➔ + %u + Define your aspects + ➔ + Find your friends -%h3 - Your aspects - .description - These will be blah blah blah blah and some stuff. + %h3 + Your aspects + .description + These will be blah blah blah blah and some stuff. -%h4 - Aspect name - = text_field_tag :aspect_name, nil, :placeholder => "New aspect" - -%br -%br -%br -%h2 - Edit your profile ➔ - Define your aspects ➔ - %u - Find your friends + %h4 + Aspect name + = text_field_tag :aspect_name, nil, :placeholder => "New aspect" -%h3 - Your friends - .description - Find your friends on Diaspora, Facebook, or send them an invite via email. + %li + %h2 + Edit your profile ➔ + Define your aspects ➔ + %u + Find your friends -.span-5 - %h4 - On Diaspora - = text_field_tag :diaspora_handle, nil, :placeholder => "Diaspora handle" -.span-5 - %h4 - On Facebook - = text_field_tag :facebook_handle, nil, :placeholder => "Name" + %h3 + Your friends + .description + Find your friends on Diaspora, Facebook, or send them an invite via email. -.span-5 - %h4 - Invite - = text_field_tag :email, nil, :placeholder => "Email", :type => "email" + .span-5 + %h4 + On Diaspora + = text_field_tag :diaspora_handle, nil, :placeholder => "Diaspora handle" + + .span-5 + %h4 + On Facebook + = text_field_tag :facebook_handle, nil, :placeholder => "Name" + + .span-5 + %h4 + Invite + = text_field_tag :email, nil, :placeholder => "Email", :type => "email" diff --git a/public/javascripts/easySlider1.7.js b/public/javascripts/easySlider1.7.js new file mode 100644 index 000000000..beaa2376e --- /dev/null +++ b/public/javascripts/easySlider1.7.js @@ -0,0 +1,226 @@ +/* + * Easy Slider 1.7 - jQuery plugin + * written by Alen Grakalic + * http://cssglobe.com/post/4004/easy-slider-15-the-easiest-jquery-plugin-for-sliding + * + * Copyright (c) 2009 Alen Grakalic (http://cssglobe.com) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * Built for jQuery library + * http://jquery.com + * + */ + +/* + * markup example for $("#slider").easySlider(); + * + *
+ *
    + *
  • + *
  • + *
  • + *
  • + *
  • + *
+ *
+ * + */ + +(function($) { + + $.fn.easySlider = function(options){ + + // default configuration properties + var defaults = { + prevId: 'prevBtn', + prevText: 'Previous', + nextId: 'nextBtn', + nextText: 'Next', + controlsShow: true, + controlsBefore: '', + controlsAfter: '', + controlsFade: true, + firstId: 'firstBtn', + firstText: 'First', + firstShow: false, + lastId: 'lastBtn', + lastText: 'Last', + lastShow: false, + vertical: false, + speed: 800, + auto: false, + pause: 2000, + continuous: false, + numeric: false, + numericId: 'controls' + }; + + var options = $.extend(defaults, options); + + this.each(function() { + var obj = $(this); + var s = $("li", obj).length; + var w = $("li", obj).width(); + var h = $("li", obj).height(); + var clickable = true; + obj.width(w); + obj.height(h); + obj.css("overflow","hidden"); + var ts = s-1; + var t = 0; + $("ul", obj).css('width',s*w); + + if(options.continuous){ + $("ul", obj).prepend($("ul li:last-child", obj).clone().css("margin-left","-"+ w +"px")); + $("ul", obj).append($("ul li:nth-child(2)", obj).clone()); + $("ul", obj).css('width',(s+1)*w); + }; + + if(!options.vertical) $("li", obj).css('float','left'); + + if(options.controlsShow){ + var html = options.controlsBefore; + if(options.numeric){ + html += '
    '; + } else { + if(options.firstShow) html += ''+ options.firstText +''; + html += ' '+ options.prevText +''; + html += ' '+ options.nextText +''; + if(options.lastShow) html += ' '+ options.lastText +''; + }; + + html += options.controlsAfter; + $(obj).after(html); + }; + + if(options.numeric){ + for(var i=0;i'+ (i+1) +'') + .appendTo($("#"+ options.numericId)) + .click(function(){ + animate($("a",$(this)).attr('rel'),true); + }); + }; + } else { + $("a","#"+options.nextId).click(function(){ + animate("next",true); + }); + $("a","#"+options.prevId).click(function(){ + animate("prev",true); + }); + $("a","#"+options.firstId).click(function(){ + animate("first",true); + }); + $("a","#"+options.lastId).click(function(){ + animate("last",true); + }); + }; + + function setCurrent(i){ + i = parseInt(i)+1; + $("li", "#" + options.numericId).removeClass("current"); + $("li#" + options.numericId + i).addClass("current"); + }; + + function adjust(){ + if(t>ts) t=0; + if(t<0) t=ts; + if(!options.vertical) { + $("ul",obj).css("margin-left",(t*w*-1)); + } else { + $("ul",obj).css("margin-left",(t*h*-1)); + } + clickable = true; + if(options.numeric) setCurrent(t); + }; + + function animate(dir,clicked){ + if (clickable){ + clickable = false; + var ot = t; + switch(dir){ + case "next": + t = (ot>=ts) ? (options.continuous ? t+1 : ts) : t+1; + break; + case "prev": + t = (t<=0) ? (options.continuous ? t-1 : 0) : t-1; + break; + case "first": + t = 0; + break; + case "last": + t = ts; + break; + default: + t = dir; + break; + }; + var diff = Math.abs(ot-t); + var speed = diff*options.speed; + if(!options.vertical) { + p = (t*w*-1); + $("ul",obj).animate( + { marginLeft: p }, + { queue:false, duration:speed, complete:adjust } + ); + } else { + p = (t*h*-1); + $("ul",obj).animate( + { marginTop: p }, + { queue:false, duration:speed, complete:adjust } + ); + }; + + if(!options.continuous && options.controlsFade){ + if(t==ts){ + $("a","#"+options.nextId).hide(); + $("a","#"+options.lastId).hide(); + } else { + $("a","#"+options.nextId).show(); + $("a","#"+options.lastId).show(); + }; + if(t==0){ + $("a","#"+options.prevId).hide(); + $("a","#"+options.firstId).hide(); + } else { + $("a","#"+options.prevId).show(); + $("a","#"+options.firstId).show(); + }; + }; + + if(clicked) clearTimeout(timeout); + if(options.auto && dir=="next" && !clicked){; + timeout = setTimeout(function(){ + animate("next",false); + },diff*options.speed+options.pause); + }; + + }; + + }; + // init + var timeout; + if(options.auto){; + timeout = setTimeout(function(){ + animate("next",false); + },options.pause); + }; + + if(options.numeric) setCurrent(0); + + if(!options.continuous && options.controlsFade){ + $("a","#"+options.prevId).hide(); + $("a","#"+options.firstId).hide(); + }; + + }); + + }; + +})(jQuery); + + + diff --git a/public/javascripts/view.js b/public/javascripts/view.js index 26b3fea55..f8b2fb8b2 100644 --- a/public/javascripts/view.js +++ b/public/javascripts/view.js @@ -73,6 +73,9 @@ $(document).ready(function(){ $(".reshare_box").hide(); }; }); + + $("#slider").easySlider({speed:400, numeric:true}); + $("img", "#left_pane").tipsy({live:true}); $(".add_aspect_button", "#aspect_nav").tipsy({gravity:'w'}); @@ -133,3 +136,10 @@ $(".make_profile_photo").live("click", function(){ }); }); +$(".getting_started_box").live("click",function(evt){ + $(this).animate({ + left: parseInt($(this).css('left'),30) == 0 ? + -$(this).outerWidth() : + 0 + },function(evt){ $(this).css('left', '1000px')}); +}); diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 1414e73ec..9ba66b8df 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -1243,3 +1243,12 @@ ul#breadcrumb &:last-child &:after :content '' + +#slider ul, #slider li + :margin 0 + :padding 0 + :list-style none + +#slider, #slider li + :width 1000px + :overflow hidden From 69b1b71a5d65eda0c1b7d14abd06f915101d7366 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Wed, 20 Oct 2010 16:12:34 -0700 Subject: [PATCH 05/26] removed javascript slider. made each getting_started section its own page. added bio to profile (and changed xml_accessors to xml_readers). --- app/controllers/users_controller.rb | 11 +- app/models/profile.rb | 8 +- app/models/user.rb | 2 + app/views/layouts/application.html.haml | 4 +- app/views/users/_profile.haml | 4 +- app/views/users/getting_started.html.haml | 93 -------- app/views/users/getting_started/1.html.haml | 20 ++ app/views/users/getting_started/2.html.haml | 35 +++ app/views/users/getting_started/3.html.haml | 36 ++++ config/routes.rb | 12 +- public/javascripts/easySlider1.7.js | 226 -------------------- public/javascripts/view.js | 2 +- public/stylesheets/sass/application.sass | 55 +++-- 13 files changed, 156 insertions(+), 352 deletions(-) delete mode 100644 app/views/users/getting_started.html.haml create mode 100644 app/views/users/getting_started/1.html.haml create mode 100644 app/views/users/getting_started/2.html.haml create mode 100644 app/views/users/getting_started/3.html.haml delete mode 100644 public/javascripts/easySlider1.7.js diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 630335d86..ed6658678 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -66,7 +66,16 @@ class UsersController < ApplicationController end def getting_started - render 'users/getting_started' + @aspect = :getting_started + @user = current_user + @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' + + if params[:id].to_i < 4 + render "users/getting_started/#{params[:id]}" + else + render "users/getting_started/1" + end end def export diff --git a/app/models/profile.rb b/app/models/profile.rb index baab495d7..544277ce7 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -9,13 +9,15 @@ class Profile include ROXML xml_reader :person_id - xml_accessor :first_name - xml_accessor :last_name - xml_accessor :image_url + xml_reader :first_name + xml_reader :last_name + xml_reader :image_url + xml_reader :bio key :first_name, String key :last_name, String key :image_url, String + key :bio, String validates_presence_of :first_name, :last_name after_validation :strip_names diff --git a/app/models/user.rb b/app/models/user.rb index 6a184b156..4790ac25d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -40,6 +40,8 @@ class User key :invite_messages, Hash + key :getting_started, Boolean, :default => false + before_validation :strip_username, :on => :create validates_presence_of :username validates_uniqueness_of :username, :case_sensitive => false diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 22a5a4f8a..78dd8c8b9 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -30,7 +30,6 @@ = javascript_include_tag 'fileuploader' = javascript_include_tag 'view', 'image_picker', 'stream' - = javascript_include_tag 'easySlider1.7' = render 'js/websocket_js' @@ -68,3 +67,6 @@ .span-24.last = render "posts/debug" + + #getting_started_button + = link_to "Getting started", getting_started_path(1) diff --git a/app/views/users/_profile.haml b/app/views/users/_profile.haml index f57c775cb..8bf100c4d 100644 --- a/app/views/users/_profile.haml +++ b/app/views/users/_profile.haml @@ -20,11 +20,11 @@ %h4 Your birthday %br - = select_date + = select_date Time.now, :order => [:month, :day, :year] %h4 Your bio - = text_area_tag :bio, nil, :placeholder => "Fill me out" + = profile.text_area :bio, :value => @profile.bio, :rows => 5, :placeholder => "Fill me out" %h4 Your photo diff --git a/app/views/users/getting_started.html.haml b/app/views/users/getting_started.html.haml deleted file mode 100644 index b0ea13a36..000000000 --- a/app/views/users/getting_started.html.haml +++ /dev/null @@ -1,93 +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. - - - -%h1 - = "Welcome, #{current_user.real_name}!" - - .description - Do the stuff below to further complete some things. - -#slider - %ul - %li - %h2 - %u - Edit your profile - ➔ - Define your aspects ➔ - Find your friends - - - %h3 - Your Profile - .description - This info will be available to whomever you connect with on Diaspora. - - %h4 - Your name - = text_field_tag :first_name, nil, :placeholder => "First name" - = text_field_tag :last_name, nil, :placeholder => "Last name" - - %h4 - Your birthday - %br - = select_date - - %h4 - Your bio - = text_area_tag :bio, nil, :placeholder => "Fill me out" - - %h4 - Your photo - %br - = file_field_tag :photo - - - %li - %h2 - Edit your profile ➔ - %u - Define your aspects - ➔ - Find your friends - - %h3 - Your aspects - .description - These will be blah blah blah blah and some stuff. - - %h4 - Aspect name - = text_field_tag :aspect_name, nil, :placeholder => "New aspect" - - - %li - %h2 - Edit your profile ➔ - Define your aspects ➔ - %u - Find your friends - - - %h3 - Your friends - .description - Find your friends on Diaspora, Facebook, or send them an invite via email. - - .span-5 - %h4 - On Diaspora - = text_field_tag :diaspora_handle, nil, :placeholder => "Diaspora handle" - - .span-5 - %h4 - On Facebook - = text_field_tag :facebook_handle, nil, :placeholder => "Name" - - .span-5 - %h4 - Invite - = text_field_tag :email, nil, :placeholder => "Email", :type => "email" diff --git a/app/views/users/getting_started/1.html.haml b/app/views/users/getting_started/1.html.haml new file mode 100644 index 000000000..51cc5ee07 --- /dev/null +++ b/app/views/users/getting_started/1.html.haml @@ -0,0 +1,20 @@ +-# Copyright (c) 2010, Diaspora Inc. This file is +-# licensed under the Affero General Public License version 3 or later. See +-# the COPYRIGHT file. + + + +%h1 + = "Welcome, #{current_user.real_name}!" + .description + Do the stuff below to further complete some things. + +%h2 + %u + Edit your profile + ➔ + Define your aspects ➔ + Find your friends + += render 'users/profile' + diff --git a/app/views/users/getting_started/2.html.haml b/app/views/users/getting_started/2.html.haml new file mode 100644 index 000000000..de532553e --- /dev/null +++ b/app/views/users/getting_started/2.html.haml @@ -0,0 +1,35 @@ +-# Copyright (c) 2010, Diaspora Inc. This file is +-# licensed under the Affero General Public License version 3 or later. See +-# the COPYRIGHT file. + + + +%h1 + = "Welcome, #{current_user.real_name}!" + .description + Do the stuff below to further complete some things. + +%h2 + Edit your profile ➔ + %u + Define your aspects + ➔ + Find your friends + +%h3 + Your aspects + .description + These will be blah blah blah blah and some stuff. + +%h4 + Aspect name + = text_field_tag :aspect_name, nil, :placeholder => "New aspect" + +%ul.aspects + - for aspect in @aspects + %li + = aspect + .friend_pictures.horizontal + - for friend in @friends + = person_image_link(friend) + diff --git a/app/views/users/getting_started/3.html.haml b/app/views/users/getting_started/3.html.haml new file mode 100644 index 000000000..e6c6fcd24 --- /dev/null +++ b/app/views/users/getting_started/3.html.haml @@ -0,0 +1,36 @@ +-# Copyright (c) 2010, Diaspora Inc. This file is +-# licensed under the Affero General Public License version 3 or later. See +-# the COPYRIGHT file. + + + +%h1 + = "Welcome, #{current_user.real_name}!" + .description + Do the stuff below to further complete some things. + +%h2 + Edit your profile ➔ + Define your aspects ➔ + %u + Find your friends + +%h3 + Your friends + .description + Find your friends on Diaspora, Facebook, or send them an invite via email. + +.span-5 + %h4 + On Diaspora + = text_field_tag :diaspora_handle, nil, :placeholder => "Diaspora handle" + +.span-5 + %h4 + On Facebook + = text_field_tag :facebook_handle, nil, :placeholder => "Name" + +.span-5 + %h4 + Invite + = text_field_tag :email, nil, :placeholder => "Email", :type => "email" diff --git a/config/routes.rb b/config/routes.rb index b1d68fff7..8a9af0e61 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -17,12 +17,12 @@ Diaspora::Application.routes.draw do :password => "devise/passwords", :invitations => "invitations"} # added public route to user - match 'public/:username', :to => 'users#public' - match 'users/getting_started', :to => 'users#getting_started' - match 'users/export', :to => 'users#export' - match 'users/import', :to => 'users#import' - match 'users/export_photos', :to => 'users#export_photos' - resources :users, :except => [:create, :new, :show] + match 'public/:username', :to => 'users#public' + match 'users/getting_started/:id', :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' + resources :users, :except => [:create, :new, :show] match 'aspects/move_friend', :to => 'aspects#move_friend', :as => 'move_friend' match 'aspects/add_to_aspect',:to => 'aspects#add_to_aspect', :as => 'add_to_aspect' diff --git a/public/javascripts/easySlider1.7.js b/public/javascripts/easySlider1.7.js deleted file mode 100644 index beaa2376e..000000000 --- a/public/javascripts/easySlider1.7.js +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Easy Slider 1.7 - jQuery plugin - * written by Alen Grakalic - * http://cssglobe.com/post/4004/easy-slider-15-the-easiest-jquery-plugin-for-sliding - * - * Copyright (c) 2009 Alen Grakalic (http://cssglobe.com) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. - * - * Built for jQuery library - * http://jquery.com - * - */ - -/* - * markup example for $("#slider").easySlider(); - * - *
    - *
      - *
    • - *
    • - *
    • - *
    • - *
    • - *
    - *
    - * - */ - -(function($) { - - $.fn.easySlider = function(options){ - - // default configuration properties - var defaults = { - prevId: 'prevBtn', - prevText: 'Previous', - nextId: 'nextBtn', - nextText: 'Next', - controlsShow: true, - controlsBefore: '', - controlsAfter: '', - controlsFade: true, - firstId: 'firstBtn', - firstText: 'First', - firstShow: false, - lastId: 'lastBtn', - lastText: 'Last', - lastShow: false, - vertical: false, - speed: 800, - auto: false, - pause: 2000, - continuous: false, - numeric: false, - numericId: 'controls' - }; - - var options = $.extend(defaults, options); - - this.each(function() { - var obj = $(this); - var s = $("li", obj).length; - var w = $("li", obj).width(); - var h = $("li", obj).height(); - var clickable = true; - obj.width(w); - obj.height(h); - obj.css("overflow","hidden"); - var ts = s-1; - var t = 0; - $("ul", obj).css('width',s*w); - - if(options.continuous){ - $("ul", obj).prepend($("ul li:last-child", obj).clone().css("margin-left","-"+ w +"px")); - $("ul", obj).append($("ul li:nth-child(2)", obj).clone()); - $("ul", obj).css('width',(s+1)*w); - }; - - if(!options.vertical) $("li", obj).css('float','left'); - - if(options.controlsShow){ - var html = options.controlsBefore; - if(options.numeric){ - html += '
      '; - } else { - if(options.firstShow) html += ''+ options.firstText +''; - html += ' '+ options.prevText +''; - html += ' '+ options.nextText +''; - if(options.lastShow) html += ' '+ options.lastText +''; - }; - - html += options.controlsAfter; - $(obj).after(html); - }; - - if(options.numeric){ - for(var i=0;i'+ (i+1) +'') - .appendTo($("#"+ options.numericId)) - .click(function(){ - animate($("a",$(this)).attr('rel'),true); - }); - }; - } else { - $("a","#"+options.nextId).click(function(){ - animate("next",true); - }); - $("a","#"+options.prevId).click(function(){ - animate("prev",true); - }); - $("a","#"+options.firstId).click(function(){ - animate("first",true); - }); - $("a","#"+options.lastId).click(function(){ - animate("last",true); - }); - }; - - function setCurrent(i){ - i = parseInt(i)+1; - $("li", "#" + options.numericId).removeClass("current"); - $("li#" + options.numericId + i).addClass("current"); - }; - - function adjust(){ - if(t>ts) t=0; - if(t<0) t=ts; - if(!options.vertical) { - $("ul",obj).css("margin-left",(t*w*-1)); - } else { - $("ul",obj).css("margin-left",(t*h*-1)); - } - clickable = true; - if(options.numeric) setCurrent(t); - }; - - function animate(dir,clicked){ - if (clickable){ - clickable = false; - var ot = t; - switch(dir){ - case "next": - t = (ot>=ts) ? (options.continuous ? t+1 : ts) : t+1; - break; - case "prev": - t = (t<=0) ? (options.continuous ? t-1 : 0) : t-1; - break; - case "first": - t = 0; - break; - case "last": - t = ts; - break; - default: - t = dir; - break; - }; - var diff = Math.abs(ot-t); - var speed = diff*options.speed; - if(!options.vertical) { - p = (t*w*-1); - $("ul",obj).animate( - { marginLeft: p }, - { queue:false, duration:speed, complete:adjust } - ); - } else { - p = (t*h*-1); - $("ul",obj).animate( - { marginTop: p }, - { queue:false, duration:speed, complete:adjust } - ); - }; - - if(!options.continuous && options.controlsFade){ - if(t==ts){ - $("a","#"+options.nextId).hide(); - $("a","#"+options.lastId).hide(); - } else { - $("a","#"+options.nextId).show(); - $("a","#"+options.lastId).show(); - }; - if(t==0){ - $("a","#"+options.prevId).hide(); - $("a","#"+options.firstId).hide(); - } else { - $("a","#"+options.prevId).show(); - $("a","#"+options.firstId).show(); - }; - }; - - if(clicked) clearTimeout(timeout); - if(options.auto && dir=="next" && !clicked){; - timeout = setTimeout(function(){ - animate("next",false); - },diff*options.speed+options.pause); - }; - - }; - - }; - // init - var timeout; - if(options.auto){; - timeout = setTimeout(function(){ - animate("next",false); - },options.pause); - }; - - if(options.numeric) setCurrent(0); - - if(!options.continuous && options.controlsFade){ - $("a","#"+options.prevId).hide(); - $("a","#"+options.firstId).hide(); - }; - - }); - - }; - -})(jQuery); - - - diff --git a/public/javascripts/view.js b/public/javascripts/view.js index f8b2fb8b2..7b8af68d7 100644 --- a/public/javascripts/view.js +++ b/public/javascripts/view.js @@ -74,7 +74,7 @@ $(document).ready(function(){ }; }); - $("#slider").easySlider({speed:400, numeric:true}); + //$("#slider").easySlider({speed:400}); $("img", "#left_pane").tipsy({live:true}); diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 9ba66b8df..824cc7ff6 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -393,6 +393,8 @@ li.message form :position relative + :font + :size 14px #user_name :margin @@ -442,7 +444,6 @@ form > li :background none :border none - #stream ul.comments :display none @@ -453,6 +454,10 @@ form :margin :right 10px + form + :margin + :right 12px + input.comment_submit :display none :margin @@ -635,7 +640,6 @@ label :width 100% :margin :bottom 10px - :top -14px :border :bottom 2px #777 solid @@ -674,14 +678,14 @@ label :bottom -2px input[type='submit'] :position absolute - :right -13px + :right 0 :top 5px :width 75px + input + :display inline .public_toggle :width 300px - :margin - :left -3px :font :size smaller :style italic @@ -1074,16 +1078,6 @@ ul#settings_nav :width 30px :height 30px -.friend_pictures.horizontal - :display inline - :margin - :left 20px - - img - :width 30px - :height 30px - :margin-right -4px - #thumbnails :line-height 14px @@ -1244,11 +1238,34 @@ ul#breadcrumb &:after :content '' -#slider ul, #slider li +#getting_started_button + :position fixed + :bottom 4px + :margin + :left 680px + + a + :padding 10px + :background #333 + :color #eee + + :-webkit-border-radius 5px 5px 0 0 + :-moz-border-radius 5px 5px 0 0 + :border-radius 5px 5px 0 0 + + :-webkit-box-shadow 0 0 2px #666 + +ul.aspects :margin 0 :padding 0 :list-style none + :width 67% + :color #999 + :font + :size 24px + + > li + :padding 12px 0 + :border + :bottom 1px solid #eee -#slider, #slider li - :width 1000px - :overflow hidden From dd4f46c8b0cf83e76a7e172fa759f10f621ef3bb Mon Sep 17 00:00:00 2001 From: danielvincent Date: Wed, 20 Oct 2010 16:41:38 -0700 Subject: [PATCH 06/26] repositioning layout on getting started --- app/views/users/getting_started/1.html.haml | 25 +++++----- app/views/users/getting_started/2.html.haml | 51 ++++++++++---------- app/views/users/getting_started/3.html.haml | 53 +++++++++++---------- public/stylesheets/sass/application.sass | 1 - 4 files changed, 67 insertions(+), 63 deletions(-) diff --git a/app/views/users/getting_started/1.html.haml b/app/views/users/getting_started/1.html.haml index 51cc5ee07..41e2c3aaf 100644 --- a/app/views/users/getting_started/1.html.haml +++ b/app/views/users/getting_started/1.html.haml @@ -3,18 +3,19 @@ -# the COPYRIGHT file. +.span-8.append-1.last + %h1{:style => "text-align:right;"} + = "Welcome!" + .description + Do the stuff below to further complete some things. -%h1 - = "Welcome, #{current_user.real_name}!" - .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 "Find your friends", getting_started_path(3) -%h2 - %u - Edit your profile - ➔ - Define your aspects ➔ - Find your friends - -= render 'users/profile' +.span-15.last + = render 'users/profile' diff --git a/app/views/users/getting_started/2.html.haml b/app/views/users/getting_started/2.html.haml index de532553e..d7ec9baeb 100644 --- a/app/views/users/getting_started/2.html.haml +++ b/app/views/users/getting_started/2.html.haml @@ -3,33 +3,34 @@ -# the COPYRIGHT file. +.span-8.append-1.last + %h1{:style => "text-align:right;"} + = "Welcome!" + .description + Do the stuff below to further complete some things. -%h1 - = "Welcome, #{current_user.real_name}!" - .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 "Find your friends", getting_started_path(3) -%h2 - Edit your profile ➔ - %u - Define your aspects - ➔ - Find your friends +.span-15.last + %h3 + Your aspects + .description + These will be blah blah blah blah and some stuff. -%h3 - Your aspects - .description - These will be blah blah blah blah and some stuff. + %h4 + Aspect name + = text_field_tag :aspect_name, nil, :placeholder => "New aspect" -%h4 - Aspect name - = text_field_tag :aspect_name, nil, :placeholder => "New aspect" - -%ul.aspects - - for aspect in @aspects - %li - = aspect - .friend_pictures.horizontal - - for friend in @friends - = person_image_link(friend) + %ul.aspects + - for aspect in @aspects + %li + = aspect + .friend_pictures.horizontal + - for friend in @friends + = person_image_link(friend) diff --git a/app/views/users/getting_started/3.html.haml b/app/views/users/getting_started/3.html.haml index e6c6fcd24..f5136aeaf 100644 --- a/app/views/users/getting_started/3.html.haml +++ b/app/views/users/getting_started/3.html.haml @@ -4,33 +4,36 @@ -%h1 - = "Welcome, #{current_user.real_name}!" - .description - Do the stuff below to further complete some things. +.span-8.append-1.last + %h1{:style => "text-align:right;"} + = "Welcome!" + .description + Do the stuff below to further complete some things. -%h2 - Edit your profile ➔ - Define your aspects ➔ - %u - Find your friends + %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 "Find your friends", getting_started_path(3) -%h3 - Your friends - .description - Find your friends on Diaspora, Facebook, or send them an invite via email. +.span-15.last + %h3 + Your friends + .description + Find your friends on Diaspora, Facebook, or send them an invite via email. -.span-5 - %h4 - On Diaspora - = text_field_tag :diaspora_handle, nil, :placeholder => "Diaspora handle" + .span-5.last + %h4 + On Diaspora + = text_field_tag :diaspora_handle, nil, :placeholder => "Diaspora handle" -.span-5 - %h4 - On Facebook - = text_field_tag :facebook_handle, nil, :placeholder => "Name" + .span-5.last + %h4 + On Facebook + = text_field_tag :facebook_handle, nil, :placeholder => "Name" -.span-5 - %h4 - Invite - = text_field_tag :email, nil, :placeholder => "Email", :type => "email" + .span-5.last + %h4 + Invite + = text_field_tag :email, nil, :placeholder => "Email", :type => "email" diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 824cc7ff6..3912b1cc0 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -1259,7 +1259,6 @@ ul.aspects :margin 0 :padding 0 :list-style none - :width 67% :color #999 :font :size 24px From 0c72257c501686a66184defeaa8d0d60949ddc4d Mon Sep 17 00:00:00 2001 From: danielvincent Date: Tue, 26 Oct 2010 11:59:57 -0700 Subject: [PATCH 07/26] aspects can be created/destroyed via ajax on getting_started#2 --- app/views/users/getting_started/1.html.haml | 9 +++--- app/views/users/getting_started/2.html.haml | 36 +++++++++++++++------ public/stylesheets/sass/application.sass | 27 +++++++++++++++- 3 files changed, 58 insertions(+), 14 deletions(-) diff --git a/app/views/users/getting_started/1.html.haml b/app/views/users/getting_started/1.html.haml index 41e2c3aaf..4533186e2 100644 --- a/app/views/users/getting_started/1.html.haml +++ b/app/views/users/getting_started/1.html.haml @@ -3,18 +3,19 @@ -# the COPYRIGHT file. -.span-8.append-1.last - %h1{:style => "text-align:right;"} - = "Welcome!" +.span-8.append-1.last{:style => "text-align:right;"} + %h1 + = "Welcome to Diaspora!" .description Do the stuff below to further complete some things. - %h3{:style => "text-align:right;"} + %h3 = link_to "Edit your profile", getting_started_path(1) %br = link_to "Define your aspects", getting_started_path(2) %br = link_to "Find your friends", getting_started_path(3) + %br .span-15.last = render 'users/profile' diff --git a/app/views/users/getting_started/2.html.haml b/app/views/users/getting_started/2.html.haml index d7ec9baeb..ce4269d1e 100644 --- a/app/views/users/getting_started/2.html.haml +++ b/app/views/users/getting_started/2.html.haml @@ -3,34 +3,52 @@ -# the COPYRIGHT file. -.span-8.append-1.last - %h1{:style => "text-align:right;"} - = "Welcome!" +- content_for :head do + :javascript + $("#new_aspect").live("submit", function(){ + var newAspectName = $(this).children("#aspect_name").val(); + $("ul.aspects").prepend($("
    1. " + newAspectName + "
    2. ").fadeIn(200)); + $("#aspect_nav").find("ul").first().find("li:last").before($("
    3. " + newAspectName + "
    4. ").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{:style => "text-align:right;"} + %h3 = link_to "Edit your profile", getting_started_path(1) %br = link_to "Define your aspects", getting_started_path(2) %br = link_to "Find your friends", getting_started_path(3) + %br .span-15.last %h3 Your aspects - .description - These will be blah blah blah blah and some stuff. + %p + Diaspora aspects are mappings of your real-life aspects. %h4 Aspect name - = text_field_tag :aspect_name, nil, :placeholder => "New aspect" + - form_for Aspect.new, :remote => true do |aspect| + = aspect.text_field :name + = aspect.submit "Add" %ul.aspects - for aspect in @aspects - %li + %li{:style=>"position:relative;"} = aspect .friend_pictures.horizontal - - for friend in @friends + - for friend in aspect.people = person_image_link(friend) + = link_to "x", aspect_path(aspect), :confirm => "are you sure?", :method => :delete, :remote => true, :class => "delete right" + diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 3912b1cc0..c5cc05e2a 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -1130,6 +1130,8 @@ h1,h2,h3,h4 :size 70% :weight 100 :color #ccc + :margin + :top 0.5em h2,h3,h4 .description @@ -1264,7 +1266,30 @@ ul.aspects :size 24px > li - :padding 12px 0 + :padding 12px :border :bottom 1px solid #eee + &:hover + :background + :color #fafafa + + + .right + :top 12px + :right 12px + + .delete + :background + :color #eee + :width 20px + :height 20px + + :-webkit-border-radius 10px + + :line-height 16px + :text-indent 6px + :font-size 16px + +.inline + :display inline From ec141a2019481cdb9225f5c14804e41c9429ae7a Mon Sep 17 00:00:00 2001 From: danielvincent Date: Tue, 26 Oct 2010 12:53:12 -0700 Subject: [PATCH 08/26] a user can add a person to an aspect from getting_started#2 --- app/views/requests/_new_request.haml | 2 +- app/views/shared/_aspect_friends.haml | 2 +- app/views/users/getting_started/1.html.haml | 2 +- app/views/users/getting_started/2.html.haml | 8 +++++++- app/views/users/getting_started/3.html.haml | 2 +- public/javascripts/view.js | 3 ++- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/views/requests/_new_request.haml b/app/views/requests/_new_request.haml index c67bc61b9..11e6f73c2 100644 --- a/app/views/requests/_new_request.haml +++ b/app/views/requests/_new_request.haml @@ -9,7 +9,7 @@ %i= aspect.name - if @friends_not_in_aspect - = render('shared/add_friend_dropdown', :aspect => @aspect, :friends => @friends_not_in_aspect) + = render('shared/add_friend_dropdown', :aspect => aspect, :friends => @friends_not_in_aspect) diff --git a/app/views/shared/_aspect_friends.haml b/app/views/shared/_aspect_friends.haml index f4b2f06f7..c7137b025 100644 --- a/app/views/shared/_aspect_friends.haml +++ b/app/views/shared/_aspect_friends.haml @@ -16,7 +16,7 @@ = person_image_link(friend) -unless (@aspect == :all) - = link_to (image_tag('add_friend_button.png', :title => "add to #{@aspect}")), "#add_request_pane", :id => 'add_request_button' + = link_to (image_tag('add_friend_button.png', :title => "add to #{@aspect}")), "#add_request_pane", :class => 'add_request_button' .fancybox_content #add_request_pane diff --git a/app/views/users/getting_started/1.html.haml b/app/views/users/getting_started/1.html.haml index 4533186e2..4496290b8 100644 --- a/app/views/users/getting_started/1.html.haml +++ b/app/views/users/getting_started/1.html.haml @@ -14,7 +14,7 @@ %br = link_to "Define your aspects", getting_started_path(2) %br - = link_to "Find your friends", getting_started_path(3) + = link_to "Connect your services", getting_started_path(3) %br .span-15.last diff --git a/app/views/users/getting_started/2.html.haml b/app/views/users/getting_started/2.html.haml index ce4269d1e..806461e1f 100644 --- a/app/views/users/getting_started/2.html.haml +++ b/app/views/users/getting_started/2.html.haml @@ -27,7 +27,7 @@ %br = link_to "Define your aspects", getting_started_path(2) %br - = link_to "Find your friends", getting_started_path(3) + = link_to "Connect your services", getting_started_path(3) %br .span-15.last @@ -50,5 +50,11 @@ - 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 + = link_to "x", aspect_path(aspect), :confirm => "are you sure?", :method => :delete, :remote => true, :class => "delete right" diff --git a/app/views/users/getting_started/3.html.haml b/app/views/users/getting_started/3.html.haml index f5136aeaf..8a4c6b95a 100644 --- a/app/views/users/getting_started/3.html.haml +++ b/app/views/users/getting_started/3.html.haml @@ -15,7 +15,7 @@ %br = link_to "Define your aspects", getting_started_path(2) %br - = link_to "Find your friends", getting_started_path(3) + = link_to "Connect your services", getting_started_path(3) .span-15.last %h3 diff --git a/public/javascripts/view.js b/public/javascripts/view.js index 7b8af68d7..6bb6b45b4 100644 --- a/public/javascripts/view.js +++ b/public/javascripts/view.js @@ -27,7 +27,7 @@ $(document).ready(function(){ //buttons////// $(".add_aspect_button").fancybox({ 'titleShow' : false , 'hideOnOverlayClick' : false }); - $("#add_request_button").fancybox({ 'titleShow': false , 'hideOnOverlayClick' : false }); + $(".add_request_button").fancybox({ 'titleShow': false , 'hideOnOverlayClick' : false }); $(".invite_user_button").fancybox({ 'titleShow': false , 'hideOnOverlayClick' : false }); $(".add_request_button").fancybox({ 'titleShow': false , 'hideOnOverlayClick' : false }); $(".remove_person_button").fancybox({ 'titleShow': false , 'hideOnOverlayClick' : false }); @@ -80,6 +80,7 @@ $(document).ready(function(){ $("img", "#left_pane").tipsy({live:true}); $(".add_aspect_button", "#aspect_nav").tipsy({gravity:'w'}); $(".person img", ".dropzone").tipsy({live:true}); + $(".avatar", ".aspects").tipsy({live:true}); });//end document ready From ea46fa8fd89bde935d6f133f82f838083d44836a Mon Sep 17 00:00:00 2001 From: danielvincent Date: Tue, 26 Oct 2010 15:03:38 -0700 Subject: [PATCH 09/26] save and continue buttons on getting_started#1 and getting_started#2. raise fields --- app/controllers/users_controller.rb | 7 ++- app/views/users/_profile.haml | 3 -- app/views/users/getting_started/1.html.haml | 55 ++++++++++++++++++++- app/views/users/getting_started/2.html.haml | 50 ++++++++++--------- app/views/users/getting_started/3.html.haml | 13 +++-- public/stylesheets/sass/application.sass | 13 ++++- 6 files changed, 105 insertions(+), 36 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index ed6658678..a4a6475e9 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -40,7 +40,12 @@ class UsersController < ApplicationController flash[:error] = "Failed to update profile" end end - redirect_to edit_user_path(@user) + + if params[:getting_started] + redirect_to getting_started_path(params[:getting_started].to_i+1) + else + redirect_to edit_user_path(@user) + end end diff --git a/app/views/users/_profile.haml b/app/views/users/_profile.haml index 8bf100c4d..b18a56c86 100644 --- a/app/views/users/_profile.haml +++ b/app/views/users/_profile.haml @@ -49,9 +49,6 @@ =will_paginate @photos - - - .submit_block = link_to t('.cancel'), edit_user_path(current_user) = t('.or') diff --git a/app/views/users/getting_started/1.html.haml b/app/views/users/getting_started/1.html.haml index 4496290b8..5ffb4a1ae 100644 --- a/app/views/users/getting_started/1.html.haml +++ b/app/views/users/getting_started/1.html.haml @@ -10,7 +10,7 @@ Do the stuff below to further complete some things. %h3 - = link_to "Edit your profile", getting_started_path(1) + = link_to "Edit your profile", getting_started_path(1), :class => 'selected' %br = link_to "Define your aspects", getting_started_path(2) %br @@ -18,5 +18,56 @@ %br .span-15.last - = render 'users/profile' + .floating + = form_for @user do |user| + %h3 + Your Profile + .description + This info will be available to whomever you connect with on Diaspora. + + = user.error_messages + + = user.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 + = select_date Time.now, :order => [:month, :day, :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 + = user.submit "Save and continue →" diff --git a/app/views/users/getting_started/2.html.haml b/app/views/users/getting_started/2.html.haml index 806461e1f..3e7fe3175 100644 --- a/app/views/users/getting_started/2.html.haml +++ b/app/views/users/getting_started/2.html.haml @@ -22,7 +22,7 @@ .description Do the stuff below to further complete some things. - %h3 + %h3.nav = link_to "Edit your profile", getting_started_path(1) %br = link_to "Define your aspects", getting_started_path(2) @@ -31,30 +31,36 @@ %br .span-15.last - %h3 - Your aspects - %p - Diaspora aspects are mappings of your real-life aspects. + .floating + %h3 + Your aspects + %p + Diaspora aspects are mappings of your real-life aspects. - %h4 - Aspect name - - form_for Aspect.new, :remote => true do |aspect| - = aspect.text_field :name - = aspect.submit "Add" + %h4 + Aspect name + - form_for Aspect.new, :remote => true do |aspect| + = aspect.text_field :name + = 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) + %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' + = 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 + .fancybox_content + #add_request_pane + = render "requests/new_request", :aspect => aspect - = link_to "x", aspect_path(aspect), :confirm => "are you sure?", :method => :delete, :remote => true, :class => "delete right" + = 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(3), :class => "button" diff --git a/app/views/users/getting_started/3.html.haml b/app/views/users/getting_started/3.html.haml index 8a4c6b95a..65fae6637 100644 --- a/app/views/users/getting_started/3.html.haml +++ b/app/views/users/getting_started/3.html.haml @@ -16,24 +16,23 @@ = link_to "Define your aspects", getting_started_path(2) %br = link_to "Connect your services", getting_started_path(3) + %br .span-15.last - %h3 - Your friends - .description - Find your friends on Diaspora, Facebook, or send them an invite via email. + .floating + %h3 + Your friends + .description + Find your friends on Diaspora, Facebook, or send them an invite via email. - .span-5.last %h4 On Diaspora = text_field_tag :diaspora_handle, nil, :placeholder => "Diaspora handle" - .span-5.last %h4 On Facebook = text_field_tag :facebook_handle, nil, :placeholder => "Name" - .span-5.last %h4 Invite = text_field_tag :email, nil, :placeholder => "Email", :type => "email" diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index c5cc05e2a..6a1e7e7a7 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -1266,7 +1266,7 @@ ul.aspects :size 24px > li - :padding 12px + :padding 12px 0 :border :bottom 1px solid #eee @@ -1293,3 +1293,14 @@ ul.aspects .inline :display inline + +.floating + :padding 12px + :background + :color rgb(254,254,254) + :-webkit-box-shadow 0 1px 3px #333 + :border-radius 2px + :border + :bottom 1px solid #ccc + :top 1px solid #fff + From f1fbb68fd8aed83e395aa994468be5fe66df515e Mon Sep 17 00:00:00 2001 From: danielvincent Date: Tue, 26 Oct 2010 18:35:14 -0700 Subject: [PATCH 10/26] added success to getting_started. fixed birthday selectors to display years down to 1930. made buttons rounder. all save and continue buttons step forward. --- app/controllers/requests_controller.rb | 7 ++++- app/controllers/services_controller.rb | 1 - app/controllers/users_controller.rb | 3 ++- app/views/people/edit.html.haml | 2 +- app/views/requests/_new_request.haml | 8 +++--- app/views/users/getting_started/1.html.haml | 5 +++- app/views/users/getting_started/2.html.haml | 8 +++--- app/views/users/getting_started/3.html.haml | 29 ++++++++++----------- app/views/users/getting_started/4.html.haml | 27 +++++++++++++++++++ public/stylesheets/sass/application.sass | 20 +++++++++++++- public/stylesheets/sass/ui.sass | 8 +++--- 11 files changed, 85 insertions(+), 33 deletions(-) create mode 100644 app/views/users/getting_started/4.html.haml diff --git a/app/controllers/requests_controller.rb b/app/controllers/requests_controller.rb index 4a10821aa..0f07640fb 100644 --- a/app/controllers/requests_controller.rb +++ b/app/controllers/requests_controller.rb @@ -44,7 +44,12 @@ class RequestsController < ApplicationController else raise e end - respond_with :location => aspect + + if params[:getting_started] + redirect_to getting_started_path(params[:getting_started]) + else + respond_with :location => aspect + end return end diff --git a/app/controllers/services_controller.rb b/app/controllers/services_controller.rb index 7c5da42a7..d5fd50c83 100644 --- a/app/controllers/services_controller.rb +++ b/app/controllers/services_controller.rb @@ -31,7 +31,6 @@ class ServicesController < ApplicationController :uid => auth['uid']) end - flash[:notice] = "Authentication successful." redirect_to services_url end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index fb1fa8e70..9e1f9dd91 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -61,8 +61,9 @@ class UsersController < ApplicationController @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 - if params[:id].to_i < 4 + if params[:id].to_i < 5 render "users/getting_started/#{params[:id]}" else render "users/getting_started/1" diff --git a/app/views/people/edit.html.haml b/app/views/people/edit.html.haml index 4e657eddf..11a3986f5 100644 --- a/app/views/people/edit.html.haml +++ b/app/views/people/edit.html.haml @@ -29,7 +29,7 @@ %h4 Your birthday %br - = select_date Time.now, :order => [:month, :day, :year] + = date_select person, :birthday, :order => [:month, :day, :year], :start_year => 1930, :end_year => Time.now.year %h4 Your bio diff --git a/app/views/requests/_new_request.haml b/app/views/requests/_new_request.haml index 11e6f73c2..1f7355d2a 100644 --- a/app/views/requests/_new_request.haml +++ b/app/views/requests/_new_request.haml @@ -11,10 +11,6 @@ - if @friends_not_in_aspect = render('shared/add_friend_dropdown', :aspect => aspect, :friends => @friends_not_in_aspect) - - - - = form_for Request.new do |fr_request| = fr_request.error_messages @@ -26,5 +22,9 @@ = fr_request.label :destination_url, t(".friends_username") = fr_request.text_field :destination_url = fr_request.hidden_field :aspect_id, :value => aspect.id + + - if defined?(getting_started) + = hidden_field_tag :getting_started, getting_started + = fr_request.submit diff --git a/app/views/users/getting_started/1.html.haml b/app/views/users/getting_started/1.html.haml index 8bb35efd4..ca743df5f 100644 --- a/app/views/users/getting_started/1.html.haml +++ b/app/views/users/getting_started/1.html.haml @@ -36,7 +36,7 @@ %h4 Your birthday %br - = select_date Time.now, :order => [:month, :day, :year] + = date_select person, :birthday, :order => [:month, :day, :year], :start_year => 1930, :end_year => Time.now.year %h4 Your bio @@ -71,3 +71,6 @@ .submit_block = person.submit "Save and continue →" +/.bottom_notification +/ .blue_button +/ SKIP diff --git a/app/views/users/getting_started/2.html.haml b/app/views/users/getting_started/2.html.haml index 3e7fe3175..ffb7e5cc8 100644 --- a/app/views/users/getting_started/2.html.haml +++ b/app/views/users/getting_started/2.html.haml @@ -34,13 +34,13 @@ .floating %h3 Your aspects - %p - Diaspora aspects are mappings of your real-life 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. %h4 Aspect name - form_for Aspect.new, :remote => true do |aspect| - = aspect.text_field :name + = aspect.text_field :name, :style => "display:inline;" = aspect.submit "Add" %ul.aspects @@ -55,7 +55,7 @@ .fancybox_content #add_request_pane - = render "requests/new_request", :aspect => aspect + = 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" diff --git a/app/views/users/getting_started/3.html.haml b/app/views/users/getting_started/3.html.haml index 65fae6637..13725bfc4 100644 --- a/app/views/users/getting_started/3.html.haml +++ b/app/views/users/getting_started/3.html.haml @@ -6,7 +6,7 @@ .span-8.append-1.last %h1{:style => "text-align:right;"} - = "Welcome!" + = "Welcome to Diaspora!" .description Do the stuff below to further complete some things. @@ -20,19 +20,18 @@ .span-15.last .floating - %h3 - Your friends - .description - Find your friends on Diaspora, Facebook, or send them an invite via email. + %h3 Your services + %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 - On Diaspora - = text_field_tag :diaspora_handle, nil, :placeholder => "Diaspora handle" + %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'] !="" - %h4 - On Facebook - = text_field_tag :facebook_handle, nil, :placeholder => "Name" - - %h4 - Invite - = text_field_tag :email, nil, :placeholder => "Email", :type => "email" + .submit_block + = link_to "Save and continue →", getting_started_path(4), :class => "button" diff --git a/app/views/users/getting_started/4.html.haml b/app/views/users/getting_started/4.html.haml new file mode 100644 index 000000000..a1cfef842 --- /dev/null +++ b/app/views/users/getting_started/4.html.haml @@ -0,0 +1,27 @@ +-# 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 + %h1 + You're all set up! + %h3 + = link_to "Continue on to your everyone page, an overview of all of your aspects.", root_path + diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 8e6b2af86..6860a7301 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -1300,10 +1300,28 @@ ul.aspects .floating :padding 12px :background - :color rgb(254,254,254) + :color rgb(255,255,255) :-webkit-box-shadow 0 1px 3px #333 :border-radius 2px :border :bottom 1px solid #ccc :top 1px solid #fff + + +.bottom_notification + :position fixed + :bottom 0 + :left 0 + :width 100% + :background + :color rgba(16,127,201,0.8) + + :text + :align center + :font + :size 16px + :weight bold + :color #fff + :padding 21px + diff --git a/public/stylesheets/sass/ui.sass b/public/stylesheets/sass/ui.sass index e064b3fcf..ff4b3c099 100644 --- a/public/stylesheets/sass/ui.sass +++ b/public/stylesheets/sass/ui.sass @@ -10,7 +10,7 @@ :display inline - :padding 4px + :padding 5px :font-size 12px :line-height 100% @@ -27,9 +27,9 @@ :left 1px solid #ccc :right 1px solid #ccc - :border-radius 3px - :-moz-border-radius 3px - :-webkit-border-radius 3px + :border-radius 8px + :-moz-border-radius 8px + :-webkit-border-radius 8px :cursor pointer From a8086f2990305f03e620227359d8602606e39b7d Mon Sep 17 00:00:00 2001 From: danielvincent Date: Tue, 26 Oct 2010 23:27:26 -0700 Subject: [PATCH 11/26] further refinements. added back buttons, more explanation text. --- app/views/users/getting_started/1.html.haml | 3 -- app/views/users/getting_started/2.html.haml | 9 ++--- app/views/users/getting_started/3.html.haml | 6 +++- app/views/users/getting_started/4.html.haml | 31 ++++++++++++++++- config/locales/diaspora/en.yml | 6 ++++ public/stylesheets/sass/application.sass | 38 ++++++++++++++++++--- 6 files changed, 79 insertions(+), 14 deletions(-) diff --git a/app/views/users/getting_started/1.html.haml b/app/views/users/getting_started/1.html.haml index ca743df5f..395845ec1 100644 --- a/app/views/users/getting_started/1.html.haml +++ b/app/views/users/getting_started/1.html.haml @@ -71,6 +71,3 @@ .submit_block = person.submit "Save and continue →" -/.bottom_notification -/ .blue_button -/ SKIP diff --git a/app/views/users/getting_started/2.html.haml b/app/views/users/getting_started/2.html.haml index ffb7e5cc8..0516cdd9f 100644 --- a/app/views/users/getting_started/2.html.haml +++ b/app/views/users/getting_started/2.html.haml @@ -35,13 +35,13 @@ %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. + 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" + - form_for Aspect.new, :remote => true do |aspect| + = aspect.text_field :name, :style => "display:inline;" + = aspect.submit "Add" %ul.aspects - for aspect in @aspects @@ -63,4 +63,5 @@ %br .submit_block + = link_to "Back", getting_started_path(1), :class => "button" = link_to "Save and continue →", getting_started_path(3), :class => "button" diff --git a/app/views/users/getting_started/3.html.haml b/app/views/users/getting_started/3.html.haml index 13725bfc4..e2271d545 100644 --- a/app/views/users/getting_started/3.html.haml +++ b/app/views/users/getting_started/3.html.haml @@ -20,7 +20,10 @@ .span-15.last .floating - %h3 Your services + %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 @@ -34,4 +37,5 @@ %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" diff --git a/app/views/users/getting_started/4.html.haml b/app/views/users/getting_started/4.html.haml index a1cfef842..c90de31cd 100644 --- a/app/views/users/getting_started/4.html.haml +++ b/app/views/users/getting_started/4.html.haml @@ -21,7 +21,36 @@ .span-15.last .floating %h1 - You're all set up! + = "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/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 91b80deab..0165b8262 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -117,6 +117,12 @@ en: edit: editing_profile: "Editing profile" destroy: "Account successfully closed." + getting_started: + '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." + or: "or" comments: comment: ago: "ago" diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 6860a7301..734a6190c 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -393,8 +393,11 @@ li.message form :position relative - :font - :size 14px + input, + textarea, + label + :font + :size 14px #user_name :margin @@ -596,7 +599,6 @@ li.message .from .right h5 :color #ccc - input:not([type='submit']), textarea :font @@ -612,6 +614,8 @@ textarea :-webkit-border-radius 5px :-moz-border-radius 5px +input[type='checkbox'] + :width auto .submit_block :text @@ -685,7 +689,6 @@ label :display inline .public_toggle - :width 300px :font :size smaller :style italic @@ -1298,6 +1301,7 @@ ul.aspects :display inline .floating + :position relative :padding 12px :background :color rgb(255,255,255) @@ -1306,8 +1310,12 @@ ul.aspects :border :bottom 1px solid #ccc :top 1px solid #fff + :min-height 500px - + .submit_block + :position absolute + :bottom 13px + :right 12px .bottom_notification :position fixed @@ -1325,3 +1333,23 @@ ul.aspects :color #fff :padding 21px + +.inline_aspect_listing + :margin 0 + :padding 0 + :list + :style none + :display inline + > li + :display inline + :font + :weight normal + + &:after + :content ", " + + &:last-child + &:before + :content "and " + &:after + :content "." From b320f5df7295b57b29a8db6342b657d18b47f12a Mon Sep 17 00:00:00 2001 From: danielvincent Date: Wed, 27 Oct 2010 08:45:43 -0700 Subject: [PATCH 12/26] fixed js for changing a user's profile photo on photos#show --- public/javascripts/view.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/javascripts/view.js b/public/javascripts/view.js index 6bb6b45b4..730358083 100644 --- a/public/javascripts/view.js +++ b/public/javascripts/view.js @@ -127,8 +127,8 @@ $(".make_profile_photo").live("click", function(){ $.ajax({ type: "PUT", - url: '/users/'+user_id, - data: {"user":{"profile":{ "image_url": photo_url }}}, + url: '/people/'+user_id, + data: {"person":{"profile":{ "image_url": photo_url }}}, success: function(){ $("img[data-person_id='"+ person_id +"']").each( function() { $(this).attr('src', photo_url); From 4ec11691cd8b031200c352cabf44227045c0febc Mon Sep 17 00:00:00 2001 From: danielvincent Date: Wed, 27 Oct 2010 10:36:13 -0700 Subject: [PATCH 13/26] user has a getting_started flag, set true by default. aspect#index checks to see if getting_started flag is set. --- app/controllers/aspects_controller.rb | 4 +++ app/controllers/users_controller.rb | 23 +++++++++----- app/models/user.rb | 2 +- app/views/layouts/application.html.haml | 2 -- app/views/users/getting_started/1.html.haml | 2 ++ app/views/users/getting_started/2.html.haml | 4 +++ app/views/users/getting_started/3.html.haml | 3 ++ app/views/users/getting_started/4.html.haml | 9 +++++- public/stylesheets/sass/application.sass | 33 +++++++++------------ 9 files changed, 52 insertions(+), 30 deletions(-) diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index 985fb68a9..71927046c 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -11,6 +11,10 @@ class AspectsController < ApplicationController def index @posts = current_user.visible_posts(:by_members_of => :all).paginate :page => params[:page], :per_page => 15, :order => 'created_at DESC' @aspect = :all + + if current_user.getting_started == true + redirect_to getting_started_path(1) + end end def create diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 9e1f9dd91..faa40e425 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -20,14 +20,23 @@ class UsersController < ApplicationController def update @user = current_user - params[:user].delete(:password) if params[:user][:password].blank? - params[:user].delete(:password_confirmation) if params[:user][:password].blank? and params[:user][:password_confirmation].blank? - if params[:user][:password] && params[:user][:password_confirmation] - if @user.update_attributes(:password => params[:user][:password], :password_confirmation => params[:user][:password_confirmation]) - flash[:notice] = "Password Changed" - else - flash[:error] = "Password Change Failed" + if params[:user][:getting_started] + puts "here" + boolean = params[:user][:getting_started] == "true" + @user.update_attributes( :getting_started => boolean ) + redirect_to root_path + + else + params[:user].delete(:password) if params[:user][:password].blank? + params[:user].delete(:password_confirmation) if params[:user][:password].blank? and params[:user][:password_confirmation].blank? + + if params[:user][:password] && params[:user][:password_confirmation] + if @user.update_attributes(:password => params[:user][:password], :password_confirmation => params[:user][:password_confirmation]) + flash[:notice] = "Password Changed" + else + flash[:error] = "Password Change Failed" + end end end diff --git a/app/models/user.rb b/app/models/user.rb index accedb2d3..fa245c290 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -40,7 +40,7 @@ class User key :invite_messages, Hash - key :getting_started, Boolean, :default => false + key :getting_started, Boolean, :default => true before_validation :strip_username, :on => :create validates_presence_of :username diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index f0c74cc50..ddbdc9377 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -69,5 +69,3 @@ .span-24.last = render "posts/debug" - #getting_started_button - = link_to "Getting started", getting_started_path(1) diff --git a/app/views/users/getting_started/1.html.haml b/app/views/users/getting_started/1.html.haml index 395845ec1..8cfb0e747 100644 --- a/app/views/users/getting_started/1.html.haml +++ b/app/views/users/getting_started/1.html.haml @@ -71,3 +71,5 @@ .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 index 0516cdd9f..479523d3d 100644 --- a/app/views/users/getting_started/2.html.haml +++ b/app/views/users/getting_started/2.html.haml @@ -65,3 +65,7 @@ .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 index e2271d545..0ce946d7f 100644 --- a/app/views/users/getting_started/3.html.haml +++ b/app/views/users/getting_started/3.html.haml @@ -39,3 +39,6 @@ .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 index c90de31cd..d635bf9c2 100644 --- a/app/views/users/getting_started/4.html.haml +++ b/app/views/users/getting_started/4.html.haml @@ -3,6 +3,14 @@ -# 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;"} @@ -31,7 +39,6 @@ %br %br - %h3 = link_to "Continue on to your everyone page, an overview of all of your aspects.", root_path diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 734a6190c..14829f35c 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -1246,23 +1246,6 @@ ul#breadcrumb &:after :content '' -#getting_started_button - :position fixed - :bottom 4px - :margin - :left 680px - - a - :padding 10px - :background #333 - :color #eee - - :-webkit-border-radius 5px 5px 0 0 - :-moz-border-radius 5px 5px 0 0 - :border-radius 5px 5px 0 0 - - :-webkit-box-shadow 0 0 2px #666 - ul.aspects :margin 0 :padding 0 @@ -1328,10 +1311,22 @@ ul.aspects :text :align center :font - :size 16px + :size 14px :weight bold :color #fff - :padding 21px + :padding 12px + :bottom 10px + + a + :color #fafafa + :background + :color rgb(16,127,201) + :padding 8px + :border-radius 10px + + &:hover + :background + :color #22AAE0 .inline_aspect_listing From cd726c0ba72dff29811126a3a3e2fc884e45b476 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Wed, 27 Oct 2010 12:21:25 -0700 Subject: [PATCH 14/26] 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($("
    5. " + newAspectName + "
    6. ").fadeIn(200)); - $("#aspect_nav").find("ul").first().find("li:last").before($("
    7. " + newAspectName + "
    8. ").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 From b906dd5a1d62ba2d39a31886d6989ff0b85b53d0 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Wed, 27 Oct 2010 12:31:48 -0700 Subject: [PATCH 15/26] added redirect to getting_started_path in requests#create --- app/controllers/requests_controller.rb | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/app/controllers/requests_controller.rb b/app/controllers/requests_controller.rb index 0f07640fb..ffc845c93 100644 --- a/app/controllers/requests_controller.rb +++ b/app/controllers/requests_controller.rb @@ -46,7 +46,7 @@ class RequestsController < ApplicationController end if params[:getting_started] - redirect_to getting_started_path(params[:getting_started]) + redirect_to getting_started_path(:step=>params[:getting_started]) else respond_with :location => aspect end @@ -66,16 +66,29 @@ class RequestsController < ApplicationController else raise e end - respond_with :location => aspect + + if params[:getting_started] + redirect_to getting_started_path(:step=>params[:getting_started]) + else + respond_with :location => aspect + end return end if @request flash[:notice] = I18n.t 'requests.create.success',:destination_url => @request.destination_url - respond_with :location => aspect + if params[:getting_started] + redirect_to getting_started_path(:step=>params[:getting_started]) + else + respond_with :location => aspect + end else flash[:error] = I18n.t 'requests.create.horribly_wrong' - respond_with :location => aspect + if params[:getting_started] + redirect_to getting_started_path(:step=>params[:getting_started]) + else + respond_with :location => aspect + end end end From 335bd9c96aeb530e688fd4330dde03c85f6dbedc Mon Sep 17 00:00:00 2001 From: danielvincent Date: Wed, 27 Oct 2010 12:53:46 -0700 Subject: [PATCH 16/26] skip getting started button sets getting_started to false via js and redirects to root_path --- app/controllers/users_controller.rb | 5 ++--- app/views/users/getting_started.html.haml | 12 ++++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 3ecf933b1..21182fd94 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -22,7 +22,6 @@ class UsersController < ApplicationController @user = current_user if params[:user][:getting_started] - puts "here" boolean = params[:user][:getting_started] == "true" @user.update_attributes( :getting_started => boolean ) redirect_to root_path @@ -38,9 +37,9 @@ class UsersController < ApplicationController flash[:error] = "Password Change Failed" end end - end - redirect_to edit_user_path(@user) + redirect_to edit_user_path(@user) + end end def destroy diff --git a/app/views/users/getting_started.html.haml b/app/views/users/getting_started.html.haml index 6f69c8de2..71bc63dd0 100644 --- a/app/views/users/getting_started.html.haml +++ b/app/views/users/getting_started.html.haml @@ -3,6 +3,18 @@ -# the COPYRIGHT file. +- if current_user.getting_started == true + :javascript + $("#getting_started_skip").live("click", function(evt){ + evt.preventDefault(); + $.ajax({ + type: "PUT", + url: "/users/#{current_user.id}", + data: {"user":{"getting_started":'false'}}, + success: function() { window.location = "#{root_path}"} + }) + }); + .span-8.append-1.last %h1{:style => "text-align:right;"} = "Welcome to Diaspora!" From bfb1c6df282f7cc57a7f2a2108c611d46ddccdc8 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Wed, 27 Oct 2010 13:33:42 -0700 Subject: [PATCH 17/26] collapsed layout views --- app/controllers/application_controller.rb | 10 --- app/views/devise/passwords/new.html.haml | 21 +++--- app/views/devise/sessions/new.html.haml | 53 +++++++------- app/views/layouts/application.html.haml | 30 ++++---- app/views/layouts/session_wall.html.haml | 53 -------------- app/views/registrations/new.html.haml | 84 +++++++++++------------ 6 files changed, 100 insertions(+), 151 deletions(-) delete mode 100644 app/views/layouts/session_wall.html.haml diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index df08808ae..b4018863b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -10,16 +10,6 @@ class ApplicationController < ActionController::Base before_filter :count_requests before_filter :set_invites - layout :layout_by_resource - - def layout_by_resource - if devise_controller? - "session_wall" - else - "application" - end - end - def set_friends_and_status if current_user if params[:aspect] == nil || params[:aspect] == 'all' diff --git a/app/views/devise/passwords/new.html.haml b/app/views/devise/passwords/new.html.haml index 1d877b70e..d9431bbb8 100644 --- a/app/views/devise/passwords/new.html.haml +++ b/app/views/devise/passwords/new.html.haml @@ -1,9 +1,12 @@ -%h2 Forgot your password? -= form_for(resource, :as => resource_name, :url => password_path(resource_name)) do |f| - = devise_error_messages! - %p - = f.label :email - = f.text_field :email - %p - = f.submit "Send me reset password instructions" -= render :partial => "devise/shared/links" +.span-12.prepend-6.last + .floating + %h3 + Forgot your password? + = form_for(resource, :as => resource_name, :url => password_path(resource_name)) do |f| + = devise_error_messages! + %p + = f.label :email + = f.text_field :email + %p + = f.submit "Send me reset password instructions" + = render :partial => "devise/shared/links" diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml index 5803415b4..852a8afd5 100644 --- a/app/views/devise/sessions/new.html.haml +++ b/app/views/devise/sessions/new.html.haml @@ -1,26 +1,33 @@ -%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!! -= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| - #user - %p.username - = f.label :username - = f.text_field :username - %p.user_network - ="@#{APP_CONFIG[:terse_pod_url]}" +.span-10.append-1.last + .floating + %h3 Login + = form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| + #user + %p.username + = f.label :username + = f.text_field :username + %p.user_network + ="@#{APP_CONFIG[:terse_pod_url]}" + %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.label :password - = f.password_field :password - /%p - /- if devise_mapping.rememberable? - / = f.check_box :remember_me - / = f.label :remember_me - = f.submit "Sign in" - = link_to "Have a problem? Find an answer here", 'http://diaspora.shapado.com/' - %p -= render :partial => "devise/shared/links" + = render :partial => "devise/shared/links" + %p + = link_to "Have a problem? Find an answer here", '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!! diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index ddbdc9377..c7deeda8e 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -31,7 +31,8 @@ = javascript_include_tag 'view', 'image_picker', 'stream' - = render 'js/websocket_js' + - if current_user + = render 'js/websocket_js' = csrf_meta_tag = yield(:head) @@ -43,24 +44,25 @@ %header .container{:style => "position:relative;"} #diaspora_text{:href => root_path} - = link_to "DIASPORA*", root_path + = link_to "DIASPORA*", (current_user ? root_path : new_user_session_path) %span.sub_text PREVIEW - #global_search - = form_tag(people_path, :method => 'get') do - = text_field_tag 'q', nil, :placeholder => "Search", :type => 'search', :results => 5 + - if current_user + #global_search + = form_tag(people_path, :method => 'get') do + = text_field_tag 'q', nil, :placeholder => "Search", :type => 'search', :results => 5 - %ul#user_menu - .avatar - = owner_image_tag - = link_to current_user.real_name, '#' - %li= link_to "view profile", current_user.person - %li= link_to "edit profile", edit_person_path(current_user.person) - %li= link_to "account settings", edit_user_path(current_user) - %li= link_to t('.logout.'), destroy_user_session_path + %ul#user_menu + .avatar + = owner_image_tag + = link_to current_user.real_name, '#' + %li= link_to "view profile", current_user.person + %li= link_to "edit profile", edit_person_path(current_user.person) + %li= link_to "account settings", edit_user_path(current_user) + %li= link_to t('.logout.'), destroy_user_session_path - = render "shared/aspect_nav" + = render "shared/aspect_nav" .container .span-24.last diff --git a/app/views/layouts/session_wall.html.haml b/app/views/layouts/session_wall.html.haml deleted file mode 100644 index bc15063d6..000000000 --- a/app/views/layouts/session_wall.html.haml +++ /dev/null @@ -1,53 +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. - -!!! -%html - %head - %title - DIASPORA | login - %meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/ - %meta{"http-equiv"=> "X-UA-Compatible", :content =>"chrome=1" } - - = stylesheet_link_tag "sessions" - /= javascript_include_tag"http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" - = javascript_include_tag 'jquery142' - = javascript_include_tag 'jquery.infieldlabel' - - :javascript - $(document).ready(function(){ - $("#user_username").focus(); - $("label").inFieldLabels(); - }); - - = csrf_meta_tag - = yield(:head) - - %body - - :plain - - - - flash.each do |name, msg| - = content_tag :div, msg, :id => "flash_#{name}" - %div#huge_text - DIASPORA* - = yield - - /= link_to "signup", "/signup" diff --git a/app/views/registrations/new.html.haml b/app/views/registrations/new.html.haml index cea31ff78..191f885e6 100644 --- a/app/views/registrations/new.html.haml +++ b/app/views/registrations/new.html.haml @@ -1,50 +1,50 @@ -= image_tag "http://needcoffee.cachefly.net/needcoffee/uploads/2009/02/predator-arnold-schwarzenegger.jpg" - -= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| - %p - = f.label :username - = f.text_field :username - %p - = f.label :email - = f.text_field :email - %p - = f.label :password - = f.password_field :password - %p - = f.label :password_confirmation - = f.password_field :password_confirmation - - = f.fields_for :person do |p| - = p.fields_for :profile do |pr| +.span-12.prepend-6.last + .floating + %h3 + Sign up for Diaspora + = image_tag "http://needcoffee.cachefly.net/needcoffee/uploads/2009/02/predator-arnold-schwarzenegger.jpg" + = form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %p - = pr.label :first_name - = pr.text_field :first_name + = f.label :username + = f.text_field :username %p - = pr.label :last_name - = pr.text_field :last_name - = f.submit t('.sign_up') -= render :partial => "devise/shared/links" + = f.label :email + = f.text_field :email + %p + = f.label :password + = f.password_field :password + %p + = f.label :password_confirmation + = f.password_field :password_confirmation + + = f.fields_for :person do |p| + = p.fields_for :profile do |pr| + %p + = pr.label :first_name + = pr.text_field :first_name + %p + = pr.label :last_name + = pr.text_field :last_name + = f.submit t('.sign_up') -%br -%br + .floating + %h3 + Upload an existing Diaspora account -%h2 or, upload yourself + = form_tag '/users/import', :multipart => true do + %p + = label_tag 'user[email]' + = text_field_tag 'user[email]' + %p + = label_tag 'user[password]' + = password_field_tag 'user[password]' + %p + = label_tag 'user[password_confirmation]' + = password_field_tag 'user[password_confirmation]' -= form_tag '/users/import', :multipart => true do - - %p - = label_tag 'user[email]' - = text_field_tag 'user[email]' - %p - = label_tag 'user[password]' - = password_field_tag 'user[password]' - %p - = label_tag 'user[password_confirmation]' - = password_field_tag 'user[password_confirmation]' - - %label Select File - = file_field 'upload', 'file' - = submit_tag "Upload" + %label Select File + = file_field 'upload', 'file' + = submit_tag "Upload" From 05c5e770eee422c75cd6d244fb487ff52a588dfa Mon Sep 17 00:00:00 2001 From: danielvincent Date: Wed, 27 Oct 2010 16:25:22 -0700 Subject: [PATCH 18/26] removed real name from signup process. --- app/controllers/aspects_controller.rb | 2 +- app/models/person.rb | 6 ++- app/models/profile.rb | 1 - app/models/user.rb | 7 ++-- app/views/registrations/new.html.haml | 8 ---- app/views/users/getting_started.html.haml | 2 +- public/stylesheets/sass/application.sass | 1 - .../registrations_controller_spec.rb | 8 +--- spec/models/person_spec.rb | 37 +++++++++++-------- spec/models/profile_spec.rb | 20 ---------- spec/models/user_spec.rb | 2 +- 11 files changed, 34 insertions(+), 60 deletions(-) diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index 71927046c..2cb295f21 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -13,7 +13,7 @@ class AspectsController < ApplicationController @aspect = :all if current_user.getting_started == true - redirect_to getting_started_path(1) + redirect_to getting_started_path end end diff --git a/app/models/person.rb b/app/models/person.rb index 5a1486653..b794c8811 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -58,7 +58,11 @@ class Person end def real_name - "#{profile.first_name.to_s} #{profile.last_name.to_s}" + if profile.first_name.nil? || profile.first_name.empty? + self.diaspora_handle + else + "#{profile.first_name.to_s} #{profile.last_name.to_s}" + end end def owns?(post) diff --git a/app/models/profile.rb b/app/models/profile.rb index 544277ce7..7258c4bfd 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -19,7 +19,6 @@ class Profile key :image_url, String key :bio, String - validates_presence_of :first_name, :last_name after_validation :strip_names before_save :strip_names diff --git a/app/models/user.rb b/app/models/user.rb index fa245c290..eb50ff8e8 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -89,10 +89,6 @@ class User self.person.send(method, *args) end - def real_name - "#{person.profile.first_name.to_s} #{person.profile.last_name.to_s}" - end - ######### Aspects ###################### def aspect(opts = {}) aspect = Aspect.new(opts) @@ -405,12 +401,15 @@ class User ###Helpers############ def self.build(opts = {}) + opts[:person] = {} opts[:person][:diaspora_handle] = "#{opts[:username]}@#{APP_CONFIG[:terse_pod_url]}" opts[:person][:url] = APP_CONFIG[:pod_url] opts[:serialized_private_key] = generate_key opts[:person][:serialized_public_key] = opts[:serialized_private_key].public_key + opts[:person][:profile] = Profile.new + u = User.new(opts) u end diff --git a/app/views/registrations/new.html.haml b/app/views/registrations/new.html.haml index 191f885e6..ea0be2b75 100644 --- a/app/views/registrations/new.html.haml +++ b/app/views/registrations/new.html.haml @@ -17,14 +17,6 @@ = f.label :password_confirmation = f.password_field :password_confirmation - = f.fields_for :person do |p| - = p.fields_for :profile do |pr| - %p - = pr.label :first_name - = pr.text_field :first_name - %p - = pr.label :last_name - = pr.text_field :last_name = f.submit t('.sign_up') diff --git a/app/views/users/getting_started.html.haml b/app/views/users/getting_started.html.haml index 71bc63dd0..da1b6c40f 100644 --- a/app/views/users/getting_started.html.haml +++ b/app/views/users/getting_started.html.haml @@ -30,7 +30,7 @@ %br .span-15.last - .floating + .floating{:style=>"min-height:500px;"} = render "users/getting_started/step_#{@step}", :current_user => current_user - if @step > 1 diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 315b8a41f..61794ba0f 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -1293,7 +1293,6 @@ ul.aspects :border :bottom 1px solid #ccc :top 1px solid #fff - :min-height 500px .submit_block :position absolute diff --git a/spec/controllers/registrations_controller_spec.rb b/spec/controllers/registrations_controller_spec.rb index 3c9bbde07..942e8f5c9 100644 --- a/spec/controllers/registrations_controller_spec.rb +++ b/spec/controllers/registrations_controller_spec.rb @@ -14,11 +14,7 @@ describe RegistrationsController do @valid_params = {"user" => {"username" => "jdoe", "email" => "jdoe@example.com", "password" => "password", - "password_confirmation" => "password", - "person" => { - "profile" => { - "first_name" => "John", - "last_name" => "Doe"}}}} + "password_confirmation" => "password"}} end describe "#create" do @@ -41,7 +37,7 @@ describe RegistrationsController do end context "with invalid parameters" do before do - @valid_params["user"]["person"]["profile"].delete("first_name") + @valid_params["user"]["password_confirmation"] = "baddword" @invalid_params = @valid_params end it "does not create a user" do diff --git a/spec/models/person_spec.rb b/spec/models/person_spec.rb index fa89610af..afbf41d8d 100644 --- a/spec/models/person_spec.rb +++ b/spec/models/person_spec.rb @@ -13,22 +13,6 @@ describe Person do @aspect2 = @user2.aspect(:name => "Abscence of Babes") end - describe "validation" do - describe "of associated profile" do - it "fails if the profile isn't valid" do - person = Factory.build(:person) - person.should be_valid - - person.profile.update_attribute(:first_name, nil) - person.profile.should_not be_valid - person.should_not be_valid - - person.errors.count.should == 1 - person.errors.full_messages.first.should =~ /first name/i - end - end - end - describe '#diaspora_handle' do context 'local people' do it 'uses the pod config url to set the diaspora_handle' do @@ -54,6 +38,27 @@ describe Person do end end + context '#real_name' do + let!(:user) { Factory(:user) } + let!(:person) { user.person } + let!(:profile) { person.profile } + + context 'with first name' do + it 'should return their name for real name' do + person.real_name.should match /#{profile.first_name}|#{profile.last_name}/ + end + end + + context 'without first name' do + it 'should display their diaspora handle' do + person.profile.first_name = nil + person.profile.last_name = nil + person.save! + person.real_name.should == person.diaspora_handle + end + end + end + describe 'xml' do before do @xml = @person.to_xml.to_s diff --git a/spec/models/profile_spec.rb b/spec/models/profile_spec.rb index de2eb6955..fed124726 100644 --- a/spec/models/profile_spec.rb +++ b/spec/models/profile_spec.rb @@ -7,16 +7,6 @@ require 'spec_helper' describe Profile do describe 'validation' do describe "of first_name" do - it "requires first name" do - profile = Factory.build(:profile, :first_name => nil) - profile.should_not be_valid - profile.first_name = "Hortense" - profile.should be_valid - end - it "requires non-empty first name" do - profile = Factory.build(:profile, :first_name => " ") - profile.should_not be_valid - end it "strips leading and trailing whitespace" do profile = Factory.build(:profile, :first_name => " Shelly ") profile.should be_valid @@ -24,16 +14,6 @@ describe Profile do end end describe "of last_name" do - it "requires a last name" do - profile = Factory.build(:profile, :last_name => nil) - profile.should_not be_valid - profile.last_name = "Shankar" - profile.should be_valid - end - it "requires non-empty last name" do - profile = Factory.build(:profile, :last_name => " ") - profile.should_not be_valid - end it "strips leading and trailing whitespace" do profile = Factory.build(:profile, :last_name => " Ohba ") profile.should be_valid diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 351d5347c..dfb5995c0 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -124,7 +124,7 @@ describe User do :username => "ohai", :email => "ohai@example.com", :password => "password", - :password_confirmation => "password", + :password_confirmation => "wrongpasswordz", :person => {:profile => {:first_name => "", :last_name => ""}}} end it "raises no error" do From db1a753add388aa34086e02555a18324aa7a3a7c Mon Sep 17 00:00:00 2001 From: danielvincent Date: Wed, 27 Oct 2010 18:08:55 -0700 Subject: [PATCH 19/26] major hack on getting_started#2 with aspect javascript. reload the page on ajax success on new aspect creation just to get it working. --- app/controllers/aspects_controller.rb | 2 +- app/views/users/getting_started.html.haml | 29 +++++++++++++------ .../users/getting_started/_step_2.html.haml | 2 +- public/stylesheets/sass/application.sass | 6 ++++ 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index 2cb295f21..d5962614b 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -47,7 +47,7 @@ class AspectsController < ApplicationController def show @aspect = current_user.aspect_by_id params[:id] - @friends_not_in_aspect = current_user.friends_not_in_aspect(@aspect) + @friends_not_in_aspect = current_user.friends #current_user.friends_not_in_aspect(@aspect) unless @aspect render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404 else diff --git a/app/views/users/getting_started.html.haml b/app/views/users/getting_started.html.haml index da1b6c40f..5edb3e67a 100644 --- a/app/views/users/getting_started.html.haml +++ b/app/views/users/getting_started.html.haml @@ -3,18 +3,29 @@ -# the COPYRIGHT file. -- if current_user.getting_started == true +- content_for :head do :javascript - $("#getting_started_skip").live("click", function(evt){ - evt.preventDefault(); - $.ajax({ - type: "PUT", - url: "/users/#{current_user.id}", - data: {"user":{"getting_started":'false'}}, - success: function() { window.location = "#{root_path}"} - }) + $("#new_aspect").live("ajax:success", function(data,stat,xhr){ + window.location.reload(); }); + $(".aspects li").find(".delete").live("click", function(){ + var aspectElement = $(this).parent("li"); + aspectElement.fadeOut(300, function(){aspectElement.remove();}); + }); + + - if current_user.getting_started == true + :javascript + $("#getting_started_skip").live("click", function(evt){ + evt.preventDefault(); + $.ajax({ + type: "PUT", + url: "/users/#{current_user.id}", + data: {"user":{"getting_started":'false'}}, + success: function() { window.location = "#{root_path}"} + }) + }); + .span-8.append-1.last %h1{:style => "text-align:right;"} = "Welcome to Diaspora!" diff --git a/app/views/users/getting_started/_step_2.html.haml b/app/views/users/getting_started/_step_2.html.haml index 503ab8f5f..3935cd760 100644 --- a/app/views/users/getting_started/_step_2.html.haml +++ b/app/views/users/getting_started/_step_2.html.haml @@ -10,7 +10,7 @@ %h4 Aspect name - - form_for Aspect.new, :remote => true do |aspect| + - form_for Aspect.new, :remote => true, :format => :json do |aspect| = aspect.text_field :name, :style => "display:inline;" = aspect.submit "Add" diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 61794ba0f..03cdcabf5 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -1355,3 +1355,9 @@ ul.aspects :position absolute :left 12px :bottom 12px + +#user_photo_uploader + .avatar + :border-radius 5px + :height 100px + :width 100px From 59858cd86b0ac5c9227729cd5e23ca5bb10cb7a0 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Wed, 27 Oct 2010 18:34:51 -0700 Subject: [PATCH 20/26] opts[:person] set to empty hash only if not already defined. same with opts[:person][:profile]. rake db:reset works properly again. --- app/models/user.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index b011c7df1..16cc2783e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -407,14 +407,14 @@ class User ###Helpers############ def self.build(opts = {}) - opts[:person] = {} + opts[:person] ||= {} + opts[:person][:profile] ||= Profile.new opts[:person][:diaspora_handle] = "#{opts[:username]}@#{APP_CONFIG[:terse_pod_url]}" opts[:person][:url] = APP_CONFIG[:pod_url] opts[:serialized_private_key] = generate_key opts[:person][:serialized_public_key] = opts[:serialized_private_key].public_key - opts[:person][:profile] = Profile.new u = User.new(opts) u From dc89d984f1db02f28c3d0d18cd153b6f60363466 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Wed, 27 Oct 2010 18:36:15 -0700 Subject: [PATCH 21/26] put remove buttons on incoming requests, allowing a user to ignore again. --- app/views/aspects/manage.html.haml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/views/aspects/manage.html.haml b/app/views/aspects/manage.html.haml index a49030d34..cbc5c0ff1 100644 --- a/app/views/aspects/manage.html.haml +++ b/app/views/aspects/manage.html.haml @@ -22,6 +22,10 @@ - else - for request in @remote_requests %li.person.request{:data=>{:guid=>request.id, :person_id=>request.person.id}} + .delete + .x + X + .circle = person_image_tag(request.person) %h3 Remove from Aspect From 06654b13b2d1580c4d84000f4ff54a01b98d386d Mon Sep 17 00:00:00 2001 From: danielvincent Date: Wed, 27 Oct 2010 22:55:58 -0700 Subject: [PATCH 22/26] posts don't socket into services#index anymore. --- app/views/services/index.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/services/index.html.haml b/app/views/services/index.html.haml index 8d00f8eb3..ee298eb34 100644 --- a/app/views/services/index.html.haml +++ b/app/views/services/index.html.haml @@ -14,7 +14,7 @@ %h2 Services - %ul#stream + %ul - for service in @services %h3 %b= service.provider From bb9a6e47a4af4bf7fa50f48cd7a868fd28e1ad81 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Thu, 28 Oct 2010 11:01:16 -0700 Subject: [PATCH 23/26] added birthday and gender to Profile. fixed a view issue on getting_started#2 --- app/controllers/people_controller.rb | 6 ++++++ app/models/profile.rb | 4 ++++ app/views/people/edit.html.haml | 7 ++++++- app/views/users/getting_started/_step_1.html.haml | 7 ++++++- app/views/users/getting_started/_step_2.html.haml | 2 +- 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index 512f47ed2..f76f1c6e6 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -41,6 +41,12 @@ class PeopleController < ApplicationController end def update + # convert date selector into proper timestamp + birthday = params[:date] + if birthday + params[:person][:profile][:birthday] ||= Date.parse("#{birthday[:year]}-#{birthday[:month]}-#{birthday[:day]}") + end + prep_image_url(params[:person]) if current_user.update_profile params[:person][:profile] diff --git a/app/models/profile.rb b/app/models/profile.rb index 7258c4bfd..8848cd823 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -12,11 +12,15 @@ class Profile xml_reader :first_name xml_reader :last_name xml_reader :image_url + xml_reader :birthday + xml_reader :gender xml_reader :bio key :first_name, String key :last_name, String key :image_url, String + key :birthday, Date + key :gender, String key :bio, String after_validation :strip_names diff --git a/app/views/people/edit.html.haml b/app/views/people/edit.html.haml index 11a3986f5..29e10d757 100644 --- a/app/views/people/edit.html.haml +++ b/app/views/people/edit.html.haml @@ -26,10 +26,15 @@ = 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 gender + %br + = select_tag 'person[profile][gender]', options_for_select(["","Female","Male"], @person.profile.gender) + %h4 Your birthday %br - = date_select person, :birthday, :order => [:month, :day, :year], :start_year => 1930, :end_year => Time.now.year + = select_date @person.profile.birthday, :order => [:month, :day, :year], :start_year => 1930, :end_year => 2000 %h4 Your bio diff --git a/app/views/users/getting_started/_step_1.html.haml b/app/views/users/getting_started/_step_1.html.haml index d57d0b119..7778a39f8 100644 --- a/app/views/users/getting_started/_step_1.html.haml +++ b/app/views/users/getting_started/_step_1.html.haml @@ -17,10 +17,15 @@ = 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 gender + %br + = select_tag 'person[profile][gender]', options_for_select(["","Female","Male"], @person.profile.gender) + %h4 Your birthday %br - = date_select person, :birthday, :order => [:month, :day, :year], :start_year => 1930, :end_year => Time.now.year + = select_date @person.profile.birthday, :order => [:month, :day, :year], :start_year => 1930, :end_year => 2000 %h4 Your bio diff --git a/app/views/users/getting_started/_step_2.html.haml b/app/views/users/getting_started/_step_2.html.haml index 3935cd760..bed14bd33 100644 --- a/app/views/users/getting_started/_step_2.html.haml +++ b/app/views/users/getting_started/_step_2.html.haml @@ -19,7 +19,7 @@ %li{:style=>"position:relative;"} = aspect .friend_pictures.horizontal - - for friend in aspect.people + - for friend in aspect.person_objects = person_image_link(friend) = link_to (image_tag('add_friend_button.png', :title => "add to #{aspect}")), "#add_request_pane", :class => 'add_request_button' From 6626b009618e32450c078e98c85df63201943cc2 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Thu, 28 Oct 2010 11:11:05 -0700 Subject: [PATCH 24/26] fix on aspect#show in @friends_not_in_aspect --- app/controllers/aspects_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index 14e796833..9aa0c1d3a 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -47,7 +47,7 @@ class AspectsController < ApplicationController def show @aspect = current_user.aspect_by_id params[:id] - @friends_not_in_aspect = current_user.friends #current_user.friends_not_in_aspect(@aspect) + @friends_not_in_aspect = current_user.friends_not_in_aspect(@aspect) unless @aspect render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404 else From a0d83e28a188bda6c9169f588965d55cd7bbe0b9 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Thu, 28 Oct 2010 11:28:58 -0700 Subject: [PATCH 25/26] copy in manage page by clicking 'add a new friend' for now --- app/controllers/aspects_controller.rb | 7 +++++-- app/views/aspects/manage.html.haml | 2 +- app/views/requests/_new_request.haml | 5 +++-- app/views/shared/_add_friend_dropdown.html.haml | 2 ++ 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index 9aa0c1d3a..6887e4bee 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -47,7 +47,6 @@ class AspectsController < ApplicationController def show @aspect = current_user.aspect_by_id params[:id] - @friends_not_in_aspect = current_user.friends_not_in_aspect(@aspect) unless @aspect render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404 else @@ -90,7 +89,11 @@ class AspectsController < ApplicationController flash[:error] = I18n.t 'aspects.add_to_aspect.failure' end - redirect_to aspect_path(params[:aspect_id]) + if params[:manage] + redirect_to aspects_manage_path + else + redirect_to aspect_path(params[:aspect_id]) + end end def remove_from_aspect diff --git a/app/views/aspects/manage.html.haml b/app/views/aspects/manage.html.haml index cbc5c0ff1..77ca7750d 100644 --- a/app/views/aspects/manage.html.haml +++ b/app/views/aspects/manage.html.haml @@ -67,6 +67,6 @@ .fancybox_content %div{:id => "add_request_pane_#{aspect.id}"} - = render "requests/new_request", :aspect => aspect + = render "requests/new_request", :aspect => aspect, :manage => true diff --git a/app/views/requests/_new_request.haml b/app/views/requests/_new_request.haml index 1f7355d2a..0ec66d163 100644 --- a/app/views/requests/_new_request.haml +++ b/app/views/requests/_new_request.haml @@ -8,8 +8,7 @@ =t('.add_a_new_friend_to') %i= aspect.name - - if @friends_not_in_aspect - = render('shared/add_friend_dropdown', :aspect => aspect, :friends => @friends_not_in_aspect) + = render 'shared/add_friend_dropdown', :aspect => aspect, :friends => current_user.friends_not_in_aspect(aspect), :manage => defined?(manage) = form_for Request.new do |fr_request| = fr_request.error_messages @@ -25,6 +24,8 @@ - if defined?(getting_started) = hidden_field_tag :getting_started, getting_started + - if defined?(manage) + = hidden_field_tag :manage, true = fr_request.submit diff --git a/app/views/shared/_add_friend_dropdown.html.haml b/app/views/shared/_add_friend_dropdown.html.haml index ee39fc6ad..6ca34e534 100644 --- a/app/views/shared/_add_friend_dropdown.html.haml +++ b/app/views/shared/_add_friend_dropdown.html.haml @@ -2,4 +2,6 @@ = form_tag '/aspects/add_to_aspect', :id => 'add_to_aspect' do = select_tag :friend_id, options_from_collection_for_select(friends, "id", "real_name"), :include_blank => true = hidden_field_tag :aspect_id, aspect.id + - if defined?(manage) + = hidden_field_tag :manage, true = submit_tag "add to #{aspect.name}" From d02c36b53a66fb5b5616606692b6157b09a39b4a Mon Sep 17 00:00:00 2001 From: danielvincent Date: Thu, 28 Oct 2010 11:30:45 -0700 Subject: [PATCH 26/26] quickfix in add_friend_dropdown --- app/views/shared/_add_friend_dropdown.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/shared/_add_friend_dropdown.html.haml b/app/views/shared/_add_friend_dropdown.html.haml index 6ca34e534..062f534b8 100644 --- a/app/views/shared/_add_friend_dropdown.html.haml +++ b/app/views/shared/_add_friend_dropdown.html.haml @@ -2,6 +2,6 @@ = form_tag '/aspects/add_to_aspect', :id => 'add_to_aspect' do = select_tag :friend_id, options_from_collection_for_select(friends, "id", "real_name"), :include_blank => true = hidden_field_tag :aspect_id, aspect.id - - if defined?(manage) + - if defined?(manage) && manage = hidden_field_tag :manage, true = submit_tag "add to #{aspect.name}"