+ [% IF dset_id == dset.id %]
+ [% PROCESS set action = 'edit' %]
+ [% ELSE %]
+ [% PROCESS set action = 'view' %]
+ [% END %]
+
- [% FOREACH dest IN dset.destinations %]
-
-
-
-
- [% IF (dest.id == -1) %]
- [% PROCESS target action = 'add' %]
- [% ELSIF dtarget_id == dest.id %]
- [% PROCESS target action = 'edit' %]
-
- [% ELSE %]
- [% PROCESS target action = 'view' %]
- [% END %]
+ [% priority = 0 %]
+ [% FOREACH dest IN dset.destinations %]
+
+
+ [% IF (dest.id == -1) %]
+ [% PROCESS target action = 'add' %]
+ [% ELSIF dtarget_id == dest.id %]
+ [% PROCESS target action = 'edit' %]
+ [% ELSE %]
+ [% PROCESS target action = 'view' %]
+ [% END %]
[% priority = priority + 1 %]
- [% END %]
+ [% END %]
-
-
- [%# dest is still available. this is expected behaviour
- see: http://template-toolkit.org/docs/manual/Directives.html#section_FOREACH %]
+ [%# dest is still available. this is expected behaviour
+ see: http://template-toolkit.org/docs/manual/Directives.html#section_FOREACH %]
- [% IF priority == 0 or dset_id == dset.id %] [%# either editing set or nothing here so far, offer empty one %]
- [% dest = undef %] [%# dest still holds the last one %]
-
- [% PROCESS target action = 'add' %]
-
- [% END %]
+ [% IF priority == 0 or dset_id == dset.id %] [%# either editing set or nothing here so far, offer empty one %]
+ [% dest = undef %] [%# dest still holds the last one %]
+
+ [% PROCESS target action = 'add' %]
+
+ [% END %]