From 9a93acd1a55e168061e2597577e5a0109cd6c738 Mon Sep 17 00:00:00 2001 From: William MARTIN Date: Fri, 1 Apr 2011 14:17:56 +0200 Subject: [PATCH] Update the admin template --- src/IDF/Views/Project.php | 28 ++++++++++++++++++++++++ src/IDF/templates/idf/admin/summary.html | 26 +++++++++++++++++++++- 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/src/IDF/Views/Project.php b/src/IDF/Views/Project.php index 2befafc..03f2f9b 100644 --- a/src/IDF/Views/Project.php +++ b/src/IDF/Views/Project.php @@ -265,6 +265,33 @@ class IDF_Views_Project public $admin_precond = array('IDF_Precondition::projectOwner'); public function admin($request, $match) { + $prj = $request->project; + $title = sprintf(__('%s Project Summary'), (string) $prj); + $extra = array('project' => $prj); + if ($request->method == 'POST') { + $form = new IDF_Form_ProjectConf(array_merge($request->POST, + $request->FILES), + $extra); + if ($form->isValid()) { + $form->save(); + $request->user->setMessage(__('The project has been updated.')); + $url = Pluf_HTTP_URL_urlForView('IDF_Views_Project::admin', + array($prj->shortname)); + return new Pluf_HTTP_Response_Redirect($url); + } + } else { + $form = new IDF_Form_ProjectConf($prj->getData(), $extra); + } + + return Pluf_Shortcuts_RenderToResponse('idf/admin/summary.html', + array( + 'page_title' => $title, + 'form' => $form, + 'project' => $prj, + 'upload_path' => Pluf::f('upload_path'), + ), + $request); +/* $prj = $request->project; $title = sprintf(__('%s Project Summary'), (string) $prj); $form_fields = array('fields'=> array('name', 'shortdesc', @@ -292,6 +319,7 @@ class IDF_Views_Project 'form' => $form, ), $request); +*/ } /** diff --git a/src/IDF/templates/idf/admin/summary.html b/src/IDF/templates/idf/admin/summary.html index 8ee1d71..1c012bb 100644 --- a/src/IDF/templates/idf/admin/summary.html +++ b/src/IDF/templates/idf/admin/summary.html @@ -9,7 +9,7 @@ {/if} {/if} -
+ @@ -30,6 +30,30 @@ {$form.f.description|unsafe} + + + + + + + + +{if $project.logo} + + + + +{/if}
{$form.f.name.labelTag}:
{trans 'Actual logo'}: +{if $project.logo} +project logo +{else} +{trans 'Your project do not have a logo configured yet.'} +{/if} +
{$form.f.logo.labelTag}:{if $form.f.logo.errors}{$form.f.logo.fieldErrors}{/if} +{$form.f.logo|unsafe} +
{$form.f.logo_remove.labelTag}:{if $form.f.logo_remove.errors}{$form.f.logo_remove.fieldErrors}{/if} +{$form.f.logo_remove|unsafe} +