| 1 | package UR::Object::View::Default::Html; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | require UR; | ||
| 6 | our $VERSION = "0.46"; # UR $VERSION; | ||
| 7 | use IO::File; | ||
| 8 | |||
| 9 | class UR::Object::View::Default::Html { | ||
| 10 | is => 'UR::Object::View::Default::Xsl', | ||
| 11 | has => { | ||
| 12 | output_format => { value => 'html' }, | ||
| 13 | transform => { value => 1 }, | ||
| 14 | toolkit => { value => 'html' }, | ||
| 15 | } | ||
| 16 | }; | ||
| 17 | |||
| 18 | 1; | ||
| 19 | |||
| 20 | =pod | ||
| 21 | |||
| 22 | =head1 NAME | ||
| 23 | |||
| 24 | UR::Object::View::Default::Html - represent object state in HTML format | ||
| 25 | |||
| 26 | =head1 SYNOPSIS | ||
| 27 | |||
| 28 | ##### | ||
| 29 | |||
| 30 | package Acme::Product::View::OrderStatus::Html; | ||
| 31 | |||
| 32 | class Acme::Product::View::OrderStatus::Html { | ||
| 33 | is => 'UR::Object::View::Default::Html', | ||
| 34 | }; | ||
| 35 | |||
| 36 | sub _generate_content { | ||
| 37 | my $self = shift; | ||
| 38 | my $subject = $self->subject; | ||
| 39 | my $html = ... | ||
| 40 | .... | ||
| 41 | return $html; | ||
| 42 | } | ||
| 43 | |||
| 44 | ##### | ||
| 45 | |||
| 46 | $o = Acme::Product->get(1234); | ||
| 47 | |||
| 48 | $v = $o->create_view( | ||
| 49 | perspective => 'order status', | ||
| 50 | toolkit => 'html', | ||
| 51 | aspects => [ | ||
| 52 | 'id', | ||
| 53 | 'name', | ||
| 54 | 'qty_on_hand', | ||
| 55 | 'outstanding_orders' => [ | ||
| 56 | 'id', | ||
| 57 | 'status', | ||
| 58 | 'customer' => [ | ||
| 59 | 'id', | ||
| 60 | 'name', | ||
| 61 | ] | ||
| 62 | ], | ||
| 63 | ], | ||
| 64 | ); | ||
| 65 | |||
| 66 | $html1 = $v->content; | ||
| 67 | |||
| 68 | $o->qty_on_hand(200); | ||
| 69 | |||
| 70 | $html2 = $v->content; | ||
| 71 | |||
| 72 | =head1 DESCRIPTION | ||
| 73 | |||
| 74 | This class implements basic HTML views of objects. It has standard behavior for all text views. | ||
| 75 | |||
| 76 | =head1 SEE ALSO | ||
| 77 | |||
| 78 | UR::Object::View::Default::Text, UR::Object::View, UR::Object::View::Toolkit::XML, UR::Object::View::Toolkit::Text, UR::Object | ||
| 79 | |||
| 80 | =cut | ||
| 81 |