e32dd6cf9d4b9f9bdd67724a8365c2d6778cc59c
Author: yandod
Date: 2009-12-30 19:22:36 +0900
diff --git a/app/config/routes.php b/app/config/routes.php
index b956533..7cf49d7 100755
--- a/app/config/routes.php
+++ b/app/config/routes.php
@@ -15,6 +15,7 @@
Router::connect('/projects/:project_id/issues/:action/*', array('controller' => 'issues'));
Router::connect('/projects/:action/:project_id', array('controller' => 'projects'));
Router::connect('/projects/:project_id/news/:action/', array('controller' => 'news'));
+ Router::connect('/projects/:project_id/news/:action/:id', array('controller' => 'news'));
Router::connect('/projects/:project_id/documents/:action/', array('controller' => 'documents'));
Router::connect('/projects/:project_id/boards/:action/:id/', array('controller' => 'boards'));
Router::connect('/projects/:project_id/timelog/:action/*', array('controller' => 'timelog'), array('project_id' => '.+'));
diff --git a/app/controllers/news_controller.php b/app/controllers/news_controller.php
index 48842b7..dee81d1 100644
--- a/app/controllers/news_controller.php
+++ b/app/controllers/news_controller.php
@@ -153,20 +153,20 @@ class NewsController extends AppController {
# redirect_to :action => 'show', :id => @news
# end
#
- function destroy( $id = null )
+ function destroy()
{
- $project = $this->News->read(null, $id);
- if ( !$project ) {
+ $project = $this->News->findById($this->params['news_id']);
+ if ( !$project ) {
$this->cakeError('error404');
- }
+ }
- if ($this->News->del($id)) {
- // TODO: project_idを正しく設定する!
- $this->Session->setFlash(__('Successful deletion.', true), 'default', array('class'=>'flash notice'));
- $this->redirect(array('controller'=>'projects', 'action' => $project['Project'][0]['Project']['identifier'], 'news/index'));
+ if ($this->News->del($this->params['news_id'])) {
+ // TODO: project_idを正しく設定する!
+ $this->Session->setFlash(__('Successful deletion.', true), 'default', array('class'=>'flash notice'));
+ $this->redirect(array('controller'=>'projects', 'action' => $project['Project']['identifier'], 'news/index'));
} else {
$this->cakeError('error404');
- }
+ }
}
#
# def preview
