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 2019/05/21 19:24:16 UTC

[whimsy] branch master updated: Factor out common emit_authmap code

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 1a4e099  Factor out common emit_authmap code
1a4e099 is described below

commit 1a4e099ecd9862eb4e9ce79ee080d0aebe1d5ea1
Author: Shane Curcuru <as...@shanecurcuru.org>
AuthorDate: Tue May 21 15:24:07 2019 -0400

    Factor out common emit_authmap code
---
 tools/wwwdocs.rb         | 16 ++++++++++++++++
 www/committers/tools.cgi | 13 +------------
 2 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/tools/wwwdocs.rb b/tools/wwwdocs.rb
index 79a3b09..9036739 100755
--- a/tools/wwwdocs.rb
+++ b/tools/wwwdocs.rb
@@ -3,6 +3,7 @@
 #   Docs: for WVisible PAGETITLE and categories in .cgi
 #   Repos: for ASF::SVN access in .cgi|rb
 $LOAD_PATH.unshift '/srv/whimsy/lib'
+require 'wunderbar'
 require 'whimsy/asf'
 SCANDIR = "../www"
 ISERR = '!'
@@ -18,6 +19,21 @@ IS_PRIVATE = /\A(private|infra\/infrastructure)/
 ASFSVN = 'ASF::SVN'
 SCANDIRSVN = "../"
 
+# Output ul of key of AUTHMAP for use in helpblock
+def emit_authmap
+  _ul do
+    _li do
+      _span.glyphicon :aria_hidden, class: "#{AUTHPUBLIC}"
+      _ 'Publicly available'
+    end
+    AUTHMAP.each do |realm, style|
+      _li do
+        _span.glyphicon.glyphicon_lock :aria_hidden, class: "#{style}", aria_label: "#{realm}"
+        _ "#{realm}"
+      end
+    end
+  end
+end
 # Return [PAGETITLE, [cat,egories] ] after WVisible; or same as !Bogosity error
 def scan_file(f)
   begin
diff --git a/www/committers/tools.cgi b/www/committers/tools.cgi
index 093f428..246e404 100755
--- a/www/committers/tools.cgi
+++ b/www/committers/tools.cgi
@@ -35,18 +35,7 @@ _html do
           _em 'partial'
           _ ' listing of tools that Whimsy provides.'
         end
-        _ul do
-          _li do
-            _span.glyphicon :aria_hidden, class: "#{AUTHPUBLIC}"
-            _ 'Publicly available'
-          end
-          AUTHMAP.each do |realm, style|
-            _li do
-              _span.glyphicon.glyphicon_lock :aria_hidden, class: "#{style}", aria_label: "#{realm}"
-              _ "#{realm}"
-            end
-          end
-        end
+        emit_authmap
       }
     ) do
       scan = get_annotated_scan("../#{SCANDIR}")