From db1a753add388aa34086e02555a18324aa7a3a7c Mon Sep 17 00:00:00 2001 From: danielvincent <danielgrippi@gmail.com> Date: Wed, 27 Oct 2010 18:08:55 -0700 Subject: [PATCH] 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 2cb295f213..d5962614bb 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 da1b6c40fb..5edb3e67a0 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 503ab8f5f2..3935cd7608 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 61794ba0f1..03cdcabf5a 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 -- GitLab