Skip to content

Commit

Permalink
[2375] Add the markup for the "Create a dataset" form
Browse files Browse the repository at this point in the history
  • Loading branch information
aron committed May 23, 2012
1 parent d2aa95a commit 926d489
Showing 1 changed file with 129 additions and 0 deletions.
129 changes: 129 additions & 0 deletions ckan/templates/package/new.html
@@ -0,0 +1,129 @@
<!DOCTYPE html>
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:i18n="http://genshi.edgewall.org/i18n"
xmlns:py="http://genshi.edgewall.org/"
xmlns:xi="http://www.w3.org/2001/XInclude">
<!--! Include matchers nearest first -->
<xi:include href="../page.html" />

<!--! Now include the current page -->
<head>
<title>Create a dataset</title>
</head>
<body>
<div class="toolbar">
<ol class="breadcrumb">
<li>${h.nav_link(_('Datasets'), controller='package', action='search', highlight_actions = 'new index')}</li>
<li class="active">${h.nav_link(_('Create Dataset'), controller='package', action='new')}</li>
</ol>
</div>

<div class="primary">
<section class="module">
<div class="content">
<div class="stages">
<ol>
<li class="active"><a href="">Create dataset</a></li>
<li>Add data</li>
<li>Additional data</li>
</ol>
</div>
<form class="dataset-form form-horizontal" method="post" py:with="errors = {}; data = {};">
<div class="alert alert-error error-explanation" py:if="False and error_summary">
<h2>Errors in form</h2>
<p>The form contains invalid entries:</p>
<ul>
<li py:for="key, error in error_summary.items()">${"%s: %s" % (key if not key=='Name' else 'URL', error)}</li>
</ul>
</div>
<div class="control-group" py:with="error = errors.get('title', '')">
<label class="control-label" for="field-title">Title</label>
<div class="controls">
<input id="field-title" name="title" value="${data.get('title', '')}" placeholder="${_('A descriptive title')}" />
<span class="error-block" py:if="error">${error}</span>
</div>
</div>

<div class="control-group" py:with="error = errors.get('name', '')">
<label class="control-label" for="field-name">URL</label>
<div class="controls">
<input id="field-name" name="name" value="${data.get('name', '')}" placeholder="${_('my-dataset')}" />
<span class="error-block" py:if="error">${error}</span>
</div>
</div>

<div class="control-group" py:with="error = errors.get('notes', '')">
<label class="control-label" for="field-notes">Description</label>
<div class="controls editor">
<textarea id="field-notes" name="notes" cols="20" rows="5"></textarea>
<span class="info-block">You can use <a href="http://daringfireball.net/projects/markdown/syntax">Markdown</a> editing here</span>
<span class="error-block" py:if="error">${error}</span>
</div>
</div>

<div class="control-group" py:with="error = errors.get('license_id', '')">
<label class="control-label" for="field-license">License</label>
<div class="controls">
<select id="field-license" name="license_id">
<py:for each="licence_desc, licence_id in c.licences">
<option value="${licence_id}" py:attrs="{'selected': 'selected' if data.get('license_id', '') == licence_id else None}" py:if="licence_desc">${licence_desc}</option>
</py:for>
</select>
<span class="error-block" py:if="error">${error}</span>
<span class="info-block">Don't worry if you don't know which license the data has been released under</span>
</div>
</div>

<div class="control-group" py:if="c.groups_available" py:with="groups = data.get('groups',[])">
<label for="field-groups" class="control-label">Add to Groups</label>
<div class="controls">
<select id="field-groups" name="groups__${len(groups)}__id">
<option selected="selected" value="">Select a group...</option>
<py:for each="group in c.groups_available">
<option value="${group['id']}" >${group['name']}</option>
</py:for>
</select>
</div>

<div class="control-group" py:if="len(data.get('groups', []))" py:with="groups = data.get('groups',[])">
<label for="groups__0__id" class="control-label">Member of Groups</label>
<div class="controls">
<py:for each="num, group in enumerate(groups)">
<?python
authorized_group = [group_authz for group_authz in c.groups_authz if group_authz['id'] == group['id']]
authorized_group = authorized_group[0] if authorized_group else None
?>
<div class="checkbox" py:if="'id' in group">
<label for="groups__${num}__checked">
<input type="${'checkbox' if authorized_group else 'hidden'}" name="groups__${num}__id" checked="checked" value="${group['id']}"/>
${group.get('name', authorized_group['name'] if authorized_group else '')}
</label>
<input type="hidden" name="groups__${num}__name" value="${group.get('name', authorized_group['name'] if authorized_group else '')}" />
</div>
</py:for>
</div>
</div>
</div>

<div class="form-actions">
<a class="btn" href="">Cancel</a>
<button class="btn btn-primary" type="submit">Next: Add Data</button>
</div>
</form>
</div>
</section>
</div>

<div class="secondary">
<section class="module">
<h2 class="heading"><i class="ckan-icon ckan-icon-info"></i> What are datasets?</h2>
<div class="content">
<p>Datasets are simply used to group related pieces of data. These
can then be found under a single url with a description and
licensing information.</p>
</div>
</section>
</div>
</body>
</html>

0 comments on commit 926d489

Please sign in to comment.