[Bps-public-commit] r14467 - in Prophet/trunk: .

sartak at bestpractical.com sartak at bestpractical.com
Thu Jul 24 05:00:06 EDT 2008


Author: sartak
Date: Thu Jul 24 05:00:03 2008
New Revision: 14467

Modified:
   Prophet/trunk/   (props changed)
   Prophet/trunk/lib/Prophet/Server/View.pm

Log:
 r64994 at onn:  sartak | 2008-07-24 04:57:26 -0400
 Add change history to record display


Modified: Prophet/trunk/lib/Prophet/Server/View.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Server/View.pm	(original)
+++ Prophet/trunk/lib/Prophet/Server/View.pm	Thu Jul 24 05:00:03 2008
@@ -95,6 +95,48 @@
                     dd { $props->{$prop} }
                 }
             }
+            hr {}
+            h3 { "History" };
+
+            show record_changesets => $record;
+        }
+    }
+};
+
+template record_changesets => sub {
+    my $self = shift;
+    my $record = shift;
+    my $uuid = $record->uuid;
+
+    my @changesets = $record->handle->changesets_for_record(
+        uuid => $uuid,
+        type => $record->type,
+    );
+
+    ol {
+        for my $changeset (@changesets) {
+            my @changes = grep { $_->record_uuid eq $uuid } $changeset->changes;
+            next if @changes == 0;
+
+            for my $change (@changes) {
+                my @prop_changes = $change->prop_changes;
+                next if @prop_changes == 0;
+
+                if (@prop_changes == 1) {
+                    li { $prop_changes[0]->summary };
+                    next;
+                }
+
+                li {
+                    ul {
+                        for my $prop_change (@prop_changes) {
+                            li {
+                                outs $prop_change->summary;
+                            }
+                        }
+                    }
+                }
+            }
         }
     }
 };



More information about the Bps-public-commit mailing list