Permalink
Browse files

Pull in short url using ajax t:40m

  • Loading branch information...
Will McNeilly
Will McNeilly committed Sep 16, 2011
1 parent e7e045c commit bc9bc6ad533a3d759034cbee7d5e7b362efe9a6c
@@ -11,15 +11,15 @@
//$('#link_url').
-$(function (){
- $('#new_link')
- .bind("ajax:beforeSend", function(e) {
- alert("PROGRESS");
- })
- .bind("ajax:success", function(e){
- alert("SUCCESS");
- })
- .bind("ajax:error", function(e){
- alert("FAIL");
- })
-})
+//$(function (){
+// $('#new_link')
+// .bind("ajax:beforeSend", function(e) {
+// alert("PROGRESS");
+// })
+// .bind("ajax:success", function(e){
+// alert("SUCCESS");
+// })
+// .bind("ajax:error", function(e){
+// alert("FAIL");
+// })
+//})
@@ -14,7 +14,7 @@ def create
if @link.save
respond_to do |format|
format.html { redirect_to @link }
- format.js { head :status => :success }
+ format.js
end
else
respond_to do |format|
@@ -0,0 +1,8 @@
+<div class="full-width squish-wrapper">
+ <div class="container">
+ <h3>Short Link</h3>
+ <%= link_to short_url(@link), short_url(@link) %>
+ <h3>Long Link</h3>
+ <%= link_to @link.url, @link.url %>
+ </div>
+</div>
@@ -0,0 +1,2 @@
+$('#new_link').after("<%= escape_javascript(render(:partial => "short_url")) %>");
+$('.link-table').prepend("<%= escape_javascript(render(:partial => "link", :locals => { :link => @link })) %>")

0 comments on commit bc9bc6a

Please sign in to comment.