Code

Opened 9 years ago

Closed 7 years ago

Last modified 7 years ago

#208 closed enhancement (fixed)

Allow the strings the cycle tag uses to contain spaces

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

Patch #1522 would fix this

comment:3 Changed 8 years ago by adrian

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 8 years ago by adrian

  • Status changed from new to assigned

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

  • Triage Stage changed from Unreviewed to Accepted

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

Changed 7 years ago by chris.mcavoy@…

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

comment:6 Changed 7 years ago by anonymous

  • Has patch set
  • Version set to SVN

comment:7 Changed 7 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 7 years ago by EspenG

Fixes a little bug in the admin interface

comment:8 Changed 7 years ago by anonymous

  • Summary changed from Allow the strings the cycle tag uses to contain spaces. to [patch]Allow the strings the cycle tag uses to contain spaces.

comment:9 Changed 7 years ago by mtredinnick

  • Summary changed from [patch]Allow the strings the cycle tag uses to contain spaces. to 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 7 years ago by SmileyChris

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 7 years ago by EspenG

This patch is also got backwards compatibility.

comment:11 Changed 7 years ago by anonymous

  • Cc espen@… added

comment:12 Changed 7 years ago by SmileyChris

  • Owner changed from nobody to SmileyChris
  • Status changed from assigned to new

Changed 7 years ago by SmileyChris

new patch, reviewed and refactored

Changed 7 years ago by SmileyChris

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

comment:13 Changed 7 years ago by SmileyChris

  • Summary changed from Allow the strings the cycle tag uses to contain spaces. to Allow the strings the cycle tag uses to contain spaces
  • Triage Stage changed from Accepted to Ready for checkin

comment:14 Changed 7 years ago by SmileyChris

  • 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 7 years ago by SmileyChris

(Thanks to Philippe Raoult for writing the new docs)

comment:16 Changed 7 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

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

  • Keywords sprintsept14 added

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.