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 2018/04/02 21:06:46 UTC
[whimsy] branch master updated: start to rough in guided item
creation dialogs
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 c862dac start to rough in guided item creation dialogs
c862dac is described below
commit c862dac8361246e94bb0adaf739bdfe1e6538534
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Mon Apr 2 17:06:08 2018 -0400
start to rough in guided item creation dialogs
---
www/board/agenda/public/stylesheets/app.css | 5 +
www/board/agenda/spec/index_spec.rb | 4 +-
www/board/agenda/views/buttons/post.js.rb | 138 +++++++++++++++++++---------
www/board/agenda/views/models/agenda.js.rb | 2 +-
4 files changed, 101 insertions(+), 48 deletions(-)
diff --git a/www/board/agenda/public/stylesheets/app.css b/www/board/agenda/public/stylesheets/app.css
index cba79b6..f4880a5 100644
--- a/www/board/agenda/public/stylesheets/app.css
+++ b/www/board/agenda/public/stylesheets/app.css
@@ -32,6 +32,11 @@ aside {float: right}
aside ul {margin: 0}
aside li {list-style: none}
+/* new item type */
+ul.new-item-type {margin: 0}
+.new-item-type li {list-style: none}
+.new-item-type .btn {margin: 0.2em; min-width: 12em}
+
/* next/back links */
.backlink {float: left; min-width: 9em}
.nextlink {float: right; min-width: 9em}
diff --git a/www/board/agenda/spec/index_spec.rb b/www/board/agenda/spec/index_spec.rb
index f7ce3a9..0264671 100644
--- a/www/board/agenda/spec/index_spec.rb
+++ b/www/board/agenda/spec/index_spec.rb
@@ -40,12 +40,12 @@ feature 'index' do
expect(page).to have_selector '.backlink[href="../2015-01-21/"]',
text: '2015-01-21'
expect(page).to have_selector 'button', text: 'refresh'
- expect(page).to have_selector 'button', text: 'add resolution'
+ expect(page).to have_selector 'button', text: 'add item'
expect(page).to have_selector '.nextlink[href="help"]', text: 'Help'
# hidden form
expect(page).to have_selector '.modal .modal-dialog .modal-header h4',
- text: 'Add Resolution'
+ text: 'Select Item Type'
end
it "should show a summary" do
diff --git a/www/board/agenda/views/buttons/post.js.rb b/www/board/agenda/views/buttons/post.js.rb
index ab4b3b4..a5af2380 100644
--- a/www/board/agenda/views/buttons/post.js.rb
+++ b/www/board/agenda/views/buttons/post.js.rb
@@ -6,6 +6,7 @@
class Post < Vue
def initialize
+ @button = @@button.text
@disabled = false
@alerted = false
@edited = false
@@ -22,44 +23,78 @@ class Post < Vue
}
end
+ def selectItem(event)
+ @button = event.target.textContent
+ retitle()
+ end
+
def render
_ModalDialog.wide_form.post_report_form! color: 'commented' do
- _h4 @header
+ if @button == 'add item'
+ _h4 'Select Item Type'
+
+ _ul.new_item_type do
+ _li do
+ _button.btn.btn_primary 'Change Chair', disabled: true
+ end
+
+ _li do
+ _button.btn.btn_primary 'Establish Project', disabled: true
+ end
+
+ _li do
+ _button.btn.btn_primary 'Terminate Project', disabled: true
+ end
+
+ _li do
+ _button.btn.btn_primary 'Out of Cycle Report', disabled: true
+ end
+
+ _li do
+ _button.btn.btn_primary 'New Resolution', onClick: selectItem
+ _span '- free form entry of a new resolution'
+ end
+ end
+
+ _button.btn_default 'Cancel', data_dismiss: 'modal'
+ else
+ _h4 @header
- #input field: title
- if @@button.text == 'add resolution'
- _input.post_report_title! label: 'title', disabled: @disabled,
- placeholder: 'title', value: @title, onFocus: self.default_title
- end
+ #input field: title
+ if @header == 'Add Resolution'
+ _input.post_report_title! label: 'title', disabled: @disabled,
+ placeholder: 'title', value: @title, onFocus: self.default_title
+ end
- #input field: report text
- _textarea.post_report_text! label: @label, value: @report,
- placeholder: @label, rows: 17, disabled: @disabled,
- onInput: self.change_text
-
- # upload of spreadsheet from virtual
- if @@item.title == 'Treasurer'
- _form do
- _div.form_group do
- _label 'financial spreadsheet from virtual', for: 'upload'
- _input.upload! type: 'file', value: @upload
- _button.btn.btn_primary 'Upload', onClick: upload_spreadsheet,
- disabled: @disabled || !@upload
+ #input field: report text
+ _textarea.post_report_text! label: @label, value: @report,
+ placeholder: @label, rows: 17, disabled: @disabled,
+ onInput: self.change_text
+
+ # upload of spreadsheet from virtual
+ if @@item.title == 'Treasurer'
+ _form do
+ _div.form_group do
+ _label 'financial spreadsheet from virtual', for: 'upload'
+ _input.upload! type: 'file', value: @upload
+ _button.btn.btn_primary 'Upload', onClick: upload_spreadsheet,
+ disabled: @disabled || !@upload
+ end
end
end
- end
- #input field: commit_message
- if @@button.text != 'add resolution'
- _input.post_report_message! label: 'commit message',
- disabled: @disabled, value: @message
- end
+ #input field: commit_message
+ if @header != 'Add Resolution'
+ _input.post_report_message! label: 'commit message',
+ disabled: @disabled, value: @message
+ end
- # footer buttons
- _button.btn_default 'Cancel', data_dismiss: 'modal', disabled: @disabled
- _button 'Reflow', class: self.reflow_color(), onClick: self.reflow
- _button.btn_primary 'Submit', onClick: self.submit,
- disabled: (not self.ready())
+ # footer buttons
+ _button.btn_default 'Cancel', data_dismiss: 'modal', disabled: @disabled
+ _button 'Reflow', class: self.reflow_color(), onClick: self.reflow
+ _button.btn_primary 'Submit', onClick: self.submit,
+ disabled: (not self.ready())
+ end
end
end
@@ -71,18 +106,31 @@ class Post < Vue
end
jQuery('#post-report-form').on 'shown.bs.modal' do
- # set focus once modal is shown
- if @@button.text == 'add resolution'
- document.getElementById("post-report-title").focus()
- else
- document.getElementById("post-report-text").focus()
- end
+ reposition()
+ end
+ end
- # scroll to the top
- setTimeout 0 do
- document.getElementById("post-report-text").scrollTop = 0
- end
+ # reposition after update if header changed
+ def updated()
+ reposition() if Post.header != @header
+ end
+
+ # set focus, scroll
+ def reposition()
+ # set focus once modal is shown
+ title = document.getElementById("post-report-title")
+ text = document.getElementById("post-report-text")
+
+ if title || text
+ (title || text).focus()
+
+ # scroll to the top
+ setTimeout 0 do
+ text.scrollTop = 0 if text
+ end
end
+
+ Post.header == @header
end
# initialize form title, etc.
@@ -92,7 +140,7 @@ class Post < Vue
# match form title, input label, and commit message with button text
def retitle()
- case @@button.text
+ case @button
when 'post report'
@header = 'Post Report'
@label = 'report'
@@ -103,7 +151,7 @@ class Post < Vue
@label = 'report'
@message = "Edit #{@@item.title} Report"
- when 'add resolution'
+ when 'add resolution', 'New Resolution'
@header = 'Add Resolution'
@label = 'resolution'
@title = ''
@@ -142,7 +190,7 @@ class Post < Vue
@report = @base
end
- if @@button.text == 'add resolution' or @@item.attach =~ /^[47]/
+ if @header == 'Add Resolution' or @@item.attach =~ /^[47]/
@indent = ' '
elsif @@item.attach == '8.'
@indent = ' '
@@ -242,7 +290,7 @@ class Post < Vue
def ready()
return false if @disabled
- if @@button.text == 'add resolution'
+ if @header == 'Add Resolution'
return @report != '' && @title != ''
else
return @report != @@item.text && @message != ''
@@ -277,7 +325,7 @@ class Post < Vue
def submit(event)
@edited = false
- if @@button.text == 'add resolution'
+ if @header == 'Add Resolution'
data = {
agenda: Agenda.file,
attach: '7?',
diff --git a/www/board/agenda/views/models/agenda.js.rb b/www/board/agenda/views/models/agenda.js.rb
index e8589cb..49c3f24 100644
--- a/www/board/agenda/views/models/agenda.js.rb
+++ b/www/board/agenda/views/models/agenda.js.rb
@@ -254,7 +254,7 @@ class Agenda
list = [{button: Refresh}]
if not Minutes.complete
- list << {form: Post, text: 'add resolution'}
+ list << {form: Post, text: 'add item'}
end
if User.role == :secretary
--
To stop receiving notification emails like this one, please contact
rubys@apache.org.