diff --git a/Model/Registration.php b/Model/Registration.php index 78f7b07..b6697dd 100644 --- a/Model/Registration.php +++ b/Model/Registration.php @@ -451,6 +451,20 @@ public function afterFind($results, $primary = false) { return $results; } +/** + * afterFrameSave + * + * @param array $frame Frame data + * @return void + */ + public function afterFrameSave($frame) { + // フレームに紐づく登録フォームがあるのにdefault_actionが設定されてなかったら設定する + if ($frame['Frame']['block_id'] && empty($frame['Frame']['default_action'])) { + $frame['Frame']['default_action'] = 'registration_answers/view'; + $this->Frame->save($frame, false); + } + } + /** * ブロック作成 * diff --git a/Test/Case/Controller/RegistrationEditController/EditQuestionTest.php b/Test/Case/Controller/RegistrationEditController/EditQuestionTest.php index e62af34..ce404e6 100644 --- a/Test/Case/Controller/RegistrationEditController/EditQuestionTest.php +++ b/Test/Case/Controller/RegistrationEditController/EditQuestionTest.php @@ -279,12 +279,11 @@ public function dataProviderEditGetByEditable() { 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[RegistrationPage][{{pageIndex}}][RegistrationQuestion][{{qIndex}}][question_value]', 'value' => null), ))); array_push($results, Hash::merge($results[$base], array( - 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[RegistrationPage][{{pageIndex}}][RegistrationQuestion][{{qIndex}}][question_type]', 'value' => null), + 'assert' => array('method' => 'assertInput', 'type' => 'select', 'name' => 'data[RegistrationPage][{{pageIndex}}][RegistrationQuestion][{{qIndex}}][question_type]', 'value' => null), ))); array_push($results, Hash::merge($results[$base], array( 'assert' => array('method' => 'assertInput', 'type' => 'textarea', 'name' => 'data[RegistrationPage][{{pageIndex}}][RegistrationQuestion][{{qIndex}}][description]', 'value' => null), ))); - //10 array_push($results, Hash::merge($results[$base], array( 'assert' => array('method' => 'assertInput', 'type' => 'input', 'name' => 'data[RegistrationPage][{{pageIndex}}][RegistrationQuestion][{{qIndex}}][is_choice_random]', 'value' => null), )));