This is an automated email from the ASF dual-hosted git repository.
curcuru 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 e407169 styleallthethings!
e407169 is described below
commit e4071693673513d6df8ca1818434104c8c927ea4
Author: Shane Curcuru <[email protected]>
AuthorDate: Mon Jun 5 09:38:34 2017 -0400
styleallthethings!
We should see if users want the form to be clearer if they are going to
immediately upload another file afterwards (i.e. improving the post
display to say “upload another” or something.
---
www/treasurer/bill-upload.cgi | 151 +++++++++++++++++++++++++-----------------
1 file changed, 91 insertions(+), 60 deletions(-)
diff --git a/www/treasurer/bill-upload.cgi b/www/treasurer/bill-upload.cgi
index 1d7b9de..9c3fe72 100755
--- a/www/treasurer/bill-upload.cgi
+++ b/www/treasurer/bill-upload.cgi
@@ -1,7 +1,11 @@
#!/usr/bin/env ruby
-
-require 'whimsy/asf'
+PAGETITLE = "Apache Treasurer Bill Upload" # Wvisible:treasurer
+$LOAD_PATH.unshift File.realpath(File.expand_path('../../../lib', __FILE__))
require 'wunderbar'
+require 'wunderbar/bootstrap'
+require 'wunderbar/jquery'
+require 'whimsy/asf'
+
user = ASF::Person.new($USER)
unless user.asf_member? or ASF.pmc_chairs.include? user or $USER=='ea'
@@ -11,71 +15,98 @@ unless user.asf_member? or ASF.pmc_chairs.include? user or
$USER=='ea'
end
_html do
- _title 'ASF Bill upload'
-
- _style %{
- label {margin-top: 1em; display: block}
- input, textarea {margin-top: 0.5em; margin-left: 4em; display: block}
- input[type=radio] {display: inline}
- input[type=submit] {margin-left: 0}
- fieldset {display: inline-block}
- legend {background-color: #141; color: #DFD; padding: 0.4em}
- legend, fieldset {border-radius: 8px}
- }
_style :system
- _form enctype: 'multipart/form-data', method: 'post' do
- _fieldset do
- _legend 'ASF Bill upload'
-
- _label 'Select a file to upload:'
- _input type: 'file', name: 'file', required: true
-
- _label 'Enter Commit Message:', for: 'message'
- _textarea name: 'message', id: 'message', cols: 80, required: true
-
- _label 'Funding source:', for: 'source'
- _textarea name: 'source', id: 'source', cols: 80
-
- _label 'Select a destination:'
- _div do
- _input 'Bills/received', type: 'radio', name: 'dest', value:
'received',
- checked: true
- end
- _div do
- _input 'Bills/approved', type: 'radio', name: 'dest', value: 'approved'
+ _body? do
+ _whimsy_body(
+ title: PAGETITLE,
+ subtitle: 'How To Upload Bills',
+ related: {
+ 'https://treasurer.apache.org/' => 'ASF Treasurer Process
Documentation',
+ 'https://whimsy.apache.org/committers/svn-info' => 'SVN Info helper
(to check file status)'
+ },
+ helpblock: -> {
+ _p %{
+ This form allows ASF Members and Officers to upload invoices or
+ bills to be submitted for payment.
+ }
+ _p %{
+ Remember: only allowed approvers for a specific bill should
+ put or move bills into the /approved directory.
+ }
+ }
+ ) do
+ # GET: display the data input form for upload
+ _whimsy_panel('Upload A New Bill', style: 'panel-success') do
+ _form.form_horizontal enctype: 'multipart/form-data', method: 'post' do
+ _div.form_group do
+ _label.control_label.col_sm_2 'Select file to upload', for: 'file'
+ _div.col_sm_10 do
+ _input.form_control type: 'file', id: 'file', name: 'file',
required: true, autofocus: true
+ end
+ end
+ _div.form_group do
+ _label.control_label.col_sm_2 'Enter commit message', for:
'message'
+ _div.col_sm_10 do
+ _textarea.form_control name: 'message', id: 'message', cols: 80,
required: true
+ end
+ end
+ _div.form_group do
+ _label.control_label.col_sm_2 'Funding source (optional)', for:
'source'
+ _div.col_sm_10 do
+ _textarea.form_control name: 'source', id: 'source', cols: 80
+ end
+ end
+ _div.form_group do
+ _label.control_label.col_sm_2 'Select destination', for: "dest"
+ _div.col_sm_10 do
+ _select.form_control name: 'dest', id: 'dest' do
+ _option 'Bills/received', type: 'radio', name: 'dest', value:
'received', checked: true
+ _option 'Bills/approved', type: 'radio', name: 'dest', value:
'approved'
+ end
+ end
+ end
+ _div.form_group do
+ _div.col_sm_offset_2.col_sm_10 do
+ _input.btn.btn_default type: "submit", value: "Upload"
+ end
+ end
+ end
end
- _input type: 'submit', value: 'Upload'
- end
- end
+ # POST: process the upload by checking into svn
+ if @file
+ _div.well.well_lg do
+ # destination directory
+ bills = 'https://svn.apache.org/repos/private/financials/Bills'
- if @file
- # destination directory
- bills = 'https://svn.apache.org/repos/private/financials/Bills'
+ # validate @file, @dest form parameters
+ name = @file.original_filename.gsub(/[^-.\w]/, '_').sub(/^\.+/,
'_').untaint
+ @dest.untaint if @dest =~ /^\w+$/
- # validate @file, @dest form parameters
- name = @file.original_filename.gsub(/[^-.\w]/, '_').sub(/^\.+/,
'_').untaint
- @dest.untaint if @dest =~ /^\w+$/
-
- if @file.respond_to? :empty? and @file.empty?
- _pre 'File is required', class: '_stderr'
- elsif not @message or @message.empty?
- _pre 'Message is required', class: '_stderr'
- elsif not @dest or @dest.empty?
- _pre 'Destination is required', class: '_stderr'
- else
- # append funding source to message, if present
- if @source and not @source.empty?
- @message += "\n\nFunding source: #{@source}"
+ if @file.respond_to? :empty? and @file.empty?
+ _pre 'File is required', class: '_stderr'
+ elsif not @message or @message.empty?
+ _pre 'Message is required', class: '_stderr'
+ elsif not @dest or @dest.empty?
+ _pre 'Destination is required', class: '_stderr'
+ else
+ # append funding source to message, if present
+ if @source and not @source.empty?
+ @message += "\n\nFunding source: #{@source}"
+ end
+ # add file to svn (--revision 0 means it won't overwrite an
existing file)
+ _p 'Log of your upload/checkin follows:'
+ _pre 'blah'
+ _.system ['svnmucc', '--revision', '0', '--message', @message,
+ ['--no-auth-cache', '--non-interactive'],
+ (['--username', $USER, '--password', $PASSWORD] if $PASSWORD),
+ '--', 'put', '-', File.join(bills, @dest, name)],
+ stdin: @file
+ end
+ end
end
-
- # add file to svn (--revision 0 means it won't overwrite an existing
file)
- _.system ['svnmucc', '--revision', '0', '--message', @message,
- ['--no-auth-cache', '--non-interactive'],
- (['--username', $USER, '--password', $PASSWORD] if $PASSWORD),
- '--', 'put', '-', File.join(bills, @dest, name)],
- stdin: @file
end
end
end
+
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].