You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by cu...@apache.org on 2017/04/15 02:06:43 UTC
[whimsy] branch master updated: Add style, improve help doc
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 761d30f Add style, improve help doc
761d30f is described below
commit 761d30fc7b82e13d02615b8a49eb3a7311e13856
Author: Shane Curcuru <as...@shanecurcuru.org>
AuthorDate: Fri Apr 14 22:06:39 2017 -0400
Add style, improve help doc
---
www/committers/subscribe.cgi | 183 +++++++++++++++++++++++--------------------
1 file changed, 98 insertions(+), 85 deletions(-)
diff --git a/www/committers/subscribe.cgi b/www/committers/subscribe.cgi
index 11fbd98..f7c0116 100755
--- a/www/committers/subscribe.cgi
+++ b/www/committers/subscribe.cgi
@@ -1,6 +1,7 @@
#!/usr/bin/env ruby
$LOAD_PATH.unshift File.realpath(File.expand_path('../../../lib', __FILE__))
require 'wunderbar'
+require 'wunderbar/bootstrap'
require 'mail'
require 'whimsy/asf'
require 'time'
@@ -27,106 +28,118 @@ ASF::Podling.list.each {|p|
}
pmcs = ASF::Committee.list.map(&:mail_list)
-
lists = ASF::Mail.cansub(user.asf_member?, ASF.pmc_chairs.include?(user))
-
lists.sort!
-
-
addrs = (["#{$USER}@apache.org"] + user.mail + user.alt_email)
_html do
# better system output styling (errors in red)
_style :system
- _head_ do
- _title 'ASF Mailing List Self-subscription'
- end
_body? do
- if _.post?
- unless addrs.include? @addr and lists.include? @list
- _h2_.error "Invalid input"
- break
+ _whimsy_header 'ASF Mailing List Self-subscription'
+ _whimsy_content do
+ _div.row do
+ _div.panel.panel_primary do
+ _div.panel_heading {_h3.panel_title 'How To Subscribe'}
+ _div.panel_body do
+ _ 'This page allows Apache committers to auto-subscribe to various mailing lists.'
+ _span.text_info 'Note:'
+ _ 'Only your registered email address(es) are listed here. To change your email addresses, login to '
+ _a 'https://id.apache.org/', href: "https://id.apache.org/details/#{$USER}"
+ _ 'to add or remove forwarding or alternate addresses.'
+ _br
+ end
+ end
end
-
- # Each user can only subscribe once to each list in each timeslot
- fn = "#{$USER}-#{@list}.json".untaint
-
- vars = {
- version: FORMAT_NUMBER,
- availid: $USER,
- addr: @addr,
- listkey: @list,
- # f3
- member_p: user.asf_member?,
- chair_p: ASF.pmc_chairs.include?(user),
- }
- request = JSON.pretty_generate(vars) + "\n"
- _pre request
-
- SUBREQ = 'https://svn.apache.org/repos/infra/infrastructure/trunk/subreq'
-
- # add file to svn (--revision 0 means it won't overwrite an existing file)
- _.system ['svnmucc',
- ['--revision', '0'],
- '--message', "#{@list}@ += #{$USER}",
- '--with-revprop', "whimsy:author=#{$USER}",
- ['--no-auth-cache', '--non-interactive'],
- ['--root-url', SUBREQ],
- (['--username', $USER, '--password', $PASSWORD] if $PASSWORD),
- '--', 'put', '-', fn],
- stdin: request+ "\n" # seems to need extra EOL
- _p 'Request successful (unless indicated otherwise above). You will be subscribed within the hour.'
-
- end
- unless _.post?
- end
- _form method: 'post' do
- _fieldset do
- _legend 'ASF Mailing List Self-subscription'
-
- _label 'Subscribe'
- _select name: 'addr' do
- addrs.each do |addr|
- _option addr
- end
+ if _.post?
+ unless addrs.include? @addr and lists.include? @list
+ _h2_.text_danger {_span.label.label_danger 'Invalid Input'}
+ _p 'Both email and list to subscribe to are required!'
+ break
end
-
- _ 'to'
- _select name: 'list' do
- seen = Hash.new
- lists.each do |list|
- ln = list.split('-').first
- ln = 'empire-db' if ln == 'empire'
- seen[list] = 0
- seen[list] = 1 if pmcs.include? ln
- seen[list] = 2 if current.include? ln
- seen[list] = 2 if (ln == 'incubator') \
- && (current.include? list.split('-')[1])
- seen[list] = 3 if retired.include? ln
- seen[list] = 3 if (ln == 'incubator') \
- && (retired.include? list.split('-')[1])
- end
- _option '--- Foundation lists ---', disabled: 'disabled'
- lists.find_all { |list| seen[list] == 0 }.each do |list|
- _option list
- end
- _option '--- Top-Level Projects ---', disabled: 'disabled'
- lists.find_all { |list| seen[list] == 1 }.each do |list|
- _option list
+
+ # Each user can only subscribe once to each list in each timeslot
+ fn = "#{$USER}-#{@list}.json".untaint
+
+ vars = {
+ version: FORMAT_NUMBER,
+ availid: $USER,
+ addr: @addr,
+ listkey: @list,
+ # f3
+ member_p: user.asf_member?,
+ chair_p: ASF.pmc_chairs.include?(user),
+ }
+ request = JSON.pretty_generate(vars) + "\n"
+ _div.well do
+ _p 'Submitting subscribe request:'
+ _pre request
+ end
+
+ SUBREQ = 'https://svn.apache.org/repos/infra/infrastructure/trunk/subreq'
+
+ # add file to svn (--revision 0 means it won't overwrite an existing file)
+ _.system ['svnmucc',
+ ['--revision', '0'],
+ '--message', "#{@list}@ += #{$USER}",
+ '--with-revprop', "whimsy:author=#{$USER}",
+ ['--no-auth-cache', '--non-interactive'],
+ ['--root-url', SUBREQ],
+ (['--username', $USER, '--password', $PASSWORD] if $PASSWORD),
+ '--', 'put', '-', fn],
+ stdin: request+ "\n" # seems to need extra EOL
+
+ _div.alert.alert_success role: 'alert' do
+ _p do
+ _span.strong 'Request successfully submitted'
+ _ '(unless indicated otherwise above). You will be subscribed within the hour.'
+ end
+ end
+ end
+ unless _.post?
+ end
+ _form method: 'post' do
+ _fieldset do
+ _legend 'ASF Mailing List Self-subscription'
+ _label 'Subscribe'
+ _select name: 'addr' do
+ addrs.each do |addr|
+ _option addr
+ end
end
- _option '--- Podlings ---', disabled: 'disabled'
- lists.find_all { |list| seen[list] == 2 }.each do |list|
- _option list
+
+ _ 'to'
+ _select name: 'list' do
+ seen = Hash.new
+ lists.each do |list|
+ ln = list.split('-').first
+ ln = 'empire-db' if ln == 'empire'
+ seen[list] = 0
+ seen[list] = 1 if pmcs.include? ln
+ seen[list] = 2 if current.include? ln
+ seen[list] = 2 if (ln == 'incubator') \
+ && (current.include? list.split('-')[1])
+ seen[list] = 3 if retired.include? ln
+ seen[list] = 3 if (ln == 'incubator') \
+ && (retired.include? list.split('-')[1])
+ end
+ _option '--- Foundation lists ---', disabled: 'disabled'
+ lists.find_all { |list| seen[list] == 0 }.each do |list|
+ _option list
+ end
+ _option '--- Top-Level Projects ---', disabled: 'disabled'
+ lists.find_all { |list| seen[list] == 1 }.each do |list|
+ _option list
+ end
+ _option '--- Podlings ---', disabled: 'disabled'
+ lists.find_all { |list| seen[list] == 2 }.each do |list|
+ _option list
+ end
end
+ _input type: 'submit', value: 'Submit Request'
end
- _input type: 'submit', value: 'Submit Request'
end
end
- _ 'Only your forwarding address and registered alternates are listed.'
- _ 'Visit'
- _a 'https://id.apache.org/', href: "https://id.apache.org/details/#{$USER}"
- _ 'to add or remove forwarding or alternate addresses.'
- _br
end
end
--
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].