Kosmetik: Alignment, Einrückung
[kivitendo-erp.git] / SL / Template / Plugin / L.pm
index 5ef07b7..78efe64 100644 (file)
@@ -66,6 +66,7 @@ sub select_tag    { return _call_presenter('select_tag',    @_); }
 sub input_tag     { return _call_presenter('input_tag',     @_); }
 sub truncate      { return _call_presenter('truncate',      @_); }
 sub simple_format { return _call_presenter('simple_format', @_); }
+sub part_picker   { return _call_presenter('part_picker',   @_); }
 
 sub _set_id_attribute {
   my ($attributes, $name) = @_;
@@ -221,14 +222,16 @@ sub date_tag {
 
   _set_id_attribute(\%params, $name);
   my @onchange = $params{onchange} ? (onChange => delete $params{onchange}) : ();
-  my @class    = $params{no_cal} || $params{readonly} ? () : (class => 'datepicker');
+  my @classes  = $params{no_cal} || $params{readonly} ? () : ('datepicker');
+  push @classes, delete($params{class}) if $params{class};
+  my %class    = @classes ? (class => join(' ', @classes)) : ();
 
   return $self->input_tag(
     $name, blessed($value) ? $value->to_lxoffice : $value,
     size   => 11,
     onblur => "check_right_date_format(this);",
     %params,
-    @class, @onchange,
+    %class, @onchange,
   );
 }
 
@@ -390,8 +393,10 @@ JAVASCRIPT
     my $filter  = ".filter(function(idx) { return this.substr(0, " . length($params{with}) . ") == '$params{with}'; })";
     $filter    .= ".map(function(idx, str) { return str.replace('$params{with}_', ''); })";
 
+    my $params_js = $params{params} ? qq| + ($params{params})| : '';
+
     $stop_event = <<JAVASCRIPT;
-        \$.post('$params{url}', { '${as}[]': \$(\$('${selector}').sortable('toArray'))${filter}.toArray() });
+        \$.post('$params{url}'${params_js}, { '${as}[]': \$(\$('${selector}').sortable('toArray'))${filter}.toArray() });
 JAVASCRIPT
   }
 
@@ -466,7 +471,7 @@ sub sortable_table_header {
 }
 
 sub paginate_controls {
-  my ($self)          = @_;
+  my ($self, %params) = _hashify(1, @_);
 
   my $controller      = $self->{CONTEXT}->stash->get('SELF');
   my $paginate_spec   = $controller->get_paginate_spec;
@@ -481,6 +486,7 @@ sub paginate_controls {
 
       return $controller->get_callback(%url_params);
     },
+    %params,
   );
 
   return SL::Presenter->get->render('common/paginate', %template_params);
@@ -733,6 +739,11 @@ If trueish then the children will not be recolored. The default is to
 recolor the children by setting the class C<listrow0> on odd and
 C<listrow1> on even entries.
 
+=item C<params>
+
+An optional JavaScript string that is evaluated before sending the
+POST request. The result must be a string that is appended to the URL.
+
 =back
 
 Example: