Skip to content
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
3 changes: 1 addition & 2 deletions assets/css/admin.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/admin.min.css

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions assets/css/public.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions assets/css/public.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/admin.min.js

Large diffs are not rendered by default.

56 changes: 56 additions & 0 deletions assets/src/_tsml-jquery-ui.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
$selected: #1980ec;
$border-radius: 4px;
$shadow: 0 6px 12px rgba(0, 0, 0, 0.175);

.ui-autocomplete {
font-size: 0.9rem;
min-width: 270px;
font-family: inherit;
border-radius: $border-radius;
box-shadow: $shadow;
max-height: 50vh;
overflow-y: auto;
li.ui-menu-item {
padding: 0;
.ui-menu-item-wrapper {
padding: 0.25rem 1rem;
}
.ui-state-active {
background-color: $selected;
color: #fff;
}
}
&.ui-front {
z-index: 1000;
}
}

.ui-autocomplete-category {
border-bottom: 1px solid #ccc;
font-size: 0.8em;
font-weight: bold;
margin: 10px 0px 0px 0px;
padding: 6px 20px;
text-transform: uppercase;
}

.ui-autocomplete-highlight {
font-weight: bold !important;
}

.ui-timepicker-wrapper {
font-size: 0.9rem;
max-height: 25vh;
min-width: 200px;
border-radius: $border-radius;
box-shadow: $shadow;
ul.ui-timepicker-list {
li {
padding: 0.25rem 1rem;
}
.ui-timepicker-selected {
background-color: $selected;
color: #fff;
}
}
}
2 changes: 2 additions & 0 deletions assets/src/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jQuery(function ($) {
approximate: $form.find('input#approximate'),
latitude: $form.find('input[name=latitude]'),
longitude: $form.find('input[name=longitude]'),
timezone: $form.find('select[name=timezone]'),
group: $form.find('input#group'),
group_notes: $form.find('textarea[name=group_notes]'),
group_status: $form.find('input[name="group_status"]'),
Expand Down Expand Up @@ -274,6 +275,7 @@ jQuery(function ($) {
$fields.longitude.val(location.longitude);
$('select[name=region] option[value=' + location.region + ']').prop('selected', true);
$fields.location_notes.val(location.notes);
$fields.timezone.val(location.timezone);
}
});
});
Expand Down
10 changes: 9 additions & 1 deletion assets/src/admin.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import 'tsml-jquery-ui.css';
@import 'tsml-jquery-ui';

body {
//import & settings
Expand Down Expand Up @@ -28,5 +28,13 @@ body {
}
}

select {
optgroup {
font-size: 1rem;
}
option {
font-size: 0.9rem;
}
}

}
1 change: 1 addition & 0 deletions assets/src/jquery-ui.css
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@
.ui-menu .ui-menu-item {
margin: 0;
cursor: pointer;
padding: 5px;
/* support: IE10, see #8844 */
list-style-image: url('data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7');
}
Expand Down
6 changes: 5 additions & 1 deletion assets/src/public.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import 'mixins/breakpoints';
@import 'jquery-ui.css';
@import 'tsml-jquery-ui.css';
@import 'tsml-jquery-ui';

$icon_font_path: '../fonts/'; //bootstrap
$color_gray: #aaa;
Expand Down Expand Up @@ -295,6 +295,10 @@ $online_img: 'https://images.unsplash.com/photo-1588196749597-9ff075ee6b5b?crop=
}
}

&.dropdown-menu {
z-index: 1010;
}

&.dropdown-menu-right {
max-width: none;
}
Expand Down
24 changes: 0 additions & 24 deletions assets/src/tsml-jquery-ui.css

This file was deleted.

14 changes: 10 additions & 4 deletions includes/admin_meeting.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
return $title;
});


