Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ee51b82f

Von Tamino Steinert vor etwa 2 Jahren hinzugefügt

  • ID ee51b82f6206a33d436cb453ebe835d6fbbb4c2c
  • Vorgänger a0a10e44
  • Nachfolger 84dfd7a5

Presenter: nutze link_tag anstelle von html im perl-code

(cherry picked aus Kundenprojekt)

Unterschiede anzeigen:

SL/Presenter/CustomerVendor.pm
3 3
use strict;
4 4

  
5 5
use SL::Presenter::EscapedText qw(escape is_escaped);
6
use SL::Presenter::Tag qw(input_tag html_tag name_to_id select_tag);
6
use SL::Presenter::Tag qw(input_tag html_tag name_to_id select_tag link_tag);
7 7

  
8 8
use Exporter qw(import);
9 9
our @EXPORT_OK = qw(customer_vendor customer vendor customer_vendor_picker customer_picker vendor_picker);
......
32 32

  
33 33
  croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/;
34 34

  
35
  my $callback = $params{callback} ? '&callback=' . $::form->escape($params{callback}) : '';
36

  
37
  my $text = join '', (
38
    $params{no_link} ? '' : '<a href="controller.pl?action=CustomerVendor/edit&amp;db=' . $type . '&amp;id=' . escape($cv->id) . '">',
39
    escape($cv->name),
40
    $params{no_link} ? '' : '</a>',
41
  );
35
  my $text = escape($cv->name);
36
  if (! delete $params{no_link}) {
37
    my $href = 'controller.pl?action=CustomerVendor/edit&db=' . $type
38
               . '&id=' . escape($cv->id);
39
    $text = link_tag($href, $text, %params);
40
  }
42 41

  
43 42
  is_escaped($text);
44 43
}
......
113 112
Returns a rendered version (actually an instance of
114 113
L<SL::Presenter::EscapedText>) of the customer object C<$object>.
115 114

  
116
C<%params> can include:
115
Remaining C<%params> are passed to the function
116
C<SL::Presenter::Tag::link_tag>. It can include:
117 117

  
118 118
=over 2
119 119

  
120 120
=item * display
121 121

  
122
Either C<inline> (the default) or C<table-cell>. At the moment both
123
representations are identical and produce the customer's name linked
124
to the corresponding 'edit' action.
122
Either C<inline> (the default) or C<table-cell>. Is passed to the function
123
C<SL::Presenter::Tag::link_tag>.
125 124

  
126 125
=item * no_link
127 126

  
......
135 134
Returns a rendered version (actually an instance of
136 135
L<SL::Presenter::EscapedText>) of the vendor object C<$object>.
137 136

  
138
C<%params> can include:
137
Remaining C<%params> are passed to the function
138
C<SL::Presenter::Tag::link_tag>. It can include:
139 139

  
140 140
=over 2
141 141

  
142 142
=item * display
143 143

  
144
Either C<inline> (the default) or C<table-cell>. At the moment both
145
representations are identical and produce the vendor's name linked
146
to the corresponding 'edit' action.
144
Either C<inline> (the default) or C<table-cell>. Is passed to the function
145
C<SL::Presenter::Tag::link_tag>.
147 146

  
148 147
=item * no_link
149 148

  

Auch abrufbar als: Unified diff