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] [24/50] Commit dad0e4a: add comments
Date Fri, 22 Jan 2016 02:40:55 GMT
Commit dad0e4abe8d202a72db9e810d08348eec5bd30fa:
    add comments


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

------------------------------------------------------------
spec/other_views_spec.rb                                     | +++++++ 
views/app.js.rb                                              | + 
views/comments.js.rb                                         | ++++++++++ 
views/header.js.rb                                           | + 
views/main.js.rb                                             | ++ 
------------------------------------------------------------
31 changes: 31 additions, 0 deletions.
------------------------------------------------------------


diff --git a/spec/other_views_spec.rb b/spec/other_views_spec.rb
index 632764a..4384660 100644
--- a/spec/other_views_spec.rb
+++ b/spec/other_views_spec.rb
@@ -11,4 +11,11 @@
     expect(page).to have_selector 'pre', text: 'Sam Ruby'
     expect(page).to have_selector 'h4 a', text: 'Qpid'
   end
+
+  it "should support comments" do
+    visit '/2015-02-18/comments'
+
+    expect(page).to have_selector 'h4 a', text: 'Hama'
+    expect(page).to have_selector 'pre', text: 'sr: Reminder email sent'
+  end
 end
diff --git a/views/app.js.rb b/views/app.js.rb
index b890814..67d0ab8 100644
--- a/views/app.js.rb
+++ b/views/app.js.rb
@@ -7,6 +7,7 @@
 require_relative 'index'
 require_relative 'report'
 require_relative 'search'
+require_relative 'comments'
 
 # Common elements
 require_relative 'link'
diff --git a/views/comments.js.rb b/views/comments.js.rb
new file mode 100644
index 0000000..d0e8b41
--- /dev/null
+++ b/views/comments.js.rb
@@ -0,0 +1,20 @@
+class Comments < React
+  def render
+    found = false
+
+    Agenda.index.each do |item|
+      next if item.comments.empty?
+      found = true
+
+      _section do
+	_h4 {_Link text: item.title, href: item.href}
+
+        item.comments.each do |comment|
+          _pre.comment comment
+        end
+      end
+    end
+
+    _p {_em 'No comments found'} unless found
+  end
+end
diff --git a/views/header.js.rb b/views/header.js.rb
index 0b0f520..4ac44b5 100644
--- a/views/header.js.rb
+++ b/views/header.js.rb
@@ -69,6 +69,7 @@ def render
             _li.divider
 
             _li { _Link text: 'Search', href: 'search' }
+            _li { _Link text: 'Comments', href: 'comments' }
           end
         end
 
diff --git a/views/main.js.rb b/views/main.js.rb
index 98da911..9c5daaa 100644
--- a/views/main.js.rb
+++ b/views/main.js.rb
@@ -2,6 +2,8 @@ class Main < React
   def route(path, query)
     if path == 'search'
       @item = {title: 'Search', view: Search, color: 'blank', query: query}
+    elsif path == 'comments'
+      @item = {title: 'Comments', view: Comments, color: 'blank'}
     elsif path and path != '.'
       @item = Agenda.find(path)
     else

Mime
View raw message