Opened 19 years ago

Closed 17 years ago

Last modified 17 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: dev
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: no UI/UX: no

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@… 18 years ago.
Patch that changes behavior of cycle tag according to Adrian's description.
208.2.patch (8.1 KB ) - added by EspenG 18 years ago.
Fixes a little bug in the admin interface
208.3.patch (10.4 KB ) - added by EspenG 18 years ago.
This patch is also got backwards compatibility.
208.4.patch (6.7 KB ) - added by Chris Beaven 17 years ago.
new patch, reviewed and refactored
208-update-templates.patch (8.8 KB ) - added by Chris Beaven 17 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 by rjwittams, 19 years ago

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 by Chris Beaven, 19 years ago

Patch #1522 would fix this

comment:3 by Adrian Holovaty, 18 years ago

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 by Adrian Holovaty, 18 years ago

Status: newassigned

comment:5 by Gary Wilson <gary.wilson@…>, 18 years ago

Triage Stage: UnreviewedAccepted

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

by chris.mcavoy@…, 18 years ago

Attachment: 208.patch added

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

comment:6 by anonymous, 18 years ago

Has patch: set
Version: SVN

comment:7 by EspenG, 18 years ago

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.

by EspenG, 18 years ago

Attachment: 208.2.patch added

Fixes a little bug in the admin interface

comment:8 by anonymous, 18 years ago

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

comment:9 by Malcolm Tredinnick, 18 years ago

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 by Chris Beaven, 18 years ago

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.

by EspenG, 18 years ago

Attachment: 208.3.patch added

This patch is also got backwards compatibility.

comment:11 by anonymous, 18 years ago

Cc: espen@… added

comment:12 by Chris Beaven, 17 years ago

Owner: changed from nobody to Chris Beaven
Status: assignednew

by Chris Beaven, 17 years ago

Attachment: 208.4.patch added

new patch, reviewed and refactored

by Chris Beaven, 17 years ago

Attachment: 208-update-templates.patch added

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

comment:13 by Chris Beaven, 17 years ago

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 by Chris Beaven, 17 years ago

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 by Chris Beaven, 17 years ago

(Thanks to Philippe Raoult for writing the new docs)

comment:16 by Russell Keith-Magee, 17 years ago

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 by George Vilches <gav@…>, 17 years ago

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