Merge branch 'develop' of bitbucket.org:jamkazam/jam-cloud into develop
This commit is contained in:
commit
f003fb2501
|
|
@ -81,7 +81,7 @@ notification_band_invite.sql
|
|||
band_photo_filepicker.sql
|
||||
bands_geocoding.sql
|
||||
store_s3_filenames.sql
|
||||
icecast.sql
|
||||
discardable_recorded_tracks.sql
|
||||
music_sessions_have_claimed_recording.sql
|
||||
discardable_recorded_tracks2.sql
|
||||
icecast.sql
|
||||
|
|
|
|||
|
|
@ -62,6 +62,11 @@
|
|||
|
||||
$("#band-setup-step-1").show();
|
||||
$("#band-setup-step-2").hide();
|
||||
|
||||
$('#band-invitee-input')
|
||||
.unbind('blur')
|
||||
.attr("placeholder", "Looking up friends...")
|
||||
.prop('disabled', true)
|
||||
}
|
||||
|
||||
function resetGenres() {
|
||||
|
|
@ -290,25 +295,34 @@
|
|||
|
||||
// TODO: this is repeated in createSession.js
|
||||
function loadFriends() {
|
||||
var friends = rest.getFriends({ id: context.JK.currentUserId });
|
||||
$.each(friends, function() {
|
||||
userNames.push(this.name);
|
||||
userIds.push(this.id);
|
||||
userPhotoUrls.push(this.photo_url);
|
||||
});
|
||||
rest.getFriends({ id: context.JK.currentUserId })
|
||||
.done(function(friends) {
|
||||
$.each(friends, function() {
|
||||
userNames.push(this.name);
|
||||
userIds.push(this.id);
|
||||
userPhotoUrls.push(this.photo_url);
|
||||
});
|
||||
|
||||
var autoCompleteOptions = {
|
||||
lookup: { suggestions: userNames, data: userIds },
|
||||
onSelect: addInvitation
|
||||
};
|
||||
if (!autoComplete) {
|
||||
autoComplete = $('#band-invitee-input').autocomplete(autoCompleteOptions);
|
||||
}
|
||||
else {
|
||||
autoComplete.setOptions(autoCompleteOptions);
|
||||
}
|
||||
var autoCompleteOptions = {
|
||||
lookup: { suggestions: userNames, data: userIds },
|
||||
onSelect: addInvitation
|
||||
};
|
||||
|
||||
$(".autocomplete").width("150px");
|
||||
$('#band-invitee-input').attr("placeholder", "Type a friend\'s name").prop('disabled', false);
|
||||
|
||||
if (!autoComplete) {
|
||||
autoComplete = $('#band-invitee-input').autocomplete(autoCompleteOptions);
|
||||
}
|
||||
else {
|
||||
autoComplete.setOptions(autoCompleteOptions);
|
||||
}
|
||||
|
||||
$(".autocomplete").width("150px");
|
||||
})
|
||||
.fail(function() {
|
||||
$('#band-invitee-input').attr("placeholder", "Unable to lookup friends");
|
||||
app.ajaxError(arguments)
|
||||
});
|
||||
}
|
||||
|
||||
function loadGenres(selectedGenres) {
|
||||
|
|
@ -455,14 +469,7 @@
|
|||
$('#selected-band-invitees').on("click", ".invitation a", removeInvitation);
|
||||
|
||||
// friend input focus
|
||||
$('#band-invitee-input').focus(function() {
|
||||
$(this).val('');
|
||||
});
|
||||
|
||||
// friend input blur
|
||||
$('#band-invitee-input').blur(function() {
|
||||
$(this).val('Type a friend\'s name');
|
||||
});
|
||||
$('#band-invitee-input').focus(function() { $(this).val(''); });
|
||||
|
||||
$('#btn-band-setup-cancel').click(function() {
|
||||
resetForm();
|
||||
|
|
|
|||
|
|
@ -28,25 +28,34 @@
|
|||
function afterShow(data) {
|
||||
friendSelectorDialog.setCallback(friendSelectorCallback);
|
||||
|
||||
var friends = rest.getFriends({ id: context.JK.currentUserId });
|
||||
$.each(friends, function() {
|
||||
userNames.push(this.name);
|
||||
userIds.push(this.id);
|
||||
userPhotoUrls.push(this.photo_url);
|
||||
});
|
||||
var friends = rest.getFriends({ id: context.JK.currentUserId })
|
||||
.done(function(friends) {
|
||||
$.each(friends, function() {
|
||||
userNames.push(this.name);
|
||||
userIds.push(this.id);
|
||||
userPhotoUrls.push(this.photo_url);
|
||||
});
|
||||
|
||||
var autoCompleteOptions = {
|
||||
lookup: { suggestions: userNames, data: userIds },
|
||||
onSelect: addInvitation
|
||||
};
|
||||
if (!autoComplete) {
|
||||
autoComplete = $('#friend-input').autocomplete(autoCompleteOptions);
|
||||
}
|
||||
else {
|
||||
autoComplete.setOptions(autoCompleteOptions);
|
||||
}
|
||||
var autoCompleteOptions = {
|
||||
lookup: { suggestions: userNames, data: userIds },
|
||||
onSelect: addInvitation
|
||||
};
|
||||
|
||||
$(".autocomplete").width("150px");
|
||||
$('#friend-input').attr("placeholder", "Type a friend\'s name").prop('disabled', false);
|
||||
|
||||
if (!autoComplete) {
|
||||
autoComplete = $('#friend-input').autocomplete(autoCompleteOptions);
|
||||
}
|
||||
else {
|
||||
autoComplete.setOptions(autoCompleteOptions);
|
||||
}
|
||||
|
||||
$(".autocomplete").width("150px");
|
||||
})
|
||||
.fail(function() {
|
||||
$('#friend-input').attr("placeholder", "Unable to lookup friends");
|
||||
app.ajaxError(arguments);
|
||||
});
|
||||
}
|
||||
|
||||
function friendSelectorCallback(newSelections) {
|
||||
|
|
@ -101,6 +110,11 @@
|
|||
var fan_chat = sessionSettings.hasOwnProperty('fan_chat') ? sessionSettings.fan_chat : false;
|
||||
$('#fan-chat-option-' + fan_chat).iCheck('check').attr('checked', 'checked');
|
||||
}
|
||||
|
||||
$('#friend-input')
|
||||
.unbind('blur')
|
||||
.attr("placeholder", "Looking up friends...")
|
||||
.prop('disabled', true)
|
||||
// Should easily be able to grab other items out of sessionSettings and put them into the appropriate ui elements.
|
||||
}
|
||||
|
||||
|
|
@ -267,6 +281,7 @@
|
|||
}
|
||||
|
||||
function events() {
|
||||
$('#create-session-form').on('submit', submitForm);
|
||||
$('#btn-create-session').on("click", submitForm);
|
||||
$('#selected-friends').on("click", ".invitation a", removeInvitation);
|
||||
$('#musician-access').change(toggleMusicianAccess);
|
||||
|
|
@ -288,15 +303,7 @@
|
|||
invitationDialog.showFacebookDialog();
|
||||
});
|
||||
|
||||
// friend input focus
|
||||
$('#friend-input').focus(function() {
|
||||
$(this).val('');
|
||||
});
|
||||
|
||||
// friend input blur
|
||||
$('#friend-input').blur(function() {
|
||||
$(this).val('Type a friend\'s name');
|
||||
});
|
||||
$('#friend-input').focus(function() { $(this).val(''); })
|
||||
}
|
||||
|
||||
function toggleMusicianAccess() {
|
||||
|
|
|
|||
|
|
@ -308,7 +308,9 @@
|
|||
function SessionStartRecording() {}
|
||||
function SessionStopPlay() {}
|
||||
function SessionStopRecording() {}
|
||||
|
||||
function isSessionTrackPlaying() { return false; }
|
||||
function SessionCurrrentPlayPosMs() { return 0; }
|
||||
function SessionGetTracksPlayDurationMs() { return 0; }
|
||||
function SessionGetDeviceLatency() { return 10.0; }
|
||||
|
||||
function SessionGetMasterLocalMix() {
|
||||
|
|
@ -641,6 +643,10 @@
|
|||
this.SessionStartRecording = SessionStartRecording;
|
||||
this.SessionStopPlay = SessionStopPlay;
|
||||
this.SessionStopRecording = SessionStopRecording;
|
||||
this.isSessionTrackPlaying = isSessionTrackPlaying;
|
||||
this.SessionCurrrentPlayPosMs = SessionCurrrentPlayPosMs;
|
||||
this.SessionGetTracksPlayDurationMs = SessionGetTracksPlayDurationMs;
|
||||
|
||||
this.SetVURefreshRate = SetVURefreshRate;
|
||||
this.SessionGetMasterLocalMix = SessionGetMasterLocalMix;
|
||||
this.SessionSetMasterLocalMix = SessionSetMasterLocalMix;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/api/search.json?" + queryString,
|
||||
async: true,
|
||||
success: afterLoadBands,
|
||||
error: app.ajaxError
|
||||
});
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/api/search.json?" + queryString,
|
||||
async: true,
|
||||
success: afterLoadMusicians,
|
||||
error: app.ajaxError
|
||||
});
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@
|
|||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/api/sessions?" + queryString,
|
||||
async: true,
|
||||
success: afterLoadSessions,
|
||||
complete: removeSpinner,
|
||||
error: app.ajaxError
|
||||
|
|
|
|||
|
|
@ -18,31 +18,33 @@
|
|||
$('#friend-selector-list').empty();
|
||||
|
||||
var template = $('#template-friend-selection').html();
|
||||
var friends = rest.getFriends({ id: context.JK.currentUserId });
|
||||
$.each(friends, function(index, val) {
|
||||
var id = val.id;
|
||||
var isSelected = selectedIds[id];
|
||||
var friends = rest.getFriends({ id: context.JK.currentUserId })
|
||||
.done(function(friends) {
|
||||
$.each(friends, function(index, val) {
|
||||
var id = val.id;
|
||||
var isSelected = selectedIds[id];
|
||||
|
||||
var html = context.JK.fillTemplate(template, {
|
||||
userId: id,
|
||||
css_class: isSelected ? 'selected' : '',
|
||||
userName: val.name,
|
||||
avatar_url: context.JK.resolveAvatarUrl(val.photo_url),
|
||||
status: "",
|
||||
status_img_url: "",
|
||||
check_mark_display: isSelected ? "block" : "none",
|
||||
status_img_display: "none"
|
||||
});
|
||||
var html = context.JK.fillTemplate(template, {
|
||||
userId: id,
|
||||
css_class: isSelected ? 'selected' : '',
|
||||
userName: val.name,
|
||||
avatar_url: context.JK.resolveAvatarUrl(val.photo_url),
|
||||
status: "",
|
||||
status_img_url: "",
|
||||
check_mark_display: isSelected ? "block" : "none",
|
||||
status_img_display: "none"
|
||||
});
|
||||
|
||||
$('#friend-selector-list').append(html);
|
||||
$('#friend-selector-list').append(html);
|
||||
|
||||
// disable row click if it was chosen on parent screen
|
||||
if (!isSelected) {
|
||||
$('#friend-selector-list tr[user-id="' + id + '"]').click(function() {
|
||||
updateSelectionList(id, val.name, $(this), $(this).find('img[user-id="' + id + '"]'));
|
||||
// disable row click if it was chosen on parent screen
|
||||
if (!isSelected) {
|
||||
$('#friend-selector-list tr[user-id="' + id + '"]').click(function() {
|
||||
updateSelectionList(id, val.name, $(this), $(this).find('img[user-id="' + id + '"]'));
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}).fail(app.ajaxError);
|
||||
}
|
||||
|
||||
function updateSelectionList(id, name, tr, img) {
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@
|
|||
band_id: bandId,
|
||||
user_id: userId
|
||||
};
|
||||
|
||||
|
||||
return $.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
|
|
@ -313,25 +313,113 @@
|
|||
}
|
||||
|
||||
function getFriends(options) {
|
||||
var friends = [];
|
||||
var id = getId(options);
|
||||
$.ajax({
|
||||
return $.ajax({
|
||||
type: "GET",
|
||||
async: false,
|
||||
url: '/api/users/' + id + '/friends',
|
||||
dataType: 'json'
|
||||
}).done(function(response) {
|
||||
friends = response;
|
||||
});
|
||||
return friends;
|
||||
}
|
||||
|
||||
function removeFriend(options) {
|
||||
var id = getId(options);
|
||||
var friendId = options["friend_id"];
|
||||
|
||||
return $.ajax({
|
||||
type: "DELETE",
|
||||
dataType: "json",
|
||||
url: "/api/users/" + id + "/friends/" + friendId,
|
||||
processData: false
|
||||
});
|
||||
}
|
||||
|
||||
function addFollowing(options) {
|
||||
var id = getId(options);
|
||||
|
||||
return $.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
contentType: 'application/json',
|
||||
url: "/api/users/" + id + "/followings",
|
||||
data: JSON.stringify(options),
|
||||
processData: false
|
||||
});
|
||||
}
|
||||
|
||||
function removeFollowing(options) {
|
||||
var id = getId(options);
|
||||
|
||||
return $.ajax({
|
||||
type: "DELETE",
|
||||
dataType: "json",
|
||||
contentType: 'application/json',
|
||||
url: "/api/users/" + id + "/followings",
|
||||
data: JSON.stringify(options),
|
||||
processData: false
|
||||
});
|
||||
}
|
||||
|
||||
function getFollowings(options) {
|
||||
var userId = getId(options);
|
||||
|
||||
// FOLLOWINGS (USERS)
|
||||
return $.ajax({
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
url: "/api/users/" + userId + "/followings",
|
||||
processData:false
|
||||
});
|
||||
}
|
||||
|
||||
function getFollowers(options) {
|
||||
var userId = getId(options);
|
||||
return $.ajax({
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
url: "/api/users/" + userId + "/followers",
|
||||
processData:false
|
||||
});
|
||||
}
|
||||
|
||||
function getBandFollowings(options) {
|
||||
var userId = getId(options);
|
||||
|
||||
// FOLLOWINGS (BANDS)
|
||||
return $.ajax({
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
url: "/api/users/" + userId + "/band_followings",
|
||||
processData:false
|
||||
});
|
||||
}
|
||||
|
||||
function getBandFollowing(options) {
|
||||
var id = getId(options);
|
||||
var bandId = options["band_id"];
|
||||
return $.ajax({
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
url: "/api/users/" + id + "/band_followings/" + bandId,
|
||||
processData: false
|
||||
});
|
||||
}
|
||||
|
||||
function getBands(options) {
|
||||
var userId = getId(options);
|
||||
|
||||
return $.ajax({
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
url: "/api/users/" + userId + "/bands",
|
||||
processData:false
|
||||
});
|
||||
}
|
||||
function getMusicianFollowers(userId) {
|
||||
|
||||
}
|
||||
|
||||
function getBandFollowers(bandId) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
function getClientDownloads(options) {
|
||||
|
|
@ -358,6 +446,10 @@
|
|||
if(!id) {
|
||||
id = context.JK.currentUserId;
|
||||
}
|
||||
else {
|
||||
delete options["id"];
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
|
|
@ -604,6 +696,14 @@
|
|||
this.deleteAvatar = deleteAvatar;
|
||||
this.getFilepickerPolicy = getFilepickerPolicy;
|
||||
this.getFriends = getFriends;
|
||||
this.removeFriend = removeFriend;
|
||||
this.addFollowing = addFollowing;
|
||||
this.removeFollowing = removeFollowing;
|
||||
this.getFollowings = getFollowings;
|
||||
this.getFollowers = getFollowers;
|
||||
this.getBandFollowings = getBandFollowings;
|
||||
this.getBandFollowing = getBandFollowing;
|
||||
this.getBands = getBands;
|
||||
this.updateSession = updateSession;
|
||||
this.getSession = getSession;
|
||||
this.getClientDownloads = getClientDownloads;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,10 @@
|
|||
var logger = context.JK.logger;
|
||||
var userId;
|
||||
var user = null;
|
||||
var userDefer = null;
|
||||
var rest = context.JK.Rest();
|
||||
var decrementedFriendCountOnce = false;
|
||||
var sentFriendRequest = false;
|
||||
|
||||
var instrument_logo_map = context.JK.getInstrumentIconMap24();
|
||||
|
||||
|
|
@ -25,7 +28,6 @@
|
|||
|
||||
function beforeShow(data) {
|
||||
userId = data.id;
|
||||
user = null;
|
||||
}
|
||||
|
||||
function afterShow(data) {
|
||||
|
|
@ -47,23 +49,30 @@
|
|||
}
|
||||
|
||||
function initUser() {
|
||||
if (user === null) {
|
||||
rest.getUserDetail({"id": userId})
|
||||
.done(function(response) {
|
||||
user = response;
|
||||
events();
|
||||
renderActive();
|
||||
})
|
||||
.fail(app.ajaxError);
|
||||
}
|
||||
return user;
|
||||
user = null;
|
||||
decrementedFriendCountOnce = false;
|
||||
sentFriendRequest = false;
|
||||
userDefer = rest.getUserDetail({id: userId})
|
||||
.done(function(response) {
|
||||
user = response;
|
||||
configureUserType();
|
||||
renderActive();
|
||||
})
|
||||
.fail(function(jqXHR) {
|
||||
if(jqXHR.status >= 500) {
|
||||
fetchUserNetworkOrServerFailure();
|
||||
}
|
||||
else if(jqXHR.status == 404) {
|
||||
fetchUserGone();
|
||||
}
|
||||
else {
|
||||
app.ajaxError(arguments);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function isMusician() {
|
||||
if (user) {
|
||||
return user.musician === true;
|
||||
}
|
||||
return false;
|
||||
return user.musician;
|
||||
}
|
||||
|
||||
function isCurrentUser() {
|
||||
|
|
@ -77,13 +86,9 @@
|
|||
$('#profile-instruments').show();
|
||||
$('#profile-session-stats').show();
|
||||
$('#profile-recording-stats').show();
|
||||
|
||||
// $('#profile-following-stats').hide();
|
||||
// $('#profile-favorites-stats').hide();
|
||||
|
||||
$('#btn-add-friend').show();
|
||||
$('.profile-social-left').show();
|
||||
|
||||
$('#profile-type-label').text('musician');
|
||||
$('#profile-location-label').text('Location');
|
||||
}
|
||||
|
|
@ -93,112 +98,117 @@
|
|||
$('#profile-instruments').hide();
|
||||
$('#profile-session-stats').hide();
|
||||
$('#profile-recording-stats').hide();
|
||||
|
||||
// $('#profile-following-stats').show();
|
||||
// $('#profile-favorites-stats').show();
|
||||
|
||||
$('#btn-add-friend').hide();
|
||||
$('.profile-social-left').hide();
|
||||
|
||||
$('#profile-type-label').text('fan');
|
||||
$('#profile-location-label').text('Presence');
|
||||
}
|
||||
|
||||
if (isCurrentUser()) {
|
||||
$('#btn-profile-edit').show();
|
||||
$('#btn-add-friend').hide();
|
||||
$('#btn-follow-user').hide();
|
||||
}
|
||||
else {
|
||||
configureFriendFollowersControls();
|
||||
|
||||
$('#btn-profile-edit').hide();
|
||||
$('#btn-add-friend').show();
|
||||
$('#btn-follow-user').show();
|
||||
}
|
||||
}
|
||||
|
||||
function configureFriendFollowersControls() {
|
||||
// wire up Add Friend click
|
||||
configureFriendButton();
|
||||
|
||||
// wire up Follow click
|
||||
configureFollowingButton();
|
||||
}
|
||||
|
||||
/****************** MAIN PORTION OF SCREEN *****************/
|
||||
// events for main screen
|
||||
function events() {
|
||||
configureUserType();
|
||||
// wire up panel clicks -- these need to check deferred because they can't be hidden when in an invalid state
|
||||
$('#profile-about-link').click(function(){ renderTabDeferred(renderAbout)});
|
||||
$('#profile-history-link').click(function(){ renderTabDeferred(renderHistory)});
|
||||
$('#profile-bands-link').click(function(){ renderTabDeferred(renderBands)});
|
||||
$('#profile-social-link').click(function(){ renderTabDeferred(renderSocial)});
|
||||
$('#profile-favorites-link').click(function(){ renderTabDeferred(renderFavorites)});
|
||||
|
||||
// wire up panel clicks
|
||||
$('#profile-about-link').click(renderAbout);
|
||||
$('#profile-history-link').click(renderHistory);
|
||||
$('#profile-bands-link').click(renderBands);
|
||||
$('#profile-social-link').click(renderSocial);
|
||||
$('#profile-favorites-link').click(renderFavorites);
|
||||
// this doesn't need deferred because it's only shown when valid
|
||||
$('#btn-add-friend').click(handleFriendChange);
|
||||
$('#btn-follow-user').click(handleFollowingChange);
|
||||
}
|
||||
|
||||
// wire up buttons if you're not viewing your own profile
|
||||
if (!isCurrentUser()) {
|
||||
// wire up Add Friend click
|
||||
configureFriendButton(isFriend());
|
||||
function handleFriendChange(evt) {
|
||||
if(isFriend()) {
|
||||
removeFriend(evt);
|
||||
}
|
||||
else {
|
||||
sendFriendRequest(evt);
|
||||
}
|
||||
}
|
||||
|
||||
// wire up Follow click
|
||||
configureFollowingButton(isFollowing());
|
||||
function handleFollowingChange(evt) {
|
||||
if (isFollowing()) {
|
||||
removeFollowing(false, userId);
|
||||
}
|
||||
else {
|
||||
$('#btn-add-friend').hide();
|
||||
$('#btn-follow-user').hide();
|
||||
addFollowing();
|
||||
}
|
||||
}
|
||||
|
||||
function sendFriendRequest(evt) {
|
||||
evt.stopPropagation();
|
||||
setFriend(true); // TODO: you aren't a friend yet. just a request to be one really there are 3 states here.
|
||||
sentFriendRequest = true;
|
||||
context.JK.sendFriendRequest(app, userId, friendRequestCallback);
|
||||
}
|
||||
|
||||
function removeFriend(evt) {
|
||||
evt.stopPropagation();
|
||||
|
||||
var url = "/api/users/" + context.JK.currentUserId + "/friends/" + userId;
|
||||
$.ajax({
|
||||
type: "DELETE",
|
||||
dataType: "json",
|
||||
url: url,
|
||||
processData: false,
|
||||
success: function(response) {
|
||||
renderActive(); // refresh stats
|
||||
configureFriendButton(false);
|
||||
},
|
||||
error: app.ajaxError
|
||||
});
|
||||
rest.removeFriend({friend_id: userId})
|
||||
.done(function() {
|
||||
updateFriendCount(-1);
|
||||
setFriend(false);
|
||||
configureFriendButton();
|
||||
})
|
||||
.fail(app.ajaxError);
|
||||
}
|
||||
|
||||
function isFriend() {
|
||||
return user ? user.is_friend : false;
|
||||
return user.is_friend;
|
||||
}
|
||||
|
||||
function setFriend(isFriend) {
|
||||
user.is_friend = isFriend;
|
||||
}
|
||||
|
||||
function friendRequestCallback() {
|
||||
configureFriendButton(true);
|
||||
configureFriendButton();
|
||||
}
|
||||
|
||||
function configureFriendButton(friend) {
|
||||
$('#btn-add-friend').unbind("click");
|
||||
|
||||
if (friend) {
|
||||
function configureFriendButton() {
|
||||
if (isFriend()) {
|
||||
$('#btn-add-friend').text('REMOVE FRIEND');
|
||||
$('#btn-add-friend').click(removeFriend);
|
||||
}
|
||||
else {
|
||||
$('#btn-add-friend').text('ADD FRIEND');
|
||||
$('#btn-add-friend').click(sendFriendRequest);
|
||||
}
|
||||
}
|
||||
|
||||
function addFollowing() {
|
||||
var newFollowing = {};
|
||||
newFollowing.user_id = userId;
|
||||
|
||||
var url = "/api/users/" + context.JK.currentUserId + "/followings";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
contentType: 'application/json',
|
||||
url: url,
|
||||
data: JSON.stringify(newFollowing),
|
||||
processData: false,
|
||||
success: function(response) {
|
||||
renderActive(); // refresh stats
|
||||
configureFollowingButton(true);
|
||||
},
|
||||
error: app.ajaxError
|
||||
});
|
||||
rest.addFollowing({user_id: userId})
|
||||
.done(function() {
|
||||
updateFollowingCount(1);
|
||||
setFollowing(true);
|
||||
configureFollowingButton();
|
||||
})
|
||||
.fail(app.ajaxError);
|
||||
}
|
||||
|
||||
function removeFollowing(isBand, id) {
|
||||
|
|
@ -211,43 +221,36 @@
|
|||
following.band_id = id;
|
||||
}
|
||||
|
||||
var url = "/api/users/" + context.JK.currentUserId + "/followings";
|
||||
$.ajax({
|
||||
type: "DELETE",
|
||||
dataType: "json",
|
||||
contentType: 'application/json',
|
||||
url: url,
|
||||
data: JSON.stringify(following),
|
||||
processData: false,
|
||||
success: function(response) {
|
||||
renderActive(); // refresh stats
|
||||
rest.removeFollowing(following)
|
||||
.done(function() {
|
||||
if (!isBand) {
|
||||
configureFollowingButton(false);
|
||||
updateFollowingCount(-1);
|
||||
setFollowing(false);
|
||||
configureFollowingButton();
|
||||
}
|
||||
else {
|
||||
updateBandFollowingCount(id, -1); // refresh stats
|
||||
configureBandFollowingButton(false, id);
|
||||
}
|
||||
},
|
||||
error: app.ajaxError
|
||||
});
|
||||
})
|
||||
.fail(app.ajaxError);
|
||||
}
|
||||
|
||||
function isFollowing() {
|
||||
return user ? user.is_following : false;
|
||||
return user.is_following;
|
||||
}
|
||||
|
||||
function configureFollowingButton(following) {
|
||||
$('#btn-follow-user').unbind("click");
|
||||
function setFollowing(isFollowing) {
|
||||
user.is_following = isFollowing;
|
||||
}
|
||||
|
||||
if (following) {
|
||||
function configureFollowingButton() {
|
||||
|
||||
if (isFollowing()) {
|
||||
$('#btn-follow-user').text('STOP FOLLOWING');
|
||||
$('#btn-follow-user').click(function() {
|
||||
removeFollowing(false, userId);
|
||||
});
|
||||
}
|
||||
else {
|
||||
$('#btn-follow-user').text('FOLLOW');
|
||||
$('#btn-follow-user').click(addFollowing);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -274,6 +277,17 @@
|
|||
}
|
||||
}
|
||||
|
||||
function renderTabDeferred(tabRenderer) {
|
||||
userDefer
|
||||
.done(function() {
|
||||
tabRenderer();
|
||||
})
|
||||
.fail(function() {
|
||||
// try again
|
||||
initUser();
|
||||
})
|
||||
}
|
||||
|
||||
/****************** ABOUT TAB *****************/
|
||||
function renderAbout() {
|
||||
$('#profile-instruments').empty();
|
||||
|
|
@ -293,62 +307,57 @@
|
|||
function bindAbout() {
|
||||
$('#profile-instruments').empty();
|
||||
|
||||
if (user !== null) {
|
||||
// name
|
||||
$('#profile-username').html(user.name);
|
||||
// name
|
||||
$('#profile-username').html(user.name);
|
||||
|
||||
// avatar
|
||||
$('#profile-avatar').attr('src', context.JK.resolveAvatarUrl(user.photo_url));
|
||||
// avatar
|
||||
$('#profile-avatar').attr('src', context.JK.resolveAvatarUrl(user.photo_url));
|
||||
|
||||
// instruments
|
||||
if (user.instruments) {
|
||||
for (var i=0; i < user.instruments.length; i++) {
|
||||
var instrument = user.instruments[i];
|
||||
var description = instrument.instrument_id;
|
||||
var proficiency = instrument.proficiency_level;
|
||||
var instrument_icon_url = context.JK.getInstrumentIcon45(description);
|
||||
// instruments
|
||||
if (user.instruments) {
|
||||
for (var i=0; i < user.instruments.length; i++) {
|
||||
var instrument = user.instruments[i];
|
||||
var description = instrument.instrument_id;
|
||||
var proficiency = instrument.proficiency_level;
|
||||
var instrument_icon_url = context.JK.getInstrumentIcon45(description);
|
||||
|
||||
// add instrument info to layout
|
||||
var template = $('#template-profile-instruments').html();
|
||||
var instrumentHtml = context.JK.fillTemplate(template, {
|
||||
instrument_logo_url: instrument_icon_url,
|
||||
instrument_description: description,
|
||||
proficiency_level: proficiencyDescriptionMap[proficiency],
|
||||
proficiency_level_css: proficiencyCssMap[proficiency]
|
||||
});
|
||||
// add instrument info to layout
|
||||
var template = $('#template-profile-instruments').html();
|
||||
var instrumentHtml = context.JK.fillTemplate(template, {
|
||||
instrument_logo_url: instrument_icon_url,
|
||||
instrument_description: description,
|
||||
proficiency_level: proficiencyDescriptionMap[proficiency],
|
||||
proficiency_level_css: proficiencyCssMap[proficiency]
|
||||
});
|
||||
|
||||
$('#profile-instruments').append(instrumentHtml);
|
||||
}
|
||||
$('#profile-instruments').append(instrumentHtml);
|
||||
}
|
||||
|
||||
// location
|
||||
$('#profile-location').html(user.location);
|
||||
|
||||
// stats
|
||||
var text = user.friend_count > 1 || user.friend_count === 0 ? " Friends" : " Friend";
|
||||
$('#profile-friend-stats').html(user.friend_count + text);
|
||||
|
||||
text = user.follower_count > 1 || user.follower_count === 0 ? " Followers" : " Follower";
|
||||
$('#profile-follower-stats').html(user.follower_count + text);
|
||||
|
||||
if (isMusician()) {
|
||||
text = user.session_count > 1 || user.session_count === 0 ? " Sessions" : " Session";
|
||||
$('#profile-session-stats').html(user.session_count + text);
|
||||
|
||||
text = user.recording_count > 1 || user.recording_count === 0 ? " Recordings" : " Recording";
|
||||
$('#profile-recording-stats').html(user.recording_count + text);
|
||||
} else {
|
||||
text = " Following";
|
||||
$('#profile-following-stats').html(user.following_count + text);
|
||||
text = user.favorite_count > 1 || user.favorite_count === 0 ? " Favorites" : " Favorite";
|
||||
$('#profile-favorite-stats').html(user.favorite_count + text);
|
||||
}
|
||||
|
||||
$('#profile-biography').html(user.biography);
|
||||
}
|
||||
else {
|
||||
logger.debug("No user found with userId = " + userId);
|
||||
|
||||
// location
|
||||
$('#profile-location').html(user.location);
|
||||
|
||||
// stats
|
||||
var text = user.friend_count > 1 || user.friend_count === 0 ? " Friends" : " Friend";
|
||||
$('#profile-friend-stats').html('<span class="friend-count">' + user.friend_count + '</span>' + text);
|
||||
|
||||
text = user.follower_count > 1 || user.follower_count === 0 ? " Followers" : " Follower";
|
||||
$('#profile-follower-stats').html('<span class="follower-count">' + user.follower_count + '</span>' + text);
|
||||
|
||||
if (isMusician()) {
|
||||
text = user.session_count > 1 || user.session_count === 0 ? " Sessions" : " Session";
|
||||
$('#profile-session-stats').html(user.session_count + text);
|
||||
|
||||
text = user.recording_count > 1 || user.recording_count === 0 ? " Recordings" : " Recording";
|
||||
$('#profile-recording-stats').html(user.recording_count + text);
|
||||
} else {
|
||||
text = " Following";
|
||||
$('#profile-following-stats').html(user.following_count + text);
|
||||
text = user.favorite_count > 1 || user.favorite_count === 0 ? " Favorites" : " Favorite";
|
||||
$('#profile-favorite-stats').html(user.favorite_count + text);
|
||||
}
|
||||
|
||||
$('#profile-biography').html(user.biography);
|
||||
}
|
||||
|
||||
/****************** SOCIAL TAB *****************/
|
||||
|
|
@ -378,39 +387,25 @@
|
|||
function bindSocial() {
|
||||
if (isMusician()) {
|
||||
// FRIENDS
|
||||
var url = "/api/users/" + userId + "/friends";
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
url: url,
|
||||
async: false,
|
||||
processData:false,
|
||||
success: function(response) {
|
||||
$.each(response, function(index, val) {
|
||||
var template = $('#template-profile-social').html();
|
||||
var friendHtml = context.JK.fillTemplate(template, {
|
||||
avatar_url: context.JK.resolveAvatarUrl(val.photo_url),
|
||||
userName: val.name,
|
||||
location: val.location,
|
||||
type: "Friends"
|
||||
});
|
||||
rest.getFriends({id:userId})
|
||||
.done(function(response) {
|
||||
$.each(response, function(index, val) {
|
||||
var template = $('#template-profile-social').html();
|
||||
var friendHtml = context.JK.fillTemplate(template, {
|
||||
avatar_url: context.JK.resolveAvatarUrl(val.photo_url),
|
||||
userName: val.name,
|
||||
location: val.location,
|
||||
type: "Friends"
|
||||
});
|
||||
|
||||
$('#profile-social-friends').append(friendHtml);
|
||||
});
|
||||
},
|
||||
error: app.ajaxError
|
||||
});
|
||||
$('#profile-social-friends').append(friendHtml);
|
||||
});
|
||||
})
|
||||
.fail(app.ajaxError)
|
||||
}
|
||||
|
||||
// FOLLOWINGS (USERS)
|
||||
url = "/api/users/" + userId + "/followings";
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
url: url,
|
||||
async: false,
|
||||
processData:false,
|
||||
success: function(response) {
|
||||
rest.getFollowings({id: userId})
|
||||
.done(function(response) {
|
||||
$.each(response, function(index, val) {
|
||||
var template = $('#template-profile-social').html();
|
||||
var followingHtml = context.JK.fillTemplate(template, {
|
||||
|
|
@ -421,19 +416,11 @@
|
|||
|
||||
$('#profile-social-followings').append(followingHtml);
|
||||
});
|
||||
},
|
||||
error: app.ajaxError
|
||||
});
|
||||
})
|
||||
.fail(app.ajaxError);
|
||||
|
||||
// FOLLOWINGS (BANDS)
|
||||
url = "/api/users/" + userId + "/band_followings";
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
url: url,
|
||||
async: false,
|
||||
processData:false,
|
||||
success: function(response) {
|
||||
rest.getBandFollowings({id: userId})
|
||||
.done(function(response) {
|
||||
$.each(response, function(index, val) {
|
||||
var template = $('#template-profile-social').html();
|
||||
var followingHtml = context.JK.fillTemplate(template, {
|
||||
|
|
@ -444,19 +431,11 @@
|
|||
|
||||
$('#profile-social-followings').append(followingHtml);
|
||||
});
|
||||
},
|
||||
error: app.ajaxError
|
||||
});
|
||||
})
|
||||
.fail(app.ajaxError);
|
||||
|
||||
// FOLLOWERS
|
||||
url = "/api/users/" + userId + "/followers";
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
url: url,
|
||||
async: false,
|
||||
processData:false,
|
||||
success: function(response) {
|
||||
rest.getFollowers({id: userId})
|
||||
.done(function(response) {
|
||||
$.each(response, function(index, val) {
|
||||
var template = $('#template-profile-social').html();
|
||||
var followerHtml = context.JK.fillTemplate(template, {
|
||||
|
|
@ -467,9 +446,9 @@
|
|||
|
||||
$('#profile-social-followers').append(followerHtml);
|
||||
});
|
||||
},
|
||||
error: app.ajaxError
|
||||
});
|
||||
})
|
||||
.fail(app.ajaxError);
|
||||
|
||||
}
|
||||
|
||||
/****************** HISTORY TAB *****************/
|
||||
|
|
@ -507,34 +486,28 @@
|
|||
}
|
||||
|
||||
function bindBands() {
|
||||
var url = "/api/users/" + userId + "/bands";
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
url: url,
|
||||
async: false,
|
||||
processData:false,
|
||||
success: function(response) {
|
||||
if ( (!response || response.length === 0) && isCurrentUser()) {
|
||||
|
||||
rest.getBands({id:userId})
|
||||
.done(function(response) {
|
||||
if ( (!response || response.length === 0) && isCurrentUser()) {
|
||||
var noBandHtml = $('#template-no-bands').html();
|
||||
$("#profile-bands").append(noBandHtml);
|
||||
}
|
||||
$("#profile-bands").html(noBandHtml);
|
||||
}
|
||||
else {
|
||||
addMoreBandsLink();
|
||||
|
||||
else {
|
||||
addMoreBandsLink();
|
||||
|
||||
$.each(response, function(index, val) {
|
||||
$.each(response, function(index, val) {
|
||||
|
||||
// build band member HTML
|
||||
var musicianHtml = '';
|
||||
if ("musicians" in val) {
|
||||
if (val.musicians) {
|
||||
for (var i=0; i < val.musicians.length; i++) {
|
||||
var musician = val.musicians[i];
|
||||
var instrumentLogoHtml = '';
|
||||
if ("instruments" in musician) {
|
||||
if (musician.instruments) {
|
||||
for (var j=0; j < musician.instruments.length; j++) {
|
||||
var instrument = musician.instruments[j];
|
||||
var inst = '../assets/content/icon_instrument_default24.png';
|
||||
var inst = '/assets/content/icon_instrument_default24.png';
|
||||
if (instrument.instrument_id in instrument_logo_map) {
|
||||
inst = instrument_logo_map[instrument.instrument_id];
|
||||
}
|
||||
|
|
@ -545,7 +518,7 @@
|
|||
var musicianTemplate = $('#template-musician-info').html();
|
||||
musicianHtml += context.JK.fillTemplate(musicianTemplate, {
|
||||
avatar_url: context.JK.resolveAvatarUrl(musician.photo_url),
|
||||
profile_url: "/#/profile/" + musician.id,
|
||||
profile_url: "/client#/profile/" + musician.id,
|
||||
musician_name: musician.name,
|
||||
instruments: instrumentLogoHtml
|
||||
});
|
||||
|
|
@ -555,7 +528,7 @@
|
|||
var bandHtml = context.JK.fillTemplate(template, {
|
||||
bandId: val.id,
|
||||
biography: val.biography,
|
||||
band_url: "/#/bandProfile/" + val.id,
|
||||
band_url: "/client#/bandProfile/" + val.id,
|
||||
avatar_url: context.JK.resolveBandAvatarUrl(val.logo_url),
|
||||
name: val.name,
|
||||
location: val.location,
|
||||
|
|
@ -569,15 +542,22 @@
|
|||
$('#profile-bands').append(bandHtml);
|
||||
|
||||
// wire up Band Follow button click handler
|
||||
var following = isFollowingBand(val.id);
|
||||
configureBandFollowingButton(following, val.id);
|
||||
});
|
||||
// XXX; we should return if you are following the band in the rabl, so we don't
|
||||
// have to hit the server per band shown
|
||||
rest.getBandFollowing({band_id: val.id})
|
||||
.done(function(response) {
|
||||
var alreadyFollowing = response.id !== undefined;
|
||||
configureBandFollowingButton(alreadyFollowing, val.id);
|
||||
});
|
||||
});
|
||||
|
||||
if(response.length >= 3) {
|
||||
addMoreBandsLink();
|
||||
}
|
||||
}
|
||||
})
|
||||
.fail(app.ajaxError);
|
||||
|
||||
addMoreBandsLink();
|
||||
}
|
||||
},
|
||||
error: app.ajaxError
|
||||
});
|
||||
}
|
||||
|
||||
function addMoreBandsLink() {
|
||||
|
|
@ -601,53 +581,38 @@
|
|||
return formattedGenres;
|
||||
}
|
||||
|
||||
function updateFriendCount(value) {
|
||||
if(!decrementedFriendCountOnce && !sentFriendRequest) {
|
||||
decrementedFriendCountOnce = true;
|
||||
var friendCount = $('#profile-friend-stats span.friend-count');
|
||||
friendCount.text(value + parseInt(friendCount.text()));
|
||||
}
|
||||
}
|
||||
|
||||
function updateFollowingCount(value) {
|
||||
var followingCount = $('#profile-follower-stats span.follower-count');
|
||||
followingCount.text(value + parseInt(followingCount.text()));
|
||||
}
|
||||
|
||||
function updateBandFollowingCount(bandId, value) {
|
||||
var bandFollowing = $('div[band-id="' + bandId + '"].profile-bands span.follower-count');
|
||||
bandFollowing.text(value + parseInt(bandFollowing.text()));
|
||||
}
|
||||
|
||||
function addBandFollowing(evt) {
|
||||
evt.stopPropagation();
|
||||
var bandId = $(this).parent().parent().attr('band-id');
|
||||
|
||||
var newFollowing = {};
|
||||
newFollowing.band_id = bandId;
|
||||
logger.debug("Following band " + bandId);
|
||||
|
||||
var url = "/api/users/" + context.JK.currentUserId + "/followings";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
contentType: 'application/json',
|
||||
url: url,
|
||||
data: JSON.stringify(newFollowing),
|
||||
processData: false,
|
||||
success: function(response) {
|
||||
rest.addFollowing(newFollowing)
|
||||
.done(function(response) {
|
||||
logger.debug("following band " + bandId);
|
||||
renderBands(); // refresh stats
|
||||
updateBandFollowingCount(bandId, 1); // increase counter
|
||||
configureBandFollowingButton(true, bandId);
|
||||
},
|
||||
error: app.ajaxError
|
||||
});
|
||||
}
|
||||
|
||||
function isFollowingBand(bandId) {
|
||||
var alreadyFollowing = false;
|
||||
|
||||
var url = "/api/users/" + context.JK.currentUserId + "/band_followings/" + bandId;
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
url: url,
|
||||
async: false,
|
||||
processData: false,
|
||||
success: function(response) {
|
||||
if (response.id !== undefined) {
|
||||
alreadyFollowing = true;
|
||||
}
|
||||
else {
|
||||
alreadyFollowing = false;
|
||||
}
|
||||
},
|
||||
error: app.ajaxError
|
||||
});
|
||||
|
||||
return alreadyFollowing;
|
||||
})
|
||||
.fail(app.ajaxError);
|
||||
}
|
||||
|
||||
function configureBandFollowingButton(following, bandId) {
|
||||
|
|
@ -656,8 +621,10 @@
|
|||
|
||||
if (following) {
|
||||
$btnFollowBand.text('UN-FOLLOW');
|
||||
$btnFollowBand.click(function() {
|
||||
$btnFollowBand.click(function(evt) {
|
||||
removeFollowing(true, bandId);
|
||||
evt.stopPropagation();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
else {
|
||||
|
|
@ -680,6 +647,23 @@
|
|||
bindFavorites();
|
||||
}
|
||||
|
||||
|
||||
function fetchUserGone() {
|
||||
app.notify({
|
||||
title: "User Deleted",
|
||||
text: "The user you are looking for is gone",
|
||||
icon_url: "/assets/content/icon_alert_big.png"
|
||||
})
|
||||
}
|
||||
|
||||
function fetchUserNetworkOrServerFailure() {
|
||||
app.notify({
|
||||
title: "Unable to communicate with server",
|
||||
text: "Please try again later",
|
||||
icon_url: "/assets/content/icon_alert_big.png"
|
||||
})
|
||||
}
|
||||
|
||||
function bindFavorites() {
|
||||
}
|
||||
|
||||
|
|
@ -689,6 +673,8 @@
|
|||
'afterShow': afterShow
|
||||
};
|
||||
app.bindScreen('profile', screenBindings);
|
||||
|
||||
events();
|
||||
}
|
||||
|
||||
this.initialize = initialize;
|
||||
|
|
|
|||
|
|
@ -254,3 +254,7 @@
|
|||
padding:3px;
|
||||
vertical-align:middle;
|
||||
}
|
||||
|
||||
#btn-add-friend {
|
||||
display:none;
|
||||
}
|
||||
|
|
@ -80,7 +80,7 @@
|
|||
|
||||
<div class="friendbox">
|
||||
<div id="selected-band-invitees"></div>
|
||||
<input id="band-invitee-input" type="text" placeholder="Type a friend's name" width="150px" />
|
||||
<input id="band-invitee-input" type="text" placeholder="Looking up friends..." width="150px" />
|
||||
</div>
|
||||
<br/><br/>
|
||||
If your bandmates are not on JamKazam yet, use any of the options below to invite them to join the service.<br/><br/>
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@
|
|||
<!-- friend invitation box -->
|
||||
<div class="friendbox">
|
||||
<div id="selected-friends"></div>
|
||||
<input id="friend-input" type="text" placeholder="Type a friend's name" />
|
||||
<input id="friend-input" type="text" placeholder="Looking up friends..." />
|
||||
</div>
|
||||
|
||||
<div class="mt35 mb15">
|
||||
|
|
|
|||
|
|
@ -130,9 +130,9 @@
|
|||
<span class="profile-band-location">{location}</span>
|
||||
<br clear="left" /><br />
|
||||
<div style="width:50px;">{genres}</div><br /><br />
|
||||
{follower_count} <img src="../assets/content/icon_followers.png" width="22" height="12" align="absmiddle" />
|
||||
{recording_count} <img src="../assets/content/icon_recordings.png" width="12" height="13" align="absmiddle" />
|
||||
{session_count} <img src="../assets/content/icon_session_tiny.png" width="12" height="12" align="absmiddle" />
|
||||
<span class="follower-count">{follower_count}</span> <img src="../assets/content/icon_followers.png" width="22" height="12" align="absmiddle" />
|
||||
<span class="recording-count">{recording_count}</span> <img src="../assets/content/icon_recordings.png" width="12" height="13" align="absmiddle" />
|
||||
<span class="session-count">{session_count}</span> <img src="../assets/content/icon_session_tiny.png" width="12" height="12" align="absmiddle" />
|
||||
</div>
|
||||
<div style="height:90px" class="left ml20 f11 whitespace w35"><br />
|
||||
{biography}<br /><br />
|
||||
|
|
|
|||
|
|
@ -21,9 +21,7 @@ describe "Bands", :js => true, :type => :feature, :capybara_feature => true do
|
|||
sign_in_poltergeist(user)
|
||||
wait_until_curtain_gone
|
||||
find('div.homecard.profile').trigger(:click)
|
||||
wait_for_ajax
|
||||
find('#profile-bands-link').trigger(:click)
|
||||
wait_for_ajax
|
||||
find('#band-setup-link').trigger(:click)
|
||||
expect(page).to have_selector('#band-setup-title')
|
||||
end
|
||||
|
|
|
|||
|
|
@ -29,39 +29,18 @@ def cookie_jar
|
|||
Capybara.current_session.driver.browser.current_session.instance_variable_get(:@rack_mock_session).cookie_jar
|
||||
end
|
||||
|
||||
#these S3 functions copied from ruby/spec/support/utilities.rb
|
||||
JAMKAZAM_TESTING_BUCKET = 'jamkazam-testing' # cuz i'm not comfortable using aws_bucket accessor directly
|
||||
|
||||
def app_config
|
||||
klass = Class.new do
|
||||
def aws_bucket
|
||||
JAMKAZAM_TESTING_BUCKET
|
||||
end
|
||||
|
||||
def aws_access_key_id
|
||||
'AKIAJESQY24TOT542UHQ'
|
||||
end
|
||||
|
||||
def aws_secret_access_key
|
||||
'h0V0ffr3JOp/UtgaGrRfAk25KHNiO9gm8Pj9m6v3'
|
||||
end
|
||||
end
|
||||
|
||||
return klass.new
|
||||
end
|
||||
|
||||
#see also ruby/spec/support/utilities.rb
|
||||
JAMKAZAM_TESTING_BUCKET = 'jamkazam-testing' #at least, this is the name given in jam-ruby
|
||||
def wipe_s3_test_bucket
|
||||
test_config = app_config
|
||||
s3 = AWS::S3.new(:access_key_id => test_config.aws_access_key_id,
|
||||
:secret_access_key => test_config.aws_secret_access_key)
|
||||
s3 = AWS::S3.new(:access_key_id => Rails.application.config.aws_access_key_id,
|
||||
:secret_access_key => Rails.application.config.aws_secret_access_key)
|
||||
test_bucket = s3.buckets[JAMKAZAM_TESTING_BUCKET]
|
||||
|
||||
if test_bucket.name == JAMKAZAM_TESTING_BUCKET
|
||||
puts "Web - Pretending to delete all contents of #{test_bucket.name}"
|
||||
#test_bucket.delete_all
|
||||
end
|
||||
end
|
||||
# --end of S3 methods copied from ruby/spec/support/utilities.rb
|
||||
|
||||
|
||||
def sign_in(user)
|
||||
|
|
|
|||
Loading…
Reference in New Issue