Liquid gives the wrong link - url

I'm creating a pagination in my website with Liquid template engine. But the link does not work as it should.
I want this link: https://support.beefinity.com/support/tickets/filter?page=2&requested_by=0&wf_filter=all
But I get this link: https://support.beefinity.com/support/tickets/filter/page/2?requested_by=0&url_locale=&wf_filter=all
This is the code that I use for the pagination:
{% paginate tickets by 10 %} {% for ticket in tickets %} {% if ticket.group.name == "Beefinity Support"%}
<div class="c-row c-ticket-row" id="ticket-view">
<span class="status-source sources-detailed-{{ticket.source_name | downcase}}" title=" {{ticket.source_name | downcase}} "></span> <span class="label-status-pending label label-small">{{ticket.status}}</span>
<div class="ticket-brief">
<div class="ellipsis">
<a class="c-link" href="{{ticket.portal_url}}" title="{{ticket.subject}}">{{ticket.subject}}</a>
</div>
<div class="help-text">
Made by: <span class="emphasize">{{ticket.requester.name}} Made on:{{ ticket.created_on | date: "%d-%m-%Y %H:%M" }}</span><br>
Agent: <span class="emphasize">{{ticket.agent.name}}</span>
</div>
</div>
</div>
{% endif %} {% endfor %} {% if paginate.pages != 0 %}
<div class="pagination pagination-centered">
<ul>
{% if paginate.previous %}
<li class="previous">
<a rel="prev start" href="{{ paginate.previous.url }}">
{{ paginate.previous.title }} Previous
</a>
</li>
{% else %}
<li class="disabled">
<span>« Previous </span>
</li>
{% endif %}
{% for part in paginate.parts %}
{% if part.is_link %}
<li>
<a rel="prev start" href="{{ part.url }}">
{{ part.title }}
</a>
</li>
{% else %}
{% if part.title == paginate.current_page %}
<li class="active">
{{ part.title }}
</li>
{% else %}
<li>
<a rel"start"> {{ part.title }}</a>
</li>
{% endif %}
{% endif %}
{% endfor %}
{% if paginate.next %}
<li class="next_page">
<a rel="next" href="{{ paginate.next.url }}">
Next {{ paginate.next.title }}
</a>
</li>
{% else %}
<li class="next_page disabled">
<span> Next » </span>
</li>
{% endif %}
</ul>
</div>
{% endif %}
{% endpaginate %}
in the documentation that I viewed it just goes well:

Related

Nested navigation in eleventy

My data is creating a number of paginated posts. My front matter is as follows:
---
pagination:
data: cms
size: 1
alias: article
addAllPagesToCollections: true
layout: "_base.njk"
tags: articles
permalink: "/articles/{{ article.title | slug }}/"
eleventyComputed:
title: "{{ article.title }}"
eleventyNavigation:
key: "{{ article.title}}"
parent: "{{articles}}" //<-- how do I set the parent?
---
I would like my nav HTML structure to read
<ul>
<li>articles</li>
<ul>
<li>post-1</li>
<li>post-2</li>
</ul>
</ul>
Thanks in advance.
You can create hierarchy by using macro's.
But there's an another way: flatten that hierarchy and assign to each node a variable that describes the nesting level.
Then a similar code (as below) can be used to render that hierarchy:
{% set level = 0 %}
{% for category in collections.categoryCollection %}
{% set ulCount = (category.level - level) | abs %}
{% for i in range(0, ulCount) %}
{% if category.level > level %}
<ul>
{% else %}
</ul>
{% endif %}
{% endfor %}
<li>
<a href="{{ category.categoryUri | url | normalize | firstPage(globals.categories.category.postPageSize) }}">
{{ category.categoryName }} ( {{category.items.length}} / {{ category.allItems.length }} )
</a>
</li>
{% set level = category.level %}
{% endfor %}
{% for i in range(0, level) %}
</ul>
{% endfor %}
Hope this helps, I know it works, used them to get something like this:

Twig checkbox is checked

please how can I do something as follows with twig checkbox
<input type="checkbox" name="checkbox">
{% if checkbox is checked %}
#do_it
{% else %}
#do_that
{% endif %}
help me, please
Checkboxes return string value.
{% if node.field_mycheckbox.value == '1' %}
<p>print 1</p>
{% else %}
<p>print 0</p>
{% endif %}
The controller:
$dispo = $mezzo->getAuDisponibile ();
// table column AuDisponibile is boolean
...
...
return $this-render ('anagrafiche/automezzi.html.twig', ['dispo' => $dispo]);
The template:
{% if dispo %}
<input input type='checkbox' name="idisponibile" value="SI" checked>
{% else %}
<input input type='checkbox' name="idisponibile" value="SI">
{% endif %}
You can check if a form field is checked with in example,
{% if form.field.children.KEY.vars.checked %}
Do something here
{% endif %}
Using it inside a loop.
{% for child in form.field %}
<input type="checkbox" name="checkbox" {{ child.vars.checked == true ? "Checked" }}>
{% endfor %}
or
<input type="checkbox" name="checkbox" {{ form.field.children.KEY.vars.checked ? "Checked" }}>
KEY being the array key.

How to Filter all Blog.Articles by containing specific tag in Shopify?

