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/19 23:00:49 UTC
[whimsy] branch agenda_on_vue updated (f9b06c6 -> 0216c4c)
This is an automated email from the ASF dual-hosted git repository.
rubys pushed a change to branch agenda_on_vue
in repository https://gitbox.apache.org/repos/asf/whimsy.git.
from f9b06c6 convert tests from react to vue
new 10ef265 skip non-standard agenda in parsing for historical comments
new 0216c4c five more tests passing
The 2 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:
lib/whimsy/asf/agenda.rb | 3 +++
www/board/agenda/models/comments.rb | 11 +++++---
www/board/agenda/spec/forms_spec.rb | 16 ++++++------
www/board/agenda/spec/vue_server.rb | 3 +--
www/board/agenda/views/buttons/add-comment.js.rb | 19 ++------------
www/board/agenda/views/buttons/add-minutes.js.rb | 9 ++-----
www/board/agenda/views/elements/modal-dialog.js.rb | 30 ++++++++++------------
www/board/agenda/views/models/comments.js.rb | 2 +-
www/board/agenda/views/utils.js.rb | 20 +++++++++------
9 files changed, 50 insertions(+), 63 deletions(-)
--
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].
[whimsy] 01/02: skip non-standard agenda in parsing for historical
comments
Posted by ru...@apache.org.
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
commit 10ef2654732b87df4378294255eeee816d0fcc88
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Tue Sep 19 07:54:47 2017 -0400
skip non-standard agenda in parsing for historical comments
---
lib/whimsy/asf/agenda.rb | 3 +++
www/board/agenda/models/comments.rb | 11 ++++++++---
www/board/agenda/views/models/comments.js.rb | 2 +-
www/board/agenda/views/utils.js.rb | 20 ++++++++++++--------
4 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/lib/whimsy/asf/agenda.rb b/lib/whimsy/asf/agenda.rb
index b8100c1..30acc90 100644
--- a/lib/whimsy/asf/agenda.rb
+++ b/lib/whimsy/asf/agenda.rb
@@ -95,6 +95,9 @@ class ASF::Board::Agenda
@sections[section][:index] = index if @sections[section]
end
+ # quick exit if none found -- non-standard format agenda
+ return [] if @sections.empty?
+
# look for flags
flagged_reports = Hash[@file[/ \d\. Committee Reports.*?\n\s+A\./m].
scan(/# (.*?) \[(.*)\]/)]
diff --git a/www/board/agenda/models/comments.rb b/www/board/agenda/models/comments.rb
index eabfd4e..20a36a9 100644
--- a/www/board/agenda/models/comments.rb
+++ b/www/board/agenda/models/comments.rb
@@ -29,9 +29,14 @@ class HistoricalComments
# gather up titles and comments
agendas.reverse.each do |agenda|
date = agenda[/\d+_\d+_\d+/]
- ASF::Board::Agenda.parse(File.read(agenda), true).each do |report|
- next if report['comments'].to_s.empty?
- comments[report['title']][date] = report['comments']
+ begin
+ ASF::Board::Agenda.parse(File.read(agenda), true).each do |report|
+ next if report['comments'].to_s.empty?
+ comments[report['title']][date] = report['comments']
+ end
+ rescue => e
+ STDERR.puts e.to_s
+ e.backtrace.each {|line| STDERR.puts line}
end
end
diff --git a/www/board/agenda/views/models/comments.js.rb b/www/board/agenda/views/models/comments.js.rb
index 8730a83..1e93ba9 100644
--- a/www/board/agenda/views/models/comments.js.rb
+++ b/www/board/agenda/views/models/comments.js.rb
@@ -12,7 +12,7 @@ class HistoricalComments
else
@@comments = {}
JSONStorage.fetch('historical-comments') do |comments|
- @@comments = comments
+ @@comments = comments || {}
end
end
end
diff --git a/www/board/agenda/views/utils.js.rb b/www/board/agenda/views/utils.js.rb
index 179286a..f097e5e 100644
--- a/www/board/agenda/views/utils.js.rb
+++ b/www/board/agenda/views/utils.js.rb
@@ -55,14 +55,16 @@ def post(target, data, &block)
elsif xhr.status == 404
alert "Not Found: json/#{target}"
elsif xhr.status >= 400
- console.log(xhr.response)
if not xhr.response
- alert "Exception - #{xhr.statusText}"
+ message = "Exception - #{xhr.statusText}"
elsif xhr.response.exception
- alert "Exception\n#{xhr.response.exception}"
+ message = "Exception\n#{xhr.response.exception}"
else
- alert "Exception\n#{JSON.parse(xhr.responseText).exception}"
+ message = "Exception\n#{JSON.parse(xhr.responseText).exception}"
end
+
+ console.log(message)
+ alert message
end
rescue => e
console.log(e)
@@ -101,14 +103,16 @@ def retrieve(target, type, &block)
elsif xhr.status == 404
alert "Not Found: #{type}/#{target}"
elsif xhr.status >= 400
- console.log(xhr.response)
if not xhr.response
- alert "Exception - #{xhr.statusText}"
+ message = "Exception - #{xhr.statusText}"
elsif xhr.response.exception
- alert "Exception\n#{xhr.response.exception}"
+ message = "Exception\n#{xhr.response.exception}"
else
- alert "Exception\n#{JSON.parse(xhr.responseText).exception}"
+ message = "Exception\n#{JSON.parse(xhr.responseText).exception}"
end
+
+ console.log(message)
+ alert(message)
end
rescue => e
console.log(e)
--
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <co...@whimsical.apache.org>.
[whimsy] 02/02: five more tests passing
Posted by ru...@apache.org.
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
commit 0216c4c8ef266061689cc1a0e3412093da88af4f
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Tue Sep 19 19:00:36 2017 -0400
five more tests passing
---
www/board/agenda/spec/forms_spec.rb | 16 ++++++------
www/board/agenda/spec/vue_server.rb | 3 +--
www/board/agenda/views/buttons/add-comment.js.rb | 19 ++------------
www/board/agenda/views/buttons/add-minutes.js.rb | 9 ++-----
www/board/agenda/views/elements/modal-dialog.js.rb | 30 ++++++++++------------
5 files changed, 26 insertions(+), 51 deletions(-)
diff --git a/www/board/agenda/spec/forms_spec.rb b/www/board/agenda/spec/forms_spec.rb
index 1d66132..835b64b 100644
--- a/www/board/agenda/spec/forms_spec.rb
+++ b/www/board/agenda/spec/forms_spec.rb
@@ -33,22 +33,22 @@ describe "forms", type: :feature, server: :vue do
it "should enable Save button after input" do
on_vue_server do
+ item = {}
server = {pending: {}, initials: 'sr'}
class TestCommentForm < Vue
def render
- _AddComment(item: {}, server: {pending: {}, initials: 'sr'})
+ _AddComment(item: item, server: server)
end
end
app = Vue.renderApp(TestCommentForm)
node = app.querySelector('#comment-text')
- node.textContent = 'Good job!'
- app.dispatchEvent(Event.new('input'))
- response.end app.innerHTML
+ node.value = 'Good job!'
+ node.dispatchEvent(Event.new('input'))
+ Vue.nextTick { response.end app.outerHTML }
end
- puts page.body
expect(page).to have_selector '.modal-footer .btn-warning', text: 'Delete'
expect(page).to have_selector \
'.modal-footer .btn-primary:not([disabled])', text: 'Save'
@@ -93,10 +93,10 @@ describe "forms", type: :feature, server: :vue do
app = Vue.renderApp(TestPost)
button = app.querySelector('.btn-danger')
- app.dispatchEvent(new Event('click'), button)
+ button.dispatchEvent(Event.new('click'))
post_report = app.querySelector('#post-report-text')
- post_report.textContent = this.state.report
- response.end app.innerHTML
+ post_report.value = this.state.report
+ Vue.nextTick { response.end app.outerHTML }
end
expect(find('#post-report-text').value).to match(/to\nanswer questions/)
diff --git a/www/board/agenda/spec/vue_server.rb b/www/board/agenda/spec/vue_server.rb
index 16acdf4..f1f296a 100644
--- a/www/board/agenda/spec/vue_server.rb
+++ b/www/board/agenda/spec/vue_server.rb
@@ -118,8 +118,7 @@ class VueServer
return outer.querySelector(selector)
end
- def app.dispatchEvent(event, element=nil)
- element ||= inner
+ def app.dispatchEvent(event, element)
element.dispatchEvent(event)
app._watcher.run()
end
diff --git a/www/board/agenda/views/buttons/add-comment.js.rb b/www/board/agenda/views/buttons/add-comment.js.rb
index 7c2ad93..fe54301 100644
--- a/www/board/agenda/views/buttons/add-comment.js.rb
+++ b/www/board/agenda/views/buttons/add-comment.js.rb
@@ -41,8 +41,7 @@ class AddComment < Vue
#input field: comment text
_textarea.comment_text! value: @comment, label: 'Comment',
- placeholder: 'comment', rows: 5, onChange: self.change,
- disabled: @disabled
+ placeholder: 'comment', rows: 5, disabled: @disabled
if Server.role == :director and @@item.attach =~ /^[A-Z]+$/
_input.flag! type: 'checkbox', label: 'item requires discussion or follow up',
@@ -63,26 +62,12 @@ class AddComment < Vue
end
# autofocus on comment text
- def componentDidMount()
+ def mounted()
jQuery('#comment-form').on 'shown.bs.modal' do
~'#comment-text'.focus()
end
end
- # update comment when textarea changes, triggering hiding/showing the
- # Delete button and enabling/disabling the Save button.
- def change(event)
- @comment = event.target.value
- end
-
- # when item changes, reset base and comment
- def componentWillReceiveProps(newprops)
- if newprops.item.href != self.props.item.href
- @checked = newprops.item.flagged
- @base = @comment = newprops.item.pending || ''
- end
- end
-
# when delete button is pushed, clear the comment
def delete(event)
@comment = ''
diff --git a/www/board/agenda/views/buttons/add-minutes.js.rb b/www/board/agenda/views/buttons/add-minutes.js.rb
index 65ca1a8..a462791 100644
--- a/www/board/agenda/views/buttons/add-minutes.js.rb
+++ b/www/board/agenda/views/buttons/add-minutes.js.rb
@@ -68,22 +68,17 @@ class AddMinutes < Vue
end
# autofocus on minute text
- def componentDidMount()
+ def mounted()
jQuery('#minute-form').on 'shown.bs.modal' do
~'#minute-text'.focus()
end
end
# when initially displayed, set various fields to match the item
- def componentWillMount()
+ def created()
self.setup(@@item)
end
- # when item changes, reset various fields to match
- def componentWillReceiveProps(newprops)
- self.setup(newprops.item) if newprops.item.href != self.props.item.href
- end
-
# reset base, draft minutes, shepherd, default ai_text, and indent
def setup(item)
@base = draft = Minutes.get(item.title) || ''
diff --git a/www/board/agenda/views/elements/modal-dialog.js.rb b/www/board/agenda/views/elements/modal-dialog.js.rb
index c668eab..b575512 100644
--- a/www/board/agenda/views/elements/modal-dialog.js.rb
+++ b/www/board/agenda/views/elements/modal-dialog.js.rb
@@ -6,29 +6,21 @@
#
class ModalDialog < Vue
- def initialize
- @header = []
- @body = []
- @footer = []
- end
-
- def created()
- @header.clear()
- @body.clear()
- @footer.clear()
+ def collateSlots()
+ sections = {header: [], body: [], footer: []}
$slots.default.each do |slot|
if slot.tag == 'h4'
# place h4 elements into the header, adding a modal-title class
slot = self.addClass(slot, 'modal-title')
- @header << slot
+ sections.header << slot
elsif slot.tag == 'button'
# place button elements into the footer, adding a btn class
slot = self.addClass(slot, 'btn')
- @footer << slot
+ sections.footer << slot
elsif slot.tag == 'input' or slot.tag == 'textarea'
@@ -52,33 +44,37 @@ class ModalDialog < Vue
end
end
- @body << Vue.createElement('div', {class: 'form-group'},
+ sections.body << Vue.createElement('div', {class: 'form-group'},
[label, slot])
else
# place all other elements into the body
- @body << slot
+ sections.body << slot
end
end
+
+ return sections
end
def render
+ sections = self.collateSlots()
+
_div.modal.fade id: @@id, class: @@className do
_div.modal_dialog do
_div.modal_content do
_div.modal_header class: @@color do
_button.close "\u00d7", type: 'button', data_dismiss: 'modal'
- _[*@header]
+ _[*sections.header]
end
_div.modal_body do
- _[*@body]
+ _[*sections.body]
end
_div.modal_footer class: @@color do
- _[*@footer]
+ _[*sections.footer]
end
end
end
--
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <co...@whimsical.apache.org>.