Merge pull request #197 from cachethq/component-groups
[WIP] Component Groups
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateComponentGroupsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('component_groups', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->timestamps();
|
||||
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('component_groups');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AlterTableComponentsAddGroupIdColumn extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('components', function (Blueprint $table) {
|
||||
$table->integer('group_id')->nullable()->default(null)->after('order');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('components', function (Blueprint $table) {
|
||||
$table->dropColumn('group_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,8 @@ return [
|
||||
'dashboard' => 'Dashboard',
|
||||
'components' => 'Components',
|
||||
'component-add' => 'Add Component',
|
||||
'component-groups' => 'Component Groups',
|
||||
'component-groups-add' => 'Create Group',
|
||||
'incidents' => 'Incidents',
|
||||
'incident-add' => 'Add Incident',
|
||||
'incident-create-template' => 'Create Template',
|
||||
|
||||
@@ -8,6 +8,9 @@ Route::group(['before' => 'auth', 'prefix' => 'dashboard', 'namespace' => 'Cache
|
||||
Route::get('components', ['as' => 'dashboard.components', 'uses' => 'DashComponentController@showComponents']);
|
||||
Route::get('components/add', ['as' => 'dashboard.components.add', 'uses' => 'DashComponentController@showAddComponent']);
|
||||
Route::post('components/add', 'DashComponentController@createComponentAction');
|
||||
Route::get('components/groups', ['as' => 'dashboard.components.groups', 'uses' => 'DashComponentController@showComponentGroups']);
|
||||
Route::get('components/groups/add', ['as' => 'dashboard.components.groups.add', 'uses' => 'DashComponentController@showAddComponentGroup']);
|
||||
Route::post('components/groups/add', 'DashComponentController@postAddComponentGroup');
|
||||
Route::get('components/{component}/delete', 'DashComponentController@deleteComponentAction');
|
||||
Route::get('components/{component}/edit', 'DashComponentController@showEditComponent');
|
||||
Route::post('components/{component}/edit', 'DashComponentController@updateComponentAction');
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
@extends('layout.dashboard')
|
||||
|
||||
@section('content')
|
||||
<div class="header">
|
||||
<span class="uppercase">
|
||||
<i class="icons ion-ios-keypad"></i> {{ trans('cachet.dashboard.components') }}
|
||||
</span>
|
||||
> <small>Create a component group</small>
|
||||
</div>
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
@if($group = Session::get('group'))
|
||||
<div class='alert alert-{{ $group->isValid() ? "success" : "danger" }}'>
|
||||
@if($group->isValid())
|
||||
<strong>Awesome.</strong> Component group created.
|
||||
@else
|
||||
<strong>Whoops.</strong> Something went wrong with the group. {{ $group->getErrors() }}
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<form name='CreateComponentGroupForm' class='form-vertical' role='form' action='/dashboard/components/groups/add' method='POST'>
|
||||
<fieldset>
|
||||
<div class='form-group'>
|
||||
<label for='incident-name'>Name</label>
|
||||
<input type='text' class='form-control' name='group[name]' id='group-name' required />
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<button type="submit" class="btn btn-success">Submit</button>
|
||||
<a class="btn btn-default" href="{{ route('dashboard.components.groups') }}">Cancel</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
@@ -38,6 +38,15 @@
|
||||
<label>Description</label>
|
||||
<textarea name='component[description]' class='form-control' rows='5'></textarea>
|
||||
</div>
|
||||
<div class='form-group'>
|
||||
<label>Group</label>
|
||||
<select name='component[group_id]' class='form-control'>
|
||||
<option selected></option>
|
||||
@foreach($groups as $group)
|
||||
<option value='{{ $group->id }}'>{{ $group->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<hr />
|
||||
<div class='form-group'>
|
||||
<label>Link</label>
|
||||
|
||||
@@ -38,6 +38,15 @@
|
||||
<label>Description</label>
|
||||
<textarea name='component[description]' class='form-control' rows='5'>{{ $component->description }}</textarea>
|
||||
</div>
|
||||
<div class='form-group'>
|
||||
<label>Group</label>
|
||||
<select name='component[group_id]' class='form-control'>
|
||||
<option {{ $component->group_id === null ? "selected" : null }}></option>
|
||||
@foreach($groups as $group)
|
||||
<option value='{{ $group->id }}' {{ $component->group_id === $group->id ? "selected" : null }}>{{ $group->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<hr />
|
||||
<div class='form-group'>
|
||||
<label>Link</label>
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
@extends('layout.dashboard')
|
||||
|
||||
@section('content')
|
||||
<div class="header fixed">
|
||||
@if(isset($subMenu))
|
||||
@include('partials.dashboard.sub-sidebar')
|
||||
@endif
|
||||
<div class='content-panel'>
|
||||
<div class="header">
|
||||
<span class="uppercase">
|
||||
<i class="icons ion-ios-keypad"></i> {{ trans('cachet.dashboard.components') }}
|
||||
</span>
|
||||
@@ -40,4 +44,5 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
@extends('layout.dashboard')
|
||||
|
||||
@section('content')
|
||||
@if(isset($subMenu))
|
||||
@include('partials.dashboard.sub-sidebar')
|
||||
@endif
|
||||
<div class='content-panel'>
|
||||
<div class="header">
|
||||
<span class="uppercase">
|
||||
<i class="icons ion-ios-keypad"></i> {{ trans('cachet.dashboard.component-groups') }}
|
||||
</span>
|
||||
<a class="btn btn-sm btn-success pull-right" href="{{ route('dashboard.components.groups.add') }}">
|
||||
{{ trans('cachet.dashboard.component-groups-add') }}
|
||||
</a>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 striped-list">
|
||||
@forelse($groups as $group)
|
||||
<div class='row striped-list-item'>
|
||||
<div class='col-md-8'>
|
||||
<strong>{{ $group->name }}</strong>
|
||||
</div>
|
||||
<div class='col-md-4 text-right'>
|
||||
<a href='#' class='btn btn-default'>Edit</a>
|
||||
<a href='#' class='btn btn-danger'>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
@empty
|
||||
<div class='list-group-item text-danger'>You should add a component.</div>
|
||||
@endforelse
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
Reference in New Issue
Block a user