Skip to content

Commit

Permalink
Merge pull request hotsh#402 from clnclarinet/issue_397
Browse files Browse the repository at this point in the history
Fixes issue hotsh#397. Confirmation on unfollowing a user was in both main.js.
  • Loading branch information
steveklabnik committed Sep 26, 2011
2 parents 475108f + 39c7bc4 commit 7e3bbfe
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions app/assets/javascripts/main.js.coffee
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
MAX_LENGTH = 140

$(document).ready ->

# Turn on JS styles
$("html").removeClass("no-js").addClass("js")

# Hide flash messages
$("#flash").delay(2000).slideUp('slow')

#########################################
# Updates
#########################################

# PJAX-ify the tabs
$('#updates-menu a').pjax('#content').click ->
# Set clicked tab to be given active class when pjax returns
$('#updates-menu li').removeClass("active")
$(this).parent().addClass("active")

$('.pagination a').pjax('#content')

$("#content").bind("start.pjax", pjaxStart = ->
loading = $("<div class='loading' />")
$("#content").append(loading)
window.scrollTo(0,0)
)

#########################################
# Update Form
#########################################
Expand All @@ -48,11 +48,11 @@ $(document).ready ->
# Validate form on submit
$("#update-form").submit ->
false if textarea.val().length <= 0 || textarea.val().length > MAX_LENGTH

# Helper method for RS messages
shareText = (update) ->
"RS @" + $(update).data("name") + ": " + $(update).find(".entry-content").text().trim()

# Helper method to add text and move cursor to correct position
focusTextArea = (update) ->
$(update_field).attr("value", $(update).data("id"))
Expand All @@ -66,7 +66,7 @@ $(document).ready ->
# If update form, target when clicking reply and insert appropriate text
$(".has-update-form .update").each ->
update = $(this)

$(this).find(".reply").bind "click", (ev) ->
ev.preventDefault()
textarea.text("@" + $(update).data("name") + " ")
Expand All @@ -76,11 +76,11 @@ $(document).ready ->
ev.preventDefault()
textarea.text(shareText(update))
focusTextArea(update)

# Delete update check
$(".remove-update").click ->
confirm "Are you sure you want to delete this update?"

# Manage reply state and service share checkboxes
updateTickyboxes = ->
return if(userTickiedBox)
Expand All @@ -107,11 +107,3 @@ $(document).ready ->
$("#tweet").change(recordTickyboxChange)
if( $("#facebook").length > 0)
$("#facebook").change(recordTickyboxChange)

#########################################
# Users
#########################################
$(".unfollow").click ->
confirm "Are you sure you want to unfollow this user?"


0 comments on commit 7e3bbfe

Please sign in to comment.