Skip to content

Commit

Permalink
Added datepicker filters for customization.
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottDeLuzio committed Feb 13, 2019
1 parent d64d9de commit 6766628
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 7 deletions.
44 changes: 43 additions & 1 deletion includes/wcs-scripts-styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,50 @@ function wpcrm_scripts_styles($hook) {
$wpcrm_active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'dashboard';

wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'datepicker' );
wp_enqueue_script( 'wp-crm-system-datepicker', WP_CRM_SYSTEM_PLUGIN_DIR . '/js/datepicker.js', array( 'jquery' ), WP_CRM_SYSTEM_VERSION );
wp_enqueue_script( 'jquery-ui-datepicker' );
wp_localize_script( 'wp-crm-system-datepicker', 'wpcrm_system_datepicker_vars', array(
'append_text' => apply_filters( 'wpcrm_system_datepicker_append_text', '' ),
'auto_size' => apply_filters( 'wpcrm_system_datepicker_auto_size', false ),
'button_image' => apply_filters( 'wpcrm_system_datepicker_button_image', '' ),
'button_image_only' => apply_filters( 'wpcrm_system_datepicker_button_image_only', false ),
'change_month' => apply_filters( 'wpcrm_system_datepicker_change_month', true ),
'change_year' => apply_filters( 'wpcrm_system_datepicker_change_year', true ),
'close_text' => apply_filters( 'wpcrm_system_datepicker_close_text', 'Done' ),
'constrain_input' => apply_filters( 'wpcrm_system_datepicker_constrain_input', true ),
'current_text' => apply_filters( 'wpcrm_system_datepicker_current_text', 'Today' ),
'date_format' => apply_filters( 'wpcrm_system_datepicker_date_format', get_option( 'wpcrm_system_date_format' ) ),
'day_names' => apply_filters( 'wpcrm_system_datepicker_day_names', array( 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ) ),
'day_names_min' => apply_filters( 'wpcrm_system_datepicker_day_names_min', array( 'Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa' ) ),
'day_names_short' => apply_filters( 'wpcrm_system_datepicker_day_names_short', array( 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ) ),
'default_date' => apply_filters( 'wpcrm_system_datepicker_default_date', null ),
'duration' => apply_filters( 'wpcrm_system_datepicker_duration', 'normal' ),
'first_day' => apply_filters( 'wpcrm_system_datepicker_first_day', 0 ),
'go_to_current' => apply_filters( 'wpcrm_system_datepicker_go_to_current', false ),
'hide_if_no_prev_next' => apply_filters( 'wpcrm_system_datepicker_hide_if_no_prev_next', false ),
'is_rtl' => apply_filters( 'wpcrm_system_datepicker_is_rtl', false ),
'max_date' => apply_filters( 'wpcrm_system_datepicker_max_date', null ),
'min_date' => apply_filters( 'wpcrm_system_datepicker_min_date', null ),
'month_names' => apply_filters( 'wpcrm_system_datepicker_month_names', array( 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ) ),
'month_names_short' => apply_filters( 'wpcrm_system_datepicker_month_names_short', array( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ) ),
'navigation_as_date_format' => apply_filters( 'wpcrm_system_datepicker_navigation_as_date_format', false ),
'next_text' => apply_filters( 'wpcrm_system_datepicker_next_text', 'Next' ),
'number_of_months' => apply_filters( 'wpcrm_system_datepicker_number_of_months', array( 1, 1 ) ),
'prev_text' => apply_filters( 'wpcrm_system_datepicker_prevText', 'Prev' ),
'select_other_months' => apply_filters( 'wpcrm_system_datepicker_select_other_months', false ),
'short_year_cutoff' => apply_filters( 'wpcrm_system_datepicker_short_year_cutoff', '+10' ),
'show_anim' => apply_filters( 'wpcrm_system_datepicker_show_anim', 'show' ),
'show_button_panel' => apply_filters( 'wpcrm_system_datepicker_show_button_panel', false ),
'show_current_at_pos' => apply_filters( 'wpcrm_system_datepicker_show_current_at_pos', 0 ),
'show_month_after_year' => apply_filters( 'wpcrm_system_datepicker_show_month_after_year', false ),
'show_on' => apply_filters( 'wpcrm_system_datepicker_show_on', 'focus' ),
'show_other_months' => apply_filters( 'wpcrm_system_datepicker_show_other_months', false ),
'show_week' => apply_filters( 'wpcrm_system_datepicker_show_week', false ),
'step_months' => apply_filters( 'wpcrm_system_datepicker_step_months', 1 ),
'week_header' => apply_filters( 'wpcrm_system_datepicker_week_header', 'Wk' ),
'year_range' => apply_filters( 'wpcrm_system_datepicker_year_range', '1900:2100' ),
'year_suffix' => apply_filters( 'wpcrm_system_datepicker_year_suffix', '' ),
));

