The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Valiant::HTML::PagerBuilder - A Perl module for building HTML paginators

SYNOPSIS

  use Valiant::HTML::PagerBuilder;

  my $pager_builder = Valiant::HTML::PagerBuilder->new(
    model => $model,
    pager => $pager_object,
  );

  my $window_info_html = $pager_builder->window_info(%args);

  my $navigation_line_html = $pager_builder->navigation_line(%args);

DESCRIPTION

The Valiant::HTML::PagerBuilder module is designed for building HTML paginators for web applications. It provides methods for generating window information and navigation lines for paginated data.

CONSTRUCTOR

new

Creates a new Valiant::HTML::PagerBuilder object.

  my $pager_builder = Valiant::HTML::PagerBuilder->new(
    model => $model,
    pager => $pager_object,
  );

The constructor accepts the following parameters:

model (required)

The model object representing the data to be paginated.

pager (required)

The pager object used for pagination.

uri_base (optional)

The base URI for the paginator's navigation links. Should be a URI object.

METHODS

This class supports the following public methods:

window_info

Generates window information HTML for the paginator.

  my $window_info_html = $pager_builder->window_info(%args);

The window_info method accepts a hash of arguments, which can include custom window information templates. It generates HTML for the paginator's window information.

Where args are:

none

The template for the window information when there are no entries to paginate.

one

The template for the window information when there is only one entry to paginate.

many

The template for the window information when there are multiple entries to paginate.

container

The template for the window information container.

container_attrs

The attributes for the window information container.

Generates navigation line HTML for the paginator.

  my $navigation_line_html = $pager_builder->navigation_line(%args);

The navigation_line method accepts a hash of arguments, which can include custom navigation line templates. It generates HTML for the paginator's navigation line.

Where args are:

none

The template for the navigation line when there are no entries to paginate.

page

The template for the navigation line when there are multiple pages to paginate.

page_attrs

The attributes for the navigation line pages.

current_page

The template for the navigation line when the current page is selected.

current_page_attrs

The attributes for the navigation line current page.

container

The template for the navigation line container.

container_attrs

The attributes for the navigation line container.

SEE ALSO

Valiant, Valiant::HTML::FormBuilder, Valiant::HTML::Util::FormTags

AUTHOR

See Valiant

COPYRIGHT & LICENSE

See Valiant