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/27 18:43:58 UTC
[whimsy] branch master updated (6188e26 -> bcbb739)
This is an automated email from the ASF dual-hosted git repository.
rubys pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git.
from 6188e26 post action items refresh issues
new 708cf6c remove dead code
new 39b7f82 make toggling work again
new bcbb739 move to Vue event based architecture
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
www/board/agenda/views/app.js.rb | 1 +
www/board/agenda/views/buttons/post-actions.js.rb | 15 ++-
www/board/agenda/views/event-bus.rb | 7 ++
www/board/agenda/views/layout/header.js.rb | 17 ++-
www/board/agenda/views/pages/select-actions.rb | 6 +-
www/board/agenda/views/utils.js.rb | 4 +-
www/roster/views/person.js.rb | 19 ++--
www/secretary/workbench/views/context-menu.js.rb | 126 ----------------------
8 files changed, 50 insertions(+), 145 deletions(-)
create mode 100644 www/board/agenda/views/event-bus.rb
delete mode 100644 www/secretary/workbench/views/context-menu.js.rb
--
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].
[whimsy] 02/03: make toggling work again
Posted by ru...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
commit 39b7f82abbbbb69553f98190d74c334535d8b4de
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Wed Sep 27 14:43:03 2017 -0400
make toggling work again
---
www/board/agenda/views/app.js.rb | 1 +
www/board/agenda/views/buttons/post-actions.js.rb | 15 ++++++++++++++-
www/board/agenda/views/layout/header.js.rb | 17 +++++++++++++++--
www/board/agenda/views/pages/select-actions.rb | 6 +-----
www/board/agenda/views/utils.js.rb | 4 ++--
www/roster/views/person.js.rb | 19 ++++++++++---------
6 files changed, 43 insertions(+), 19 deletions(-)
diff --git a/www/board/agenda/views/app.js.rb b/www/board/agenda/views/app.js.rb
index c7ba655..1386377 100644
--- a/www/board/agenda/views/app.js.rb
+++ b/www/board/agenda/views/app.js.rb
@@ -1,5 +1,6 @@
# config
require_relative 'vue-config'
+require_relative 'event-bus'
# common
require_relative 'router'
diff --git a/www/board/agenda/views/buttons/post-actions.js.rb b/www/board/agenda/views/buttons/post-actions.js.rb
index acf72dd..a973edc 100644
--- a/www/board/agenda/views/buttons/post-actions.js.rb
+++ b/www/board/agenda/views/buttons/post-actions.js.rb
@@ -4,11 +4,24 @@
class PostActions < Vue
def initialize
@disabled = false
+ @list = []
end
def render
_button.btn.btn_primary 'post actions', onClick: self.click,
- disabled: @disabled || SelectActions.data.list.emtpy?
+ disabled: @disabled || @list.empty?
+ end
+
+ def mounted()
+ EventBus.on :potential_actions, self.potential_actions
+ end
+
+ def beforeDestroy()
+ EventBus.off :potential_actions, self.potential_actions
+ end
+
+ def potential_actions(list)
+ @list = list
end
def click(event)
diff --git a/www/board/agenda/views/layout/header.js.rb b/www/board/agenda/views/layout/header.js.rb
index 5ba3590..7839466 100644
--- a/www/board/agenda/views/layout/header.js.rb
+++ b/www/board/agenda/views/layout/header.js.rb
@@ -8,6 +8,7 @@
class Header < Vue
def initialize
@infodropdown = nil
+ @clock_counter = 0
end
def render
@@ -18,7 +19,7 @@ class Header < Vue
_PodlingNameSearch item: @@item
end
- _span.clock! "\u231B" if clock_counter > 0
+ _span.clock! "\u231B" if @clock_counter > 0
_ul.nav.nav_pills.navbar_right do
@@ -126,8 +127,20 @@ class Header < Vue
end
end
+ def beforeMount()
+ EventBus.on :clock_counter, self.update_counter
+ end
+
+ def beforeDestroy()
+ EventBus.off :clock_counter, self.update_counter
+ end
+
+ def update_counter(counter)
+ @clock_counter = counter
+ end
+
# toggle info dropdown
- def toggleInfo
+ def toggleInfo()
@infodropdown = (@infodropdown ? nil : 'open')
end
end
diff --git a/www/board/agenda/views/pages/select-actions.rb b/www/board/agenda/views/pages/select-actions.rb
index 19078e4..f16ed8b 100644
--- a/www/board/agenda/views/pages/select-actions.rb
+++ b/www/board/agenda/views/pages/select-actions.rb
@@ -13,11 +13,6 @@ class SelectActions < Vue
@names = []
end
- def created()
- console.log 'created'
- SelectActions.data = $data
- end
-
def render
_h3 'Post Action Items'
@@ -37,6 +32,7 @@ class SelectActions < Vue
if response
@list = response.actions
@names = response.names
+ EventBus.emit :potential_actions, @list
end
end
end
diff --git a/www/board/agenda/views/utils.js.rb b/www/board/agenda/views/utils.js.rb
index f097e5e..f31f9d2 100644
--- a/www/board/agenda/views/utils.js.rb
+++ b/www/board/agenda/views/utils.js.rb
@@ -89,7 +89,7 @@ def retrieve(target, type, &block)
def xhr.onreadystatechange()
if xhr.readyState == 1
clock_counter += 1
- setTimeout(0) {Main.refresh()}
+ EventBus.emit :clock_counter, clock_counter
elsif xhr.readyState == 4
data = nil
@@ -120,7 +120,7 @@ def retrieve(target, type, &block)
block(data)
clock_counter -= 1
- Main.refresh()
+ EventBus.emit :clock_counter, clock_counter
end
end
diff --git a/www/roster/views/person.js.rb b/www/roster/views/person.js.rb
index 198aa7a..4d796cd 100644
--- a/www/roster/views/person.js.rb
+++ b/www/roster/views/person.js.rb
@@ -209,8 +209,14 @@ class Person < Vue
# when a double click occurs, toggle the associated state
def dblclick(event)
- tr = event.currentTarget
- @edit = tr.dataset.edit
+ row = event.currentTarget
+
+ if row.dataset.edit == @edit
+ @edit = nil
+ else
+ @edit = row.dataset.edit
+ end
+
window.getSelection().removeAllRanges()
end
@@ -256,13 +262,8 @@ class Person < Vue
@committer = response.committer if response.committer
# turn off edit mode on this field
- tr = form.closest('tr')[0]
- if tr
- field = "edit_#{tr.dataset.edit}"
- changes = {}
- changes[field] = false
- self.setState changes
- end
+ row = form.closest('.row')[0]
+ @edit = nil if row and row.dataset.edit == @edit
},
error: ->(response) {
--
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <co...@whimsical.apache.org>.
[whimsy] 01/03: remove dead code
Posted by ru...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
commit 708cf6c8afad78cf1cbe3fa4d0695716460acfca
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Wed Sep 27 11:49:18 2017 -0400
remove dead code
---
www/secretary/workbench/views/context-menu.js.rb | 126 -----------------------
1 file changed, 126 deletions(-)
diff --git a/www/secretary/workbench/views/context-menu.js.rb b/www/secretary/workbench/views/context-menu.js.rb
deleted file mode 100644
index 9c7413f..0000000
--- a/www/secretary/workbench/views/context-menu.js.rb
+++ /dev/null
@@ -1,126 +0,0 @@
-#
-# Context menu with actions to apply to an attachment
-#
-
-class ContextMenu < Vue
- def render
- # context menu that displays when you 'right click' an attachment
- _ul.contextMenu do
- _li "\u2704 burst", onMousedown: self.burst
- _li.divider
- _li "\u21B7 right", onMousedown: self.rotate_attachment
- _li "\u21c5 flip", onMousedown: self.rotate_attachment
- _li "\u21B6 left", onMousedown: self.rotate_attachment
- _li.divider
- _li "\u2716 delete", onMousedown: self.delete_attachment
- end
- end
-
- # disable context menu
- def mounted()
- document.querySelector('.contextMenu').style.display = :none
- end
-
- # position and show context menu
- def self.show(event)
- menu = document.querySelector('.contextMenu')
- menu.style.position = :absolute
- menu.style.display = :block
-
- bodyRect = document.body.getBoundingClientRect()
- menuRect = menu.getBoundingClientRect()
- position = {x: event.clientX, y: event.clientY}
-
- if position.x + menuRect.width > bodyRect.width
- position.x -= menuRect.width if position.x >= menuRect.width
- end
-
- if position.y + menuRect.height > bodyRect.height
- position.y -= menuRect.height if position.y >= menuRect.height
- end
-
- menu.style.left = position.x + 'px'
- menu.style.top = position.y + 'px'
- event.preventDefault()
- end
-
- # hide context menu whenever a click is received outside the menu
- def self.hide(event)
- target = event && event.target
- while target
- return if target.class == 'contextMenu'
- target = target.parentNode
- end
- document.querySelector('.contextMenu').style.display = :none
- end
-
- # burst a PDF into individual pages
- def burst(event)
- data = {
- selected: @@parts.state.menu,
- message: window.parent.location.pathname
- }
-
- @@parts.setState busy: true
- HTTP.post('../../actions/burst', data).then {|response|
- @@parts.setState attachments: response.attachments,
- selected: response.selected, busy: false, menu: nil
- window.parent.frames.content.location.href=response.selected
- ContextMenu.hide()
- }.catch {|error|
- alert error
- @@parts.setState busy: false, menu: nil
- ContextMenu.hide()
- }
- end
-
- # burst a PDF into individual pages
- def delete_attachment(event)
- data = {
- selected: @@parts.state.menu,
- message: window.parent.location.pathname
- }
-
- @@parts.setState busy: true
- HTTP.post('../../actions/delete-attachment', data).then {|response|
- if response.attachments and not response.attachments.empty?
- @@parts.setState attachments: response.attachments, busy: false,
- menu: nil
- window.parent.frames.content.location.href='_body_'
- ContextMenu.hide()
- else
- window.parent.location.href = '../..'
- end
- }.catch {|error|
- alert error
- @@parts.setState busy: false, menu: nil
- ContextMenu.hide()
- }
- end
-
- # rotate an attachment
- def rotate_attachment(event)
- message = window.parent.location.pathname
-
- data = {
- selected: @@parts.state.menu,
- message: message,
- direction: event.currentTarget.textContent
- }
-
- @@parts.setState busy: true
- HTTP.post('../../actions/rotate-attachment', data).then {|response|
- @@parts.setState attachments: response.attachments,
- selected: response.selected, busy: false, menu: nil
-
- # reload attachment in content pane
- window.parent.frames.content.location.href = response.selected
-
- ContextMenu.hide()
- }.catch {|error|
- alert error
- @@parts.setState busy: false, menu: nil
- ContextMenu.hide()
- }
- end
-end
--
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <co...@whimsical.apache.org>.
[whimsy] 03/03: move to Vue event based architecture
Posted by ru...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
commit bcbb73965e626ddeb3f02d6dae18ef61f787f14c
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Wed Sep 27 14:43:37 2017 -0400
move to Vue event based architecture
---
www/board/agenda/views/event-bus.rb | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/www/board/agenda/views/event-bus.rb b/www/board/agenda/views/event-bus.rb
new file mode 100644
index 0000000..e67aa93
--- /dev/null
+++ b/www/board/agenda/views/event-bus.rb
@@ -0,0 +1,7 @@
+# https://alligator.io/vuejs/global-event-bus/
+EventBus = new Vue()
+
+# export 'dollar-less' version of event methods to make them easier to call
+%w(emit on once off).each do |method|
+ EventBus[method] = EventBus['$' + method]
+end
--
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <co...@whimsical.apache.org>.