From 5b50abb2c7b47244adf966bb052c629cea9eaeb2 Mon Sep 17 00:00:00 2001 From: James Cole Date: Mon, 6 Jul 2015 08:33:39 +0200 Subject: [PATCH] Bread crumbs and fine tuning. --- app/Http/Controllers/CsvController.php | 17 ++++++++---- app/Http/breadcrumbs.php | 37 ++++++++++++++++++++++++++ resources/lang/en/firefly.php | 8 ++++-- resources/twig/csv/process.twig | 1 + 4 files changed, 56 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/CsvController.php b/app/Http/Controllers/CsvController.php index a5de95072d..3111f23cef 100644 --- a/app/Http/Controllers/CsvController.php +++ b/app/Http/Controllers/CsvController.php @@ -65,7 +65,7 @@ class CsvController extends Controller return Redirect::route('csv.index'); } - $subTitle = trans('firefly.csv_process'); + $subTitle = trans('firefly.csv_define_column_roles'); $firstRow = $this->data->getReader()->fetchOne(); $count = count($firstRow); $headers = []; @@ -131,7 +131,9 @@ class CsvController extends Controller */ public function downloadConfigPage() { - return view('csv.download-config'); + $subTitle = trans('firefly.csv_download_config_title'); + + return view('csv.download-config', compact('subTitle')); } /** @@ -277,8 +279,9 @@ class CsvController extends Controller $values = $this->wizard->getMappableValues($reader, $map, $hasHeaders); $map = $this->data->getMap(); $mapped = $this->data->getMapped(); + $subTitle = trans('firefly.csv_map_values'); - return view('csv.map', compact('map', 'options', 'values', 'mapped')); + return view('csv.map', compact('map', 'options', 'values', 'mapped', 'subTitle')); } /** @@ -316,7 +319,9 @@ class CsvController extends Controller Preferences::mark(); - return view('csv.process', compact('rows', 'errors', 'imported')); + $subTitle = trans('firefly.csv_process_title'); + + return view('csv.process', compact('rows', 'errors', 'imported', 'subTitle')); } @@ -348,7 +353,9 @@ class CsvController extends Controller foreach (Input::get('mapping') as $index => $data) { $mapped[$index] = []; foreach ($data as $value => $mapping) { - $mapped[$index][$value] = $mapping; + if (intval($mapping) !== 0) { + $mapped[$index][$value] = $mapping; + } } } Session::put('csv-mapped', $mapped); diff --git a/app/Http/breadcrumbs.php b/app/Http/breadcrumbs.php index d9991cbf56..d9f64ab902 100644 --- a/app/Http/breadcrumbs.php +++ b/app/Http/breadcrumbs.php @@ -161,6 +161,43 @@ Breadcrumbs::register( } ); +// CSV: +Breadcrumbs::register( + 'csv.index', function (Generator $breadcrumbs) { + $breadcrumbs->parent('home'); + $breadcrumbs->push(trans('firefly.csv_index_title'), route('csv.index')); +} +); + +Breadcrumbs::register( + 'csv.column-roles', function (Generator $breadcrumbs) { + $breadcrumbs->parent('csv.index'); + $breadcrumbs->push(trans('firefly.csv_define_column_roles'), route('csv.column-roles')); +} +); + +Breadcrumbs::register( + 'csv.map', function (Generator $breadcrumbs) { + $breadcrumbs->parent('csv.index'); + $breadcrumbs->push(trans('firefly.csv_map_values'), route('csv.map')); +} +); + +Breadcrumbs::register( + 'csv.download-config-page', function (Generator $breadcrumbs) { + $breadcrumbs->parent('csv.index'); + $breadcrumbs->push(trans('firefly.csv_download_config'), route('csv.download-config-page')); +} +); + +Breadcrumbs::register( + 'csv.process', function (Generator $breadcrumbs) { + $breadcrumbs->parent('csv.index'); + $breadcrumbs->push(trans('firefly.csv_process_title'), route('csv.process')); +} +); + + // currencies. Breadcrumbs::register( 'currency.index', function (Generator $breadcrumbs) { diff --git a/resources/lang/en/firefly.php b/resources/lang/en/firefly.php index c45f5d6ae4..692d534076 100644 --- a/resources/lang/en/firefly.php +++ b/resources/lang/en/firefly.php @@ -23,6 +23,9 @@ return [ 'csv_import' => 'Import CSV file', 'csv' => 'CSV', 'csv_index_title' => 'Upload and import a CSV file', + 'csv_define_column_roles' => 'Define column roles', + 'csv_map_values' => 'Map found values to existing values', + 'csv_download_config' => 'Download CSV configuration file.', 'csv_index_text' => 'This form allows you to import a CSV file with transactions into Firefly. It is based on the excellent CSV importer made by' . ' the folks at Atlassian. Simply upload your CSV file and follow the instructions.' . @@ -56,7 +59,8 @@ return [ 'csv_field_mapped_to' => 'Must be mapped to...', 'csv_download_config_title' => 'Download CSV configuration', 'csv_download_config_text' => 'Everything you\'ve just set up can be downloaded as a configuration file. Click the button to do so.', - 'csv_more_information_text' => 'If the import fails, you can use this configuration file so you don\'t have to start all over again.', + 'csv_more_information_text' => 'If the import fails, you can use this configuration file so you don\'t have to start all over again.' + . ' But, if the import succeeds, it will be easier to upload similar CSV files.', 'csv_do_download_config' => 'Download configuration file.', 'csv_empty_description' => '(empty description)', 'csv_upload_form' => 'CSV upload form', @@ -64,7 +68,7 @@ return [ 'csv_unsupported_map' => 'The importer cannot map the column ":columnRole" to existing values in the database.', 'csv_unsupported_value' => 'The importer does not know how to handle values in columns marked as ":columnRole".', 'csv_cannot_store_value' => 'The importer has not reserved space for columns marked ":columnRole" and will be incapable of processing them.', - 'csv_process_title' => 'CVS import finished', + 'csv_process_title' => 'CVS import finished!', 'csv_process_text' => 'The CVS importer has finished and has imported :rows rows', 'csv_row' => 'Row', 'csv_import_with_errors' => 'There was one error.|There were :errors errors.', diff --git a/resources/twig/csv/process.twig b/resources/twig/csv/process.twig index c45a882d20..b9a4c22221 100644 --- a/resources/twig/csv/process.twig +++ b/resources/twig/csv/process.twig @@ -39,6 +39,7 @@

{{ 'csv_start_over'|_ }} {{ 'csv_to_index'|_ }} + {{ 'csv_do_download_config'|_ }}