From 13f7676b6b4a0ab6b1a9afa6ed669003847b3ad2 Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Wed, 14 Mar 2018 22:29:12 +0800 Subject: [PATCH] Fixed ... shortening for tables in batteries and vehicles #51 --- .../VehicleManufacturerController.php | 3 ++- templates/battery/form.html.twig | 15 +++++++------ templates/battery/list.html.twig | 21 ++++++++++--------- templates/vehicle/list.html.twig | 2 +- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/Controller/VehicleManufacturerController.php b/src/Controller/VehicleManufacturerController.php index 4802f074..045779af 100644 --- a/src/Controller/VehicleManufacturerController.php +++ b/src/Controller/VehicleManufacturerController.php @@ -281,7 +281,8 @@ class VehicleManufacturerController extends BaseController 'mfg_name' => $vehicle->getManufacturer()->getName(), 'make' => $vehicle->getMake(), 'model_year_from' => $vehicle->getModelYearFrom(), - 'model_year_to' => $vehicle->getModelYearTo() + 'model_year_to' => $vehicle->getModelYearTo(), + 'model_year' => $vehicle->getModelYearFormatted(), ]; } diff --git a/templates/battery/form.html.twig b/templates/battery/form.html.twig index 232b8a41..b0e46cbb 100644 --- a/templates/battery/form.html.twig +++ b/templates/battery/form.html.twig @@ -377,8 +377,7 @@ id: "{{ vehicle.getID }}", mfg_name: "{{ vehicle.getManufacturer.getName }}", make: "{{ vehicle.getMake }}", - model_year_from: "{{ vehicle.getModelYearFrom }}", - model_year_to: "{{ vehicle.getModelYearTo }}" + model_year: "{{ vehicle.getModelYearFormatted }}", }; vehicleRows.push(vrow); @@ -410,7 +409,10 @@ var html = ''; $.each(response.data, function(index, vehicle) { - html += ''; + var model_year = '' + if (vehicle.model_year != "-") + model_year = ' (' + vehicle.model_year + ')'; + html += ''; }); field.html(html).prop('disabled', false); @@ -485,7 +487,7 @@ { field: 'id', title: 'ID', - width: 30 + width: 60 }, { field: 'mfg_name', @@ -496,11 +498,8 @@ title: 'Make' }, { - field: 'model_year_from', + field: 'model_year', title: 'Year', - template: function (data) { - return data.model_year_from + ' - ' + data.model_year_to; - } }, { field: 'Actions', diff --git a/templates/battery/list.html.twig b/templates/battery/list.html.twig index 75ed93ae..71a91514 100644 --- a/templates/battery/list.html.twig +++ b/templates/battery/list.html.twig @@ -101,15 +101,15 @@ width: 150 }, */ - { - field: 'model_name', - title: 'Brand', - width: 150 - }, { field: 'size_name', title: 'Size', - width: 100 + width: 180 + }, + { + field: 'model_name', + title: 'Brand', + width: 120 }, /* { @@ -121,16 +121,17 @@ { field: 'warr_private', title: 'Private Wty.', - width: 170 + width: 50 }, { field: 'warr_commercial', title: 'Commercial Wty.', - width: 170 + width: 50 }, { field: 'sell_price', - title: 'Price' + title: 'Price', + width: 100 }, { field: 'Actions', @@ -188,4 +189,4 @@ }); }); -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/templates/vehicle/list.html.twig b/templates/vehicle/list.html.twig index 58710ce0..da082031 100644 --- a/templates/vehicle/list.html.twig +++ b/templates/vehicle/list.html.twig @@ -78,7 +78,7 @@ { field: 'id', title: 'ID', - width: 30 + width: 60 }, { field: 'mfg_name',