Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostandthemachine committed Nov 24, 2012
2 parents 4aaab04 + d300913 commit 9cd21ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions lib/views/event/event.haml
Expand Up @@ -19,7 +19,7 @@
-if current_user.following?(event.user)
%p.btn.btn-primary.following-btn= "Following #{event.user.user_name}"
-else
%a.btn.btn-warning.follow-btn{id: "followed-user-#{event.user.id}"}= "Follow #{event.user.user_name}"
%a.btn.btn-warning.follow-btn{id: "followed-user-#{event.user.user_name}-#{event.user.id}"}= "Follow #{event.user.user_name}"
.row
%h4= "comments"
%hr
Expand All @@ -45,7 +45,8 @@

$('.follow-btn').click(function(e) {
var obj = event.target;
var followed_user_id = $(obj).attr('id').split('-')[2];
var followed_user_id = $(obj).attr('id').split('-')[3];
var followed_username = $(obj).attr('id').split('-')[2];
$.ajax({
type: "POST",
url: '/api/update/user/follow',
Expand All @@ -54,8 +55,8 @@
}).done(function( msg ) {
if (msg == "true") {
$('.follow-btn').remove()
$('#follow-tray').prepend("<div class='alert alert-success unfollow-success-msg'>Successfully following " + followed_username + "</div>")
$('#follow-tray').append("<p class='btn btn-primary following-btn'>Following #{event.user.user_name}</p>")
$('#follow-tray').prepend("<div class='alert alert-success unfollow-success-msg'> <button type='button' class='close' data-dismiss='alert'>×</button> Successfully following <b>" + followed_username + "</b></div>")
$('#follow-tray').append("<p class='btn btn-primary following-btn'>Following <b>#{event.user.user_name}</b></p>")
} else {
console.log("failed to follow user")
}
Expand Down
2 changes: 1 addition & 1 deletion lib/views/user/following.haml
Expand Up @@ -36,7 +36,7 @@
}).done(function( msg ) {
if (msg == "true") {
$("#following-user-" + following_user_id).remove();
$('#following-row').prepend("<div class='alert alert-success unfollow-success-msg'>Successfully unfollowed " + followed_username + "</div>")
$('#following-row').prepend("<div class='alert alert-success unfollow-success-msg'><button type='button' class='close' data-dismiss='alert'>×</button> Successfully unfollowed <b>" + followed_username + "</b></div>")
} else {
console.log("failed to unfollow user")
}
Expand Down

0 comments on commit 9cd21ba

Please sign in to comment.