changeset 55:018599af92f5

Cleanup HTML markup.
author Daniele Nicolodi <daniele@grinta.net>
date Sat, 13 Aug 2011 20:27:24 +0200
parents 99db71455ec2
children fc907b00604a
files src/ltpdarepo/templates/database.html src/ltpdarepo/templates/databases/drop.html src/ltpdarepo/templates/databases/index.html src/ltpdarepo/templates/databases/permissions.html src/ltpdarepo/templates/databases/view.html src/ltpdarepo/templates/forms.html src/ltpdarepo/templates/index.html src/ltpdarepo/templates/obj.html src/ltpdarepo/templates/objs.html src/ltpdarepo/templates/query.html src/ltpdarepo/templates/users/drop.html src/ltpdarepo/templates/users/index.html src/ltpdarepo/templates/users/view.html
diffstat 13 files changed, 87 insertions(+), 120 deletions(-) [+]
line wrap: on
line diff
--- a/src/ltpdarepo/templates/database.html	Sat Aug 13 20:27:24 2011 +0200
+++ b/src/ltpdarepo/templates/database.html	Sat Aug 13 20:27:24 2011 +0200
@@ -9,21 +9,18 @@
   <li><a href="{{ url_for('browse.query', database=database.id) }}">Advanced search</a></li>
   <li><a href="{{ url_for('browse.timeseries', database=database.id) }}">Timeseries search</a></li>
 </ul>
-<h2>Search database &laquo;{{ database.id }}&raquo;</h2>
-<p class="discrete">Search objects by name</p>
-<div class="wrapper">
-  <div class="search wrapper">  
-    <form method="GET" action="{{ url_for('browse.search', database=database.id) }}">
-      <div class="left"><input type="text" name="q"></input></div>
-      <div class="right"><input type="submit" value="&raquo;"></input></div>
-    </form>
-  </div>
-</div>
+<h2>Quick search</h2>
+<p class="discrete">Search objects by name:</p>
+<form method="GET" action="{{ url_for('browse.search', database=database.id) }}" class="search">
+  <input type="text" name="q"></input>
+  <input type="submit" value="search"></input>
+</form>
 {% if queries %}
-<p class="discrete">Saved queries</p>
+<h2>Saved queries</h2>
+<p class="discrete">Saved queries:</p>
 <ol>
-  {% for query in queries %}
-  <li><a href="{{ url_for('browse.query', database=database.id, name=query) }}">{{ query }}</a></li>
+  {% for name in queries %}
+  <li><a href="{{ url_for('browse.query', database=database.id, name=name) }}">{{ name }}</a></li>
   {% endfor %}
 </ol>
 {% endif %}
--- a/src/ltpdarepo/templates/databases/drop.html	Sat Aug 13 20:27:24 2011 +0200
+++ b/src/ltpdarepo/templates/databases/drop.html	Sat Aug 13 20:27:24 2011 +0200
@@ -1,5 +1,6 @@
 {% import 'forms.html' as forms %}
 {% extends "layout.html" %}
+{% block title %}{{ database.id }}{% endblock %}
 {% block body %}
 <h2>Drop database &#x00AB;{{ database.id }}&#x00BB;</h2>
 <p class="discrete">
@@ -7,15 +8,10 @@
   All contained data will be permanently lost.
 </p>
 <form action="" method="post" enctype="multipart/form-data" >
-<fieldset>
-{% for field in form %}
-{{ forms.render_form_field(field) }}
-{% endfor %}
-<div class="field">
-<div class="widget submit"><input id="ok" name="ok" type="submit" value="Ok" /></div>
-</div>
-<div class="widget submit"><input id="cancel" name="cancel" type="submit" value="Cancel" /></div>
-</div>
-</fieldset>
+  <fieldset>
+    {% for field in form %}{{ forms.render_form_field(field) }}{% endfor %}
+    <input id="ok" name="ok" type="submit" value="ok"></input>
+    <input id="cancel" name="cancel" type="submit" value="cancel"></input>
+  </fieldset>
 </form>
 {% endblock %}
--- a/src/ltpdarepo/templates/databases/index.html	Sat Aug 13 20:27:24 2011 +0200
+++ b/src/ltpdarepo/templates/databases/index.html	Sat Aug 13 20:27:24 2011 +0200
@@ -8,8 +8,7 @@
   <li><a href="{{ url_for('manage.databases.view', database=db.id) }}">{{ db.id }}</a></li>
 {% endfor %}
 </ul>
-<h2>Actions</h2>
-<ul>
-<li><a href="{{ url_for('manage.databases.create') }}">Create new database</a></li>
+<ul class="actions">
+  <li><a href="{{ url_for('manage.databases.create') }}">Create database</a></li>
 </ul>
 {% endblock %}
--- a/src/ltpdarepo/templates/databases/permissions.html	Sat Aug 13 20:27:24 2011 +0200
+++ b/src/ltpdarepo/templates/databases/permissions.html	Sat Aug 13 20:27:24 2011 +0200
@@ -2,30 +2,27 @@
 {% block body %}
 <h2>Permissions for database &#x00AB;{{ database }}&#x00BB;</h2>
 <form action="" method="post">
-<table>
-  <tr>
-    <th>User</th>
-    <th>Select</th>
-    <th>Insert</th>
-    <th>Update</th>
-    <th>Delete</th>
-  </tr>
-  {% for user, priv in permissions.items() %}
-  <tr>
-    <td><input type="hidden" name="{{ user }}" value=""></input>
-      {{ user }}</td>
-    <td><input type="checkbox" name="{{user}}:select" value="Y"
-      {% if priv['select'] %} checked="1" {% endif %}></td>
-    <td><input type="checkbox" name="{{user}}:insert" value="Y"
-      {% if priv['insert'] %} checked="1" {% endif %}></td>
-    <td><input type="checkbox" name="{{user}}:update" value="Y"
-      {% if priv['update'] %} checked="1" {% endif %}></td>
-    <td><input type="checkbox" name="{{user}}:delete" value="Y"
-      {% if priv['delete'] %} checked="1" {% endif %}></td>
-  </tr>
-  {% endfor %}
-</table>
-<input id="submit" type="submit" value="Submit"></intput>
-<!-- <input id="cancel" type="submit" value="Cancel"></intput> -->
+  <table class="permissions">
+    <tr>
+      <th></th>
+      <th>select</th>
+      <th>insert</th>
+      <th>update</th>
+      <th>delete</th>
+    </tr>
+    {% for user, priv in permissions.iteritems() %}
+    <tr>
+      <td>
+        <a href="{{ url_for('manage.users.view', username=user) }}">{{ user }}</a>
+        <input type="hidden" name="{{ user }}" value=""></input>
+      </td>
+      <td><input type="checkbox" name="{{user}}:select" value="Y" {% if priv['select'] %} checked="checked" {% endif %}></td>
+      <td><input type="checkbox" name="{{user}}:insert" value="Y" {% if priv['insert'] %} checked="checked" {% endif %}></td>
+      <td><input type="checkbox" name="{{user}}:update" value="Y" {% if priv['update'] %} checked="checked" {% endif %}></td>
+      <td><input type="checkbox" name="{{user}}:delete" value="Y" {% if priv['delete'] %} checked="checked" {% endif %}></td>
+    </tr>
+    {% endfor %}
+  </table>
+  <input id="submit" type="submit" value="save"></intput>
 </form>
-{% endblock %}
\ No newline at end of file
+{% endblock %}
--- a/src/ltpdarepo/templates/databases/view.html	Sat Aug 13 20:27:24 2011 +0200
+++ b/src/ltpdarepo/templates/databases/view.html	Sat Aug 13 20:27:24 2011 +0200
@@ -4,7 +4,7 @@
 <h2>Database &#x00AB;{{ database.id }}&#x00BB;</h2>
 <p class="field"><span class="label">Name:</span> {{database.name }}</p>
 <p class="field"><span class="label">Description:</span> {{ database.description }}</p>
-<ul>
+<ul class="actions">
   <li><a href="{{ url_for('manage.databases.edit', database=database.id) }}">Edit</a></li>
   <li><a href="{{ url_for('manage.databases.permissions', database=database.id) }}">Permissions</a></li>
   <li><a href="{{ url_for('manage.queries.index', database=database.id) }}">Saved queries</a></li>
--- a/src/ltpdarepo/templates/forms.html	Sat Aug 13 20:27:24 2011 +0200
+++ b/src/ltpdarepo/templates/forms.html	Sat Aug 13 20:27:24 2011 +0200
@@ -1,11 +1,11 @@
 {% macro render(form) -%}
   <form action="{{ form.action }}" method="{{ form.method }}" enctype="multipart/form-data" >
     <fieldset>
-      {% for field in form %}
+      {% for field in form if field.type not in ('SubmitField') %}
         {{ render_form_field(field) }}
       {% endfor %}
       <div class="field">
-        <div class="widget"><input id="submit" name="submit" type="submit" value="Submit" /></div>
+        <div class="widget"><input id="submit" name="submit" type="submit" value="save" /></div>
       </div>
     </fieldset>
   </form>
@@ -14,10 +14,6 @@
 {% macro render_form_field(field) %}
         {% if field.type == "HiddenField" %}
           {{ field }}
-        {% elif field.type == "SubmitField" %}
-          <div class="field">
-            <div class="widget submit">{{ field }}</div>
-          </div>
         {% else %}
           {% if field.errors %}
           <div class="field error">
@@ -42,13 +38,8 @@
       
 {% macro view(form) -%}
       {% for field in form %}
-        {% if field.type == "HiddenField" %}
-        {% elif field.type == "SubmitField" %}
-        {% elif field.type == "PasswordField" %}
-        {% else %}
+        {% if field.type not in ('HiddenField', 'SubmitField', 'PasswordField') %}
           <p class="field"><span class="label">{{ field.label }}:</span> {{ field.data }}</p>
         {% endif %}
       {% endfor %}
-    </fieldset>
-  </form>
 {%- endmacro %}
--- a/src/ltpdarepo/templates/index.html	Sat Aug 13 20:27:24 2011 +0200
+++ b/src/ltpdarepo/templates/index.html	Sat Aug 13 20:27:24 2011 +0200
@@ -11,7 +11,7 @@
   {% if 'admin' in g.identity.roles %}
   <h2>Manage</h2>
   <p class="discrete">LTPDA Repository management interface:</p>
-  <ul>
+  <ul class="actions">
     <li><a href="{{ url_for('manage.databases.index') }}">Databases</a></li>
     <li><a href="{{ url_for('manage.databases.create') }}">Create database</a></li>
     <li><a href="{{ url_for('manage.users.index') }}">Users</a></li>
--- a/src/ltpdarepo/templates/obj.html	Sat Aug 13 20:27:24 2011 +0200
+++ b/src/ltpdarepo/templates/obj.html	Sat Aug 13 20:27:24 2011 +0200
@@ -1,10 +1,10 @@
 {% extends "layout.html" %}
-{% block title %}{{ dbname }}{% endblock %}
+{% block title %}{{ obj.name }}{% endblock %}
 {% block body %}
-<h2>{{ database.id }} - {{ obj.name }}</h2>
-<table class="listing obj">
+<h2>Database &laquo;{{ database.id }}&raquo; object &laquo;{{ obj.name }}&raquo;</h2>
+<table class="obj">
   {% for field in fields %}
-  <tr><th>{{ field }}:</th><td>{{ obj[field] }}</td></tr>
+  <tr><th id="{{ field }}">{{ field }}:</th><td>{{ obj[field] }}</td></tr>
   {% endfor %}
   <tr><th>xml:</th><td><a href="{{ url_for('browse.download', frmt='xml', database=database.id, objid=obj.id) }}">download</a></td></tr>
   <tr><th>binary:</th><td><a href="{{ url_for('browse.download', frmt='mat', database=database.id, objid=obj.id) }}">download</a></td></tr>
--- a/src/ltpdarepo/templates/objs.html	Sat Aug 13 20:27:24 2011 +0200
+++ b/src/ltpdarepo/templates/objs.html	Sat Aug 13 20:27:24 2011 +0200
@@ -3,14 +3,12 @@
 {% block title %}{{ database.id }}{% endblock %}
 {% block body %}
 <h2>Database &#x00AB;{{ database.id }}&#x00BB;</h2>
-<p class="discrete small">{{ database.description|default('&nbsp;'|safe, true) }}</p>
+<p class="discrete">{{ database.description|default('&nbsp;'|safe, true) }}</p>
 
 {% block above %}{% endblock %}
 
-<p class="discrete small">{{ batch.count }} objects</p>
-{% if pagination is defined %}
-  {{ pagination.render(batch) }}
-{% endif %}
+<p class="discrete">{{ batch.count }} objects</p>
+{{ pagination.render(batch) }}
 <table class="listing">
   <thead>
     <tr>
@@ -38,15 +36,10 @@
       {% endif %}
       {% endfor %}
     </tr>
-    <tr class="details" id="{{ loop.index }}">
-      <td colspan="{{ fields|length }}" style="text-align: left;">details</td>
-    </tr>
     {% endfor %}
   </tbody>
 </table>
-{% if pagination is defined %}
-  {{ pagination.render(batch) }}
-{% endif %}
+{{ pagination.render(batch) }}
 
 {% block below %}{% endblock %}
 
--- a/src/ltpdarepo/templates/query.html	Sat Aug 13 20:27:24 2011 +0200
+++ b/src/ltpdarepo/templates/query.html	Sat Aug 13 20:27:24 2011 +0200
@@ -10,7 +10,8 @@
 
 {% block above %}
 <div class="query wrapper">
-  <form method="GET" action="{{ url_for('browse.query', database=database.id) }}">
+  <form method="GET" action="">
+    {% block extra %}{% endblock %}
     <div id="criteria" class="wrapper">
       {% for field, op, value in query %}
       <div class="criteria wrapper">
@@ -19,9 +20,9 @@
         <select class="querywidget operator" name="operator">
           {% for name in criteria[field]['operators'] %}
           {% if op == name %}
