diff --git a/app/Http/Controllers/Api/PredefinedKitsController.php b/app/Http/Controllers/Api/PredefinedKitsController.php index 2bc118db38..26ccb50354 100644 --- a/app/Http/Controllers/Api/PredefinedKitsController.php +++ b/app/Http/Controllers/Api/PredefinedKitsController.php @@ -246,7 +246,7 @@ class PredefinedKitsController extends Controller $relation = $kit->models(); if ($relation->find($model_id)) { - return response()->json(Helper::formatStandardApiResponse('error', null, ['model' => 'Model already attached to kit'])); + return response()->json(Helper::formatStandardApiResponse('error', null, ['model' => trans('admin/kits/general.model_already_attached')])); } $relation->attach($model_id, ['quantity' => $quantity]); diff --git a/app/Http/Controllers/Kits/CheckoutKitController.php b/app/Http/Controllers/Kits/CheckoutKitController.php index c75e4ea8f0..bf4f64a8d6 100644 --- a/app/Http/Controllers/Kits/CheckoutKitController.php +++ b/app/Http/Controllers/Kits/CheckoutKitController.php @@ -62,10 +62,10 @@ class CheckoutKitController extends Controller $checkout_result = $this->kitService->checkout($request, $kit, $user); if (Arr::has($checkout_result, 'errors') && count($checkout_result['errors']) > 0) { - return redirect()->back()->with('error', trans('general.checkout_error'))->with('error_messages', $checkout_result['errors']); + return redirect()->back()->with('error', trans('admin/kits/general.checkout_error'))->with('error_messages', $checkout_result['errors']); } - return redirect()->back()->with('success', trans('general.checkout_success')) + return redirect()->back()->with('success', trans('admin/kits/general.checkout_success')) ->with('assets', Arr::get($checkout_result, 'assets', null)) ->with('accessories', Arr::get($checkout_result, 'accessories', null)) ->with('consumables', Arr::get($checkout_result, 'consumables', null)); diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 73358454df..79027547b1 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -48,6 +48,7 @@ class Kernel extends HttpKernel 'api' => [ 'auth:api', + \App\Http\Middleware\CheckLocale::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, ], ]; diff --git a/app/Http/Transformers/AssetsTransformer.php b/app/Http/Transformers/AssetsTransformer.php index d3a19929e1..17693fccf4 100644 --- a/app/Http/Transformers/AssetsTransformer.php +++ b/app/Http/Transformers/AssetsTransformer.php @@ -86,7 +86,7 @@ class AssetsTransformer 'next_audit_date' => Helper::getFormattedDateObject($asset->next_audit_date, 'date'), 'deleted_at' => Helper::getFormattedDateObject($asset->deleted_at, 'datetime'), 'purchase_date' => Helper::getFormattedDateObject($asset->purchase_date, 'date'), - 'age' => $asset->purchase_date ? $asset->purchase_date->diffForHumans() : '', + 'age' => $asset->purchase_date ? $asset->purchase_date->locale(app()->getLocale())->diffForHumans() : '', 'last_checkout' => Helper::getFormattedDateObject($asset->last_checkout, 'datetime'), 'last_checkin' => Helper::getFormattedDateObject($asset->last_checkin, 'datetime'), 'expected_checkin' => Helper::getFormattedDateObject($asset->expected_checkin, 'date'), diff --git a/docker/entrypoint_alpine.sh b/docker/entrypoint_alpine.sh index c1a75b0cbd..d9d6c8a9af 100644 --- a/docker/entrypoint_alpine.sh +++ b/docker/entrypoint_alpine.sh @@ -1,7 +1,48 @@ #!/bin/sh +# Cribbed from nextcloud docker official repo +# https://github.com/nextcloud/docker/blob/master/docker-entrypoint.sh +# usage: file_env VAR [DEFAULT] +# ie: file_env 'XYZ_DB_PASSWORD' 'example' +# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of +# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) +file_env() { + local var="$1" + local fileVar="${var}_FILE" + local def="${2:-}" + local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") + local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") + if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then + echo >&2 "error: both $var and $fileVar are set (but are exclusive)" + exit 1 + fi + if [ -n "${varValue}" ]; then + export "$var"="${varValue}" + elif [ -n "${fileVarValue}" ]; then + export "$var"="$(cat "${fileVarValue}")" + elif [ -n "${def}" ]; then + export "$var"="$def" + fi + unset "$fileVar" +} + +# Add docker secrets support for the variables below: +file_env APP_KEY +file_env DB_HOST +file_env DB_PORT +file_env DB_DATABASE +file_env DB_USERNAME +file_env DB_PASSWORD +file_env REDIS_HOST +file_env REDIS_PASSWORD +file_env REDIS_PORT +file_env MAIL_HOST +file_env MAIL_PORT +file_env MAIL_USERNAME +file_env MAIL_PASSWORD + # fix key if needed -if [ -z "$APP_KEY" ] +if [ -z "$APP_KEY" -a -z "$APP_KEY_FILE" ] then echo "Please re-run this container with an environment variable \$APP_KEY" echo "An example APP_KEY you could use is: " diff --git a/docker/startup.sh b/docker/startup.sh index 62002a2ba0..2f6be7b0f8 100644 --- a/docker/startup.sh +++ b/docker/startup.sh @@ -1,7 +1,48 @@ #!/bin/bash +# Cribbed from nextcloud docker official repo +# https://github.com/nextcloud/docker/blob/master/docker-entrypoint.sh +# usage: file_env VAR [DEFAULT] +# ie: file_env 'XYZ_DB_PASSWORD' 'example' +# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of +# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) +file_env() { + local var="$1" + local fileVar="${var}_FILE" + local def="${2:-}" + local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") + local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") + if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then + echo >&2 "error: both $var and $fileVar are set (but are exclusive)" + exit 1 + fi + if [ -n "${varValue}" ]; then + export "$var"="${varValue}" + elif [ -n "${fileVarValue}" ]; then + export "$var"="$(cat "${fileVarValue}")" + elif [ -n "${def}" ]; then + export "$var"="$def" + fi + unset "$fileVar" +} + +# Add docker secrets support for the variables below: +file_env APP_KEY +file_env DB_HOST +file_env DB_PORT +file_env DB_DATABASE +file_env DB_USERNAME +file_env DB_PASSWORD +file_env REDIS_HOST +file_env REDIS_PASSWORD +file_env REDIS_PORT +file_env MAIL_HOST +file_env MAIL_PORT +file_env MAIL_USERNAME +file_env MAIL_PASSWORD + # fix key if needed -if [ -z "$APP_KEY" ] +if [ -z "$APP_KEY" -a -z "$APP_KEY_FILE" ] then echo "Please re-run this container with an environment variable \$APP_KEY" echo "An example APP_KEY you could use is: " diff --git a/resources/assets/less/overrides.less b/resources/assets/less/overrides.less index 3717dd477a..a6a2347d41 100644 --- a/resources/assets/less/overrides.less +++ b/resources/assets/less/overrides.less @@ -845,18 +845,20 @@ th.css-location > .th-inner::before { } } @media screen and (max-width: 1318px) and (min-width: 1200px){ - .box{ + .admin.box{ height:170px; } } - -.ellipsis { - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; +@media screen and (max-width: 1494px) and (min-width: 1200px){ + .dashboard.small-box{ + white-space: nowrap; + text-overflow: ellipsis; + max-width: 188px; + display: block; + overflow: hidden; + } } - /** Form-stuff overrides for checkboxes and stuff **/ label.form-control { diff --git a/resources/lang/en-US/admin/kits/general.php b/resources/lang/en-US/admin/kits/general.php index f57fb645c4..2b5c2d9cd0 100644 --- a/resources/lang/en-US/admin/kits/general.php +++ b/resources/lang/en-US/admin/kits/general.php @@ -47,4 +47,5 @@ return [ 'kit_deleted' => 'Kit was successfully deleted', 'kit_model_updated' => 'Model was successfully updated', 'kit_model_detached' => 'Model was successfully detached', + 'model_already_attached' => 'Model already attached to kit', ]; diff --git a/resources/lang/en-US/general.php b/resources/lang/en-US/general.php index 42ca4cb962..92091f9d26 100644 --- a/resources/lang/en-US/general.php +++ b/resources/lang/en-US/general.php @@ -426,7 +426,7 @@ return [ 'assets_by_status_type' => 'Assets by Status Type', 'pie_chart_type' => 'Dashboard Pie Chart Type', 'hello_name' => 'Hello, :name!', - 'unaccepted_profile_warning' => 'You have :count items requiring acceptance. Click here to accept or decline them', + 'unaccepted_profile_warning' => 'You have one item requiring acceptance. Click here to accept or decline it | You have :count items requiring acceptance. Click here to accept or decline them', 'start_date' => 'Start Date', 'end_date' => 'End Date', 'alt_uploaded_image_thumbnail' => 'Uploaded thumbnail', @@ -559,5 +559,6 @@ return [ 'expires' => 'Expires', 'map_fields'=> 'Map :item_type Field', 'remaining_var' => ':count Remaining', + 'assets_in_var' => 'Assets in :name :type', ]; diff --git a/resources/views/account/view-assets.blade.php b/resources/views/account/view-assets.blade.php index 6fee346526..a4ffa16ec7 100755 --- a/resources/views/account/view-assets.blade.php +++ b/resources/views/account/view-assets.blade.php @@ -17,7 +17,7 @@ - {{ trans('general.unaccepted_profile_warning', array('count' => $acceptances)) }} + {{ trans_choice('general.unaccepted_profile_warning', $acceptances, ['count' => $acceptances]) }} diff --git a/resources/views/categories/view.blade.php b/resources/views/categories/view.blade.php index 9b361c46c7..72a02bf922 100644 --- a/resources/views/categories/view.blade.php +++ b/resources/views/categories/view.blade.php @@ -3,8 +3,7 @@ {{-- Page title --}} @section('title') - {{ $category->name }} - {{ ucwords($category_type_route) }} +{{ trans('general.assets_in_var', ['name'=> $category->name, 'type' => trans('general.category')]) }} @parent @stop diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php index 40255f88b2..2339122072 100755 --- a/resources/views/dashboard.blade.php +++ b/resources/views/dashboard.blade.php @@ -31,7 +31,7 @@
{{ strtolower(trans('general.assets')) }}
@@ -49,7 +49,7 @@{{ strtolower(trans('general.licenses')) }}
@@ -68,7 +68,7 @@{{ strtolower(trans('general.accessories')) }}
@@ -87,7 +87,7 @@ -{{ strtolower(trans('general.consumables')) }}
@@ -104,7 +104,7 @@{{ strtolower(trans('general.components')) }}
@@ -122,7 +122,7 @@{{ strtolower(trans('general.people')) }}
diff --git a/resources/views/hardware/checkin.blade.php b/resources/views/hardware/checkin.blade.php index efd0502669..12a0627aec 100755 --- a/resources/views/hardware/checkin.blade.php +++ b/resources/views/hardware/checkin.blade.php @@ -132,7 +132,7 @@ :button_label="trans('general.checkin')" :disabled_select="!$asset->model" :options="[ - 'index' => trans('admin/hardware/form.redirect_to_all', ['type' => 'assets']), + 'index' => trans('admin/hardware/form.redirect_to_all', ['type' => trans('general.assets')]), 'item' => trans('admin/hardware/form.redirect_to_type', ['type' => trans('general.asset')]), ]" /> diff --git a/resources/views/hardware/checkout.blade.php b/resources/views/hardware/checkout.blade.php index f91e060368..17b971a5ba 100755 --- a/resources/views/hardware/checkout.blade.php +++ b/resources/views/hardware/checkout.blade.php @@ -180,7 +180,7 @@ :button_label="trans('general.checkout')" :disabled_select="!$asset->model" :options="[ - 'index' => trans('admin/hardware/form.redirect_to_all', ['type' => 'assets']), + 'index' => trans('admin/hardware/form.redirect_to_all', ['type' => trans('general.assets')]), 'item' => trans('admin/hardware/form.redirect_to_type', ['type' => trans('general.asset')]), 'target' => trans('admin/hardware/form.redirect_to_checked_out_to'), diff --git a/resources/views/settings/alerts.blade.php b/resources/views/settings/alerts.blade.php index fc52ae3869..870692f1f5 100644 --- a/resources/views/settings/alerts.blade.php +++ b/resources/views/settings/alerts.blade.php @@ -139,10 +139,6 @@