mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
CRUD
This commit is contained in:
parent
954c04c917
commit
338f3f0c7f
@ -32,7 +32,7 @@ class $CLASS$ extends BaseController
|
||||
return view('list_wrapper', [
|
||||
'entityType' => '$LOWER_NAME$',
|
||||
'datatable' => new $STUDLY_NAME$Datatable(),
|
||||
'title' => trans('texts.$LOWER_NAME$'),
|
||||
'title' => mtrans('$LOWER_NAME$', '$LOWER_NAME$_list'),
|
||||
]);
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ class $CLASS$ extends BaseController
|
||||
'$LOWER_NAME$' => null,
|
||||
'method' => 'POST',
|
||||
'url' => '$LOWER_NAME$',
|
||||
'title' => trans('texts.new_$LOWER_NAME$'),
|
||||
'title' => mtrans('$LOWER_NAME$', 'new_$LOWER_NAME$'),
|
||||
];
|
||||
|
||||
return view('$LOWER_NAME$::edit', $data);
|
||||
@ -73,7 +73,7 @@ class $CLASS$ extends BaseController
|
||||
$$LOWER_NAME$ = $this->$LOWER_NAME$Repo->save($request->input());
|
||||
|
||||
return redirect()->to($$LOWER_NAME$->present()->editUrl)
|
||||
->with('message', trans('texts.created_$LOWER_NAME$'));
|
||||
->with('message', mtrans('$LOWER_NAME$', 'created_$LOWER_NAME$'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -88,7 +88,7 @@ class $CLASS$ extends BaseController
|
||||
'$LOWER_NAME$' => $$LOWER_NAME$,
|
||||
'method' => 'PUT',
|
||||
'url' => '$LOWER_NAME$/' . $$LOWER_NAME$->public_id,
|
||||
'title' => trans('texts.edit_$LOWER_NAME$'),
|
||||
'title' => mtrans('$LOWER_NAME$', 'edit_$LOWER_NAME$'),
|
||||
];
|
||||
|
||||
return view('$LOWER_NAME$::edit', $data);
|
||||
@ -113,7 +113,7 @@ class $CLASS$ extends BaseController
|
||||
$$LOWER_NAME$ = $this->$LOWER_NAME$Repo->save($request->input(), $request->entity());
|
||||
|
||||
return redirect()->to($$LOWER_NAME$->present()->editUrl)
|
||||
->with('message', trans('texts.updated_$LOWER_NAME$'));
|
||||
->with('message', mtrans('$LOWER_NAME$', 'updated_$LOWER_NAME$'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -126,6 +126,6 @@ class $CLASS$ extends BaseController
|
||||
$count = $this->$LOWER_NAME$Repo->bulk($ids, $action);
|
||||
|
||||
return redirect()->to('$LOWER_NAME$')
|
||||
->with('message', trans('texts.' . $action . '_$LOWER_NAME$_complete'));
|
||||
->with('message', mtrans('$LOWER_NAME$', $action . '_$LOWER_NAME$_complete'));
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ class $CLASS$Datatable extends EntityDatatable
|
||||
{
|
||||
return [
|
||||
[
|
||||
trans('texts.edit_$LOWER_NAME$'),
|
||||
mtrans('$LOWER_NAME$', 'edit_$LOWER_NAME$'),
|
||||
function ($model) {
|
||||
return URL::to("$LOWER_NAME$/{$model->public_id}/edit");
|
||||
},
|
||||
|
@ -3,6 +3,15 @@
|
||||
$LANG = array(
|
||||
|
||||
'$LOWER_NAME$' => '$STUDLY_NAME$',
|
||||
'$LOWER_NAME$_list' => '$STUDLY_NAME$ List',
|
||||
'archive_$LOWER_NAME$' => 'Archive $STUDLY_NAME$',
|
||||
'delete_$LOWER_NAME$' => 'Delete $STUDLY_NAME$',
|
||||
'edit_$LOWER_NAME$' => 'Edit $STUDLY_NAME$',
|
||||
'restore_$LOWER_NAME$' => 'Restore $STUDLY_NAME$',
|
||||
'new_$LOWER_NAME$' => 'New $STUDLY_NAME$',
|
||||
'created_$LOWER_NAME$' => 'Successfully created $LOWER_NAME$',
|
||||
'updated_$LOWER_NAME$' => 'Successfully updated $LOWER_NAME$',
|
||||
|
||||
);
|
||||
|
||||
return $LANG;
|
||||
|
@ -910,8 +910,12 @@ if (!defined('CONTACT_EMAIL')) {
|
||||
}
|
||||
|
||||
// include modules in translations
|
||||
function mtrans($entityType, $text)
|
||||
function mtrans($entityType, $text = false)
|
||||
{
|
||||
if ( ! $text) {
|
||||
$text = $entityType;
|
||||
}
|
||||
|
||||
if ( ! Utils::isNinjaProd() && $module = Module::find($entityType)) {
|
||||
return trans("{$module->getLowerName()}::texts.{$text}");
|
||||
} else {
|
||||
|
@ -108,7 +108,13 @@ class AppServiceProvider extends ServiceProvider
|
||||
if ($crumb == 'company') {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ( ! Utils::isNinjaProd() && $module = \Module::find($crumb)) {
|
||||
$name = mtrans($crumb);
|
||||
} else {
|
||||
$name = trans("texts.$crumb");
|
||||
}
|
||||
|
||||
if ($i==count($crumbs)-1) {
|
||||
$str .= "<li class='active'>$name</li>";
|
||||
} else {
|
||||
|
@ -117,16 +117,16 @@ class DatatableService
|
||||
|
||||
if (($datatable->entityType != ENTITY_USER || $model->public_id) && $can_edit) {
|
||||
$dropdown_contents .= "<li><a href=\"javascript:submitForm_{$datatable->entityType}('archive', {$model->public_id})\">"
|
||||
. trans("texts.archive_{$datatable->entityType}") . '</a></li>';
|
||||
. mtrans($datatable->entityType, "archive_{$datatable->entityType}") . '</a></li>';
|
||||
}
|
||||
} else if($can_edit) {
|
||||
$dropdown_contents .= "<li><a href=\"javascript:submitForm_{$datatable->entityType}('restore', {$model->public_id})\">"
|
||||
. trans("texts.restore_{$datatable->entityType}") . '</a></li>';
|
||||
. mtrans($datatable->entityType, "restore_{$datatable->entityType}") . '</a></li>';
|
||||
}
|
||||
|
||||
if (property_exists($model, 'is_deleted') && !$model->is_deleted && $can_edit) {
|
||||
$dropdown_contents .= "<li><a href=\"javascript:submitForm_{$datatable->entityType}('delete', {$model->public_id})\">"
|
||||
. trans("texts.delete_{$datatable->entityType}") . '</a></li>';
|
||||
. mtrans($datatable->entityType, "delete_{$datatable->entityType}") . '</a></li>';
|
||||
}
|
||||
|
||||
if (!empty($dropdown_contents)) {
|
||||
|
@ -18,8 +18,8 @@
|
||||
@endcan
|
||||
|
||||
{!! DropdownButton::normal(trans('texts.archive'))->withContents([
|
||||
['label' => trans('texts.archive_'.$entityType), 'url' => 'javascript:submitForm_'.$entityType.'("archive")'],
|
||||
['label' => trans('texts.delete_'.$entityType), 'url' => 'javascript:submitForm_'.$entityType.'("delete")'],
|
||||
['label' => mtrans($entityType, 'archive_'.$entityType), 'url' => 'javascript:submitForm_'.$entityType.'("archive")'],
|
||||
['label' => mtrans($entityType, 'delete_'.$entityType), 'url' => 'javascript:submitForm_'.$entityType.'("delete")'],
|
||||
])->withAttributes(['class'=>'archive'])->split() !!}
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@
|
||||
@endif
|
||||
|
||||
@if (Auth::user()->can('create', $entityType))
|
||||
{!! Button::primary(trans("texts.new_{$entityType}"))->asLinkTo(url(Utils::pluralizeEntityType($entityType) . '/create/' . (isset($clientId) ? $clientId : '')))->appendIcon(Icon::create('plus-sign')) !!}
|
||||
{!! Button::primary(mtrans($entityType, "new_{$entityType}"))->asLinkTo(url(Utils::pluralizeEntityType($entityType) . '/create/' . (isset($clientId) ? $clientId : '')))->appendIcon(Icon::create('plus-sign')) !!}
|
||||
@endif
|
||||
|
||||
</div>
|
||||
|
@ -20,7 +20,7 @@
|
||||
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') : mtrans($option, $option) }}
|
||||
{{ ($option == 'recurring_invoices') ? trans('texts.recurring') : mtrans($option) }}
|
||||
{!! Utils::isTrial() && in_array($option, ['quotes', 'tasks', 'expenses', 'vendors']) ? ' <sup>' . trans('texts.pro') . '</sup>' : '' !!}
|
||||
</a>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user