NAME

Dancer::Plugin::Device::Layout - Dancer v1 plugin Dancer::Plugin::Device::Layout dynamically changes layout to match user agent's best layout.

VERSION

This documentation describes Dancer::Plugin::Device::Layout v0.1.

SYNOPSIS

package MyApp;
use Dancer ':syntax';
use Dancer::Plugin::Device::Layout;

get '/' => sub {
  my $tokens = {};
  my $options = { device_layout };
  template 'index', $tokens, $options;
};

DESCRIPTION

Dancer::Plugin::Device::Layout was invented to extend YANICK's Dancer::Plugin::MobileDevice with tablet detection.

SUBROUTINES/METHODS

device_layout

Returns context sensetive layout information.

# Returns ( layout => 'normal' )
my $options = { device_layout };

# Returns 'normal'
my $display_layout = device_layout;

DIAGNOSTICS

"device_layout" does have diagnostic functionality. It takes a hash to override some internal values.

override_device => normal|tablet|mobile

Ignores the user agent and assume user agent is as provided.

CONFIGURATION AND ENVIRONMENT

Dancer::Plugin::Device::Layout uses Dancer's config system to configure itself.

Extend your config.yml like this:

plugins:
  Device::Layout:
    normal_layout:    normal
    mobile_layout:    mobile
    tablet_layout:    tablet
    no_tablet:        0
    tablet_as_mobile: 0
    no_mobile:        0
normal_layout: LAYOUT

The normal layout when user agent is nighter a tablet nor a mobile device. Default is 'main'.

mobile_layout: LAYOUT

The mobile layout when user agent is a mobile but not a tablet device. Default is 'mobile'.

tablet_layout: LAYOUT

The tablet layout when user agent is a tablet device. Default is 'tablet'.

no_tablet: 1|0

Disable tablet detection. Default is '0'.

tablet_as_mobile: 1|0

Treat tablet as mobile devices. Default is undef.

no_mobile: 1|0

Disable mobile detection. Default is '0'.

DEPENDENCIES

strict
warnings
utf8
version 0.77 or higher
Dancer 1.3111 or higher (not 2.x)
Dancer::Plugin
HTTP::BrowserDetect 1.51 or higher

INCOMPATIBILITIES

Currently there are no incompatibilities known.

BUGS AND LIMITATIONS

Currently there are no bugs or limitations known. Please report bugs at GitHub Issues.

AUTHOR

LICENSE

Dancer::Plugin::Device::Layout by BURNERSK is licensed under a Artistic License 2.0 License.

COPYRIGHT

Copyright © 2013, BURNERSK. Some rights reserved.