Bugzilla – Attachment 74057 Details for
Bug 20538
Remove the need of writing [% KOHA_VERSION %] everywhere
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20538: Add POD for Asset.pm
Bug-20538-Add-POD-for-Assetpm.patch (text/plain), 2.49 KB, created by
Julian Maurice
on 2018-04-12 09:37:46 UTC
(
hide
)
Description:
Bug 20538: Add POD for Asset.pm
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2018-04-12 09:37:46 UTC
Size:
2.49 KB
patch
obsolete
>From 5ebb84bc63bd0439a4f736aa399e70cfcaa9f69f Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Thu, 12 Apr 2018 11:21:05 +0200 >Subject: [PATCH] Bug 20538: Add POD for Asset.pm > >--- > Koha/Template/Plugin/Asset.pm | 65 +++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 65 insertions(+) > >diff --git a/Koha/Template/Plugin/Asset.pm b/Koha/Template/Plugin/Asset.pm >index 59b6c85086..5b78345174 100644 >--- a/Koha/Template/Plugin/Asset.pm >+++ b/Koha/Template/Plugin/Asset.pm >@@ -17,6 +17,29 @@ package Koha::Template::Plugin::Asset; > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >+=head1 NAME >+ >+Koha::Template::Plugin::Asset >+ >+=head1 DESCRIPTION >+ >+The Asset plugin is a helper that generates HTML tags for JS and CSS files >+ >+=head1 SYNOPSYS >+ >+ [% USE Asset %] >+ >+ [% Asset.css("css/datatables.css") %] >+ [% Asset.js("js/datatables.js") %] >+ >+ [%# With attributes %] >+ [% Asset.css("css/print.css", { media = "print" }) %] >+ >+ [%# If you only want the url and not the HTML tag %] >+ [% url = Asset.url("css/datatables.css") %] >+ >+=cut >+ > use Modern::Perl; > > use Template::Plugin; >@@ -26,6 +49,14 @@ use File::Basename; > use File::Spec; > use C4::Context; > >+=head1 FUNCTIONS >+ >+=head2 new >+ >+Constructor. Do not use this directly. >+ >+=cut >+ > sub new { > my ($class, $context) = @_; > >@@ -36,6 +67,14 @@ sub new { > return bless $self, $class; > } > >+=head2 js >+ >+Returns a <script> tag for the given JS file >+ >+ [% Asset.js('js/datatables.js') %] >+ >+=cut >+ > sub js { > my ( $self, $filename, $attributes ) = @_; > >@@ -50,6 +89,15 @@ sub js { > return $self->tag('script', $attributes) . '</script>'; > } > >+=head2 css >+ >+Returns a <link> tag for the given CSS file >+ >+ [% Asset.css('css/datatables.css') %] >+ [% Asset.css('css/print.css', { media = "print" }) %] >+ >+=cut >+ > sub css { > my ( $self, $filename, $attributes ) = @_; > >@@ -66,6 +114,14 @@ sub css { > return $self->tag('link', $attributes); > } > >+=head2 url >+ >+Returns the URL for the given file >+ >+ [% Asset.url('css/datatables.css') %] >+ >+=cut >+ > sub url { > my ( $self, $filename ) = @_; > >@@ -93,6 +149,15 @@ sub url { > } > } > >+=head2 tag >+ >+Returns an HTML tag with given name and attributes. >+This shouldn't be used directly. >+ >+ [% Asset.tag("script", { src = "/koha-tmpl/intranet-tmpl/prog/css/datatables.css" }) %] >+ >+=cut >+ > sub tag { > my ($self, $name, $attributes) = @_; > >-- >2.14.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20538
:
73791
|
73836
|
74048
|
74049
|
74053
|
74054
|
74056
|
74057
|
74058
|
74059
|
74060
|
74061
|
74062
|
74063
|
74171
|
74835