Skip to content

Commit cd5a79c

Browse files
committed
Upgrading from classic template. Supporting allow multiple add
mode. Edited from classic to add description field for keyword.
1 parent 9388070 commit cd5a79c

File tree

1 file changed

+66
-69
lines changed

1 file changed

+66
-69
lines changed
Lines changed: 66 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,75 @@
1-
<tal:doc metal:use-macro="templates/page/macros/icing"
2-
define="edit_ok context/is_edit_ok"
3-
>
4-
<title metal:fill-slot="head_title">
5-
<tal:if condition="context/id" i18n:translate=""
6-
>Keyword <span tal:replace="context/id" i18n:name="id"
7-
/>: <span tal:replace="context/name" i18n:name="title"
8-
/> - <span tal:replace="config/TRACKER_NAME" i18n:name="tracker"
9-
/></tal:if>
10-
<tal:if condition="not:context/id" i18n:translate=""
11-
>New Keyword - <span tal:replace="config/TRACKER_NAME" i18n:name="tracker"
12-
/></tal:if>
13-
</title>
14-
<metal:slot fill-slot="more-javascript">
15-
<script type="text/javascript" src="@@file/help_controls.js"></script>
16-
</metal:slot>
17-
<tal:block metal:fill-slot="body_title"
18-
define="edit_ok context/is_edit_ok">
19-
<span tal:condition="python: not (context.id or edit_ok)"
20-
tal:omit-tag="python:1" i18n:translate="">New Keyword</span>
21-
<span tal:condition="python: not context.id and edit_ok"
22-
tal:omit-tag="python:1" i18n:translate="">New Keyword Editing</span>
23-
<span tal:condition="python: context.id and not edit_ok"
24-
tal:omit-tag="python:1" i18n:translate="">Keyword<tal:x
25-
replace="context/id" i18n:name="id" /></span>
26-
<span tal:condition="python: context.id and edit_ok"
27-
tal:omit-tag="python:1" i18n:translate="">Keyword<tal:x
28-
replace="context/id" i18n:name="id" /> Editing</span>
29-
</tal:block>
30-
1+
<!-- dollarId: keyword.item,v 1.3 2002/05/22 00:32:34 richard Exp dollar-->
2+
<tal:block metal:use-macro="templates/page/macros/icing">
3+
<title metal:fill-slot="head_title" i18n:translate="">Keyword editing - <span
4+
i18n:name="tracker" tal:replace="config/TRACKER_NAME" /></title>
5+
<span metal:fill-slot="body_title" tal:omit-tag="python:1"
6+
i18n:translate="">Keyword editing</span>
317
<td class="content" metal:fill-slot="content">
328

33-
<p tal:condition="python:not (context.is_view_ok()
34-
or request.user.hasRole('Anonymous'))" i18n:translate="">
35-
You are not allowed to view this page.</p>
36-
37-
<p tal:condition="python:not context.is_view_ok()
38-
and request.user.hasRole('Anonymous')" i18n:translate="">
39-
Please login with your username and password.</p>
9+
<table class="otherinfo" tal:define="keywords db/keyword/list"
10+
tal:condition="keywords">
11+
<tr><th colspan="4" class="header" i18n:translate="">Existing Keywords</th></tr>
12+
<tr tal:repeat="start python:range(0, len(keywords), 4)">
13+
<td width="25%" tal:define="batch python:utils.Batch(keywords, 4, start)"
14+
tal:repeat="keyword batch">
15+
<a tal:attributes="href string:keyword${keyword/id}"
16+
tal:content="keyword/name">keyword here</a>
17+
</td>
18+
</tr>
19+
<tr>
20+
<td colspan="4" style="border-top: 1px solid gray" i18n:translate="">
21+
To edit an existing keyword (for spelling or typing errors),
22+
click on its entry above.
23+
</td>
24+
</tr>
25+
</table>
4026

41-
<div tal:condition="context/is_view_ok">
27+
<p class="help" tal:condition="not:context/id" i18n:translate="">
28+
To create a new keyword, enter it below and click "Submit New Entry".
29+
</p>
4230

43-
<form method="POST"
44-
tal:define="required python:'name description'.split()"
31+
<form method="POST" onSubmit="return submit_once()"
4532
enctype="multipart/form-data"
46-
tal:attributes="action context/designator;">
47-
48-
<table class="form">
33+
tal:attributes="action context/designator">
4934

50-
<tr>
51-
<th class="required" i18n:translate="">Keyword:</th>
52-
<td tal:content="structure
53-
python:context.name.field(size=60)">title</td>
54-
</tr>
35+
<table class="form">
36+
<tr>
37+
<th i18n:translate="">Keyword</th>
38+
<td tal:content="structure python:context.name.field(size=60)">name</td>
39+
</tr>
40+
<tr>
41+
<th class="required" i18n:translate="">Description:</th>
42+
<td tal:content="structure python:context.description.field(size=60)">description</td>
43+
</tr>
44+
<tr>
45+
<td tal:condition="not:context/id">
46+
<tal:comment tal:replace="nothing">
47+
If we get here and do not have an id, we are creating a new
48+
keyword. It would be nice to provide some mechanism to
49+
determine the preferred state of the "Continue adding keywords"
50+
checkbox. By default I have it enabled.
51+
</tal:comment>
52+
<input type="checkbox" id="continue_new_keyword"
53+
name="__redirect_to"
54+
tal:attributes="value
55+
string:${request/base}${request/env/PATH_INFO}?@template=item;
56+
checked python:True" />
57+
<label for="continue_new_keyword" i18n:translate="">Continue adding keywords.</label>
58+
</td>
59+
</tr>
5560

56-
<tr>
57-
<th class="required" i18n:translate="">Description:</th>
58-
<td tal:content="structure python:context.description.field(size=60)">description</td>
59-
60-
</tr>
61-
62-
<tr tal:condition="context/is_edit_ok">
63-
<td>
64-
&nbsp;
65-
<input type="hidden" name="@template" value="item">
66-
<input type="hidden" name="@required" value="name,description"
67-
tal:attributes="value python:','.join(required)">
68-
</td>
69-
<td><input type="submit" value="save" tal:replace="structure context/submit"><!--submit button here-->
70-
<input type="reset">
71-
</td>
72-
</tr>
73-
74-
</table>
61+
<tr>
62+
<td>
63+
&nbsp;
64+
<input type="hidden" name="@required" value="name">
65+
<input type="hidden" name="@template" value="item">
66+
</td>
67+
<td colspan=3 tal:content="structure context/submit">
68+
submit button will go here
69+
</td>
70+
</tr>
71+
</table>
7572
</form>
76-
</div>
7773
</td>
78-
</tal:doc>
74+
75+
</tal:block>

0 commit comments

Comments
 (0)