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 2017/09/21 20:57:05 UTC

[whimsy] branch agenda_on_vue updated: redo adjournment state; convert self.forceUpdate calls to Vue

This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch agenda_on_vue
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/agenda_on_vue by this push:
     new 2d5eb80  redo adjournment state; convert self.forceUpdate calls to Vue
2d5eb80 is described below

commit 2d5eb80e4c682c45fb9cd12736a871e22fa81bf9
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Thu Sep 21 16:56:44 2017 -0400

    redo adjournment state; convert self.forceUpdate calls to Vue
---
 www/board/agenda/views/pages/adjournment.js.rb | 66 +++++++++++++-------------
 www/board/agenda/views/pages/fy22.js.rb        |  2 +-
 www/board/agenda/views/pages/missing.js.rb     |  2 +-
 www/board/agenda/views/pages/select-actions.rb |  2 +-
 4 files changed, 37 insertions(+), 35 deletions(-)

diff --git a/www/board/agenda/views/pages/adjournment.js.rb b/www/board/agenda/views/pages/adjournment.js.rb
index 74b027d..2dc8ea1 100644
--- a/www/board/agenda/views/pages/adjournment.js.rb
+++ b/www/board/agenda/views/pages/adjournment.js.rb
@@ -4,15 +4,38 @@
 
 class Adjournment < Vue
   def initialize
-    Todos.set({
-      add: [],
-      remove: [],
-      establish: [],
-      feedback: [],
-      minutes: {},
-      loading: true,
-      fetched: false
-    })
+    @add = []
+    @remove = []
+    @establish = []
+    @feedback = []
+    @minutes = {}
+    @loading = true
+    @fetched = false
+  end
+
+  # export self as shared state
+  def created()
+    if defined? global
+      global.Todos = self
+    else
+      window.Todos = self
+    end
+  end
+
+  # update state
+  def set(value)
+    for attr in value
+      Todos[attr] = value[attr]
+    end
+  end
+
+  # find corresponding agenda item
+  def link(title)
+    link = nil
+    Agenda.index.each do |item|
+      link = item.href if item.title == title
+    end
+    return link
   end
 
   def render
@@ -156,7 +179,7 @@ class TodoActions < Vue
     end
     @disabled = disabled
 
-    self.forceUpdate()
+    Vue.forceUpdate()
   end
 
   def render
@@ -247,7 +270,7 @@ class EstablishActions < Vue
     end
     @disabled = disabled
 
-    self.forceUpdate()
+    Vue.forceUpdate()
   end
 
   def render
@@ -307,24 +330,3 @@ class FeedbackReminder < Vue
       onClick:-> {window.location.href = 'feedback'}
   end
 end
-
-########################################################################
-#                             shared state                             #
-########################################################################
-
-class Todos
-  def self.set(value)
-    for attr in value
-      Todos[attr] = value[attr]
-    end
-  end
-
-  # find corresponding agenda item
-  def self.link(title)
-    link = nil
-    Agenda.index.each do |item|
-      link = item.href if item.title == title
-    end
-    return link
-  end
-end
diff --git a/www/board/agenda/views/pages/fy22.js.rb b/www/board/agenda/views/pages/fy22.js.rb
index dab699e..e246b05 100644
--- a/www/board/agenda/views/pages/fy22.js.rb
+++ b/www/board/agenda/views/pages/fy22.js.rb
@@ -323,7 +323,7 @@ class FY22 < Vue
       end
     end
 
-    self.forceUpdate()
+    Vue.forceUpdate()
   end
 
   # receive updated budget values
diff --git a/www/board/agenda/views/pages/missing.js.rb b/www/board/agenda/views/pages/missing.js.rb
index 6bb81f4..d5b1a3f 100644
--- a/www/board/agenda/views/pages/missing.js.rb
+++ b/www/board/agenda/views/pages/missing.js.rb
@@ -24,7 +24,7 @@ class Missing < Vue
             _input type: 'checkbox', name: 'selected', value: item.title,
               checked: @checked[item.title], onChange:-> {
                 @checked[item.title] = !@checked[item.title]
-                self.forceUpdate()
+                Vue.forceUpdate()
               }
           end
 
diff --git a/www/board/agenda/views/pages/select-actions.rb b/www/board/agenda/views/pages/select-actions.rb
index f1d524c..432fc3a 100644
--- a/www/board/agenda/views/pages/select-actions.rb
+++ b/www/board/agenda/views/pages/select-actions.rb
@@ -40,7 +40,7 @@ end
 class CandidateAction < Vue
   def render
     _input type: 'checkbox', checked: !@@action.complete,
-      onChange:-> {@@action.complete = !@@action.complete; self.forceUpdate()}
+      onChange:-> {@@action.complete = !@@action.complete; Vue.forceUpdate()}
     _span " "
     _span @@action.owner
     _span ": "

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