Skip to content

Commit

Permalink
Form fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Egemen Berker Kızılcan committed Nov 14, 2015
1 parent 6e4e203 commit dc75ae2
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"laravel",
"laravel5"
],
"version": "1.0.4",
"version": "1.0.5",
"authors": [
{
"name": "Hyleeh",
Expand Down
2 changes: 1 addition & 1 deletion src/Providers/HierarchyServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class HierarchyServiceProvider extends ServiceProvider {

const version = '1.0.4';
const version = '1.0.5';

/**
* Register the service provider.
Expand Down
2 changes: 1 addition & 1 deletion src/Support/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ function source_model_name($key)
*/
function source_form_name($key)
{
return 'CreateEdit' . ucfirst($key) . 'Form';
return 'Edit' . ucfirst($key) . 'Form';
}
}
2 changes: 1 addition & 1 deletion src/Support/templates/entities/form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class {{ $name }} extends Form {

public function buildForm()
{
$this->compose('Nuclear\Hierarchy\Http\Forms\NodeSourceForm');
$this->compose(new \Nuclear\Hierarchy\Http\Forms\NodeSourceForm);
@foreach($fields as $field)
$this->add('{{ $field->name }}', '{{ $field->type }}', [
'label' => '{{ $field->label }}',
Expand Down
4 changes: 2 additions & 2 deletions tests/Builders/FormBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function it_returns_the_class_name()
$builder = $this->getBuilder();

$this->assertEquals(
'CreateEditProjectForm',
'EditProjectForm',
$builder->getClassName('project')
);
}
Expand All @@ -113,7 +113,7 @@ function it_returns_the_class_path()
$builder = $this->getBuilder();

$this->assertEquals(
generated_path() . '/Forms/CreateEditProjectForm.php',
generated_path() . '/Forms/EditProjectForm.php',
$builder->getClassFilePath('project')
);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Support/HelpersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function it_registers_source_model_name_helpers()
function it_registers_source_form_name_helpers()
{
$this->assertEquals(
'CreateEditProjectForm',
'EditProjectForm',
source_form_name('project')
);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/_stubs/entities/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

use Kris\LaravelFormBuilder\Form;

class CreateEditCategoryForm extends Form {
class EditCategoryForm extends Form {

public function buildForm()
{
$this->compose('Nuclear\Hierarchy\Http\Forms\NodeSourceForm');
$this->compose(new \Nuclear\Hierarchy\Http\Forms\NodeSourceForm);
}

}

0 comments on commit dc75ae2

Please sign in to comment.