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/Letter.pm
3 3
use strict;
4 4

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

  
7 8
use Exporter qw(import);
8 9
our @EXPORT_OK = qw(letter);
......
16 17

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

  
19
  my $text = join '', (
20
    $params{no_link} ? '' : '<a href="controller.pl?action=Letter/edit&amp;letter.id=' . escape($letter->id) . '">',
21
    escape($letter->letternumber),
22
    $params{no_link} ? '' : '</a>',
23
  );
20
  my $text = escape($letter->letternumber);
21
  if (! delete $params{no_link}) {
22
    my $href = 'controller.pl?action=Letter/edit'
23
               . '&letter.id=' . escape($letter->id);
24
    $text = link_tag($href, $text, %params);
25
  }
24 26

  
25 27
  is_escaped($text);
26 28
}
......
52 54
L<SL::Presenter::EscapedText>) of the letter object C<$object>
53 55
.
54 56

  
55
C<%params> can include:
57
Remaining C<%params> are passed to the function
58
C<SL::Presenter::Tag::link_tag>. It can include:
56 59

  
57 60
=over 2
58 61

  
59 62
=item * display
60 63

  
61
Either C<inline> (the default) or C<table-cell>. At the moment both
62
representations are identical and produce the invoice number linked
63
to the corresponding 'edit' action.
64
Either C<inline> (the default) or C<table-cell>. Is passed to the function
65
C<SL::Presenter::Tag::link_tag>.
64 66

  
65 67
=item * no_link
66 68

  

Auch abrufbar als: Unified diff