Fixed issue 131, added ability to preview before submitting an issue.
This commit is contained in:
parent
7cc5a2dc58
commit
8da821eef4
@ -142,11 +142,13 @@ class IDF_Views_Issue
|
||||
$params = array(
|
||||
'project' => $prj,
|
||||
'user' => $request->user);
|
||||
$preview = (isset($request->POST['preview'])) ?
|
||||
$request->POST['content'] : false;
|
||||
if ($request->method == 'POST') {
|
||||
$form = new IDF_Form_IssueCreate(array_merge($request->POST,
|
||||
$request->FILES),
|
||||
$params);
|
||||
if ($form->isValid()) {
|
||||
if (!isset($request->POST['preview']) and $form->isValid()) {
|
||||
$issue = $form->save();
|
||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Issue::index',
|
||||
array($prj->shortname));
|
||||
@ -187,6 +189,7 @@ class IDF_Views_Issue
|
||||
array('project' => $prj,
|
||||
'form' => $form,
|
||||
'page_title' => $title,
|
||||
'preview' => $preview,
|
||||
),
|
||||
self::autoCompleteArrays($prj)
|
||||
);
|
||||
@ -252,6 +255,8 @@ class IDF_Views_Issue
|
||||
$starred = false;
|
||||
$closed = in_array($issue->status, $prj->getTagIdsByStatus('closed'));
|
||||
$interested = $issue->get_interested_list();
|
||||
$preview = (isset($request->POST['preview'])) ?
|
||||
$request->POST['content'] : false;
|
||||
if (!$request->user->isAnonymous()) {
|
||||
$starred = Pluf_Model_InArray($request->user, $issue->get_interested_list());
|
||||
$params = array(
|
||||
@ -263,7 +268,7 @@ class IDF_Views_Issue
|
||||
$form = new IDF_Form_IssueUpdate(array_merge($request->POST,
|
||||
$request->FILES),
|
||||
$params);
|
||||
if ($form->isValid()) {
|
||||
if (!isset($request->POST['preview']) && $form->isValid()) {
|
||||
$issue = $form->save();
|
||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Issue::index',
|
||||
array($prj->shortname));
|
||||
@ -324,6 +329,7 @@ class IDF_Views_Issue
|
||||
'starred' => $starred,
|
||||
'page_title' => $title,
|
||||
'closed' => $closed,
|
||||
'preview' => $preview,
|
||||
'interested' =>$interested->count(),
|
||||
),
|
||||
$arrays),
|
||||
|
@ -10,6 +10,14 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{if $preview}
|
||||
<h2 class="top">{trans 'Preview'}</h2>
|
||||
<div class="issue-comment issue-comment-first issue-comment-last">
|
||||
<br /><pre class="issue-comment-text">{issuetext $preview, $request}</pre>
|
||||
</div>
|
||||
<hr />
|
||||
{/if}
|
||||
|
||||
<form method="post" enctype="multipart/form-data" action="{url 'IDF_Views_Issue::create', array($project.shortname)}" >
|
||||
<table class="form" summary="">
|
||||
<tr>
|
||||
@ -67,7 +75,10 @@
|
||||
</tr>{/if}
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td><input type="submit" value="{trans 'Submit Issue'}" name="submit" /> | <a href="{url 'IDF_Views_Issue::index', array($project.shortname)}">{trans 'Cancel'}</a>
|
||||
<td>
|
||||
<input type="submit" value="{trans 'Submit Issue'}" name="submit" />
|
||||
<input type="submit" value="{trans 'Preview'}" name="preview" /> |
|
||||
<a href="{url 'IDF_Views_Issue::index', array($project.shortname)}">{trans 'Cancel'}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -50,8 +50,16 @@
|
||||
|
||||
{if $closed and (!$isOwner and !$isMember)}
|
||||
<p><img src="{media '/idf/img/warning.png'}" style="vertical-align: text-bottom;" alt=" " /> {blocktrans}This issue is marked as closed, add a comment only if you think this issue is still valid and more work is needed to fully fix it.{/blocktrans}</p>
|
||||
|
||||
{/if}
|
||||
|
||||
{if $preview}
|
||||
<h2>{trans 'Preview'}</h2>
|
||||
<div class="issue-comment issue-comment-first issue-comment-last">
|
||||
<br /><pre class="issue-comment-text">{issuetext $preview, $request}</pre>
|
||||
</div>
|
||||
<hr />
|
||||
{/if}
|
||||
|
||||
<form method="post" enctype="multipart/form-data" action="{url 'IDF_Views_Issue::view', array($project.shortname, $issue.id)}" >
|
||||
<table class="form" summary="">
|
||||
<tr>
|
||||
@ -109,7 +117,10 @@
|
||||
</tr>{/if}
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td><input type="submit" value="{trans 'Submit Changes'}" name="submit" /> | <a href="{url 'IDF_Views_Issue::view', array($project.shortname, $issue.id)}">{trans 'Cancel'}</a>
|
||||
<td>
|
||||
<input type="submit" value="{trans 'Submit Changes'}" name="submit" />
|
||||
<input type="submit" value="{trans 'Preview'}" name="preview" /> |
|
||||
<a href="{url 'IDF_Views_Issue::view', array($project.shortname, $issue.id)}">{trans 'Cancel'}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
Loading…
Reference in New Issue
Block a user