Permalink
Browse files

no need to reinvent confirm functionality

  • Loading branch information...
nashby committed Feb 11, 2012
1 parent 80378b5 commit 85503b678d9477adb75975fd40a7611ed529e75f
@@ -84,10 +84,6 @@ jQuery $ ->
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)
@@ -1,3 +0,0 @@
-jQuery $ ->
- $(".unfollow").click ->
- confirm("Are you sure you want to unfollow this user?")
@@ -23,4 +23,4 @@
- if current_user and update.author.id == current_user.author.id
= form_tag "/updates/#{update.id}" do
%input{:type => "hidden", :name => "_method", :value => "delete"}
- %input.remove-update{:type => "submit", :value => "I Regret This"}
+ = submit_tag "I Regret This", :class => "remove-update", :confirm => t(:remove_update, :scope => :confirms)
@@ -1,5 +1,5 @@
- unless defined?(id)
- - id = (request.path_info.gsub("/", "_")[1..-1])
+ - id = (request.path_info.gsub("/", "_")[1..-1])
%ul.updates{:class => (controller.controller_name == "updates" ? "has-update-form" : ""), :id => id}
- updates.each do |update|
@@ -42,7 +42,7 @@
- if current_user and update.author.id == current_user.author.id
= form_tag "/updates/#{update.id}" do
%input{:type => "hidden", :name => "_method", :value => "delete"}
- %input.remove-update{:type => "submit", :value => "I Regret This"}
+ = submit_tag "I Regret This", :class => "remove-update", :confirm => t(:remove_update, :scope => :confirms)
!= render :partial => "shared/pagination"
@@ -21,7 +21,7 @@
- if following
= form_tag "/subscriptions/#{author.feed.id}" do
%input{:type => "hidden", :name => "_method", :value => "delete"}
- %input.button.unfollow{:type => "submit", :value => "Unfollow", :id => "unfollow-#{author.feed.id}"}
+ = submit_tag "Unfollow", :class => "button unfollow", :id => "unfollow-#{author.feed.id}", :confirm => t(:unfollow, :scope => :confirms)
- else
= form_tag "/subscriptions" do
%input{:type => "hidden", :name => "subscribe_to", :value => author.feed.id}
View
@@ -2,4 +2,6 @@
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
en:
- hello: "Hello world"
+ confirms:
+ remove_update: "Are you sure you want to delete this update?"
+ unfollow: "Are you sure you want to unfollow this user?"

0 comments on commit 85503b6

Please sign in to comment.