A new request with request id 18422 has been created by koha-devel-request@lists.koha-community.org. Short info on the request is :
Title : Koha-devel Digest, Vol 186, Issue 6
Category :
Description : Send Koha-devel mailing list submissions to
koha-devel@lists.koha-community.org
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
or, via email, send a message with subject or body 'help' to
koha-devel-request@lists.koha-community.org
You can reach the person managing the list at
koha-devel-owner@lists.koha-community.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Koha-devel digest..."
Today's Topics:
1. Re: Embedding JSON data in HTML (Tomas Cohen Arazi)
2. TT loop count VS size (Fridolin SOMERS)
3. Re: TT loop count VS size (Jonathan Druart)
----------------------------------------------------------------------
Message: 1
Date: Thu, 6 May 2021 11:28:07 -0300
From: Tomas Cohen Arazi <tomascohen@gmail.com>
To: David Cook <dcook@prosentient.com.au>
Cc: koha-devel <koha-devel@lists.koha-community.org>
Subject: Re: [Koha-devel] Embedding JSON data in HTML
Message-ID:
<CABZfb=W+13GhEUUmOikS7OH8vFkWx+fhdwZXZjD1d7Nxfpsoow@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Nice finding, David. I've come across that in the context of Koha and
Template::Toolkit, and did something similar, using a data- attribute. I
used [% USE JSON.Escape %] to escape the data that comes from Perl.
Here, I set the data structure to a data-pickup-locations attribute:
https://gitlab.com/thekesolutions/Koha/-/commit/8b63154b866863aae6ac981b37c98864cd8875f4#f9b348ee995ab14b7c8a47e5ef2b7fe07838ec38_811_822
And then I use it:
https://gitlab.com/thekesolutions/Koha/-/commit/8b63154b866863aae6ac981b37c98864cd8875f4#f9b348ee995ab14b7c8a47e5ef2b7fe07838ec38_1245_1274
Best regards
El mié, 5 may 2021 a las 1:07, <dcook@prosentient.com.au> escribió:
> Hi all,
>
>
>
> I was just reflecting on bugs like
> https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26942 and
> reviewing https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
> when I saw the following method for embedding JSON in HTML:
>
>
>
> <!-- Generated by the server -->
>
> <script id="data" type="application/json">{"userId":1234,"userName":"John
> Doe","memberSince":"2000-01-01T00:00:00.000Z"}</script>
>
>
>
> <!-- Static -->
>
> <script>
>
> const userInfo = JSON.parse(document.getElementById("data").text);
>
> console.log("User information: %o", userInfo);
>
> </script>
>
>
>
> I thought that was neat.
>
>
>
> David Cook
>
> Software Engineer
>
> Prosentient Systems
>
> Suite 7.03
>
> 6a Glen St
>
> Milsons Point NSW 2061
>
> Australia
>
>
>
> Office: 02 9212 0899
>
> Online: 02 8005 0595
>
>
> _______________________________________________
> Koha-devel mailing list
> Koha-devel@lists.koha-community.org
> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
> website : https://www.koha-community.org/
> git : https://git.koha-community.org/
> bugs : https://bugs.koha-community.org/
>
--
Tomás Cohen Arazi
Theke Solutions (http://theke.io)
✆ +54 9351 3513384
GPG: B2F3C15F
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20210506/7006439d/attachment-0001.htm>
------------------------------
Message: 2
Date: Fri, 7 May 2021 09:17:58 +0200
From: Fridolin SOMERS <fridolin.somers@biblibre.com>
To: koha-devel <koha-devel@lists.koha-community.org>
Subject: [Koha-devel] TT loop count VS size
Message-ID: <dd42a892-33bd-935f-b7ec-6f9fd3c5fc26@biblibre.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Hi community,
I've been on a mindblowing search on a template error :D
I was thinking that "loop.count" was wrong for testing if loop is not
empty, the method is "loop.size".
See doc
http://template-toolkit.org/docs/manual/Directives.html#section_FOREACH
Looks like we use both actually :
> git grep 'IF.*\.count ' origin/master | wc -l
602
> git grep 'IF.*\.size ' origin/master | wc -l
1636
So using count seems to work because it starts with 1.
But in my opinion it is a wrong call.
We can see for example :
<a href="#images">Images ([% localimages.count || 0 | html %])</a>
This is wrong no ?
Should be create a coding guideline ?
--
Fridolin SOMERS <fridolin.somers@biblibre.com>
Software and system maintainer 🦄
BibLibre, France
------------------------------
Message: 3
Date: Fri, 7 May 2021 09:57:31 +0200
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
To: Fridolin SOMERS <fridolin.somers@biblibre.com>
Cc: koha-devel <koha-devel@lists.koha-community.org>
Subject: Re: [Koha-devel] TT loop count VS size
Message-ID:
<CAJzKNY4pxNMQDuEJ8zUrCfwiHpLCXUrz-quenLa4QGY8y=JFiQ@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
You should grep "loop.count", not ".count"
Most of the count you have with your regex is coming from
koha_objects->count
Le ven. 7 mai 2021 à 09:17, Fridolin SOMERS <fridolin.somers@biblibre.com>
a écrit :
> Hi community,
>
> I've been on a mindblowing search on a template error :D
>
> I was thinking that "loop.count" was wrong for testing if loop is not
> empty, the method is "loop.size".
>
> See doc
> http://template-toolkit.org/docs/manual/Directives.html#section_FOREACH
>
> Looks like we use both actually :
> > git grep 'IF.*\.count ' origin/master | wc -l
> 602
> > git grep 'IF.*\.size ' origin/master | wc -l
> 1636
>
> So using count seems to work because it starts with 1.
> But in my opinion it is a wrong call.
>
> We can see for example :
> <a href="#images">Images ([% localimages.count || 0 | html %])</a>
> This is wrong no ?
>
> Should be create a coding guideline ?
>
> --
> Fridolin SOMERS <fridolin.somers@biblibre.com>
> Software and system maintainer 🦄
> BibLibre, France
> _______________________________________________
> Koha-devel mailing list
> Koha-devel@lists.koha-community.org
> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
> website : https://www.koha-community.org/
> git : https://git.koha-community.org/
> bugs : https://bugs.koha-community.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20210507/e4b0c515/attachment-0001.htm>
------------------------------
Subject: Digest Footer
_______________________________________________
Koha-devel mailing list
Koha-devel@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : https://www.koha-community.org/
git : https://git.koha-community.org/
bugs : https://bugs.koha-community.org/
------------------------------
End of Koha-devel Digest, Vol 186, Issue 6
******************************************
NOTE: You are receiving this mail because, the Requester/Technician wanted you to get notified on this request creation.