Merge branch 'develop' of bitbucket.org:jamkazam/jam-cloud into develop

This commit is contained in:
Seth Call 2014-07-31 10:34:21 -05:00
commit e248d7dea2
8 changed files with 48 additions and 9 deletions

View File

@ -4,7 +4,9 @@
context.JK = context.JK || {};
context.JK.AccountProfileScreen = function(app) {
var $document = $(document);
var logger = context.JK.logger;
var EVENTS = context.JK.EVENTS;
var api = context.JK.Rest();
var userId;
var user = {};
@ -63,6 +65,7 @@
$('select#user_birth_date_1i', content_root).val(parseInt(birthDateYear));
$('select#user_birth_date_2i', content_root).val(parseInt(birthDateMonth));
$('select#user_birth_date_3i', content_root).val(parseInt(birthDateDay));
}
// update instruments
@ -87,6 +90,7 @@
}
context.JK.dropdown($('select', content_root));
}
function isUserInstrument(instrument, userInstruments) {
@ -317,7 +321,9 @@
.always(function() { loadingCitiesData = false;})
}
}
})
context.JK.dropdown($('select'));
}
function navToAccount() {
@ -366,6 +372,9 @@
},
null,
true);
$document.triggerHandler(EVENTS.USER_UPDATED, response);
}
function postUpdateProfileFailure(xhr, textStatus, errorMessage) {

View File

@ -6,6 +6,7 @@
context.JK.AccountProfileAvatarScreen = function(app) {
var self = this;
var logger = context.JK.logger;
var EVENTS = context.JK.EVENTS;
var rest = context.JK.Rest();
var user = {};
var tmpUploadPath = null;
@ -381,9 +382,9 @@
self.userDetail = response;
// notify any listeners that the avatar changed
userDropdown.loadMe();
// userDropdown.loadMe();
// $('.avatar_large img').trigger('avatar_changed', [self.userDetail.photo_url]);
$(document).triggerHandler(EVENTS.USER_UPDATED, response);
app.notify(
{ title: "Avatar Changed",
text: "You have updated your avatar successfully."

View File

@ -32,8 +32,9 @@
SHOW_SIGNUP : 'show_signup',
SHOW_SIGNIN : 'show_signin',
RSVP_SUBMITTED: 'rsvp_submitted',
RSVP_CANCELED : 'rsvp_canceled'
}
RSVP_CANCELED : 'rsvp_canceled',
USER_UPDATED : 'user_updated'
};
context.JK.ALERT_NAMES = {
NO_EVENT : 0,

View File

@ -6,7 +6,7 @@
context.JK = context.JK || {};
context.JK.UserDropdown = function (app) {
var EVENTS = context.JK.EVENTS;
var logger = context.JK.logger;
var rest = new JK.Rest();
var userMe = null;
@ -53,12 +53,16 @@
$('.shortcuts .test-network').on('click', function(e) {
app.layout.showDialog('network-test');
return false;
})
});
$('#header-avatar').on('avatar_changed', function (event, newAvatarUrl) {
updateAvatar(newAvatarUrl);
event.preventDefault();
return false;
});
$(document).on(EVENTS.USER_UPDATED, function(e, data) {
userMe = data;
updateHeader();
})
}
@ -115,5 +119,8 @@
loadMe();
}
this.loadMe = loadMe;
}
})(window, jQuery);
})(window, jQuery);

View File

@ -79,7 +79,7 @@
<div class="field right w45 birth_date">
<label>Birth Date:</label>
<%= date_select("user", "birth_date", :use_short_month => true, :start_year => 1900, :end_year => Time.now.year - 18, :order => [:month, :day, :year], :default => -25.years.from_now) %>
<%= date_select("user", "birth_date", :use_short_month => true, :start_year => 1900, :end_year => Time.now.year - 18, :order => [:month, :day, :year], :default => -25.years.from_now, :html=>{:class => "account-profile-birthdate"} ) %>
</div>
<br class="clearall"/>

View File

@ -11,7 +11,7 @@ describe "Account", :js => true, :type => :feature, :capybara_feature => true do
emulate_client
sign_in_poltergeist user
visit "/client#/account"
find('div.account-mid.identity')
end
@ -99,7 +99,25 @@ describe "Account", :js => true, :type => :feature, :capybara_feature => true do
user.subscribe_email.should be_false
user.first_name.should == "Bobby"
user.last_name.should == "Toes"
should have_selector('#profile #user', text: 'Bobby Toes')
# Update birth date and check updated birth date
jk_select("Jan", '#account-edit-profile-form #user_birth_date_2i')
jk_select("12", '#account-edit-profile-form #user_birth_date_3i')
jk_select("1960", '#account-edit-profile-form #user_birth_date_1i')
find("#account-edit-profile-submit").trigger(:click)
user.reload
user.birth_date == "1960-01-12"
should have_selector('#account-edit-profile-form .birth_date li.active', text: "Jan")
should have_selector('#account-edit-profile-form .birth_date li.active', text: "12")
should have_selector('#account-edit-profile-form .birth_date li.active', text: "1960")
}
end
describe "unsuccessfully" do

View File

@ -18,6 +18,9 @@ describe "Avatar", :js => true, :type => :feature, :capybara_feature => true do
visit "/client#/account/profile/avatar"
find('#account-edit-avatar-upload')
# within_frame 'filepicker_dialog' do
# attach_file '#fileUploadInput', Rails.root.join('spec', 'files', 'avatar.jpg')
# end
end
it {

BIN
web/spec/files/avatar.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB