Saving of first name

This commit is contained in:
Ilya Zhitomirskiy 2011-10-19 12:10:09 -07:00 committed by danielgrippi
parent bfd2d440d1
commit 49b46f09cd
4 changed files with 27 additions and 9 deletions

View file

@ -82,10 +82,8 @@
= text_field_tag 'profile[first_name]', current_user.person.profile.first_name, :placeholder => t('profiles.edit.first_name') = 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" = image_tag 'ajax-loader.gif', :id => "form_spinner", :class => "hidden"
%span.saved{:class => "hidden"} %span.saved{:class => "hidden"}
Saved! = image_tag 'icons/check_yes_ok.png'
= t(".saved")
/%br
/= submit_tag "Save"
.span-7.last .span-7.last
= render 'photos/new_profile_photo', :aspect => :getting_started, :person => current_user.person = render 'photos/new_profile_photo', :aspect => :getting_started, :person => current_user.person

View file

@ -903,6 +903,8 @@ en:
what_are_you_in_to: "What are you in to?" what_are_you_in_to: "What are you in to?"
hashtag_explanation: "Hashtags allow you to talk about and follow your interests. They're also a great way to find new people on Diaspora." hashtag_explanation: "Hashtags allow you to talk about and follow your interests. They're also a great way to find new people on Diaspora."
saved: "Saved!"
update: update:
password_changed: "Password changed. You can now log in with your new password." password_changed: "Password changed. You can now log in with your new password."
password_not_changed: "Password change failed" password_not_changed: "Password change failed"

View file

@ -5,14 +5,25 @@ Diaspora.Pages.UsersGettingStarted = function() {
self.peopleSearch = self.instantiate("Search", body.find("form.people.search_form")); self.peopleSearch = self.instantiate("Search", body.find("form.people.search_form"));
self.tagSearch = self.instantiate("Search", body.find("form.tag_input.search_form")); self.tagSearch = self.instantiate("Search", body.find("form.tag_input.search_form"));
$('#edit_profile').bind('ajax:success', function(evt, data, status, xhr){
$('#form_spinner').addClass("hidden");
$('.profile .saved').show();
$('.profile .saved').fadeOut(2000);
});
// It seems that the default behavior of rails ujs is to clear the remote form
$('#edit_profile').bind('ajax:complete', function(evt, xhr, status){
var firstNameField = $("#profile_first_name");
firstNameField.val(firstNameField.data("cachedValue"));
});
$("#profile_first_name").bind("change", function(){ $("#profile_first_name").bind("change", function(){
$('#edit_profile').bind('ajax:success', function(evt, data, status, xhr){ $(this).data("cachedValue", $(this).val());
$('#form_spinner').addClass("hidden");
$('.profile .saved').removeClass("hidden");
$('.profile .saved').fadeOut(2000);
});
$('#edit_profile').submit(); $('#edit_profile').submit();
$('#form_spinner').removeClass("hidden"); $('#form_spinner').removeClass("hidden");
}); });
}); });
}; };

View file

@ -3230,6 +3230,13 @@ ul#getting_started
.button .button
:top 20px :top 20px
.saved
img
:position relative
:top 4px
:right 2px
#right_service_icons #right_service_icons
:text-align center :text-align center
:padding 10px :padding 10px