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


The following commit(s) were added to refs/heads/master by this push:
     new 7e5c819  wire in a button for sending a summary to committers
7e5c819 is described below

commit 7e5c819c61327c0f561cc08fda6cb4efb00d2264
Author: Sam Ruby <[email protected]>
AuthorDate: Thu May 24 11:53:02 2018 -0400

    wire in a button for sending a summary to committers
---
 www/board/agenda/helpers/integer.rb              | 14 ++++++
 www/board/agenda/main.rb                         |  1 +
 www/board/agenda/routes.rb                       |  2 +-
 www/board/agenda/views/app.js.rb                 |  1 +
 www/board/agenda/views/buttons/summary.js.rb     | 56 ++++++++++++++++++++++++
 www/board/agenda/views/committers_report.text.rb | 15 -------
 www/board/agenda/views/models/agenda.js.rb       |  2 +
 7 files changed, 75 insertions(+), 16 deletions(-)

diff --git a/www/board/agenda/helpers/integer.rb 
b/www/board/agenda/helpers/integer.rb
new file mode 100644
index 0000000..8ce9e46
--- /dev/null
+++ b/www/board/agenda/helpers/integer.rb
@@ -0,0 +1,14 @@
+# Add the right prefix to a number
+unless Integer.public_method_defined? :ordinalize
+  class Integer
+    def ordinalize
+      if self % 10 == 1
+        self.to_s + "st"
+      elsif self % 10 == 2
+        self.to_s + "nd"
+      else
+        self.to_s + "th"
+      end
+    end
+  end
+end
diff --git a/www/board/agenda/main.rb b/www/board/agenda/main.rb
index 3ee9ee3..e2d5058 100755
--- a/www/board/agenda/main.rb
+++ b/www/board/agenda/main.rb
@@ -47,6 +47,7 @@ require_relative './models/agenda'
 require_relative './models/minutes'
 require_relative './models/comments'
 require_relative './helpers/string'
+require_relative './helpers/integer'
 require_relative './daemon/session'
 
 require 'websocket-client-simple'
diff --git a/www/board/agenda/routes.rb b/www/board/agenda/routes.rb
index 25c791a..8184bbd 100755
--- a/www/board/agenda/routes.rb
+++ b/www/board/agenda/routes.rb
@@ -286,7 +286,7 @@ get %r{/(\d\d\d\d-\d\d-\d\d).json} do |file|
 end
 
 # draft committers report
-get '/text/committers-report' do
+get %r{/text/summary/(\d\d\d\d-\d\d-\d\d)} do |date|
   _text :committers_report
 end
 
diff --git a/www/board/agenda/views/app.js.rb b/www/board/agenda/views/app.js.rb
index a6967e1..9d47574 100644
--- a/www/board/agenda/views/app.js.rb
+++ b/www/board/agenda/views/app.js.rb
@@ -50,6 +50,7 @@ require_relative 'buttons/publish-minutes'
 require_relative 'buttons/reminders'
 require_relative 'buttons/refresh'
 require_relative 'buttons/showseen'
+require_relative 'buttons/summary'
 require_relative 'buttons/timestamp'
 require_relative 'buttons/vote'
 require_relative 'buttons/email'
diff --git a/www/board/agenda/views/buttons/summary.js.rb 
b/www/board/agenda/views/buttons/summary.js.rb
new file mode 100644
index 0000000..e007093
--- /dev/null
+++ b/www/board/agenda/views/buttons/summary.js.rb
@@ -0,0 +1,56 @@
+class Summary < Vue
+  def initialize
+    @disabled = true
+  end
+
+  # default attributes for the button associated with this form
+  def self.button
+    {
+      text: 'summary',
+      class: 'btn_danger',
+      data_toggle: 'modal',
+      data_target: '#summary-form'
+    }
+  end
+
+  def render
+    _ModalDialog.summary_form!.wide_form color: 'commented' do
+      _h4.commented 'Send out summary of meeting'
+
+      _textarea.summary_text!.form_control rows: 17, tabIndex: 1,
+        placeholder: 'committers summary', value: @summary, disabled: @disabled
+
+      _button.btn_default 'Cancel', type: 'button', data_dismiss: 'modal'
+      _button.btn_primary 'Send', type: 'button', onClick: self.send,
+        disabled: @disabled
+    end
+  end
+
+  # autofocus on summary text; fetch summary
+  def mounted()
+    @summary = ''
+    jQuery('#summary-form').on 'shown.bs.modal' do
+      retrieve "summary/#{Agenda.title}", :text do |summary|
+        document.getElementById("summary-text").focus()
+        @disabled = false
+        @summary = summary
+        jQuery('#summary-text').animate(scrollTop: 0)
+      end
+    end
+  end
+
+  def send(event)
+    data = {
+      agenda: Agenda.file,
+      message: "Draft minutes for #{Agenda.title}",
+      text: @summary
+    }
+
+    @disabled = true
+    post 'summary', data do
+      @disabled = false
+      jQuery('#summary-form').modal(:hide)
+      document.body.classList.remove('modal-open')
+    end
+  end
+end
diff --git a/www/board/agenda/views/committers_report.text.rb 
b/www/board/agenda/views/committers_report.text.rb
index 93d495d..573fe0a 100644
--- a/www/board/agenda/views/committers_report.text.rb
+++ b/www/board/agenda/views/committers_report.text.rb
@@ -2,21 +2,6 @@ require 'chronic'
 
 ## This is a script to generate an email for [email protected]
 
-# Add the right prefix to a number
-unless Integer.public_method_defined? :ordinalize
-  class Integer
-    def ordinalize
-      if self % 10 == 1
-       self.to_s + "st"
-      elsif self % 10 == 2
-       self.to_s + "nd"
-      else
-       self.to_s + "th"
-      end
-    end
-  end
-end
-
 # load agenda and minutes
 board_svn = ASF::SVN['foundation_board']
 minutes_file = Dir[File.join(AGENDA_WORK, 'board_minutes_*.yml')].sort.
diff --git a/www/board/agenda/views/models/agenda.js.rb 
b/www/board/agenda/views/models/agenda.js.rb
index 9c1155f..126e4a6 100644
--- a/www/board/agenda/views/models/agenda.js.rb
+++ b/www/board/agenda/views/models/agenda.js.rb
@@ -258,6 +258,8 @@ class Agenda
 
     if not Minutes.complete
       list << {form: Post, text: 'add item'}
+    else
+      list << {form: Summary}
     end
 
     if User.role == :secretary 

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to