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/GL.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(gl_transaction);
......
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="gl.pl?action=edit&amp;id=' . escape($gl_transaction->id) . '">',
21
    escape($gl_transaction->reference),
22
    $params{no_link} ? '' : '</a>',
23
  );
20
  my $text = escape($gl_transaction->reference);
21
  if (! delete $params{no_link}) {
22
    my $href = 'gl.pl?action=edit&id=' . escape($gl_transaction->id);
23
    $text = link_tag($href, $text, %params);
24
  }
24 25

  
25 26
  is_escaped($text);
26 27
}
......
51 52
Returns a rendered version (actually an instance of
52 53
L<SL::Presenter::EscapedText>) of a gl object C<$object>.
53 54

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

  
56 58
=over 2
57 59

  
58 60
=item * display
59 61

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

  
64 65
=item * no_link
65 66

  

Auch abrufbar als: Unified diff