Skip to content

Commit

Permalink
Fix action
Browse files Browse the repository at this point in the history
  • Loading branch information
arronzhang committed Mar 26, 2013
1 parent a95c7f7 commit 32dc9f3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
7 changes: 5 additions & 2 deletions Slim/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,10 @@ public function renderTemplate( $method, $format = "html" ) {

$temp = $method . ".".$format.".twig";
$file = $path . '/'. $temp;
if( file_exists($file) ) {
//if( file_exists($file) ) {
$this->render( $temp );
return;
}
//}
}

/**
Expand Down Expand Up @@ -428,6 +428,9 @@ public function action($action, $callable = null){
$app->view()->setData( "action", $action );
$app->view()->setData( "params", $data );
$app->data( $data );
if( is_callable( $callable ) ) {
call_user_func( $callable );
}
$app->renderTemplate("action");
});
$this->post($pattern, function($id) use ($table, $action, $app, $callable) {
Expand Down
5 changes: 1 addition & 4 deletions Slim/Admin/ActionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ public function __construct()
/*
* Action
*/
public function action($table, $name, $settings, $callable){
if( !is_callable($callable) ) {
throw new \InvalidArgumentException('$callable must a function');
}
public function action($table, $name, $settings, $callable = null){
if(is_string($settings) ) {
$settings = array( "alias" => $settings );
}
Expand Down
4 changes: 2 additions & 2 deletions Slim/Admin/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,15 @@ public function columns()
* Action
*
*/
public function action($name, $settings, $callable) {
public function action($name, $settings, $callable = null) {
return $this->actions->action($this, $name, $settings, $callable);
}

public function actions() {
return $this->actions->actions();
}

public function multiAction($name, $settings, $callable) {
public function multiAction($name, $settings, $callable = null) {
return $this->multi_actions->action($this, $name, $settings, $callable);
}

Expand Down

0 comments on commit 32dc9f3

Please sign in to comment.