From 02aa10e41d22331f1d2dfdca8b2d118559bb75cd Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 9 Nov 2015 16:53:18 +0200 Subject: [PATCH] Corrected form autocomplete behavior --- public/js/built.js | 3 +- public/js/pdf.pdfmake.js | 3 +- resources/views/accounts/details.blade.php | 24 +-- resources/views/clients/edit.blade.php | 3 + resources/views/header.blade.php | 23 ++- resources/views/invoices/edit.blade.php | 15 +- .../views/partials/autocomplete_fix.blade.php | 4 + resources/views/payments/payment.blade.php | 168 +++++++++++------- 8 files changed, 152 insertions(+), 91 deletions(-) create mode 100644 resources/views/partials/autocomplete_fix.blade.php diff --git a/public/js/built.js b/public/js/built.js index 61ab1c94c2c2..7e1ea06b3edf 100644 --- a/public/js/built.js +++ b/public/js/built.js @@ -31628,7 +31628,7 @@ function GetPdfMake(invoice, javascript, callback) { } // only show the footer on the last page - if (key === 'footer') { + if (invoice.is_pro && key === 'footer') { return function(page, pages) { return page === pages ? val : ''; } @@ -31638,6 +31638,7 @@ function GetPdfMake(invoice, javascript, callback) { if (key === 'text') { val = NINJA.parseMarkdownText(val, true); } + /* if (key === 'stack') { val = NINJA.parseMarkdownStack(val); diff --git a/public/js/pdf.pdfmake.js b/public/js/pdf.pdfmake.js index 4a795553b763..fd57a6bf6270 100644 --- a/public/js/pdf.pdfmake.js +++ b/public/js/pdf.pdfmake.js @@ -55,7 +55,7 @@ function GetPdfMake(invoice, javascript, callback) { } // only show the footer on the last page - if (key === 'footer') { + if (invoice.is_pro && key === 'footer') { return function(page, pages) { return page === pages ? val : ''; } @@ -65,6 +65,7 @@ function GetPdfMake(invoice, javascript, callback) { if (key === 'text') { val = NINJA.parseMarkdownText(val, true); } + /* if (key === 'stack') { val = NINJA.parseMarkdownStack(val); diff --git a/resources/views/accounts/details.blade.php b/resources/views/accounts/details.blade.php index d7e669d77652..3d8a0d3f42c4 100644 --- a/resources/views/accounts/details.blade.php +++ b/resources/views/accounts/details.blade.php @@ -18,9 +18,12 @@ - {!! Former::open_for_files()->addClass('warn-on-exit')->rules(array( - 'name' => 'required', - )) !!} + {!! Former::open_for_files() + ->addClass('warn-on-exit') + ->autocomplete('on') + ->rules([ + 'name' => 'required' + ]) !!} {{ Former::populate($account) }} @@ -62,13 +65,14 @@
- {!! Former::text('address1') !!} - {!! Former::text('address2') !!} - {!! Former::text('city') !!} - {!! Former::text('state') !!} - {!! Former::text('postal_code') !!} - {!! Former::select('country_id')->addOption('','') - ->fromQuery($countries, 'name', 'id') !!} + {!! Former::text('address1')->autocomplete('address-line1') !!} + {!! Former::text('address2')->autocomplete('address-line2') !!} + {!! Former::text('city')->autocomplete('address-level2') !!} + {!! Former::text('state')->autocomplete('address-level1') !!} + {!! Former::text('postal_code')->autocomplete('postal-code') !!} + {!! Former::select('country_id') + ->addOption('','') + ->fromQuery($countries, 'name', 'id') !!}
diff --git a/resources/views/clients/edit.blade.php b/resources/views/clients/edit.blade.php index becbfbdd9572..75a17c7a84a5 100644 --- a/resources/views/clients/edit.blade.php +++ b/resources/views/clients/edit.blade.php @@ -14,10 +14,13 @@
{!! Former::open($url) + ->autocomplete('off') ->rules( ['email' => 'email'] )->addClass('col-md-12 warn-on-exit') ->method($method) !!} + + @include('partials.autocomplete_fix') @if ($client) {!! Former::populate($client) !!} diff --git a/resources/views/header.blade.php b/resources/views/header.blade.php index b8d257752ed7..4fb97ca4f0bc 100644 --- a/resources/views/header.blade.php +++ b/resources/views/header.blade.php @@ -539,7 +539,7 @@