// move author meta box to right side
add_action('do_meta_boxes', function () {
remove_meta_box('authordiv', 'tsml_meeting', 'normal');
Expand All @@ -32,7 +31,6 @@
$tsml_version = get_option('tsml_version');
if (version_compare($tsml_version, TSML_VERSION, '<')) {


// do this every time
update_option('tsml_version', TSML_VERSION);
flush_rewrite_rules();
Expand Down Expand Up @@ -214,7 +212,7 @@ class="checkboxes<?php if (!empty($tsml_types_in_use) && count($tsml_types_in_us
'location',
__('Location Information', '12-step-meeting-list'),
function () {
global $tsml_timezone, $tsml_user_interface;
global $tsml_timezone, $tsml_user_interface, $post;
$meeting = tsml_get_meeting();
$location = $meetings = [];
if ($meeting->post_parent) {
Expand Down Expand Up @@ -332,7 +330,15 @@ function () {
<label for="timezone">
<?php esc_html_e('Timezone', '12-step-meeting-list') ?>
</label>
<?php tsml_timezone_select(@$location->timezone) ?>
<?php
$timezone = null;
if ($location && $location->timezone) {
$timezone = $location->timezone;
} elseif ($post && 'auto-draft' === $post->post_status) {
$timezone = $tsml_timezone;
}
tsml_timezone_select($timezone)
?>
</div>

<?php if (empty($location->timezone) && empty($tsml_timezone) && $tsml_user_interface === 'tsml_ui') { ?>
Expand Down
26 changes: 10 additions & 16 deletions includes/admin_settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -467,24 +467,18 @@ function tsml_settings_page()
<h2>
<?php esc_html_e('Timezone', '12-step-meeting-list') ?>
</h2>
<?php if ($tsml_user_interface === 'tsml_ui') { ?>
<p>
<?php esc_html_e('If your site features meetings in a variety of timezones, leave this blank and meetings will be displayed in the user\'s timezone. This requires a timezone to be set on each meeting location.', '12-step-meeting-list') ?>
</p>
<p>
<?php esc_html_e('If your site features meetings in a variety of timezones, leave this blank and meetings will be displayed in the user\'s timezone. This requires a timezone to be set on each meeting location.', '12-step-meeting-list') ?>
</p>

<p>
<?php esc_html_e('If your site features meetings in a single timezone, select it here and meetings will be displayed in that timezone. There is no need to specify a timezone for each meeting.', '12-step-meeting-list') ?>
</p>
<p>
<?php esc_html_e('If your site features meetings in a single timezone, select it here and meetings will be displayed in that timezone. There is no need to specify a timezone for each meeting.', '12-step-meeting-list') ?>
</p>

<form method="post" onchange="this.submit()">
<?php wp_nonce_field($tsml_nonce, 'tsml_nonce', false) ?>
<?php tsml_timezone_select($tsml_timezone) ?>
</form>
<?php } else { ?>
<p>
<?php esc_html_e('Timezone settings are only relevant to the TSML UI interface.', '12-step-meeting-list') ?>
</p>
<?php } ?>
<form method="post" onchange="this.submit()">
<?php wp_nonce_field($tsml_nonce, 'tsml_nonce', false) ?>
<?php tsml_timezone_select($tsml_timezone) ?>
</form>
</div>
</div>

Expand Down
8 changes: 7 additions & 1 deletion includes/functions_get.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,8 @@ function tsml_feedback_url($meeting)
*/
function tsml_get_meetings($arguments = [], $from_cache = true, $full_export = false)
{
global $tsml_cache, $tsml_cache_writable, $tsml_contact_fields, $tsml_contact_display, $tsml_data_sources, $tsml_custom_meeting_fields, $tsml_source_fields_map, $tsml_import_fields, $tsml_entity_fields, $tsml_array_fields;
global $tsml_cache, $tsml_cache_writable, $tsml_contact_fields, $tsml_contact_display, $tsml_data_sources, $tsml_custom_meeting_fields,
$tsml_source_fields_map, $tsml_import_fields, $tsml_entity_fields, $tsml_array_fields, $tsml_timezone;

$tsml_entity = tsml_get_entity();

Expand Down Expand Up @@ -545,6 +546,11 @@ function tsml_get_meetings($arguments = [], $from_cache = true, $full_export = f
$meeting['approximate'] = 'no';
}

// Default timezone to the current set timezone
if (empty($meeting['timezone']) && $tsml_timezone) {
$meeting['timezone'] = $tsml_timezone;
}

// Calculate the attendance option
$meeting['attendance_option'] = tsml_calculate_attendance_option($meeting['types'], $meeting['approximate']);

Expand Down
43 changes: 33 additions & 10 deletions includes/functions_timezone.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,47 @@ function tsml_timezone_is_valid($timezone)
*/
function tsml_timezone_select($selected = null)
{
$continents = [];
foreach (DateTimeZone::listIdentifiers() as $timezone) {
$count_slashes = substr_count($timezone, '/');
if ($count_slashes < 1) {
global $tsml_timezone, $wpdb;
$timezones = DateTimeZone::listIdentifiers();

$used = $wpdb->get_col("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = 'timezone'");
$used[] = $tsml_timezone;
$used = array_filter(array_unique($used));
$used_timezones = [];
foreach ($used as $timezone) {
if (!in_array($timezone, $timezones)) {
continue;
}
list($continent, $city) = explode('/', $timezone, 2);
$used_timezones[$timezone] = str_replace(['_', '/'], [' ', ' - '], $city);
}

$groups = [];
foreach ($timezones as $timezone) {
if (in_array($timezone, $used) || !substr_count($timezone, '/')) {
continue;
}
list($continent, $city) = explode('/', $timezone, 2);
if (!isset($continents[$continent])) {
$continents[$continent] = [];
if (!isset($groups[$continent])) {
$groups[$continent] = [];
}
$continents[$continent][$timezone] = str_replace('_', ' ', str_replace('/', ' - ', $city));
$groups[$continent][$timezone] = str_replace('_', ' ', str_replace('/', ' - ', $city));
}
$continents['UTC'] = ['UTC' => 'UTC'];
$groups['UTC'] = ['UTC' => 'UTC'];
?>
<select name="timezone" id="timezone">
<option value="" <?php selected($timezone, null) ?>></option>
<?php foreach ($continents as $continent => $cities) { ?>
<optgroup label="<?php echo esc_attr($continent) ?>">
<?php if (!empty($used_timezones)) : ?>
<optgroup label="<?php esc_attr_e('Currently In Use', '12-step-meeting-list'); ?>">
<?php foreach ($used_timezones as $timezone => $city) { ?>
<option value="<?php echo esc_attr($timezone) ?>" <?php selected($timezone, $selected) ?>>
<?php echo esc_html($city) ?>
</option>
<?php } ?>
</optgroup>
<?php endif; ?>
<?php foreach ($groups as $group => $cities) { ?>
<optgroup label="<?php echo esc_attr($group) ?>">
<?php foreach ($cities as $timezone => $city) { ?>
<option value="<?php echo esc_attr($timezone) ?>" <?php selected($timezone, $selected) ?>>
<?php echo esc_html($city) ?>
Expand Down
19 changes: 18 additions & 1 deletion package-lock.json

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

3 changes: 3 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,9 @@ Yes, you will need to know the key name of the field. Then include an array in y

== Changelog ==

= 3.19.11 =
* Expanding use of Timezone picker, adding most used at top of list [more info](https://github.com/code4recovery/12-step-meeting-list/issues/1774)

= 3.19.10 =
* Updated "Square Cash" field label to "Cash App" [more info](https://github.com/code4recovery/12-step-meeting-list/issues/1857)

Expand Down