Skip to content

Commit

Permalink
Merge branch 'refs/heads/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
snipe committed Nov 26, 2013
2 parents c8288b4 + 196710d commit 7f82a6e
Show file tree
Hide file tree
Showing 16 changed files with 47 additions and 35 deletions.
6 changes: 3 additions & 3 deletions app/controllers/admin/AssetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,11 @@ public function postEdit($assetId = null)

// Declare the rules for the form validation
$rules = array(
'name' => 'required|alpha_dash|min:3',
'name' => 'required|min:3',
'asset_tag' => 'required|alpha_dash|min:3',
'model_id' => 'required',
'serial' => 'required|alpha_dash|min:3',
'warranty_months' => 'integer|min:1',
'serial' => 'required|alpha_space|min:3',
'warranty_months' => 'required|integer',
);

// Create a new validator instance from our validation rules
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/GroupsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public function postEdit($id = null)

// Declare the rules for the form validation
$rules = array(
'name' => 'required|alpha_dash|min:2',
'name' => 'required|alpha_space|min:2',
);

// Create a new validator instance from our validation rules
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/admin/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class UsersController extends AdminController {
* @var array
*/
protected $validationRules = array(
'first_name' => 'required|alpha_dash|min:3',
'last_name' => 'required|alpha_dash|min:3',
'first_name' => 'required|alpha_space|min:3',
'last_name' => 'required|alpha_space|min:3',
'email' => 'required|email|unique:users,email',
'password' => 'required|between:3,32',
'password_confirm' => 'required|between:3,32|same:password',
Expand Down
2 changes: 2 additions & 0 deletions app/lang/en/validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"unique" => "The :attribute has already been taken.",
"url" => "The :attribute format is invalid.",


/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
Expand All @@ -76,6 +77,7 @@
*/

'custom' => array(),
'alpha_space' => "The :attribute field may only contain letters, commas, spaces and dashes.",

/*
|--------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions app/models/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ class Asset extends Elegant {
protected $table = 'assets';
protected $softDelete = true;
protected $rules = array(
'name' => 'required|min:3',
'asset_tag' => 'required|min:3|unique:assets',
'name' => 'required|alpha_space|min:3',
'asset_tag' => 'required|alpha_space|min:3|unique:assets',
'model_id' => 'required',
'serial' => 'required|alpha_dash|min:3',
'warranty_months' => 'integer|min:1',
Expand Down
2 changes: 1 addition & 1 deletion app/models/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Category extends Elegant {
* Category validation rules
*/
protected $rules = array(
'name' => 'required|min:2',
'name' => 'required|alpha_space|min:2',
);


Expand Down
2 changes: 1 addition & 1 deletion app/models/Depreciation.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Depreciation extends Elegant {

// Declare the rules for the form validation
protected $rules = array(
'name' => 'required|min:3',
'name' => 'required|alpha_space|min:3',
'months' => 'required|min:1|integer',
);

Expand Down
4 changes: 2 additions & 2 deletions app/models/License.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class License extends Elegant {
protected $table = 'licenses';
protected $softDelete = true;
protected $rules = array(
'name' => 'required|min:3',
'serial' => 'required|min:5',
'name' => 'required|alpha_space|min:3',
'serial' => 'required|alpha_dash|min:5',
'seats' => 'required|min:1|integer',
'license_email' => 'email',
);
Expand Down
4 changes: 2 additions & 2 deletions app/models/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ class Location extends Elegant {
protected $softDelete = true;
protected $table = 'locations';
protected $rules = array(
'name' => 'required|min:3',
'city' => 'required|min:3',
'name' => 'required|alpha_space|min:3',
'city' => 'required|alpha_space|min:3',
'state' => 'required|alpha|min:2|max:2',
'country' => 'required|alpha|min:2|max:2',
'zip' => 'alpha_dash|min:5',
Expand Down
2 changes: 1 addition & 1 deletion app/models/Manufacturer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Manufacturer extends Elegant {
protected $softDelete = true;
// Declare the rules for the form validation
protected $rules = array(
'name' => 'required|min:2',
'name' => 'required|alpha_space|min:2',
);

public function has_models()
Expand Down
2 changes: 1 addition & 1 deletion app/models/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Model extends Elegant {

// Declare the rules for the form validation
protected $rules = array(
'name' => 'required|not_in:foo,bar|min:3',
'name' => 'required|alpha_space|min:3',
'modelno' => 'alpha_dash|min:1',
'category_id' => 'required|integer',
);
Expand Down
2 changes: 1 addition & 1 deletion app/models/Statuslabel.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Statuslabel extends Elegant {
protected $softDelete = true;

protected $rules = array(
'name' => 'required|min:2',
'name' => 'required|alpha_space|min:2',
);

public function has_assets()
Expand Down
3 changes: 3 additions & 0 deletions app/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@



Route::when('admin/*', 'crsf', array('post'));
Route::when('assets/*', 'crsf', array('post'));

Route::group(array('prefix' => 'assets'), function()
{

Expand Down
1 change: 1 addition & 0 deletions app/start/global.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,4 @@
*/

require app_path().'/filters.php';
require app_path().'/validators.php';
6 changes: 6 additions & 0 deletions app/validators.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

Validator::extend('alpha_space', function($attribute,$value,$parameters)
{
return preg_match("/^[-_,. a-zA-Z0-9]+$/",$value);
});
36 changes: 18 additions & 18 deletions app/views/backend/categories/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,26 @@
<div class="profile-box">
<br>
<form class="form-horizontal" method="post" action="" autocomplete="off">
<!-- CSRF Token -->
<input type="hidden" name="_token" value="{{ csrf_token() }}" />
<!-- CSRF Token -->
<input type="hidden" name="_token" value="{{ csrf_token() }}" />

<!-- Category Title -->
<div class="control-group {{ $errors->has('name') ? 'error' : '' }}">
<label class="control-label" for="name">Category Name</label>
<div class="controls">
<input type="text" name="name" id="name" value="{{ Input::old('name', $category->name) }}" />
{{ $errors->first('title', '<span class="help-inline">:message</span>') }}
</div>
</div>
<!-- Category Title -->
<div class="control-group {{ $errors->has('name') ? 'error' : '' }}">
<label class="control-label" for="name">Category Name</label>
<div class="controls">
<input type="text" name="name" id="name" value="{{ Input::old('name', $category->name) }}" />
{{ $errors->first('name', '<span class="help-inline">:message</span>') }}
</div>
</div>

<!-- Form actions -->
<div class="control-group">
<div class="controls">
<a class="btn btn-link" href="{{ route('categories') }}">@lang('general.cancel')</a>
<button type="submit" class="btn-flat success"><i class="icon-ok icon-white"></i> @lang('general.save')</button>
</div>
</div>
</form>
<!-- Form actions -->
<div class="control-group">
<div class="controls">
<a class="btn btn-link" href="{{ route('categories') }}">@lang('general.cancel')</a>
<button type="submit" class="btn-flat success"><i class="icon-ok icon-white"></i> @lang('general.save')</button>
</div>
</div>
</form>


</div>
Expand Down

0 comments on commit 7f82a6e

Please sign in to comment.