| 1 | package WWW::Garden::Design::Export::Pg; | ||
| 2 | |||
| 3 | use Moo; | ||
| 4 | |||
| 5 | with 'WWW::Garden::Design::Export'; | ||
| 6 | |||
| 7 | use strict; | ||
| 8 | use warnings; | ||
| 9 | |||
| 10 | use Mojo::Log; | ||
| 11 | |||
| 12 | use WWW::Garden::Design::Database::Pg; | ||
| 13 | |||
| 14 | our $VERSION = '0.97'; | ||
| 15 | |||
| 16 | # ----------------------------------------------- | ||
| 17 | |||
| 18 | sub BUILD | ||
| 19 | { | ||
| 20 | my($self) = @_; | ||
| 21 | my($config) = $self -> config; | ||
| 22 | |||
| 23 | $self -> init_export; | ||
| 24 | $self -> db | ||
| 25 | ( | ||
| 26 | WWW::Garden::Design::Database::Pg -> new | ||
| 27 | ( | ||
| 28 | logger => Mojo::Log -> new(path => $$config{log_path}) | ||
| 29 | ) | ||
| 30 | ); | ||
| 31 | |||
| 32 | } # End of BUILD. | ||
| 33 | |||
| 34 | # ----------------------------------------------- | ||
| 35 | # Warning: This method must be here and not upstairs, in WWW::Garden::Design::Export, | ||
| 36 | # because it's also called by Local::Website when rebuilding savage.net.au/Flowers.html. | ||
| 37 | |||
| 38 | sub init_datatable | ||
| 39 | { | ||
| 40 | my($self) = @_; | ||
| 41 | |||
| 42 | return <<EOS; | ||
| 43 | \$(function() | ||
| 44 | { | ||
| 45 | \$('#result_table').DataTable | ||
| 46 | ({ | ||
| 47 | 'columnDefs': | ||
| 48 | [ | ||
| 49 | {'cellType':'th','orderable':true,'searchable':true,'type':'html'}, // Native. | ||
| 50 | {'cellType':'th','orderable':true,'searchable':true,'type':'html'}, // Scientific name. | ||
| 51 | {'cellType':'th','orderable':true,'searchable':true,'type':'html'}, // Common name. | ||
| 52 | {'cellType':'th','orderable':true,'searchable':true,'type':'html'}, // Aliases. | ||
| 53 | {'cellType':'th','orderable':false,'searchable':false,'type':'html'} // Thumbnail. | ||
| 54 | ], | ||
| 55 | 'order': [ [1, 'asc'] ] | ||
| 56 | }); | ||
| 57 | }); | ||
| 58 | EOS | ||
| 59 | |||
| 60 | } # End of init_datatable. | ||
| 61 | |||
| 62 | # ----------------------------------------------- | ||
| 63 | |||
| 64 | 1; | ||
| 65 | |||
| 66 | =pod | ||
| 67 | |||
| 68 | =head1 NAME | ||
| 69 | |||
| 70 | WWW::Garden::Design::Export::Pg - Manage the 'flowers' database | ||
| 71 | |||
| 72 | =head1 Machine-Readable Change Log | ||
| 73 | |||
| 74 | The file Changes was converted into Changelog.ini by L<Module::Metadata::Changes>. | ||
| 75 | |||
| 76 | =head1 Version Numbers | ||
| 77 | |||
| 78 | Version numbers < 1.00 represent development versions. From 1.00 up, they are production versions. | ||
| 79 | |||
| 80 | =head1 Repository | ||
| 81 | |||
| 82 | L<https://github.com/ronsavage/WWW-Garden-Design> | ||
| 83 | |||
| 84 | =head1 Support | ||
| 85 | |||
| 86 | Email the author, or log a bug on RT: | ||
| 87 | |||
| 88 | L<https://rt.cpan.org/Public/Dist/Display.html?Name=WWW::Garden::Design>. | ||
| 89 | |||
| 90 | =head1 Author | ||
| 91 | |||
| 92 | L<WWW::Garden::Design> was written by Ron Savage I<E<lt>ron@savage.net.auE<gt>> in 2014. | ||
| 93 | |||
| 94 | My homepage: L<https://savage.net.au/>. | ||
| 95 | |||
| 96 | =head1 Copyright | ||
| 97 | |||
| 98 | Australian copyright (c) 2018, Ron Savage. | ||
| 99 | |||
| 100 | All Programs of mine are 'OSI Certified Open Source Software'; | ||
| 101 | you can redistribute them and/or modify them under the terms of | ||
| 102 | The Perl License, a copy of which is available at: | ||
| 103 | http://dev.perl.org/licenses/ | ||
| 104 | |||
| 105 | =cut |