Presenter: button_tag, submit_tag, ajax_submit_tag von L nach SL::Presenter::Tag...
[kivitendo-erp.git] / SL / Template / Plugin / L.pm
index bd3edda..56dd4fb 100644 (file)
@@ -73,6 +73,9 @@ sub part_picker   { return _call_presenter('part_picker',   @_); }
 sub chart_picker  { return _call_presenter('chart_picker',  @_); }
 sub customer_vendor_picker   { return _call_presenter('customer_vendor_picker',   @_); }
 sub project_picker           { return _call_presenter('project_picker',           @_); }
+sub button_tag               { return _call_presenter('button_tag',               @_); }
+sub submit_tag               { return _call_presenter('submit_tag',               @_); }
+sub ajax_submit_tag          { return _call_presenter('ajax_submit_tag',          @_); }
 
 sub _set_id_attribute {
   my ($attributes, $name, $unique) = @_;
@@ -143,37 +146,6 @@ sub link {
   return $self->html_tag('a', $content, %params, href => $href);
 }
 
-sub submit_tag {
-  my ($self, $name, $value, %attributes) = _hashify(3, @_);
-
-  if ( $attributes{confirm} ) {
-    $attributes{onclick} = 'return confirm("'. _J(delete($attributes{confirm})) .'");';
-  }
-
-  return $self->input_tag($name, $value, %attributes, type => 'submit', class => 'submit');
-}
-
-sub button_tag {
-  my ($self, $onclick, $value, %attributes) = _hashify(3, @_);
-
-  _set_id_attribute(\%attributes, $attributes{name}) if $attributes{name};
-  $attributes{type} ||= 'button';
-
-  $onclick = 'if (!confirm("'. _J(delete($attributes{confirm})) .'")) return false; ' . $onclick if $attributes{confirm};
-
-  return $self->html_tag('input', undef, %attributes, value => $value, onclick => $onclick);
-}
-
-sub ajax_submit_tag {
-  my ($self, $url, $form_selector, $text, @slurp) = @_;
-
-  $url           = _J($url);
-  $form_selector = _J($form_selector);
-  my $onclick    = qq|kivi.submit_ajax_form('${url}', '${form_selector}')|;
-
-  return $self->button_tag($onclick, $text, @slurp);
-}
-
 sub yes_no_tag {
   my ($self, $name, $value, %attributes) = _hashify(3, @_);
 
@@ -528,36 +500,6 @@ Creates a HTML 'input type=hidden' tag named C<$name> with the value
 C<$value> and with arbitrary HTML attributes from C<%attributes>. The
 tag's C<id> defaults to C<name_to_id($name)>.
 
-=item C<submit_tag $name, $value, %attributes>
-
-Creates a HTML 'input type=submit class=submit' tag named C<$name> with the
-value C<$value> and with arbitrary HTML attributes from C<%attributes>. The
-tag's C<id> defaults to C<name_to_id($name)>.
-
-If C<$attributes{confirm}> is set then a JavaScript popup dialog will
-be added via the C<onclick> handler asking the question given with
-C<$attributes{confirm}>. The request is only submitted if the user
-clicks the dialog's ok/yes button.
-
-=item C<ajax_submit_tag $url, $form_selector, $text, %attributes>
-
-Creates a HTML 'input type="button"' tag with a very specific onclick
-handler that submits the form given by the jQuery selector
-C<$form_selector> to the URL C<$url> (the actual JavaScript function
-called for that is C<kivi.submit_ajax_form()> in
-C<js/client_js.js>). The button's label will be C<$text>.
-
-=item C<button_tag $onclick, $text, %attributes>
-
-Creates a HTML 'input type="button"' tag with an onclick handler
-C<$onclick> and a value of C<$text>. The button does not have a name
-nor an ID by default.
-
-If C<$attributes{confirm}> is set then a JavaScript popup dialog will
-be prepended to the C<$onclick> handler asking the question given with
-C<$attributes{confirm}>. The request is only submitted if the user
-clicks the dialog's "ok/yes" button.
-
 =item C<textarea_tag $name, $value, %attributes>
 
 Creates a HTML 'textarea' tag named C<$name> with the content