about summary refs log tree commit homepage
path: root/examples/rails_app-2.3.4/app/views/files/pull.html.erb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-11-12 19:32:46 -0800
committerEric Wong <normalperson@yhbt.net>2009-11-12 19:32:46 -0800
commitb5419dc0e819550b5db0bc18579d8243477c53f2 (patch)
tree6abaca5ea13b00bf936572812996c9c0480a1158 /examples/rails_app-2.3.4/app/views/files/pull.html.erb
parent701405d00364c63c0efbf11a39368dd2cbee0053 (diff)
downloadupr-b5419dc0e819550b5db0bc18579d8243477c53f2.tar.gz
JSON compatible with Ry Dahl's Ajax.Pull + example
Ry posted about it here:
  http://rubyforge.org/pipermail/mongrel-users/2007-July/003747.html

This is technically superior compared to all the existing interfaces
since it only requires only one, long-running client-side HTTP request.
I would imagine it's possible for a JavaScript programmer to be capable
of even removing the need for an extra request entirely, I'm not that
programmer...
Diffstat (limited to 'examples/rails_app-2.3.4/app/views/files/pull.html.erb')
-rw-r--r--examples/rails_app-2.3.4/app/views/files/pull.html.erb46
1 files changed, 46 insertions, 0 deletions
diff --git a/examples/rails_app-2.3.4/app/views/files/pull.html.erb b/examples/rails_app-2.3.4/app/views/files/pull.html.erb
new file mode 100644
index 0000000..275704d
--- /dev/null
+++ b/examples/rails_app-2.3.4/app/views/files/pull.html.erb
@@ -0,0 +1,46 @@
+<html>
+  <head>
+<!-- http://rubyforge.org/pipermail/mongrel-users/2007-July/003747.html -->
+    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+    <title>streaming upload progress test</title>
+    <%= javascript_include_tag 'ajax_pull/prototype-1_5_1.js' %>
+    <%= javascript_include_tag 'ajax_pull/ajax_pull.js' %>
+    <%= javascript_include_tag 'ajax_pull/upload_progress.js' %>
+  </head>
+  <body>
+<%
+upid = "#{Time.now.to_i}.#{rand}"
+act = { :action => 'pull', :upload_id => upid }
+opt = {
+  :multipart => true,
+  :target => 'upload-target',
+  :onsubmit => "UploadProgress.begin('#{upid}')"
+}
+-%>
+
+    <% if flash[:notice] %>
+      <div class="notice"><%= flash[:notice] %></div>
+    <% end %>
+    <p><%= link_to "#{upid} (single)",
+          :action => 'status', :upload_id => upid %></p>
+    <p><%= link_to "#{upid} (stream)",
+           "/progress?long&upload_id=#{upid}" %></p>
+
+    <% form_tag(act, opt) do %>
+      <div><p><%= file_field_tag :data %></p></div>
+      <p><%= submit_tag :Upload %></p>
+    <% end %>
+
+    <p>Below is the results <code>div</code></p>
+    <div id="results">(nothing)</div>
+
+    <p>Below is the progress bar <code>div</code></p>
+    <div id="progress-bar"></div>
+
+    <p>Below is the debug list</p>
+    <ol id="debug"></ol>
+
+    <iframe id="upload-target" name="upload-target" src="about:blank"></iframe>
+
+  </body>
+</html>