root/admin/shop/edit_category.tt
[%- IF category.id;
meta.title = 'Edit Category';
ELSE;
meta.title = 'Add Category';
END;
-%]
[%- IF category.id %]
<form id="edit_category" action="[% c.uri_for( '/admin/shop/category', category.id, 'save' ) %]" method="post">
[%- ELSE %]
<form id="add_category" action="[% c.uri_for( '/admin/shop/category/add-do' ) %]" method="post">
[%- END %]
<p>
<label for="name">Category Name</label>
<br><input type="text" class="textshort" name="name" value="[% category.name | html %]">
</p>
<p>
<label for="url_name">URL Name</label>
<br><input type="text" class="textshort" name="url_name" value="[% category.url_name | html %]">
</p>
<p>
<label for="parent">Parent Category</label>
<br><select name="parent">
<option value="" [% 'selected="selected"' UNLESS category.parent %]>None (top-level)</input>
[%- FOREACH cat IN categories %]
<option value="[% cat.id %]"[% IF cat.id == category.parent.id %]selected="selected"[% END %]>[% cat.name | html %]</input>
[%- END %]
</select>
</p>
<p>
<label for="description">Description</label>
<br><input type="text" class="textlong" name="description" value="[% category.description | html %]">
</p>
<p>
<label for="hidden">Hide category</label>
<br><input type="checkbox" id="hidden" name="hidden"[% ' checked="checked"' IF category.hidden OR ( hide_new_categories AND NOT category.id ) %]>
</p>
<p>
[%- IF category.id %]
<input name="submit" type="submit" value="Update">
<input name="delete" type="submit" value="Delete" onclick="javascript:return confirm('Are you sure you want to delete this category?')">
[%- ELSE %]
<input name="submit" type="submit" value="Create">
[%- END %]
</p>
</form>