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: Add _whimsy_panel_table and remove copy/paste error
Date Sun, 04 Jun 2017 16:08:55 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  a9e59f7   Add _whimsy_panel_table and remove copy/paste error
a9e59f7 is described below

commit a9e59f75a7ecfb295dbccf679987a649493ca330
Author: Shane Curcuru <asf@shanecurcuru.org>
AuthorDate: Sun Jun 4 12:08:50 2017 -0400

    Add _whimsy_panel_table and remove copy/paste error
---
 lib/whimsy/asf/themes.rb | 62 ++++++++++++------------------------------------
 www/test/test.cgi        | 30 ++++++++++++++++++++---
 2 files changed, 42 insertions(+), 50 deletions(-)

diff --git a/lib/whimsy/asf/themes.rb b/lib/whimsy/asf/themes.rb
index 5986d11..0d5956e 100644
--- a/lib/whimsy/asf/themes.rb
+++ b/lib/whimsy/asf/themes.rb
@@ -111,6 +111,21 @@ class Wunderbar::HtmlMarkup
     end
   end
   
+  # Emit a panel with helpblock and table https://getbootstrap.com/components/#panels-tables
+  def _whimsy_panel_table(title: 'Table Title', style: 'panel-default', header: 'h2', helpblock:
nil)
+    _div.panel class: style do
+      _div.panel_heading do 
+        _.tag! header, class: 'panel-title' do
+          _ title
+        end
+      end
+      _div.panel_body do
+        helpblock.call if helpblock
+      end
+      yield
+    end
+  end
+  
   # Emit a bootstrap navbar with required ASF links
   def _whimsy_nav
     _nav.navbar.navbar_default do
@@ -168,54 +183,7 @@ class Wunderbar::HtmlMarkup
       end
     end
   end
-  
-  # Emit complete bootstrap theme, with related links, and helpblock of intro text
-  def _whimsy_body(title: 'MOAR WHIMSY!', subtitle: 'About This Script', related: {}, helpblock:
nil)
-    _whimsy_nav
-    _div.content.container_fluid do
-      _div.row do
-        _div.col_sm_12 do
-          _h1 title
-        end
-      end
-      _div.row do
-        _div.col_md_8 do
-          _whimsy_panel subtitle do
-            if helpblock
-              helpblock.call
-            else
-              # TODO: make this point to the specific cgi being run
-              _a 'See the code', href: 'https://github.com/apache/whimsy/'
-            end
 
-          end
-        end
-        _div.col_md_4 do
-          _whimsy_panel "More Whimsy", style: "panel-info" do
-            _ul do
-              if related
-                related.each do |url, desc|
-                  _li do
-                    _a desc, href: url
-                  end
-                end
-              else
-                _li do
-                  _a 'Whimsy Source Code', href: 'https://github.com/apache/whimsy/'
-                end
-              end
-            end
-          end
-        end
-      end      
-      _div.row do
-        _div.col_sm_12 do
-          yield
-        end
-      end
-      _whimsy_foot
-    end    
-  end
   # Emit complete bootstrap theme, with related links, and helpblock of intro text
   def _whimsy_body(title: 'MOAR WHIMSY!', subtitle: 'About This Script', related: {}, helpblock:
nil)
     _whimsy_nav
diff --git a/www/test/test.cgi b/www/test/test.cgi
index d0468fa..3ffa396 100755
--- a/www/test/test.cgi
+++ b/www/test/test.cgi
@@ -24,9 +24,33 @@ _html do
         _p "Similarly, having a listing of related tools in the right hand panel helps end
users find other interesting tools here."
       }
     ) do
-      _whimsy_panel "Your Data Here" do
-        _p "This is where your code would output data or a form or whatever!"
-        _p "All headers/footers and nicely wrapping a row is handled by themes.rb"
+      _whimsy_panel_table(
+        title: "Your Table Title Here",
+        helpblock: -> {
+          _p "Explain any additional details (if needed) about your table data here."
+        }
+      ) do
+        _table.table.table_hover.table_striped do
+          _thead_ do
+            _tr do
+              _th 'Row Number'
+              _th 'Column Two'
+            end
+            _tbody do
+              datums = ["Fred", "Francie", "Flubber"]
+              [1, 2, 3].each do | row |
+                _tr_ do
+                  _td do
+                    _ row
+                  end
+                  _td do
+                    _ datums[row]
+                  end
+                end
+              end
+            end
+          end
+        end
       end
     end
   end

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

Mime
View raw message