From 839f8fe1af8fcea9809503e829c926781839792e Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Tue, 12 Aug 2014 23:22:01 +0200 Subject: [PATCH] [docs] Update sample application to use progress callback --- sample/app/assets/javascripts/application.js | 3 +++ sample/app/views/users/_form.html.erb | 1 + sample/config/routes.rb | 1 + 3 files changed, 5 insertions(+) diff --git a/sample/app/assets/javascripts/application.js b/sample/app/assets/javascripts/application.js index 44e9f11..babb66e 100644 --- a/sample/app/assets/javascripts/application.js +++ b/sample/app/assets/javascripts/application.js @@ -27,6 +27,9 @@ ready = function() { }, fail: function(e, data) { return alert(data.failReason); + }, + progress: function(e, data) { + window.document.title = parseInt(data.loaded / data.total * 100, 10) + '%' } }); }); diff --git a/sample/app/views/users/_form.html.erb b/sample/app/views/users/_form.html.erb index 516156f..79f18c2 100644 --- a/sample/app/views/users/_form.html.erb +++ b/sample/app/views/users/_form.html.erb @@ -22,5 +22,6 @@
<%= f.submit %> + (upload big file to show progress in the title bar)
<% end %> diff --git a/sample/config/routes.rb b/sample/config/routes.rb index bdbc195..7486304 100644 --- a/sample/config/routes.rb +++ b/sample/config/routes.rb @@ -1,4 +1,5 @@ Rails.application.routes.draw do + root to: 'users#index' resources :users # The priority is based upon order of creation: first created -> highest priority.