whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject [whimsy] branch master updated: polyfill fetch for older browsers
Date Sat, 06 Aug 2016 21:48:28 GMT
This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/whimsy.git

The following commit(s) were added to refs/heads/master by this push:
       new  61335aa   polyfill fetch for older browsers
61335aa is described below

commit 61335aa003ad535b489e53f58fb7d4f40e0d0144
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Sat Aug 6 17:48:00 2016 -0400

    polyfill fetch for older browsers
---
 www/roster/views/committee.js.rb | 28 +++++++++++++++-------------
 www/roster/views/group.js.rb     | 32 +++++++++++++++++---------------
 2 files changed, 32 insertions(+), 28 deletions(-)

diff --git a/www/roster/views/committee.js.rb b/www/roster/views/committee.js.rb
index ef6dc97..fff45a0 100644
--- a/www/roster/views/committee.js.rb
+++ b/www/roster/views/committee.js.rb
@@ -417,19 +417,21 @@ class PMCConfirm < React
       body: {pmc: @@pmc, id: @id, action: action, targets: targets}.inspect
     }
 
-    fetch('actions/committee', args).then {|response|
-      content_type = response.headers.get('content-type') || ''
-      if response.status == 200 and content_type.include? 'json'
-        response.json().then do |json|
-          @@update.call(json)
+    Polyfill.require(%w(Promise fetch)) do
+      fetch('actions/committee', args).then {|response|
+        content_type = response.headers.get('content-type') || ''
+        if response.status == 200 and content_type.include? 'json'
+          response.json().then do |json|
+            @@update.call(json)
+          end
+        else
+          alert "#{response.status} #{response.statusText}"
         end
-      else
-        alert "#{response.status} #{response.statusText}"
-      end
-      jQuery('#confirm').modal(:hide)
-    }.catch {|error|
-      alert errror
-      jQuery('#confirm').modal(:hide)
-    }
+        jQuery('#confirm').modal(:hide)
+      }.catch {|error|
+        alert errror
+        jQuery('#confirm').modal(:hide)
+      }
+    end
   end
 end
diff --git a/www/roster/views/group.js.rb b/www/roster/views/group.js.rb
index fb1fff6..eaef951 100644
--- a/www/roster/views/group.js.rb
+++ b/www/roster/views/group.js.rb
@@ -212,21 +212,23 @@ class GroupConfirm < React
     }
 
     @disabled = true
-    fetch('actions/authgroup', args).then {|response|
-      content_type = response.headers.get('content-type') || ''
-      if response.status == 200 and content_type.include? 'json'
-        response.json().then do |json|
-          @@update.call(json)
+    Polyfill.require(%w(Promise fetch)) do
+      fetch('actions/authgroup', args).then {|response|
+        content_type = response.headers.get('content-type') || ''
+        if response.status == 200 and content_type.include? 'json'
+          response.json().then do |json|
+            @@update.call(json)
+          end
+        else
+          alert "#{response.status} #{response.statusText}"
         end
-      else
-        alert "#{response.status} #{response.statusText}"
-      end
-      jQuery('#confirm').modal(:hide)
-      @disabled = false
-    }.catch {|error|
-      alert errror
-      jQuery('#confirm').modal(:hide)
-      @disabled = false
-    }
+        jQuery('#confirm').modal(:hide)
+        @disabled = false
+      }.catch {|error|
+        alert errror
+        jQuery('#confirm').modal(:hide)
+        @disabled = false
+      }
+    end
   end
 end

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <commits@whimsical.apache.org>'].

Mime
View raw message