Implemented resource creation.

This commit is contained in:
Thomas Keller
2011-11-15 20:31:39 +01:00
parent f29348c604
commit b2e25fc501
13 changed files with 391 additions and 73 deletions

View File

@@ -3,10 +3,18 @@
{block subtabs}
<div id="sub-tabs">
<a {if $inPageList}class="active" {/if}href="{url 'IDF_Views_Wiki::listPages', array($project.shortname)}">{trans 'List Pages'}</a>
{if !$user.isAnonymous()} | <a {if $inCreate}class="active" {/if}href="{url 'IDF_Views_Wiki::createPage', array($project.shortname)}">{trans 'New Page'}</a> {/if}
{if !$user.isAnonymous() and $inPageView} | <a href="{url 'IDF_Views_Wiki::updatePage', array($project.shortname, $page.title)}">{trans 'Update This Page'}</a> {/if}
|
<form class="star" action="{url 'IDF_Views_Wiki::search', array($project.shortname)}" method="get">
{if !$user.isAnonymous()}
| <a {if $inResourceList}class="active" {/if}href="{url 'IDF_Views_Wiki::listResources', array($project.shortname)}">{trans 'List Resources'}</a>
| <a {if $inCreatePage}class="active" {/if}href="{url 'IDF_Views_Wiki::createPage', array($project.shortname)}">{trans 'New Page'}</a>
| <a {if $inCreateResource}class="active" {/if}href="{url 'IDF_Views_Wiki::createResource', array($project.shortname)}">{trans 'New Resource'}</a>
{if $inPageView}
| <a href="{url 'IDF_Views_Wiki::updatePage', array($project.shortname, $page.title)}">{trans 'Update This Page'}</a>
{/if}
{if $inResourceView}
| <a href="{url 'IDF_Views_Wiki::updateResource', array($project.shortname, $resource.title)}">{trans 'Update This Resource'}</a>
{/if}
{/if}
| <form class="star" action="{url 'IDF_Views_Wiki::search', array($project.shortname)}" method="get">
<input accesskey="4" type="text" value="{$q}" name="q" size="20" />
<input type="submit" name="s" value="{trans 'Search'}" />
</form>

View File

@@ -1,5 +1,5 @@
{extends "idf/wiki/base.html"}
{block docclass}yui-t1{assign $inCreate = true}{/block}
{block docclass}yui-t1{assign $inCreatePage = true}{/block}
{block body}
{if $preview}

View File

@@ -0,0 +1,56 @@
{extends "idf/wiki/base.html"}
{block docclass}yui-t1{assign $inCreateResource = true}{/block}
{block body}
{if $form.errors}
<div class="px-message-error">
<p>{trans 'The form contains some errors. Please correct them to create the page.'}</p>
{if $form.get_top_errors}
{$form.render_top_errors|unsafe}
{/if}
</div>
{/if}
<form method="post" enctype="multipart/form-data" action="." >
<table class="form" summary="">
<tr>
<th><strong>{$form.f.title.labelTag}:</strong></th>
<td>{if $form.f.title.errors}{$form.f.title.fieldErrors}{/if}
{$form.f.title|unsafe}<br />
<span class="helptext">{$form.f.title.help_text}</span>
</td>
</tr>
<tr>
<th><strong>{$form.f.summary.labelTag}:</strong></th>
<td>{if $form.f.summary.errors}{$form.f.summary.fieldErrors}{/if}
{$form.f.summary|unsafe}<br />
<span class="helptext">{$form.f.summary.help_text}</span>
</td>
</tr>
<tr>
<th><strong>{$form.f.file.labelTag}:</strong></th>
<td>{if $form.f.file.errors}{$form.f.file.fieldErrors}{/if}
{$form.f.file|unsafe}
</td>
</tr>
<td>&nbsp;</td>
<td><input type="submit" value="{trans 'Create Resource'}" name="submit" /> | <a href="{url 'IDF_Views_Wiki::listResources', array($project.shortname)}">{trans 'Cancel'}</a>
</td>
</tr>
</table>
</form>
{/block}
{block context}
<div class="issue-submit-info">
{blocktrans}
Wiki resources are later addressed in wiki pages by their title, so ensure that you
give your resource a unique and an easy to remember name.
{/blocktrans}
</div>
{/block}
{block javascript}
<script type="text/javascript">
document.getElementById('id_title').focus()
</script>
{/block}

View File

@@ -0,0 +1,12 @@
{extends "idf/wiki/base.html"}
{block docclass}yui-t1{assign $inResourceList=true}{/block}
{block body}
{$resources.render}
{aurl 'url', 'IDF_Views_Wiki::createResource', array($project.shortname)}
<p><a href="{$url}"><img style="vertical-align: text-bottom;" src="{media '/idf/img/add.png'}" alt="+" align="bottom" /></a> <a href="{$url}">{trans 'New Resource'}</a></p>
{/block}
{block context}
<p><strong>{trans 'Number of resources:'}</strong> {$resources.nb_items}</p>
{/block}