wp_register_style( 'jquery-ui-datepicker', WP_CRM_SYSTEM_PLUGIN_URL . '/css/jquery-ui.min.css' );
wp_enqueue_style( 'jquery-ui-datepicker' );
Expand Down
41 changes: 40 additions & 1 deletion js/datepicker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
jQuery(document).ready(function() {
jQuery('.datepicker').datepicker({
dateFormat : 'dd-mm-yy'
appendText: wpcrm_system_datepicker_vars.append_text,
autoSize: wpcrm_system_datepicker_vars.auto_size,
buttonImage: wpcrm_system_datepicker_vars.button_image,
buttonImageOnly: wpcrm_system_datepicker_vars.button_image_only,
changeMonth: wpcrm_system_datepicker_vars.change_month,
changeYear: wpcrm_system_datepicker_vars.change_year,
closeText: wpcrm_system_datepicker_vars.close_text,
constrainInput: wpcrm_system_datepicker_vars.constrain_input,
currentText: wpcrm_system_datepicker_vars.current_text,
dateFormat: wpcrm_system_datepicker_vars.date_format,
dayNames: wpcrm_system_datepicker_vars.day_names,
dayNamesMin: wpcrm_system_datepicker_vars.day_names_min,
dayNamesShort: wpcrm_system_datepicker_vars.day_names_short,
defaultDate: wpcrm_system_datepicker_vars.default_date,
duration: wpcrm_system_datepicker_vars.duration,
firstDay: wpcrm_system_datepicker_vars.first_day,
gotoCurrent: wpcrm_system_datepicker_vars.go_to_current,
hideIfNoPrevNext: wpcrm_system_datepicker_vars.hide_if_no_prev_next,
isRTL: wpcrm_system_datepicker_vars.is_rtl,
maxDate: wpcrm_system_datepicker_vars.max_date,
minDate: wpcrm_system_datepicker_vars.min_date,
monthNames: wpcrm_system_datepicker_vars.month_names,
monthNamesShort: wpcrm_system_datepicker_vars.month_names_short,
navigationAsDateFormat: wpcrm_system_datepicker_vars.navigation_as_date_format,
nextText: wpcrm_system_datepicker_vars.next_text,
numberOfMonths: wpcrm_system_datepicker_vars.number_of_months,
prevText: wpcrm_system_datepicker_vars.prev_text,
selectOtherMonths: wpcrm_system_datepicker_vars.select_other_months,
shortYearCutoff: wpcrm_system_datepicker_vars.short_year_cutoff,
showAnim: wpcrm_system_datepicker_vars.show_anim,
showButtonPanel: wpcrm_system_datepicker_vars.show_button_panel,
showCurrentAtPos: wpcrm_system_datepicker_vars.show_current_at_pos,
showMonthAfterYear: wpcrm_system_datepicker_vars.show_month_after_year,
showOn: wpcrm_system_datepicker_vars.show_on,
showOtherMonths: wpcrm_system_datepicker_vars.show_other_months,
showWeek: wpcrm_system_datepicker_vars.show_week,
stepMonths: wpcrm_system_datepicker_vars.step_months,
weekHeader: wpcrm_system_datepicker_vars.week_header,
yearRange: wpcrm_system_datepicker_vars.year_range,
yearSuffix: wpcrm_system_datepicker_vars.year_suffix
});
});
8 changes: 5 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: scott.deluzio
Tags: WordPress CRM, Free CRM for WordPress, CRM, Free WordPress CRM, CRM for WordPress, gdpr
Requires at least: 3.3.0
Tested up to: 5.0.3
Stable tag: 2.6.5
Stable tag: 2.6.6
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -92,6 +92,8 @@ Absolutely. There are inexpensive extensions that allow you to import as little
Your data is only accessible through the WordPress CRM dashboard. None of it will be accessible through the public facing portion of your website unless you are using our GDPR features (see above). This allows you to provide access to as few or as many people as you need to.

== Changelog ==
= 2.6.6 =
* Added the ability to customize the datepicker via developer filters. See documentation for more details on how to modify the datepicker.
= 2.6.5 =
* Updated the WPCRM_System_Create class to include custom file fields, which have been introduced in the Custom Fields add-on.
= 2.6.4 =
Expand Down Expand Up @@ -333,5 +335,5 @@ Your data is only accessible through the WordPress CRM dashboard. None of it wil
* Initial Release

== Upgrade Notice ==
= 2.6.5 =
* Updated the WPCRM_System_Create class to include custom file fields, which have been introduced in the Custom Fields add-on.
= 2.6.6 =
* Added the ability to customize the datepicker via developer filters. See documentation for more details on how to modify the datepicker.
4 changes: 2 additions & 2 deletions wp-crm-system.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: WP-CRM System
Plugin URI: https://www.wp-crm.com
Description: A complete CRM for WordPress
Version: 2.6.5
Version: 2.6.6
Author: Scott DeLuzio
Author URI: https://www.wp-crm.com
Text Domain: wp-crm-system
Expand Down Expand Up @@ -34,7 +34,7 @@ function wp_crm_plugin_init() {
define( 'WP_CRM_SYSTEM', __FILE__ );
}
if ( ! defined( 'WP_CRM_SYSTEM_VERSION' ) ) {
define( 'WP_CRM_SYSTEM_VERSION', '2.6.5' );
define( 'WP_CRM_SYSTEM_VERSION', '2.6.6' );
}
if( ! defined( 'WP_CRM_SYSTEM_URL' ) ) {
define( 'WP_CRM_SYSTEM_URL', plugins_url( '', __FILE__ ) );
Expand Down

0 comments on commit 6766628

Please sign in to comment.