Skip to content
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

[new] Flatpickr support #104

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
wpsf.setup_timepickers();
wpsf.setup_datepickers();
wpsf.setup_selects();
wpsf.setup_datetimepickers();

},

/**
Expand Down Expand Up @@ -218,6 +220,18 @@
});
},

/**
* Set up datetimepickers
*/
setup_datetimepickers: function() {

$( '.datetimepicker' ).each( function() {
var datetimepicker_args = $( this ).data( 'datetimepicker' );
flatpickr(this, datetimepicker_args);
} );

},

/**
* Set up selects
*/
Expand Down Expand Up @@ -252,7 +266,7 @@
wpsf.reindex_group( $group );

wpsf.trigger_dynamic_fields();

$row.trigger('wpsfGroupRowAdded', [$row]);

return false;
Expand Down
13 changes: 13 additions & 0 deletions assets/vendor/flatpickr/flatpickr.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions assets/vendor/flatpickr/flatpickr.min.js

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion settings/example-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function wpsf_tabless_settings( $wpsf_settings ) {
'title' => 'Time Picker',
'desc' => 'This is a description.',
'type' => 'time',
'timepicker' => array(), // Array of timepicker options (http://fgelinas.com/code/timepicker).
'timepicker' => array(), // Array of timepicker options (https://web.archive.org/web/20220122113558/https://fgelinas.com/code/timepicker/).
),
array(
'id' => 'date',
Expand All @@ -63,6 +63,15 @@ function wpsf_tabless_settings( $wpsf_settings ) {
'type' => 'date',
'datepicker' => array(), // Array of datepicker options (http://api.jqueryui.com/datepicker/).
),
array(
'id' => 'datetime',
'title' => 'DateTime Picker',
'desc' => 'This is a description.',
'type' => 'datetime',
'datetimepicker' => array(
'enableTime' => true,
), // Array of datetimepicker options (https://flatpickr.js.org/).
),
array(
'id' => 'image_radio',
'title' => 'Select a radio',
Expand Down
Loading