X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/ff159a4d47b9a2d10744dcfc23da2c63605c8a32..eeb5375ee7727c956cc357cc8f90b19d1bfe80b9:/SL/Presenter/Project.pm
diff --git a/SL/Presenter/Project.pm b/SL/Presenter/Project.pm
index 8aecdfe49..7ae4c79db 100644
--- a/SL/Presenter/Project.pm
+++ b/SL/Presenter/Project.pm
@@ -3,7 +3,7 @@ package SL::Presenter::Project;
use strict;
use SL::Presenter::EscapedText qw(escape is_escaped);
-use SL::Presenter::Tag qw(input_tag html_tag name_to_id select_tag);
+use SL::Presenter::Tag qw(input_tag html_tag name_to_id select_tag link_tag);
use Exporter qw(import);
our @EXPORT_OK = qw(project project_picker);
@@ -19,14 +19,19 @@ sub project {
croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/;
- my $description = $project->full_description(style => $params{style});
- my $callback = $params{callback} ? '&callback=' . $::form->escape($params{callback}) : '';
+ my $description = $project->full_description(style => delete $params{style});
+ my $callback = $params{callback} ?
+ '&callback=' . $::form->escape(delete $params{callback})
+ : '';
+
+ my $text = escape($description);
+ if (! delete $params{no_link}) {
+ my $href = 'controller.pl?action=Project/edit'
+ . '&id=' . escape($project->id)
+ . $callback;
+ $text = link_tag($href, $text, %params);
+ }
- my $text = join '', (
- $params{no_link} ? '' : '',
- escape($description),
- $params{no_link} ? '' : '',
- );
is_escaped($text);
}
@@ -41,6 +46,13 @@ sub project_picker {
my %data_params = map { $_ => delete $params{$_} } grep { defined $params{$_} } qw(customer_id active valid description_style);
+ # If there is no 'onClick' parameter, set it to 'this.select()',
+ # so that the user can type directly in the input field
+ # to search another project.
+ if (!grep { m{onclick}i } keys %params) {
+ $params{onClick} = 'this.select()';
+ }
+
my $ret =
input_tag($name, (ref $value && $value->can('id') ? $value->id : ''), class => "@classes", type => 'hidden', id => $id,
'data-project-picker-data' => JSON::to_json(\%data_params),
@@ -81,22 +93,26 @@ SL::Presenter::Project - Presenter module for project Rose::DB objects
Returns a rendered version (actually an instance of
L) of the project object C<$customer>.
-C<%params> can include:
+Remaining C<%params> are passed to the function
+C. It can include:
=over 2
=item * display
-Either C (the default) or C. At the moment both
-representations are identical and produce the project's description
-(controlled by the C