You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2016/08/06 22:28:43 UTC

[whimsy] branch master updated: more polyfills

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  313b93d   more polyfills
313b93d is described below

commit 313b93dda2a4ec955a1e3371d889079ba0d14ab4
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Sat Aug 6 18:28:08 2016 -0400

    more polyfills
---
 www/roster/views/pmc/confirm.js.rb | 32 +++++++++++++++++---------------
 www/roster/views/pmc/main.js.rb    | 22 ++++++++++++----------
 2 files changed, 29 insertions(+), 25 deletions(-)

diff --git a/www/roster/views/pmc/confirm.js.rb b/www/roster/views/pmc/confirm.js.rb
index 0ed2494..b33e5f0 100644
--- a/www/roster/views/pmc/confirm.js.rb
+++ b/www/roster/views/pmc/confirm.js.rb
@@ -59,21 +59,23 @@ class PMCConfirm < React
     }
 
     @disabled = true
-    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)
-      @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
diff --git a/www/roster/views/pmc/main.js.rb b/www/roster/views/pmc/main.js.rb
index 49dbc2a..5ede89b 100644
--- a/www/roster/views/pmc/main.js.rb
+++ b/www/roster/views/pmc/main.js.rb
@@ -98,17 +98,19 @@ class PMC < React
     if @attic == nil and not committee.established and defined? fetch
       @attic = []
 
-      fetch('attic/issues.json', credentials: 'include').then {|response|
-        if response.status == 200
-          response.json().then do |json|
-            @attic = json
+      Polyfill.require(%w(Promise fetch)) do
+        fetch('attic/issues.json', credentials: 'include').then {|response|
+          if response.status == 200
+            response.json().then do |json|
+              @attic = json
+            end
+          else
+            console.log "Attic JIRA #{response.status} #{response.statusText}"
           end
-        else
-          console.log "Attic JIRA #{response.status} #{response.statusText}"
-        end
-      }.catch {|error|
-        console.log "Attic JIRA #{errror}"
-      }
+        }.catch {|error|
+          console.log "Attic JIRA #{errror}"
+        }
+      end
     end
   end
 end

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