Closes #126, components can have links and tags.

This commit is contained in:
James Brooks
2014-12-30 15:14:55 +00:00
parent a38a89c3e6
commit f4f691ab46
5 changed files with 71 additions and 2 deletions

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AlterTableComponentsAddMetaColumns extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('components', function(Blueprint $table)
{
$table->text('tags')->nullable()->default(null)->after('description');
$table->text('link')->nullable()->default(null)->after('description');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('components', function(Blueprint $table)
{
$table->dropColumn('tags');
$table->dropColumn('link');
});
}
}

View File

@@ -11,9 +11,17 @@ class Component extends Eloquent implements \Dingo\Api\Transformer\Transformable
'user_id' => 'integer|required',
'name' => 'required',
'status' => 'integer',
'link' => 'url'
];
protected $fillable = ['name', 'description', 'status', 'user_id'];
protected $fillable = [
'name',
'description',
'status',
'user_id',
'tags',
'link'
];
/**
* Lookup all of the incidents reported on the component.

View File

@@ -38,6 +38,16 @@
<label>Description</label>
<textarea name='component[description]' class='form-control' rows='5'></textarea>
</div>
<hr />
<div class='form-group'>
<label>Link</label>
<input type='text' name='component[link]' class='form-control' />
</div>
<div class='form-group'>
<label>Tags</label>
<textarea name='component[tags]' class='form-control' rows='2'></textarea>
<span class='help-block'>Comma separated.</span>
</div>
</fieldset>
<button type="submit" class="btn btn-primary">Submit</button>

View File

@@ -38,6 +38,16 @@
<label>Description</label>
<textarea name='component[description]' class='form-control' rows='5'>{{ $component->description }}</textarea>
</div>
<hr />
<div class='form-group'>
<label>Link</label>
<input type='text' name='component[link]' class='form-control' value='{{ $component->link }}' />
</div>
<div class='form-group'>
<label>Tags</label>
<textarea name='component[tags]' class='form-control' rows='2'>{{ $component->tags }}</textarea>
<span class='help-block'>Comma separated.</span>
</div>
</fieldset>
<button type="submit" class="btn btn-success">Save Component</button>

View File

@@ -1,9 +1,14 @@
@if($components->count() > 0)
<ul class='list-group components'>
@foreach($components as $component)
<li class='list-group-item component '>
<li class='list-group-item component'>
@if($component->link)
<h3 class='pull-right'><a href='{{ $component->link }}' target='_blank'><i class='ion ion-link'></i></a></h3>
@endif
<h4>{{ $component->name }} <small class='text-component-{{ $component->status }}'>{{ $component->humanStatus }}</small></h4>
@if($component->description)
<p>{{ $component->description }}</p>
@endif
</li>
@endforeach
</ul>