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] [20/50] Commit 1cb44a3: add comments
Date Fri, 22 Jan 2016 02:40:54 GMT
Commit 1cb44a316e35fbf451893cfe27abd764d3e41101:
    add comments


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

------------------------------------------------------------
spec/report_spec.rb                                          | ++++ 
views/agenda.js.rb                                           | ++++++++++ 
views/report.js.rb                                           | +++++++++ 
------------------------------------------------------------
32 changes: 32 additions, 0 deletions.
------------------------------------------------------------


diff --git a/spec/report_spec.rb b/spec/report_spec.rb
index 3ec259f..0361685 100644
--- a/spec/report_spec.rb
+++ b/spec/report_spec.rb
@@ -33,5 +33,9 @@
     visit '/2015-02-18/Abdera'
     expect(page).to have_selector 'pre em', text: 'Missing'
     expect(page).not_to have_selector 'dt', text: 'Approved'
+
+    # comments
+    expect(page).to have_selector 'h3#comments', text: 'Comments'
+    expect(page).to have_selector 'pre.comment', text: 'rb: Reminder email sent'
   end
 end
diff --git a/views/agenda.js.rb b/views/agenda.js.rb
index 1850ac3..b930019 100644
--- a/views/agenda.js.rb
+++ b/views/agenda.js.rb
@@ -43,6 +43,25 @@ def text
     @text || @report
   end
 
+  # return comments as an array of individual comments
+  def comments
+    results = []
+    return results if @comments === undefined
+
+    comment = ''
+    @comments.split("\n").each do |line|
+      if line =~ /^\S/
+        results << comment unless comment.empty?
+        comment = line
+      else
+        comment += "\n" + line
+      end
+    end
+
+    results << comment unless comment.empty?
+    return results
+  end
+
   def self.view
     Index
   end
diff --git a/views/report.js.rb b/views/report.js.rb
index 75d8adb..aaa41b5 100644
--- a/views/report.js.rb
+++ b/views/report.js.rb
@@ -7,6 +7,15 @@ def render
           _ @@data.text
         end
       end
+
+      if @@data.comments
+        _section do
+          _h3.comments! 'Comments'
+          @@data.comments.each do |comment|
+            _pre.comment comment
+          end
+        end
+      end
     end
   end
 end

Mime
View raw message