Mercurial > p > roundup > code
diff templates/classic/html/page.html @ 3704:18def94e5150
macro th_label:
- usage of th_label in user.item.html (for a start)
- macro search_select_translated (for status and priority)
- Javascript support for adding uses (just past the email address and
leave the input field)
| author | Tobias Herp <tobias-herp@users.sourceforge.net> |
|---|---|
| date | Sun, 17 Sep 2006 23:27:21 +0000 |
| parents | 101ef7a4f9a1 |
| children | ba2eeadeed69 |
line wrap: on
line diff
--- a/templates/classic/html/page.html Sun Sep 17 23:22:29 2006 +0000 +++ b/templates/classic/html/page.html Sun Sep 17 23:27:21 2006 +0000 @@ -1,5 +1,5 @@ -<tal:block metal:define-macro="icing"> -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" +<tal:block metal:define-macro="icing"><!-- ££££µµµµ vim:sw=2 ts=2 +--><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> @@ -9,11 +9,21 @@ tal:attributes="content string:text/html;; charset=${request/client/charset}" /> <script tal:replace="structure request/base_javascript"> </script> +<metal:x define-slot="more-javascript" /> </head> <body class="body"> -<table class="body"> +<table class="body" + tal:define=" +kw_edit python:request.user.hasPermission('Edit', 'keyword'); +kw_create python:request.user.hasPermission('Create', 'keyword'); +kw_edit_link python:kw_edit and db.keyword.list(); +columns string:id,activity,title,creator,status; +columns_showall string:id,activity,title,creator,assignedto,status; +status_notresolved string:-1,1,2,3,4,5,6,7; +" +> <tr> <td class="page-header-left"> </td> @@ -24,7 +34,8 @@ <div id="searchbox"> <form method="GET" action="issue"> <input type="hidden" name="@columns" - value="id,activity,title,creator,assignedto,status"/> + tal:attributes="value columns_showall" + value="id,activity,title,creator,assignedto,status"/> <input type="hidden" name="@sort" value="activity"/> <input type="hidden" name="@group" value="priority"/> <input id="search-text" name="@search_text" size="10"/> @@ -53,23 +64,29 @@ <span tal:condition="python:request.user.hasPermission('Create', 'issue')"> <a href="issue?@template=item" i18n:translate="">Create New</a><br> </span> - <a tal:attributes="href python:request.indexargs_url('issue', { + <a href="#" + tal:define="txt python:i18n.gettext('Show Unassigned')" + tal:attributes="href python:request.indexargs_url('issue', { '@sort': '-activity', '@group': 'priority', '@filter': 'status,assignedto', - '@columns': 'id,activity,title,creator,status', - 'status': '-1,1,2,3,4,5,6,7', + '@columns': columns, + 'status': status_notresolved, 'assignedto': '-1', - '@dispname': i18n.gettext('Show Unassigned'), - })" i18n:translate="">Show Unassigned</a><br> - <a tal:attributes="href python:request.indexargs_url('issue', { + '@dispname': txt, + })" + tal:content="txt">Show Unassigned</a><br> + <a href="#" + tal:define="txt python:i18n.gettext('Show All')" + tal:attributes="href python:request.indexargs_url('issue', { '@sort': '-activity', '@group': 'priority', '@filter': 'status', - '@columns': 'id,activity,title,creator,assignedto,status', - 'status': '-1,1,2,3,4,5,6,7', - '@dispname': i18n.gettext('Show All'), - })" i18n:translate="">Show All</a><br> + '@columns': columns_showall, + 'status': status_notresolved, + '@dispname': txt, + })" + tal:content="txt">Show All</a><br> <a href="issue?@template=search" i18n:translate="">Search</a><br> <input type="submit" class="form-small" value="Show issue:" i18n:attributes="value"><input class="form-small" size="4" @@ -80,14 +97,12 @@ </form> <p class="classblock" - tal:condition="python:request.user.hasPermission('Edit', 'keyword') - or request.user.hasPermission('Create', 'keyword')"> + tal:condition="python:kw_edit or kw_create"> <b i18n:translate="">Keywords</b><br> <span tal:condition="python:request.user.hasPermission('Create', 'keyword')"> <a href="keyword?@template=item" i18n:translate="">Create New</a><br> </span> - <span tal:condition="python:db.keyword.list() and - request.user.hasPermission('Edit', 'keyword')"> + <span tal:condition="kw_edit_link"> <a href="keyword?@template=item" i18n:translate="">Edit Existing</a><br> </span> </p> @@ -172,15 +187,27 @@ See issue.search.html in the classic template for examples. --> + +<!-- creates a th and a label: --> +<th metal:define-macro="th_label" + tal:define="required required | python:[]" + tal:attributes="class python:(name in required) and 'required' or nothing"> + <label tal:attributes="for name" tal:content="label" i18n:translate="">text</label> + <metal:x define-slot="behind_the_label" /> +</th> + <td metal:define-macro="search_input"> <input tal:attributes="value python:request.form.getvalue(name) or nothing; - name name"> + name name; + id name"> </td> <td metal:define-macro="search_date"> <input tal:attributes="value python:request.form.getvalue(name) or nothing; - name name"> - <a class="classhelp" tal:attributes="href python:'''javascript:help_window('issue?@template=calendar&property=%s&form=itemSynopsis', 300, 200)'''%name">(cal)</a> + name name; + id name"> + <a class="classhelp" + tal:attributes="href python:'''javascript:help_window('issue?@template=calendar&property=%s&form=itemSynopsis', 300, 200)'''%name">(cal)</a> </td> <td metal:define-macro="search_popup"> @@ -189,26 +216,55 @@ string (eg. "id,title" or "id,name,description") as well as name --> <input tal:attributes="value python:request.form.getvalue(name) or nothing; - name name"> + name name; + id name"> <span tal:replace="structure python:db.issue.classhelp(columns, property=name)" /> </td> <td metal:define-macro="search_select"> - <select tal:attributes="name name" + <select tal:attributes="name name; id name" tal:define="value python:request.form.getvalue(name)"> <option value="" i18n:translate="">don't care</option> - <tal:block metal:define-slot="extra_options"></tal:block> - <option value="" i18n:translate="">------------</option> + <metal:slot define-slot="extra_options" /> + <option value="" i18n:translate="" disabled="disabled">------------</option> <option tal:repeat="s python:db[db_klass].list()" tal:attributes="value s/id; selected python:value == s.id" tal:content="python:s[db_content]"></option> </select> </td> +<!-- like search_select, but translates the further values. +Could extend it (METAL 1.1 attribute "extend-macro") +--> +<td metal:define-macro="search_select_translated"> + <select tal:attributes="name name; id name" + tal:define="value python:request.form.getvalue(name)"> + <option value="" i18n:translate="">don't care</option> + <metal:slot define-slot="extra_options" /> + <option value="" i18n:translate="" disabled="disabled">------------</option> + <option tal:repeat="s python:db[db_klass].list()" + tal:attributes="value s/id; selected python:value == s.id" + tal:content="python:s[db_content]" + i18n:translate=""></option> + </select> +</td> + +<!-- currently, there is no convenient API to get a list of all roles --> +<td metal:define-macro="search_select_roles"> + <select name=roles id=roles> + <option value="" i18n:translate="">don't care</option> + <option value="" i18n:translate="" disabled="disabled">------------</option> + <option value="User">User</option> + <option value="Admin">Admin</option> + <option value="Anonymous">Anonymous</option> + </select> +</td> + <td metal:define-macro="search_multiselect"> <input tal:attributes="value python:request.form.getvalue(name) or nothing; - name name"> + name name; + id name"> <span tal:replace="structure python:db[db_klass].classhelp(db_content, property=name, width='600')" /> </td> @@ -249,3 +305,27 @@ checked python:name == group_on"> </td> +<!-- +The following macros are intended for user editing. + +The invoking context must define a "name" variable which names the +property being searched; the "edit_ok" variable tells whether the +current user is allowed to edit. + +See user.item.html in the classic template for examples. +--> +<script metal:define-macro="user_utils" type="text/javascript" src="@@file/user_utils.js"></script> + +<!-- src: value will be re-used for other input fields --> +<input metal:define-macro="user_src_input" + type="text" tal:attributes="onblur python:edit_ok and 'split_name(this)'; + id name; name name; value value; readonly not:edit_ok" + value="heinz.kunz"> +<!-- normal: no re-using --> +<input metal:define-macro="user_normal_input" type="text" + tal:attributes="id name; name name; value value; readonly not:edit_ok" + value="heinz"> +<!-- password: type; no initial value --> + <input metal:define-macro="user_pw_input" type="password" + tal:attributes="id name; name name; readonly not:edit_ok" value=""> +
