mirror of
https://github.com/diaspora/diaspora.git
synced 2026-01-10 07:38:10 -05:00
ajax form on the getting started
This commit is contained in:
committed by
danielgrippi
parent
80216cb024
commit
bfd2d440d1
@@ -38,30 +38,30 @@ class ProfilesController < ApplicationController
|
||||
:id => params[:photo_id]).first if params[:photo_id]
|
||||
|
||||
if current_user.update_profile params[:profile]
|
||||
flash[:notice] = I18n.t 'profiles.update.updated'
|
||||
if current_user.getting_started?
|
||||
respond_to do |format|
|
||||
format.js { render :nothing => true, :status => 200 }
|
||||
format.html { redirect_to getting_started_path }
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.js { render :nothing => true, :status => 200 }
|
||||
format.html { redirect_to edit_profile_path }
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js { render :nothing => true, :status => 200 }
|
||||
format.html {
|
||||
flash[:notice] = I18n.t 'profiles.update.updated'
|
||||
if current_user.getting_started?
|
||||
|
||||
redirect_to getting_started_path
|
||||
else
|
||||
redirect_to edit_profile_path
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
else
|
||||
flash[:error] = I18n.t 'profiles.update.failed'
|
||||
if params[:getting_started]
|
||||
respond_to do |format|
|
||||
format.js { render :nothing => true, :status => 409 }
|
||||
format.html { redirect_to getting_started_path(:step => params[:getting_started]) }
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.js { render :nothing => true, :status => 409 }
|
||||
format.html { redirect_to edit_profile_path }
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js { render :nothing => true, :status => 200 }
|
||||
format.html {
|
||||
flash[:error] = I18n.t 'profiles.update.failed'
|
||||
if params[:getting_started]
|
||||
redirect_to getting_started_path(:step => params[:getting_started])
|
||||
else
|
||||
redirect_to edit_profile_path
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -75,11 +75,17 @@
|
||||
to Diaspora. We can pull your name and photo, and enable cross-positng.
|
||||
|
||||
.span-12
|
||||
= form_for current_user.person.profile do |profile|
|
||||
/= form_for(current_user.person.profile, :remote => true) do |profile|
|
||||
|
||||
= form_tag profile_path, :method => :put, :remote => true, :id => 'edit_profile' do |profile|
|
||||
.span-5
|
||||
= profile.text_field :first_name, :placeholder => t('profiles.edit.first_name')
|
||||
%br
|
||||
= profile.submit "Save"
|
||||
= text_field_tag 'profile[first_name]', current_user.person.profile.first_name, :placeholder => t('profiles.edit.first_name')
|
||||
= image_tag 'ajax-loader.gif', :id => "form_spinner", :class => "hidden"
|
||||
%span.saved{:class => "hidden"}
|
||||
Saved!
|
||||
|
||||
/%br
|
||||
/= submit_tag "Save"
|
||||
|
||||
.span-7.last
|
||||
= render 'photos/new_profile_photo', :aspect => :getting_started, :person => current_user.person
|
||||
|
||||
@@ -4,5 +4,15 @@ Diaspora.Pages.UsersGettingStarted = function() {
|
||||
this.subscribe("page/ready", function(evt, body) {
|
||||
self.peopleSearch = self.instantiate("Search", body.find("form.people.search_form"));
|
||||
self.tagSearch = self.instantiate("Search", body.find("form.tag_input.search_form"));
|
||||
|
||||
$("#profile_first_name").bind("change", function(){
|
||||
$('#edit_profile').bind('ajax:success', function(evt, data, status, xhr){
|
||||
$('#form_spinner').addClass("hidden");
|
||||
$('.profile .saved').removeClass("hidden");
|
||||
$('.profile .saved').fadeOut(2000);
|
||||
});
|
||||
$('#edit_profile').submit();
|
||||
$('#form_spinner').removeClass("hidden");
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user