-
Notifications
You must be signed in to change notification settings - Fork 810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Contact Form: Convert HTML5 date input to text input + jQuery Datepicker #7890
Merged
dereksmart
merged 6 commits into
Automattic:master
from
rclations:update/contact-form-html5-date-fixes
Sep 29, 2017
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
342343a
convert HTML5 date into to text field + jQuery datepicker
rclations 8d4b65a
fixing jquery datepicker year format
rclations 8953c51
removing date input field styles
rclations 862aff4
updating contact form editor view to not use HTML5 date input
rclations fb4dfc9
Contact Form: Update date input class name to be more specific
rclations d33533d
Added Core's native method of localizing jQuery datepicker.
zinigor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,160 +1,161 @@ | ||
.ui-datepicker { | ||
padding: 0; | ||
margin: 0; | ||
-webkit-border-radius: 0; | ||
-moz-border-radius: 0; | ||
border-radius: 0; | ||
background-color: #fff; | ||
border: 1px solid #dfdfdf; | ||
border-top: none; | ||
-webkit-box-shadow: 0 3px 6px rgba(0, 0, 0, 0.075); | ||
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.075); | ||
min-width: 17em; | ||
width: auto; | ||
padding: 0; | ||
margin: 0; | ||
-webkit-border-radius: 0; | ||
-moz-border-radius: 0; | ||
border-radius: 0; | ||
background-color: #fff; | ||
border: 1px solid #dfdfdf; | ||
border-top: none; | ||
-webkit-box-shadow: 0 3px 6px rgba(0, 0, 0, 0.075); | ||
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.075); | ||
min-width: 17em; | ||
width: auto; | ||
} | ||
|
||
.ui-datepicker * { | ||
padding: 0; | ||
-webkit-border-radius: 0; | ||
-moz-border-radius: 0; | ||
border-radius: 0; | ||
padding: 0; | ||
-webkit-border-radius: 0; | ||
-moz-border-radius: 0; | ||
border-radius: 0; | ||
} | ||
|
||
.ui-datepicker table { | ||
font-size: 13px; | ||
margin: 0; | ||
border: none; | ||
border-collapse: collapse; | ||
width: auto; | ||
margin: 0; | ||
border: none; | ||
border-collapse: collapse; | ||
} | ||
|
||
.ui-datepicker .ui-widget-header, | ||
.ui-datepicker .ui-datepicker-header { | ||
background-image: none; | ||
border: none; | ||
font-weight: normal; | ||
background-image: none; | ||
border: none; | ||
font-weight: normal; | ||
} | ||
|
||
.ui-datepicker .ui-datepicker-header .ui-state-hover { | ||
background: transparent; | ||
border-color: transparent; | ||
cursor: pointer; | ||
background: transparent; | ||
border-color: transparent; | ||
cursor: pointer; | ||
} | ||
|
||
.ui-datepicker .ui-datepicker-title { | ||
margin: 0; | ||
padding: 10px 0; | ||
font-size: 14px; | ||
line-height: 14px; | ||
text-align: center; | ||
margin: 0; | ||
padding: 10px 0; | ||
font-size: 14px; | ||
line-height: 14px; | ||
text-align: center; | ||
} | ||
|
||
.ui-datepicker .ui-datepicker-prev, | ||
.ui-datepicker .ui-datepicker-next { | ||
position: relative; | ||
top: 0; | ||
height: 34px; | ||
width: 34px; | ||
position: relative; | ||
top: 0; | ||
height: 34px; | ||
width: 34px; | ||
} | ||
|
||
.ui-datepicker .ui-state-hover.ui-datepicker-prev, | ||
.ui-datepicker .ui-state-hover.ui-datepicker-next { | ||
border: none; | ||
border: none; | ||
} | ||
|
||
.ui-datepicker .ui-datepicker-prev, | ||
.ui-datepicker .ui-datepicker-prev-hover { | ||
left: 0; | ||
left: 0; | ||
} | ||
|
||
.ui-datepicker .ui-datepicker-next, | ||
.ui-datepicker .ui-datepicker-next-hover { | ||
right: 0; | ||
right: 0; | ||
} | ||
|
||
.ui-datepicker .ui-datepicker-next span, | ||
.ui-datepicker .ui-datepicker-prev span { | ||
display: none; | ||
display: none; | ||
} | ||
|
||
.ui-datepicker .ui-datepicker-prev { | ||
float: left; | ||
float: left; | ||
} | ||
|
||
.ui-datepicker .ui-datepicker-next { | ||
float: right; | ||
float: right; | ||
} | ||
|
||
.ui-datepicker .ui-datepicker-prev:before, | ||
.ui-datepicker .ui-datepicker-next:before { | ||
font: normal 20px/34px 'dashicons'; | ||
padding-left: 7px; | ||
speak: none; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
width: 34px; | ||
height: 34px; | ||
font: normal 20px/34px 'dashicons'; | ||
padding-left: 7px; | ||
speak: none; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
width: 34px; | ||
height: 34px; | ||
} | ||
|
||
.ui-datepicker .ui-datepicker-prev:before { | ||
content: '\f341'; | ||
content: '\f341'; | ||
} | ||
|
||
.ui-datepicker .ui-datepicker-next:before { | ||
content: '\f345'; | ||
content: '\f345'; | ||
} | ||
|
||
.ui-datepicker .ui-datepicker-prev-hover:before, | ||
.ui-datepicker .ui-datepicker-next-hover:before { | ||
opacity: 0.7; | ||
opacity: 0.7; | ||
} | ||
|
||
.ui-datepicker select.ui-datepicker-month, | ||
.ui-datepicker select.ui-datepicker-year { | ||
width: 33%; | ||
width: 33%; | ||
} | ||
|
||
.ui-datepicker thead { | ||
font-weight: 600; | ||
font-weight: 600; | ||
} | ||
|
||
.ui-datepicker th { | ||
padding: 10px; | ||
padding: 10px; | ||
border-width: 1px; | ||
} | ||
|
||
.ui-datepicker td { | ||
padding: 0; | ||
border: 1px solid #f4f4f4; | ||
padding: 0; | ||
border: 1px solid #f4f4f4; | ||
} | ||
|
||
.ui-datepicker td.ui-datepicker-other-month { | ||
border: transparent; | ||
border: transparent; | ||
} | ||
|
||
.ui-datepicker td.ui-datepicker-week-end { | ||
background-color: #f4f4f4; | ||
border: 1px solid #f4f4f4; | ||
background-color: #f4f4f4; | ||
border: 1px solid #f4f4f4; | ||
} | ||
|
||
.ui-datepicker td.ui-datepicker-today { | ||
background-color: #f0f0c0; | ||
background-color: #f0f0c0; | ||
} | ||
|
||
.ui-datepicker td.ui-datepicker-current-day { | ||
background: #bbdd88; | ||
background: #bbdd88; | ||
} | ||
|
||
.ui-datepicker td .ui-state-default { | ||
background: transparent; | ||
border: none; | ||
text-align: center; | ||
text-decoration: none; | ||
width: auto; | ||
display: block; | ||
padding: 5px 10px; | ||
font-weight: normal; | ||
color: #444; | ||
background: transparent; | ||
border: none; | ||
text-align: center; | ||
text-decoration: none; | ||
width: auto; | ||
display: block; | ||
padding: 5px 10px; | ||
font-weight: normal; | ||
color: #444; | ||
} | ||
|
||
.ui-datepicker td.ui-state-disabled .ui-state-default { | ||
opacity: 0.5; | ||
opacity: 0.5; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
jQuery( function ( $ ) { | ||
var datefield = $( '.contact-form input[type="date"]' ); | ||
if ( 'function' === typeof $.fn.datepicker && 'text' === datefield[0].type ) { | ||
datefield.datepicker( { dateFormat : 'yyyy-mm-dd' } ); | ||
} | ||
$( '.contact-form input.date' ).datepicker( { dateFormat : 'yy-mm-dd' } ); | ||
} ); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we find a way to scope this better? These are pretty generic classes and it's technically possible (yet unlikely) that there will be another form with the same classes on the same page in a sidebar/widget whatever.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the class to
jp-contact-form-date
.The input class is pulled from the shortcode, so I added a check in
render()
to override the default for date type fields.This could be resolved more elegantly in the future via #5876