whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From curc...@apache.org
Subject [whimsy] branch master updated: Improve registered trademark output
Date Sun, 23 Apr 2017 00:27:09 GMT
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  2711e34   Improve registered trademark output
2711e34 is described below

commit 2711e347fcde2e9ecc5832e9b48ba13d7cb8e96c
Author: Shane Curcuru <asf@shanecurcuru.org>
AuthorDate: Sat Apr 22 20:27:05 2017 -0400

    Improve registered trademark output
---
 www/test/trademark.cgi | 105 +++++++++++++++++++++++++++++++------------------
 1 file changed, 66 insertions(+), 39 deletions(-)

diff --git a/www/test/trademark.cgi b/www/test/trademark.cgi
index 874493f..43cfa1c 100755
--- a/www/test/trademark.cgi
+++ b/www/test/trademark.cgi
@@ -6,57 +6,84 @@ require 'whimsy/asf'
 require 'wunderbar'
 require 'wunderbar/bootstrap'
 require 'net/http'
-require 'whimsy/asf/themes'
 
 PAGETITLE = 'Listing of Apache Registered Trademarks'
+COUNTRY = 'CountryName' # Fieldnames from counsel provided docket
+STAT = 'TrademarkStatus'
+CLASS = 'Class'
+REG = 'RegNumber'
 
-_html do
-  _head_ do
-    _title PAGETITLE
-    _style %{
-      th {border-bottom: solid black}
-      table {border-spacing: 1em 0.2em }
-      tr td:first-child {text-align: center}
-      .issue {color: red; font-weight: bold}
-    }
+def _marks(marks)
+  _ul.list_group do
+    marks.each do |mark, items|
+      _li!.list_group_item.active do
+        _{"#{mark} &reg;"}
+      end
+      items.each do |itm|
+        if itm[STAT] == 'Registered' then
+          if itm[COUNTRY] == 'United States of America' then
+            _li.list_group_item do
+              _a "In the #{itm[COUNTRY]}, class #{itm[CLASS]}, reg # #{itm[REG]}", href:
'usptolink'
+            end
+          else
+            _li.list_group_item "In the #{itm[COUNTRY]}, class #{itm[CLASS]}, reg # #{itm[REG]}",
href: 'usptolink'
+          end
+        end
+      end
+    end
+  end
+end
+
+def _project(name, url, marks)
+  _div.panel.panel_primary do
+    _div.panel_heading do 
+      _h3!.panel_title do 
+        _a! name, href: url
+        _{"&reg; software"}
+      end
+    end
+    _div.panel_body do
+      _{"The ASF owns the following registered trademarks for our #{name}&reg; software:"}
+    end
+    _marks marks
+  end
+end
+
+def _apache(marks)
+  _div.panel.panel_primary do
+    _div.panel_heading do 
+      _h3.panel_title do 
+        _{"Our APACHE&reg; trademarks"}
+      end
+    end
+    _div!.panel_body do
+      _{"Our APACHE&reg; trademark represents our house brand of consensus-driven, community
built software for the public good."}
+    end
+    _marks marks
   end
+end
+
+_html do
   _body? do
     _whimsy_header PAGETITLE
     brand_dir = ASF::SVN['private/foundation/Brand']
-    docket = CSV.read("#{brand_dir}/trademark-registrations.csv", headers:true)
-    docketcols = %w[ Mark Jurisdiction Class ] 
-    # TODO: consolidate Jurisdiction info by 'Mark' column  
-    # TODO: add optional json output to convert rarely-changed registered CSV into checkinable
JSON
+    docket = JSON.parse(File.read("#{brand_dir}/docket.json"))
     projects = JSON.parse(Net::HTTP.get(URI('https://projects.apache.org/json/foundation/projects.json')))
+
     _whimsy_content do
-      _table class: "table " do
-        _thead_ do
-          _tr do
-            docketcols.each { |h| _th h }
-          end
-        end
-        _tbody do
-          docket.each do | row |
-            _tr_ do
-              docketcols.each do |h|
-                if h == 'Mark' then
-                  _td do
-                    begin
-                      # TODO: Map unusual project names
-                      _a row[h], href: projects[row[h].downcase]['homepage']
-                    rescue 
-                      _ row[h]
-                    end
-                  end
-                else 
-                  _td row[h]
-                end
-              end
-            end
-          end
+      _p 'The ASF holds the following registered trademarks'
+      docket.each do |pmc, marks|
+        if pmc == 'apache' then
+          _apache(marks)
+        elsif projects[pmc] then
+          _project projects[pmc]['name'], projects[pmc]['homepage'], marks
+        else
+          _.comment! '# TODO map all pmc names to projects or podlings'
+          _project 'Apache ' + pmc.capitalize, 'https://' + pmc + '.apache.org', marks
         end
       end
     end
+
     _whimsy_footer({
       "https://www.apache.org/foundation/marks/resources" => "Trademark Site Map",
       "https://www.apache.org/foundation/marks/list/" => "Official Apache Trademark List"

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <commits@whimsical.apache.org>'].

Mime
View raw message