whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam Ruby <ru...@apache.org>
Subject [whimsy.git] [14/50] Commit f60b65e: Add agenda items to navigation index
Date Fri, 22 Jan 2016 02:40:53 GMT
Commit f60b65eb3f14941fdb4224b47cd6f2e9ab39f52e:
    Add agenda items to navigation index


Branch: refs/heads/master
Author: Sam Ruby <rubys@intertwingly.net>
Committer: Sam Ruby <rubys@intertwingly.net>
Pusher: rubys <rubys@apache.org>

------------------------------------------------------------
spec/index_spec.rb                                           | ++++ 
views/agenda.js.rb                                           | + -
views/app.js.rb                                              | +++++++ 
views/header.js.rb                                           | ++++++++++++ 
views/main.js.rb                                             | + --------
------------------------------------------------------------
45 changes: 36 additions, 9 deletions.
------------------------------------------------------------


diff --git a/spec/index_spec.rb b/spec/index_spec.rb
index 9959be5..fa1f199 100644
--- a/spec/index_spec.rb
+++ b/spec/index_spec.rb
@@ -12,6 +12,10 @@
     expect(page).to have_selector '.navbar-fixed-top.blank .navbar-brand', 
       text: '2015-02-18'
 
+    # navigation
+    expect(page).to have_selector 'a[href=Change-Geronimo-Chair]',
+      text: 'Special Orders'
+
     # rows with colors and titles
     expect(page).to have_selector 'tr.missing td', text: 'Abdera'
     expect(page).to have_selector 'tr.commented td', text: 'Axis'
diff --git a/views/agenda.js.rb b/views/agenda.js.rb
index ba5e953..64b38e4 100644
--- a/views/agenda.js.rb
+++ b/views/agenda.js.rb
@@ -32,7 +32,7 @@ def initialize(entry)
     end
   end
 
-  attr_accessor :attach, :title, :owner, :shepherd
+  attr_reader :attach, :title, :owner, :shepherd, :index
 
   def href
     @title.gsub(/[^a-zA-Z0-9]+/, '-')
diff --git a/views/app.js.rb b/views/app.js.rb
index 5ee7c2e..4f20e49 100644
--- a/views/app.js.rb
+++ b/views/app.js.rb
@@ -1,7 +1,14 @@
+# General layout
 require_relative 'main'
+require_relative 'header'
 require_relative 'footer'
+
+# Individual pages
 require_relative 'index'
 require_relative 'report'
+
+# Common elements
 require_relative 'link'
 
+# Model
 require_relative 'agenda'
diff --git a/views/header.js.rb b/views/header.js.rb
new file mode 100644
index 0000000..18e8990
--- /dev/null
+++ b/views/header.js.rb
@@ -0,0 +1,23 @@
+class Header < React
+  def render
+    _header.navbar.navbar_fixed_top class: @@item.color do
+      _div.navbar_brand @@item.title
+      _ul.nav.nav_pills.navbar_right do
+        _li.dropdown do
+          _a.dropdown_toggle.nav! data_toggle: "dropdown" do
+            _ 'navigation'
+            _b.caret
+          end
+
+          _ul.dropdown_menu do
+            _li { _Link text: 'Agenda', href: '' }
+
+            Agenda.index.each do |item|
+              _li { _Link text: item.index, href: item.href } if item.index
+            end
+          end
+        end
+      end
+    end
+  end
+end
diff --git a/views/main.js.rb b/views/main.js.rb
index b273f0d..d8cfcc0 100644
--- a/views/main.js.rb
+++ b/views/main.js.rb
@@ -8,14 +8,7 @@ def route(path)
   end
 
   def render
-    _header.navbar.navbar_fixed_top class: @item.color do
-      _div.navbar_brand @item.title
-      _ul.nav.nav_pills.navbar_right do
-        _li.dropdown do
-          _a.dropdown_toggle.nav! 'navigation'
-        end
-      end
-    end
+    _Header item: @item
 
     _main do
       React.createElement(@item.view, data: @item)

Mime
View raw message