Commit 43f7b2e4 authored by Nicolas Widart's avatar Nicolas Widart

Add a generate module UI

parent 09eee38c
......@@ -20,6 +20,12 @@ class SidebarViewComposer
'route' => 'dashboard.modules.index',
'icon-class' => 'fa fa-cog',
'title' => 'Modules',
],
[
'request' => "{$view->prefix}/workshop/workbench*",
'route' => 'dashboard.workbench.index',
'icon-class' => 'fa fa-cog',
'title' => 'Workbench',
]
]));
}
......
<?php namespace Modules\Workshop\Http\Controllers;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\View;
use Laracasts\Flash\Flash;
use Modules\Core\Http\Controllers\Admin\AdminBaseController;
use Modules\Workshop\Http\Requests\GenerateModuleRequest;
use Symfony\Component\Console\Output\BufferedOutput;
class WorkbenchController extends AdminBaseController
{
public function index()
{
return View::make('workshop::admin.workbench.index');
}
public function generate(GenerateModuleRequest $request)
{
$output = new BufferedOutput;
Artisan::call('module:make', ['name' => $request->name], $output);
Flash::message($output->fetch());
return Redirect::route('dashboard.workbench.index');
}
}
\ No newline at end of file
<?php namespace Modules\Workshop\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class GenerateModuleRequest extends FormRequest
{
public function rules()
{
return [];
}
public function authorize()
{
return true;
}
public function messages()
{
return [];
}
}
\ No newline at end of file
......@@ -4,5 +4,8 @@ Route::group(['prefix' => Config::get('core::core.admin-prefix').'/workshop', 'n
function () {
Route::get('modules', ['as' => 'dashboard.modules.index', 'uses' => 'ModulesController@index']);
Route::post('modules', ['as' => 'dashboard.modules.store', 'uses' => 'ModulesController@store']);
# Workbench
Route::get('workbench', ['as' => 'dashboard.workbench.index', 'uses' => 'WorkbenchController@index']);
Route::post('generate', ['as' => 'dashboard.workbench.generate.index', 'uses' => 'WorkbenchController@generate']);
}
);
\ No newline at end of file
@extends('core::layouts.master')
@section('content-header')
<h1>
Module helpers
</h1>
<ol class="breadcrumb">
<li><a href="{{ URL::route('dashboard.index') }}"><i class="fa fa-dashboard"></i> Home</a></li>
<li class="active">Workbench</li>
</ol>
@stop
@section('content')
<div class="row">
<div class="col-md-12">
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<li class="active"><a href="#tab_1-1" data-toggle="tab">Generator</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab_1-1">
@include('flash::message')
{!! Form::open(['route' => 'dashboard.workbench.generate.index', 'method' => 'post']) !!}
<div class="box-body">
<div class='form-group'>
{!! Form::label('name', 'Module Name:') !!}
{!! Form::text('name', Input::old('name'), ['class' => 'form-control', 'placeholder' => 'Module Name']) !!}
</div>
</div>
<div class="box-footer">
<button type="submit" class="btn btn-primary btn-flat">Generate new module</button>
</div>
{!! Form::close() !!}
</div>
</div>
</div>
</div>
</div>
@stop
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment