Merge branch 'b-3.6.1' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / SL / Helper / UserPreferences / PositionsScrollbar.pm
1 package SL::Helper::UserPreferences::PositionsScrollbar;
2
3 use strict;
4 use parent qw(Rose::Object);
5
6 use Carp;
7 use List::MoreUtils qw(none);
8
9 use SL::Helper::UserPreferences;
10
11 use Rose::Object::MakeMethods::Generic (
12   'scalar --get_set_init' => [ qw(user_prefs) ],
13 );
14
15 sub get_height {
16   my $value = $_[0]->user_prefs->get('height');
17   return !defined($value) ? 25 : $value;
18 }
19
20 sub store_height {
21   $_[0]->user_prefs->store('height', $_[1]);
22 }
23
24 sub init_user_prefs {
25   SL::Helper::UserPreferences->new(
26     namespace => $_[0]->namespace,
27   )
28 }
29
30 # read only stuff
31 sub namespace     { 'PositionsScrollbar' }
32 sub version       { 1 }
33
34 1;
35
36 __END__
37
38 =pod
39
40 =encoding utf-8
41
42 =head1 NAME
43
44 SL::Helper::UserPreferences::PositionsScrollbar - preferences intended
45 to store user settings for displaying a scrollbar for the postions area
46 of document forms (it's height).
47
48 =head1 SYNOPSIS
49
50   use SL::Helper::UserPreferences::PositionsScrollbar;
51   my $prefs = SL::Helper::UserPreferences::PositionsScrollbar->new();
52
53   $prefs->store_height(75);
54   my $value = $prefs->get_height;
55
56 =head1 DESCRIPTION
57
58 This module manages storing the height for displaying the scrollbar in the
59 positions area in forms (new order controller).
60
61 =head1 BUGS
62
63 None yet :)
64
65 =head1 AUTHOR
66
67 Bernd Bleßmann E<lt>bernd@kivitendo-premium.deE<gt>
68
69 =cut