1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00
This commit is contained in:
Hillel Coren 2016-12-09 11:26:21 +02:00
parent dc981b40ab
commit a0af7f4b96
7 changed files with 51 additions and 51 deletions

View File

@ -68,6 +68,7 @@ class MakeClass extends GeneratorCommand
'DATATABLE_COLUMNS' => $this->getColumns(), 'DATATABLE_COLUMNS' => $this->getColumns(),
'FORM_FIELDS' => $this->getFormFields(), 'FORM_FIELDS' => $this->getFormFields(),
'DATABASE_FIELDS' => $this->getDatabaseFields($module), 'DATABASE_FIELDS' => $this->getDatabaseFields($module),
'TRANSFORMER_FIELDS' => $this->getTransformerFields($module),
]))->render(); ]))->render();
} }
@ -137,4 +138,19 @@ class MakeClass extends GeneratorCommand
return $str; return $str;
} }
protected function getTransformerFields($module)
{
$fields = $this->option('fields');
$fields = explode(',', $fields);
$str = '';
foreach ($fields as $field) {
$field = explode(':', $field)[0];
$str .= "'{$field}' => $" . $module->getLowerName() . "->$field,\n ";
}
return rtrim($str);
}
} }

View File

@ -66,7 +66,7 @@ class MakeModule extends Command
Artisan::call('ninja:make-class', ['name' => $name, 'module' => $name, 'class' => 'request', 'prefix' => 'create']); Artisan::call('ninja:make-class', ['name' => $name, 'module' => $name, 'class' => 'request', 'prefix' => 'create']);
Artisan::call('ninja:make-class', ['name' => $name, 'module' => $name, 'class' => 'request', 'prefix' => 'update']); Artisan::call('ninja:make-class', ['name' => $name, 'module' => $name, 'class' => 'request', 'prefix' => 'update']);
Artisan::call('ninja:make-class', ['name' => $name, 'module' => $name, 'class' => 'api-controller']); Artisan::call('ninja:make-class', ['name' => $name, 'module' => $name, 'class' => 'api-controller']);
Artisan::call('ninja:make-class', ['name' => $name, 'module' => $name, 'class' => 'transformer']); Artisan::call('ninja:make-class', ['name' => $name, 'module' => $name, 'class' => 'transformer', '--fields' => $fields]);
Artisan::call('module:dump'); Artisan::call('module:dump');
} }

View File

@ -2,9 +2,6 @@
namespace $NAMESPACE$; namespace $NAMESPACE$;
//use Response;
//use Input;
//use App\Models\$STUDLY_NAME$;
use App\Http\Controllers\BaseAPIController; use App\Http\Controllers\BaseAPIController;
use Modules\$STUDLY_NAME$\Repositories\$STUDLY_NAME$Repository; use Modules\$STUDLY_NAME$\Repositories\$STUDLY_NAME$Repository;
use Modules\$STUDLY_NAME$\Http\Requests\$STUDLY_NAME$Request; use Modules\$STUDLY_NAME$\Http\Requests\$STUDLY_NAME$Request;
@ -127,8 +124,6 @@ class $STUDLY_NAME$ApiController extends BaseAPIController
return $this->handleAction($request); return $this->handleAction($request);
} }
//$data = $request->input();
//$data['public_id'] = $publicId;
$$LOWER_NAME$ = $this->$LOWER_NAME$Repo->save($request->input(), $request->entity()); $$LOWER_NAME$ = $this->$LOWER_NAME$Repo->save($request->input(), $request->entity());
return $this->itemResponse($$LOWER_NAME$); return $this->itemResponse($$LOWER_NAME$);

View File

@ -3,9 +3,6 @@
namespace $CLASS_NAMESPACE$; namespace $CLASS_NAMESPACE$;
use Auth; use Auth;
//use Illuminate\Http\Request;
//use Illuminate\Http\Response;
//use Illuminate\Routing\Controller;
use App\Http\Controllers\BaseController; use App\Http\Controllers\BaseController;
use App\Services\DatatableService; use App\Services\DatatableService;
use Modules\$STUDLY_NAME$\Datatables\$STUDLY_NAME$Datatable; use Modules\$STUDLY_NAME$\Datatables\$STUDLY_NAME$Datatable;
@ -119,14 +116,6 @@ class $CLASS$ extends BaseController
->with('message', trans('texts.updated_$LOWER_NAME$')); ->with('message', trans('texts.updated_$LOWER_NAME$'));
} }
/**
* Remove the specified resource from storage.
* @return Response
*/
public function destroy()
{
}
/** /**
* Update multiple resources * Update multiple resources
*/ */

View File

