@@ -6,40 +6,40 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Feedback extends Plugin { |
| 8 | 8 | |
| 9 | - public function onLoad($form) |
|
| 10 | - { |
|
| 11 | - $form->addButton('feedback_trigger_'.$form->id); |
|
| 12 | - } |
|
| 9 | + public function onLoad($form) |
|
| 10 | + { |
|
| 11 | + $form->addButton('feedback_trigger_'.$form->id); |
|
| 12 | + } |
|
| 13 | 13 | |
| 14 | - public function onSubmitted($form) |
|
| 15 | - { |
|
| 16 | - $request = $form->getRequest(); |
|
| 14 | + public function onSubmitted($form) |
|
| 15 | + { |
|
| 16 | + $request = $form->getRequest(); |
|
| 17 | 17 | |
| 18 | - if ($request->get('feedback_trigger_'.$form->id)) { |
|
| 18 | + if ($request->get('feedback_trigger_'.$form->id)) { |
|
| 19 | 19 | |
| 20 | - $field = $form->field($request->get('name')); |
|
| 20 | + $field = $form->field($request->get('name')); |
|
| 21 | 21 | |
| 22 | - if ( ! is_null($field)) { |
|
| 22 | + if ( ! is_null($field)) { |
|
| 23 | 23 | |
| 24 | - $field->setFromRequest($request); |
|
| 25 | - $field->runValidations(); |
|
| 24 | + $field->setFromRequest($request); |
|
| 25 | + $field->runValidations(); |
|
| 26 | 26 | |
| 27 | - $response = [ |
|
| 28 | - 'id' => $field->id, |
|
| 29 | - 'valid' => $field->valid(), |
|
| 30 | - 'error_id' => 'feedback_errors_'.$field->id, |
|
| 31 | - 'error' => '', |
|
| 32 | - ]; |
|
| 27 | + $response = [ |
|
| 28 | + 'id' => $field->id, |
|
| 29 | + 'valid' => $field->valid(), |
|
| 30 | + 'error_id' => 'feedback_errors_'.$field->id, |
|
| 31 | + 'error' => '', |
|
| 32 | + ]; |
|
| 33 | 33 | |
| 34 | - if ( ! $field->valid()) { |
|
| 35 | - $response['error'] = $form->renderFieldErrors($field); |
|
| 36 | - } |
|
| 34 | + if ( ! $field->valid()) { |
|
| 35 | + $response['error'] = $form->renderFieldErrors($field); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - header('Content-Type: application/json'); |
|
| 39 | - echo json_encode($response); |
|
| 40 | - exit(); |
|
| 41 | - } |
|
| 42 | - } |
|
| 43 | - } |
|
| 38 | + header('Content-Type: application/json'); |
|
| 39 | + echo json_encode($response); |
|
| 40 | + exit(); |
|
| 41 | + } |
|
| 42 | + } |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | 45 | } |
| 46 | 46 | \ No newline at end of file |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | return [ |
| 4 | - 'plugins' => [ |
|
| 5 | - 'feedback', |
|
| 6 | - ], |
|
| 4 | + 'plugins' => [ |
|
| 5 | + 'feedback', |
|
| 6 | + ], |
|
| 7 | 7 | ]; |
| 8 | 8 | \ No newline at end of file |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | return [ |
| 4 | - 'placeholder_first' => 'Nombre', |
|
| 5 | - 'placeholder_surname' => 'Apellido', |
|
| 4 | + 'placeholder_first' => 'Nombre', |
|
| 5 | + 'placeholder_surname' => 'Apellido', |
|
| 6 | 6 | ]; |
| 7 | 7 | \ No newline at end of file |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | return [ |
| 4 | - 'placeholder' => '[email protected]', |
|
| 4 | + 'placeholder' => '[email protected]', |
|
| 5 | 5 | ]; |
| 6 | 6 | \ No newline at end of file |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | return [ |
| 4 | - 'placeholder' => '[email protected]', |
|
| 4 | + 'placeholder' => '[email protected]', |
|
| 5 | 5 | ]; |
| 6 | 6 | \ No newline at end of file |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | return [ |
| 4 | - 'placeholder' => 'Buscar…', |
|
| 5 | - 'button' => 'Ir', |
|
| 4 | + 'placeholder' => 'Buscar…', |
|
| 5 | + 'button' => 'Ir', |
|
| 6 | 6 | ]; |
| 7 | 7 | \ No newline at end of file |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | return [ |
| 4 | - 'placeholder' => 'Search…', |
|
| 5 | - 'button' => 'Go', |
|
| 4 | + 'placeholder' => 'Search…', |
|
| 5 | + 'button' => 'Go', |
|
| 6 | 6 | ]; |
| 7 | 7 | \ No newline at end of file |
@@ -6,18 +6,18 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Blade implements Engine { |
| 8 | 8 | |
| 9 | - /** |
|
| 9 | + /** |
|
| 10 | 10 | * Render the template content. |
| 11 | 11 | * |
| 12 | - * @param string $path |
|
| 13 | - * @param array $properties |
|
| 12 | + * @param string $path |
|
| 13 | + * @param array $properties |
|
| 14 | 14 | * @return string |
| 15 | 15 | */ |
| 16 | - public function render($path, $properties = []) |
|
| 17 | - { |
|
| 18 | - if ( ! function_exists('app')) throw new \Exception('Laravel required for blade rendering engine.'); |
|
| 16 | + public function render($path, $properties = []) |
|
| 17 | + { |
|
| 18 | + if ( ! function_exists('app')) throw new \Exception('Laravel required for blade rendering engine.'); |
|
| 19 | 19 | |
| 20 | - return app()->make('view')->file($path, $properties); |
|
| 21 | - } |
|
| 20 | + return app()->make('view')->file($path, $properties); |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | 23 | } |
@@ -12,32 +12,32 @@ |
||
| 12 | 12 | * |
| 13 | 13 | * @var \Mustache_Engine |
| 14 | 14 | */ |
| 15 | - protected $compiler; |
|
| 15 | + protected $compiler; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 17 | + /** |
|
| 18 | 18 | * Fetch the compiler. |
| 19 | 19 | * |
| 20 | 20 | * @return \Mustache_Engine |
| 21 | 21 | */ |
| 22 | - public function compiler() |
|
| 23 | - { |
|
| 24 | - if ( ! $this->compiler) $this->compiler = new Mustache_Engine; |
|
| 22 | + public function compiler() |
|
| 23 | + { |
|
| 24 | + if ( ! $this->compiler) $this->compiler = new Mustache_Engine; |
|
| 25 | 25 | |
| 26 | - return $this->compiler; |
|
| 27 | - } |
|
| 26 | + return $this->compiler; |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - /** |
|
| 29 | + /** |
|
| 30 | 30 | * Render the template content. |
| 31 | 31 | * |
| 32 | - * @param string $path |
|
| 33 | - * @param array $properties |
|
| 32 | + * @param string $path |
|
| 33 | + * @param array $properties |
|
| 34 | 34 | * @return string |
| 35 | 35 | */ |
| 36 | - public function render($path, $properties = []) |
|
| 37 | - { |
|
| 38 | - $content = file_get_contents($path); |
|
| 36 | + public function render($path, $properties = []) |
|
| 37 | + { |
|
| 38 | + $content = file_get_contents($path); |
|
| 39 | 39 | |
| 40 | - return $this->compiler()->render($content, $properties); |
|
| 41 | - } |
|
| 40 | + return $this->compiler()->render($content, $properties); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | 43 | } |