Opened 11 years ago

Closed 9 years ago

Last modified 9 years ago

#208 closed enhancement (fixed)

Allow the strings the cycle tag uses to contain spaces

Reported by: anonymous Owned by: Chris Beaven
Component: Template system Version: master
Severity: normal Keywords: sprintsept14
Cc: espen@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I would like to be able to use the cycle tag like so:

{% cycle <td class="tdClass">,</tr><tr><td class="tdClass"> %}

The current cycle tag (as I understand it) does not allow spaces or a way to escape spaces.

Attachments (5)

208.patch (7.6 KB) - added by chris.mcavoy@… 10 years ago.
Patch that changes behavior of cycle tag according to Adrian's description.
208.2.patch (8.1 KB) - added by EspenG 10 years ago.
Fixes a little bug in the admin interface
208.3.patch (10.4 KB) - added by EspenG 10 years ago.
This patch is also got backwards compatibility.
208.4.patch (6.7 KB) - added by Chris Beaven 9 years ago.
new patch, reviewed and refactored
208-update-templates.patch (8.8 KB) - added by Chris Beaven 9 years ago.
separate patch which should be applied - updates admin and databrowse templates to use new format

Download all attachments as: .zip

Change History (22)

comment:1 Changed 11 years ago by rjwittams

I think this would be better handled with a blockcycle tag.
Eg
{%blockcycle %}

<td class="tdClass">

{%next%}

</tr><tr><td class="tdClass">

{%endblockcycle %}

Not that I'm sure this example is very good....

comment:2 Changed 11 years ago by Chris Beaven

Patch #1522 would fix this

comment:3 Changed 10 years ago by Adrian Holovaty

Now that we have an intelligent string splitter in the template system, I'd like to change cycle in a backwards-incompatible way, so that you'd pass in strings, separated by spaces. Examples:

{% cycle 'value 1' 'value 2' %}
{% cycle 'value 1' 'value 2' 'value 3' %}
{% cycle 'value 1' 'value 2' as foo %}

Variables would be allowed as the cycle values, too:

{% cycle some_var 'some value' %}

comment:4 Changed 10 years ago by Adrian Holovaty

Status: newassigned

comment:5 Changed 10 years ago by Gary Wilson <gary.wilson@…>

Triage Stage: UnreviewedAccepted

Marking as accepted since Adrian stated how he would like this tag to change.

Changed 10 years ago by chris.mcavoy@…

Attachment: 208.patch added

Patch that changes behavior of cycle tag according to Adrian's description.

comment:6 Changed 10 years ago by anonymous

Has patch: set
Version: SVN

comment:7 Changed 10 years ago by EspenG

I found a bug in the admin interface while using the patch attached to this ticket. I also looked around for more of the same bug in the admin interface but could not find any. Will upload a new patch that fixes this bug.

Changed 10 years ago by EspenG

Attachment: 208.2.patch added

Fixes a little bug in the admin interface

comment:8 Changed 10 years ago by anonymous

Summary: Allow the strings the cycle tag uses to contain spaces.[patch]Allow the strings the cycle tag uses to contain spaces.

comment:9 Changed 10 years ago by Malcolm Tredinnick

Summary: [patch]Allow the strings the cycle tag uses to contain spaces.Allow the strings the cycle tag uses to contain spaces.

No need to put [patch] in the title any longer. We have the "has patch" flag for that purpose.

comment:10 Changed 10 years ago by Chris Beaven

I'd like to see this with backwards compatibility which is possible: After checking for as something, you can see if there's only one bit left with commas, in which case use the old method.

Changed 10 years ago by EspenG

Attachment: 208.3.patch added

This patch is also got backwards compatibility.

comment:11 Changed 9 years ago by anonymous

Cc: espen@… added

comment:12 Changed 9 years ago by Chris Beaven

Owner: changed from nobody to Chris Beaven
Status: assignednew

Changed 9 years ago by Chris Beaven

Attachment: 208.4.patch added

new patch, reviewed and refactored

Changed 9 years ago by Chris Beaven

Attachment: 208-update-templates.patch added

separate patch which should be applied - updates admin and databrowse templates to use new format

comment:13 Changed 9 years ago by Chris Beaven

Summary: Allow the strings the cycle tag uses to contain spaces.Allow the strings the cycle tag uses to contain spaces
Triage Stage: AcceptedReady for checkin

comment:14 Changed 9 years ago by Chris Beaven

Keywords: cycle removed

So just to clarify, 208.patch contains just the code and 208-update-templates.patch contains just the template changes.

comment:15 Changed 9 years ago by Chris Beaven

(Thanks to Philippe Raoult for writing the new docs)

comment:16 Changed 9 years ago by Russell Keith-Magee

Resolution: fixed
Status: newclosed

(In [6153]) Fixed #208 -- Modernized the syntax of the cycle tag to allow for spaces and variables in cycle values. Thanks to SmileyChris and Chris McAvoy for their work on this.

comment:17 Changed 9 years ago by George Vilches <gav@…>

Keywords: sprintsept14 added
Note: See TracTickets for help on using tickets.
Back to Top