@ -26,6 +26,7 @@ class $STUDLY_NAME$Transformer extends EntityTransformer
public function transform($STUDLY_NAME$ $$LOWER_NAME$) public function transform($STUDLY_NAME$ $$LOWER_NAME$)
{ {
return array_merge($this->getDefaults($$LOWER_NAME$), [ return array_merge($this->getDefaults($$LOWER_NAME$), [
$TRANSFORMER_FIELDS$
'id' => (int) $$LOWER_NAME$->public_id, 'id' => (int) $$LOWER_NAME$->public_id,
'updated_at' => $this->getTimestamp($$LOWER_NAME$->updated_at), 'updated_at' => $this->getTimestamp($$LOWER_NAME$->updated_at),
'archived_at' => $this->getTimestamp($$LOWER_NAME$->deleted_at), 'archived_at' => $this->getTimestamp($$LOWER_NAME$->deleted_at),

View File

@ -495,50 +495,22 @@
'tasks', 'tasks',
'expenses', 'expenses',
'vendors', 'vendors',
'settings',
] as $option) ] as $option)
@if (in_array($option, ['dashboard', 'settings']) @if (in_array($option, ['dashboard', 'settings'])
|| Auth::user()->can('view', substr($option, 0, -1)) || Auth::user()->can('view', substr($option, 0, -1))
|| Auth::user()->can('create', substr($option, 0, -1))) || Auth::user()->can('create', substr($option, 0, -1)))
<li class="{{ Request::is("{$option}*") ? 'active' : '' }}"> @include('partials.navigation_option')
@if ($option == 'settings')
<a type="button" class="btn btn-default btn-sm pull-right"
href="{{ Utils::getDocsUrl(request()->path()) }}" target="_blank">
<i class="fa fa-question-circle" style="width:20px" title="{{ trans('texts.help') }}"></i>
</a>
@elseif ($option != 'dashboard')
@if (Auth::user()->can('create', substr($option, 0, -1)))
<a type="button" class="btn btn-primary btn-sm pull-right"
href="{{ url("/{$option}/create") }}">
<i class="fa fa-plus-circle" style="width:20px" title="{{ trans('texts.create_new') }}"></i>
</a>
@endif
@endif
<a href="{{ url($option == 'recurring' ? 'recurring_invoice' : $option) }}"
style="font-size:16px; padding-top:6px; padding-bottom:6px"
class="{{ Request::is("{$option}*") ? 'active' : '' }}">
<i class="fa fa-{{ \App\Models\EntityModel::getIcon($option) }}" style="width:46px; padding-right:10px"></i>
{{ ($option == 'recurring_invoices') ? trans('texts.recurring') : trans("texts.{$option}") }}
{!! Utils::isTrial() && in_array($option, ['quotes', 'tasks', 'expenses', 'vendors']) ? '&nbsp;<sup>' . trans('texts.pro') . '</sup>' : '' !!}
@if (false && $option == 'self-update' && Updater::source()->isNewVersionAvailable('v'.NINJA_VERSION))
<span class="badge alert-danger">1</span>
@endif
</a>
</li>
@endif @endif
@endforeach @endforeach
@if ( ! Utils::isNinjaProd()) @if ( ! Utils::isNinjaProd())
@foreach (Module::all() as $module) @foreach (Module::all() as $module)
<li class="{{ Request::is("{$module->getAlias()}*") ? 'active' : '' }}"> @include('partials.navigation_option', [
<a href="{{ url($module->getAlias()) }}" 'option' => $module->getAlias(),
style="font-size:16px; padding-top:6px; padding-bottom:6px" 'icon' => $module->get('icon', 'th-large'),
class="{{ Request::is("{$module->getAlias()}*") ? 'active' : '' }}"> ])
<i class="fa fa-{{ $module->get('icon', 'th-large') }}" style="width:46px; padding-right:10px"></i>
{{ $module->getName() }}
</a>
</li>
@endforeach @endforeach
@endif @endif
@include('partials.navigation_option', ['option' => 'settings'])
</ul> </ul>
</div> </div>
<!-- /#left-sidebar-wrapper --> <!-- /#left-sidebar-wrapper -->

View File

@ -0,0 +1,27 @@
<li class="{{ Request::is("{$option}*") ? 'active' : '' }}">
@if ($option == 'settings')
<a type="button" class="btn btn-default btn-sm pull-right"
href="{{ Utils::getDocsUrl(request()->path()) }}" target="_blank">
<i class="fa fa-question-circle" style="width:20px" title="{{ trans('texts.help') }}"></i>
</a>
@elseif (Auth::user()->can('create', substr($option, 0, -1)))
<a type="button" class="btn btn-primary btn-sm pull-right"
href="{{ url("/{$option}/create") }}">
<i class="fa fa-plus-circle" style="width:20px" title="{{ trans('texts.create_new') }}"></i>
</a>
@endif
<a href="{{ url($option == 'recurring' ? 'recurring_invoice' : $option) }}"
style="font-size:16px; padding-top:6px; padding-bottom:6px"
class="{{ Request::is("{$option}*") ? 'active' : '' }}">
<i class="fa fa-{{ empty($icon) ? \App\Models\EntityModel::getIcon($option) : $icon }}" style="width:46px; padding-right:10px"></i>
{{ ($option == 'recurring_invoices') ? trans('texts.recurring') : trans("texts.{$option}") }}
{!! Utils::isTrial() && in_array($option, ['quotes', 'tasks', 'expenses', 'vendors']) ? '&nbsp;<sup>' . trans('texts.pro') . '</sup>' : '' !!}
</a>
</li>