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/Chart.pm
10 10
use Carp;
11 11
use Data::Dumper;
12 12
use SL::Presenter::EscapedText qw(escape is_escaped);
13
use SL::Presenter::Tag qw(input_tag name_to_id html_tag);
13
use SL::Presenter::Tag qw(input_tag name_to_id html_tag link_tag);
14 14

  
15 15
sub chart {
16 16
  my ($chart, %params) = @_;
......
19 19

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

  
22
  my $text = join '', (
23
    $params{no_link} ? '' : '<a href="am.pl?action=edit_account&id=' . escape($chart->id) . '">',
24
    escape($chart->accno),
25
    $params{no_link} ? '' : '</a>',
26
  );
22
  my $text = escape($chart->accno);
23
  if (! delete $params{no_link}) {
24
    my $href = 'am.pl?action=edit_account&id=' . escape($chart->id);
25
    $text = link_tag($href, $text, %params);
26
  }
27 27
  is_escaped($text);
28 28
}
29 29

  
......
82 82
Returns a rendered version (actually an instance of
83 83
L<SL::Presenter::EscapedText>) of the chart object C<$object>
84 84

  
85
C<%params> can include:
85
Remaining C<%params> are passed to the function
86
C<SL::Presenter::Tag::link_tag>. It can include:
86 87

  
87
=over 4
88
=over 2
88 89

  
89 90
=item * display
90 91

  
91
Either C<inline> (the default) or C<table-cell>. At the moment both
92
representations are identical and produce the chart's name linked
93
to the corresponding 'edit' action.
92
Either C<inline> (the default) or C<table-cell>. Is passed to the function
93
C<SL::Presenter::Tag::link_tag>.
94

  
95
=item * no_link
96

  
97
If falsish (the default) then the account number will be linked to the "edit"
98
dialog.
94 99

  
95 100
=back
96 101

  

Auch abrufbar als: Unified diff