-          <option name="{{ name }}" selected="selected">{{ name }}</option>
+          <option value="{{ name }}" selected="selected">{{ name }}</option>
           {% else %}
-          <option name="{{ name }}">{{ name }}</option>
+          <option value="{{ name }}">{{ name }}</option>
           {% endif %}
           {% endfor %}
         </select>
@@ -29,9 +30,9 @@
         <select class="querywidget value" name="value">
           {% for name in criteria[field]['values'] %}
           {% if value == name %}
-          <option name="{{ name }}" selected="selected">{{ name }}</option>
+          <option value="{{ name }}" selected="selected">{{ name }}</option>
           {% else %}
-          <option name="{{ name }}">{{ name }}</option>
+          <option value="{{ name }}">{{ name }}</option>
           {% endif %}
           {% endfor %}
         </select>
@@ -43,18 +44,14 @@
       {% endfor %}
     </div>
 
-    <div>
-      <select id="add">
-        <option value="" selected="selected">Add criteria&hellip;</option>
-        {% for c in criteria.values() %}
-        <option value="{{ c['val'] }}">{{ c['name'] }}</option>
-        {% endfor %}
-      </select>
-    </div>
+    <select id="add">
+      <option value="" selected="selected">Add criteria&hellip;</option>
+      {% for c in criteria.values() %}
+      <option value="{{ c['val'] }}">{{ c['name'] }}</option>
+      {% endfor %}
+    </select>
 
-    <div>
-      <input type="submit" value="search" class="search"></input>
-    </div>
+    <input type="submit" value="search" class="search"></input>
 
   </form>
 </div>
--- a/src/ltpdarepo/templates/users/drop.html	Sat Aug 13 20:27:24 2011 +0200
+++ b/src/ltpdarepo/templates/users/drop.html	Sat Aug 13 20:27:24 2011 +0200
@@ -6,15 +6,12 @@
   Are you sure you want to drop this user?
 </p>
 <form action="" method="post" enctype="multipart/form-data" >
-<fieldset>
-{% for field in form %}
-{{ forms.render_form_field(field) }}
-{% endfor %}
-<div class="field">
-<div class="widget submit"><input id="ok" name="ok" type="submit" value="Ok" /></div>
-</div>
-<div class="widget submit"><input id="cancel" name="cancel" type="submit" value="Cancel" /></div>
-</div>
-</fieldset>
+  <fieldset>
+    {% for field in form %}
+    {{ forms.render_form_field(field) }}
+    {% endfor %}
+    <input id="ok" name="ok" type="submit" value="ok"></input>
+    <input id="cancel" name="cancel" type="submit" value="cancel"></input>
+  </fieldset>
 </form>
 {% endblock %}
--- a/src/ltpdarepo/templates/users/index.html	Sat Aug 13 20:27:24 2011 +0200
+++ b/src/ltpdarepo/templates/users/index.html	Sat Aug 13 20:27:24 2011 +0200
@@ -1,18 +1,17 @@
 {% extends "layout.html" %}
 {% block title %} Users {% endblock %}
 {% block body %}
-  <h2>Users</h2>
-  <p class="discrete">Manage user accounts:</p>
-  <ul class="databases">
+<h2>Users</h2>
+<p class="discrete">Manage user accounts:</p>
+<ul class="databases">
   {% for user in users %}
-    <li>
-    <a href="{{ url_for('manage.users.view', username=user.username) }}">{{ user.username }}</a>
-      &mdash; {{ user.name }}
-    </li>
+  <li>
+    <a href="{{ url_for('manage.users.view', username=user.username) }}">
+      {{ user.username }}</a> &mdash; {{ user.name }}
+  </li>
   {% endfor %}
-  </ul>
-  <h2>Actions</h2>
-  <ul>
-    <li><a href="{{ url_for('manage.users.create') }}">Create new user</a></p>
-  </ul>
+</ul>
+<ul class="actions">
+  <li><a href="{{ url_for('manage.users.create') }}">Create new user</a></li>
+</ul>
 {% endblock %}
--- a/src/ltpdarepo/templates/users/view.html	Sat Aug 13 20:27:24 2011 +0200
+++ b/src/ltpdarepo/templates/users/view.html	Sat Aug 13 20:27:24 2011 +0200
@@ -1,9 +1,10 @@
 {% import 'forms.html' as forms %}
 {% extends "layout.html" %}
+{% block title %}User {{ username }}{% endblock %}
 {% block body %}
 <h2>User &#x00AB;{{ username }}&#x00BB;</h2>
 {{ forms.view(form) }}
-<ul>
+<ul class="actions">
   <li><a href="{{ url_for('manage.users.edit', username=username) }}">Edit</a></li>
   <li><a href="{{ url_for('manage.users.drop', username=username) }}">Drop</a></li>
 </ul>