hello is there anyone shopify experts out there .
my only goal is to filter or display all articles according to their tag .
so this is what i have so far from this forum
{% assign counter = 0 %}
{% for article in blogs['lookbook'].articles %}
{% if article.tags contains 'Fox Racing' and counter < 2 %}
{% assign counter = counter | plus: 1 %}
<div class="njohn_search_otherpage">
<a href="{{ article.url }}" title="{{ article.title | escape }}">
<div>{{ article.image.src | img_url: 'medium' | img_tag: article.title }}</div>
<div>{{ article.title }}</div>
</a>
</div>
{% endif %}
{% endfor %}
the code are working but it's only four article will showed up. but in that sample tag i have already 10 articles.
The above code has a counter that limits the articles displayed, removing that counter works as expected, filtering all the articles by a tag.
{% for article in blogs['lookbook'].articles %}
{% if article.tags contains 'Fox Racing' %}
<div class="njohn_search_otherpage"> <div>{{ article.image.src | img_url: 'medium' | img_tag: article.title }}</div> <div>{{ article.title }}</div> </div>
{% endif %}
{% endfor %}

Symfony and JQueryMobile content loading

salam
i develop a mobile site with symfony2 and jqueryMobile
i load a listview in a collapsible but a got this response like in image
here my code in the first page
{% block content %}
<h4>Les Categories</h4>
<div data-role="collapsible-set" data-theme="b" data-content-theme="d" class="ui-collapsible-set">
{% for Categorie in Categories %}
<div data-role="collapsible" data-collapsed="true" class="info" data-record="{{Categorie.id}}">
<h1>{{ Categorie.Libelle }}</h1>
<p class="catdetail">
</p>
</div>
{% endfor %}
</div>
<script>
$('div.info').live('expand', function(){
//get the ID for this record
var record = $(this).data("record");
console.log('expanded '+record);
$(".catdetail", this).load("{{ path('Ecommerceboutique_mobile')}}dscat/"+record);
});
</script>
{% endblock %}
and here the second page which loaded in collapsible
<ul data-role="listview" class="ui-listview">
{% for souscategorie in souscategories %}
<li>
<a href="{{ path('Ecommerceboutique_mobile_lstprdsouscat', { 'id': souscategorie.id })}}">
{{souscategorie.Libelle}}
</a>
</li>
{% endfor %}
EDIT
i add the script to second page but still the same problem
<script>
$(function() {
$('.selector').listview('refresh');
});
Maybe refresh the listview once you have pulled it
$(".catdetail", this).load("{{ path('Ecommerceboutique_mobile')}}dscat/"+record).listview('refresh');
jQM Docs:
http://jquerymobile.com/demos/1.2.0/docs/lists/lists-methods.html
I solve the problem by this
{% for souscategorie in souscategories %}
<li data-corners="false" data-shadow="false" data-iconshadow="true" data-wrapperels="div" data-icon="arrow-r" data-iconpos="right" data-theme="c" class="ui-btn ui-btn-icon-right ui-li-has-arrow ui-li ui-btn-up-c">
<div class="ui-btn-inner ui-li">
<div class="ui-btn-text">
<a href="{{ path('Ecommerceboutique_mobile_lstprdsouscat', { 'id': souscategorie.id })}}" class="ui-link-inherit">
{{souscategorie.Libelle}}
</a>
</div>
<span class="ui-icon ui-icon-arrow-r ui-icon-shadow"> </span>
</div>
</li>
{% endfor %}
thanks phill for your help

jquerymobile Thumbnails

salam
i'm new in jqueryMobile and i want to view a Thumbnails but a got this
how can i got a normal one?
here the code of this list
<ul data-role="listview" class="ui-listview">
{% for produit in produits %}
<li data-corners="false" data-shadow="false" data-iconshadow="true" data-wrapperels="div" data-icon="arrow-r" data-iconpos="right" data-theme="c" class="ui-btn ui-btn-icon-right ui-li-has-arrow ui-li ui-li-has-thumb ui-btn-up-c"><div class="ui-btn-inner ui-li"><div class="ui-btn-text"><a href="index.html" class="ui-link-inherit">
{% if produit.Images is empty %}
<img src="{{asset('upload/non_disponible.jpg')}}" class="ui-li-thumb"/>
{% else %}
<img src="{{asset('upload/')}}{{produit.Images[0].path}}" class="ui-li-thumb"/>
{% endif %}
<h3 class="ui-li-heading">Broken Bells</h3>
<p class="ui-li-desc">Broken Bells</p>
</a></div><span class="ui-icon ui-icon-arrow-r ui-icon-shadow"> </span></div></li>
{%endfor%}
</ul>
Try the following code instead (using jQuery Mobile version 1.2.0):
<ul data-role="listview" class="ui-listview">
{% for produit in produits %}
<li data-theme="c">
<a href="index.html" class="ui-link-inherit">
{% if produit.Images is empty %}
<img src="{{asset('upload/non_disponible.jpg')}}" class="ui-li-thumb"/>
{% else %}
<img src="{{asset('upload/')}}{{produit.Images[0].path}}" class="ui-li-thumb"/>
{% endif %}
<h3 class="ui-li-heading">Broken Bells</h3>
<p class="ui-li-desc">Broken Bells</p>
</a>
</li>
{%endfor%}
</ul>
Hope this helps. Let me know about your results.

Resources