categories dropdown in create/edit form

This commit is contained in:
snipe
2013-11-14 22:32:16 -05:00
parent 590dbb2bd5
commit 0fcd64c386
3 changed files with 7 additions and 4 deletions
@@ -35,7 +35,8 @@ class CategoriesController extends AdminController {
public function getCreate()
{
// Show the page
return View::make('backend/categories/create');
$category_options = array('' => 'Top Level') + Category::lists('name', 'id');
return View::make('backend/categories/create')->with('category_options',$category_options);
}
@@ -97,7 +98,8 @@ class CategoriesController extends AdminController {
}
// Show the page
return View::make('backend/categories/edit', compact('category'));
$category_options = array('' => 'Top Level') + Category::lists('name', 'id');
return View::make('backend/categories/edit', compact('category'))->with('category_options',$category_options);
}
@@ -170,4 +172,5 @@ class CategoriesController extends AdminController {
}
}
@@ -39,7 +39,7 @@ Create a New Asset Category ::
<div class="control-group {{ $errors->has('parent') ? 'error' : '' }}">
<label class="control-label" for="parent">Category Parent</label>
<div class="controls">
<input class="span6" type="text" name="parent" id="parent" value="{{ Input::old('parent') }}" />
{{ Form::select('parent', $category_options , Input::old('parent')) }}
{{ $errors->first('parent', '<span class="help-inline">:message</span>') }}
</div>
</div>
+1 -1
View File
@@ -43,7 +43,7 @@ Category Update ::
<div class="control-group {{ $errors->has('parent') ? 'error' : '' }}">
<label class="control-label" for="parent">Category Parent</label>
<div class="controls">
<input type="text" name="parent" id="parent" value="{{ Input::old('name', $category->parent) }}" />
{{ Form::select('parent', $category_options, Input::old('parent', $category->parent)) }}
{{ $errors->first('parent', '<span class="help-inline">:message</span>') }}
</div>
</div>