view templates/classic/html/query.edit.html @ 3696:790363e96852

Sorting/grouping by multiple properties. - Implement sorting/grouping by multiple properties for the web interface. I'm now using @sort0/@sortdir0,@sort1/@sortdir1,... and @group0/@groupdir0,... when generating URLs from a search template. These are converted to a list internally. When saving URLs (e.g. when storing queries) I'm using @sort=prop1,prop2,... and @group=... with optional '-' prepended to individual props. This means saved URLs are backward compatible with existing trackers (and yes, this was a design goal). I need the clumsy version with @sort0,@sort1 etc, because I'm currently using several selectors and checkboxes (as the classic template does, too). I don't think there is a way around that in HTML? - Updated (hopefully all) documentation to reflect the new URL format and the consequences in the web-interface. - I've set the number of sort/group properties in the classic template to two -- this can easily be reverted by changing n_sort to 1. Richard, would you look over these changes? I've set a tag before and (will set) after commit, so that it would be easy to merge out. Don't be too scared about the size of the change, most is documentation, the guts are in cgi/templating.py and small changes in the classic template.
author Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
date Wed, 30 Aug 2006 20:28:26 +0000
parents 7fb8cfe3c737
children 00896a2acaa5
line wrap: on
line source

<!-- dollarId: user.item,v 1.7 2002/08/16 04:29:04 richard Exp dollar-->
<tal:block metal:use-macro="templates/page/macros/icing">
<title metal:fill-slot="head_title" i18n:translate=""
 >"Your Queries" Editing - <span tal:replace="config/TRACKER_NAME"
 i18n:name="tracker" /></title>
<span metal:fill-slot="body_title" tal:omit-tag="python:1"
 i18n:translate="">"Your Queries" Editing</span>

<td class="content" metal:fill-slot="content">

<span tal:condition="not:context/is_edit_ok"
 i18n:translate="">You are not allowed to edit queries.</span>

<script language="javascript">
// This exists solely because I can't figure how to get the & into an
// attributes TALES expression, and so it keeps getting quoted.
function retire(qid) {
    window.location = 'query'+qid+'?@action=retire&@template=edit';
}
</script>

<form method="POST" onSubmit="return submit_once()" action="query"
      enctype="multipart/form-data" tal:condition="context/is_edit_ok">

<table class="list" width="100%"
       tal:define="uid request/user/id; mine request/user/queries">

<tr><th i18n:translate="">Query</th>
    <th i18n:translate="">Include in "Your Queries"</th>
    <th i18n:translate="">Edit</th>
    <th i18n:translate="">Private to you?</th>
    <th>&nbsp;</th>
</tr>

<tr tal:repeat="query mine">
 <tal:block condition="query/is_retired">

 <td><a tal:attributes="href string:${query/klass}?${query/url}"
        tal:content="query/name">query</a></td>

 <td metal:define-macro="include">
  <select tal:condition="python:query.id not in mine"
          tal:attributes="name string:user${uid}@add@queries">
    <option value="" i18n:translate="">leave out</option>
    <option tal:attributes="value query/id" i18n:translate="">include</option>
  </select>
  <select tal:condition="python:query.id in mine"
          tal:attributes="name string:user${uid}@remove@queries">
    <option value="" i18n:translate="">leave in</option>
    <option tal:attributes="value query/id" i18n:translate="">remove</option>
  </select>
 </td>

 <td colspan="3" i18n:translate="">[query is retired]</td>

 <!-- <td> maybe offer "restore" some day </td> -->
 </tal:block>
</tr>

<tr tal:define="queries python:db.query.filter(filterspec={'private_for':uid})"
     tal:repeat="query queries">
 <td><a tal:attributes="href string:${query/klass}?${query/url}"
        tal:content="query/name">query</a></td>

 <td metal:use-macro="template/macros/include" />

 <td><a tal:attributes="href string:query${query/id}" i18n:translate="">edit</a></td>

 <td>
  <select tal:attributes="name string:query${query/id}@private_for">
   <option tal:attributes="selected python:query.private_for == uid;
           value uid" i18n:translate="">yes</option>
   <option tal:attributes="selected python:query.private_for == None"
           value="-1" i18n:translate="">no</option>
  </select>
 </td>

 <td>
  <input type="button" value="Delete" i18n:attributes="value"
  tal:attributes="onClick python:'''retire('%s')'''%query.id">
  </td>
</tr>

<tr tal:define="queries python:db.query.filter(filterspec={'private_for':None})"
     tal:repeat="query queries">
 <td><a tal:attributes="href string:${query/klass}?${query/url}"
        tal:content="query/name">query</a></td>

 <td metal:use-macro="template/macros/include" />

 <td colspan="3" tal:condition="query/is_edit_ok">
  <a tal:attributes="href string:query${query/id}" i18n:translate="">edit</a>
 </td>
 <td tal:condition="not:query/is_edit_ok" colspan="3"
    i18n:translate="">[not yours to edit]</td>

</tr>

<tr><td colspan="5">
   <input type="hidden" name="@action" value="edit">
   <input type="hidden" name="@template" value="edit">
   <input type="submit" value="Save Selection" i18n:attributes="value">
</td></tr>

</table>

</form>
</td>
</tal:block>

Roundup Issue Tracker: http://roundup-tracker.org/