- {!! Former::open('signup/submit')->addClass('signUpForm') !!} + {!! Former::open('signup/submit')->addClass('signUpForm')->autocomplete('on') !!} @if (Auth::check()) {!! Former::populateField('new_first_name', Auth::user()->first_name) !!} @@ -580,10 +580,23 @@ @endif {{ Former::setOption('TwitterBootstrap3.labelWidths.large', 1) }} {{ Former::setOption('TwitterBootstrap3.labelWidths.small', 1) }} - {!! Former::text('new_first_name')->placeholder(trans('texts.first_name'))->label(' ') !!} - {!! Former::text('new_last_name')->placeholder(trans('texts.last_name'))->label(' ') !!} - {!! Former::text('new_email')->placeholder(trans('texts.email'))->label(' ') !!} - {!! Former::password('new_password')->placeholder(trans('texts.password'))->label(' ') !!} + + {!! Former::text('new_first_name') + ->placeholder(trans('texts.first_name')) + ->autocomplete('given-name') + ->label(' ') !!} + {!! Former::text('new_last_name') + ->placeholder(trans('texts.last_name')) + ->autocomplete('family-name') + ->label(' ') !!} + {!! Former::text('new_email') + ->placeholder(trans('texts.email')) + ->autocomplete('email') + ->label(' ') !!} + {!! Former::password('new_password') + ->placeholder(trans('texts.password')) + ->label(' ') !!} + {{ Former::setOption('TwitterBootstrap3.labelWidths.large', 4) }} {{ Former::setOption('TwitterBootstrap3.labelWidths.small', 4) }}
diff --git a/resources/views/invoices/edit.blade.php b/resources/views/invoices/edit.blade.php index fa751c0128ed..fd6d654a68cc 100644 --- a/resources/views/invoices/edit.blade.php +++ b/resources/views/invoices/edit.blade.php @@ -30,12 +30,17 @@ @endif - {!! Former::open($url)->method($method)->addClass('warn-on-exit')->rules(array( - 'client' => 'required', - 'invoice_number' => 'required', - 'product_key' => 'max:255' - )) !!} + {!! Former::open($url) + ->method($method) + ->addClass('warn-on-exit') + ->autocomplete('off') + ->rules(array( + 'client' => 'required', + 'invoice_number' => 'required', + 'product_key' => 'max:255' + )) !!} + @include('partials.autocomplete_fix') diff --git a/resources/views/partials/autocomplete_fix.blade.php b/resources/views/partials/autocomplete_fix.blade.php new file mode 100644 index 000000000000..ec3f8c5cdb9b --- /dev/null +++ b/resources/views/partials/autocomplete_fix.blade.php @@ -0,0 +1,4 @@ + +
+ +
\ No newline at end of file diff --git a/resources/views/payments/payment.blade.php b/resources/views/payments/payment.blade.php index 5bd3fe442a0e..7db903be5399 100644 --- a/resources/views/payments/payment.blade.php +++ b/resources/views/payments/payment.blade.php @@ -133,21 +133,23 @@ header h3 em { -{!! Former::vertical_open($url)->rules(array( -'first_name' => 'required', -'last_name' => 'required', -'card_number' => 'required', -'expiration_month' => 'required', -'expiration_year' => 'required', -'cvv' => 'required', -'address1' => 'required', -'city' => 'required', -'state' => 'required', -'postal_code' => 'required', -'country_id' => 'required', -'phone' => 'required', -'email' => 'required|email' -)) !!} +{!! Former::vertical_open($url) + ->autocomplete('on') + ->rules(array( + 'first_name' => 'required', + 'last_name' => 'required', + 'card_number' => 'required', + 'expiration_month' => 'required', + 'expiration_year' => 'required', + 'cvv' => 'required', + 'address1' => 'required', + 'city' => 'required', + 'state' => 'required', + 'postal_code' => 'required', + 'country_id' => 'required', + 'phone' => 'required', + 'email' => 'required|email' + )) !!} @if ($client) {{ Former::populate($client) }} @@ -191,16 +193,25 @@ header h3 em {

{{ trans('texts.contact_information') }}

- {!! Former::text('first_name')->placeholder(trans('texts.first_name'))->label('') !!} + {!! Former::text('first_name') + ->placeholder(trans('texts.first_name')) + ->autocomplete('given-name') + ->label('') !!}
- {!! Former::text('last_name')->placeholder(trans('texts.last_name'))->label('') !!} + {!! Former::text('last_name') + ->placeholder(trans('texts.last_name')) + ->autocomplete('family-name') + ->label('') !!}
@if (isset($paymentTitle))
- {!! Former::text('email')->placeholder(trans('texts.email'))->label('') !!} + {!! Former::text('email') + ->placeholder(trans('texts.email')) + ->autocomplete('email') + ->label('') !!}
@endif @@ -211,26 +222,45 @@ header h3 em {

{{ trans('texts.billing_address') }}  {{ trans('texts.payment_footer1') }}

- {!! Former::text('address1')->placeholder(trans('texts.address1'))->label('') !!} + {!! Former::text('address1') + ->autocomplete('address-line1') + ->placeholder(trans('texts.address1')) + ->label('') !!}
- {!! Former::text('address2')->placeholder(trans('texts.address2'))->label('') !!} -
-
-
-
- {!! Former::text('city')->placeholder(trans('texts.city'))->label('') !!} -
-
- {!! Former::text('state')->placeholder(trans('texts.state'))->label('') !!} + {!! Former::text('address2') + ->autocomplete('address-line2') + ->placeholder(trans('texts.address2')) + ->label('') !!}
- {!! Former::text('postal_code')->placeholder(trans('texts.postal_code'))->label('') !!} + {!! Former::text('city') + ->autocomplete('address-level2') + ->placeholder(trans('texts.city')) + ->label('') !!}
- {!! Former::select('country_id')->placeholder(trans('texts.country_id'))->fromQuery($countries, 'name', 'id')->label('')->addGroupClass('country-select') !!} + {!! Former::text('state') + ->autocomplete('address-level1') + ->placeholder(trans('texts.state')) + ->label('') !!} +
+
+
+
+ {!! Former::text('postal_code') + ->autocomplete('postal-code') + ->placeholder(trans('texts.postal_code')) + ->label('') !!} +
+
+ {!! Former::select('country_id') + ->placeholder(trans('texts.country_id')) + ->fromQuery($countries, 'name', 'id') + ->addGroupClass('country-select') + ->label('') !!}
@@ -240,43 +270,53 @@ header h3 em {

{{ trans('texts.billing_method') }}

- {!! Former::text('card_number')->placeholder(trans('texts.card_number'))->label('') !!} + {!! Former::text('card_number') + ->placeholder(trans('texts.card_number')) + ->autocomplete('cc-number') + ->label('') !!}
- {!! Former::text('cvv')->placeholder(trans('texts.cvv'))->label('') !!} + {!! Former::text('cvv') + ->placeholder(trans('texts.cvv')) + ->autocomplete('off') + ->label('') !!}
- {!! Former::select('expiration_month')->placeholder(trans('texts.expiration_month')) - ->addOption('01 - January', '1') - ->addOption('02 - February', '2') - ->addOption('03 - March', '3') - ->addOption('04 - April', '4') - ->addOption('05 - May', '5') - ->addOption('06 - June', '6') - ->addOption('07 - July', '7') - ->addOption('08 - August', '8') - ->addOption('09 - September', '9') - ->addOption('10 - October', '10') - ->addOption('11 - November', '11') - ->addOption('12 - December', '12')->label('') - !!} + {!! Former::select('expiration_month') + ->autocomplete('cc-exp-month') + ->placeholder(trans('texts.expiration_month')) + ->addOption('01 - January', '1') + ->addOption('02 - February', '2') + ->addOption('03 - March', '3') + ->addOption('04 - April', '4') + ->addOption('05 - May', '5') + ->addOption('06 - June', '6') + ->addOption('07 - July', '7') + ->addOption('08 - August', '8') + ->addOption('09 - September', '9') + ->addOption('10 - October', '10') + ->addOption('11 - November', '11') + ->addOption('12 - December', '12')->label('') + !!}
- {!! Former::select('expiration_year')->placeholder(trans('texts.expiration_year')) - ->addOption('2015', '2015') - ->addOption('2016', '2016') - ->addOption('2017', '2017') - ->addOption('2018', '2018') - ->addOption('2019', '2019') - ->addOption('2020', '2020') - ->addOption('2021', '2021') - ->addOption('2022', '2022') - ->addOption('2023', '2023') - ->addOption('2024', '2024') - ->addOption('2025', '2025')->label('') - !!} + {!! Former::select('expiration_year') + ->autocomplete('cc-exp-year') + ->placeholder(trans('texts.expiration_year')) + ->addOption('2015', '2015') + ->addOption('2016', '2016') + ->addOption('2017', '2017') + ->addOption('2018', '2018') + ->addOption('2019', '2019') + ->addOption('2020', '2020') + ->addOption('2021', '2021') + ->addOption('2022', '2022') + ->addOption('2023', '2023') + ->addOption('2024', '2024') + ->addOption('2025', '2025')->label('') + !!}
@@ -322,16 +362,6 @@ header h3 em {
- - {!! Former::close() !!}