Plugin Directory

Changeset 3035121

Timestamp:
02/13/2024 01:33:54 PM (5 months ago)
Author:
marcbelletre
Message:

v1.4.2

Location:
acf-rrule-field
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • acf-rrule-field/tags/1.4.2/acf-rrule.php

    r3023435 r3035121  
    55Plugin URI: https://github.com/marcbelletre/acf-rrule
    66Description: Create recurring rules with a single ACF field
    7 Version: 1.4.1
     7Version: 1.4.
    88Author: Marc Bellêtre
    99Author URI: https://pixelparfait.fr
     
    4545            // - these will be passed into the field class.
    4646            $this->settings = [
    47                 'version' => '1.4.1',
     47                'version' => '1.4.',
    4848                'url' => plugin_dir_url(__FILE__),
    4949                'path' => plugin_dir_path(__FILE__),
  • acf-rrule-field/tags/1.4.2/assets/js/input.js

    r2497275 r3035121  
    1 (function($){
     1(function{
    22
     3
     4
     5
     6
     7
     8
    39
    4     /**
    5     *  initialize_field
    6     *
    7     *  This function will initialize the $field.
    8     *
    9     *  @date    30/11/17
    10     *  @since   5.6.5
    11     *
    12     *  @param   n/a
    13     *  @return  n/a
    14     */
     10            field.$el.find('.acf-field[data-frequency], .freq-suffix[data-frequency]').each(function () {
     11                if ($(this).data('frequency') != freq) {
     12                    $(this).hide();
     13                } else {
     14                    $(this).show();
     15                }
     16            });
     17        }
    1518
    16     function initialize_field( $field ) {
     19        const selectEndType = function ($input) {
     20            var type = $input.val();
    1721
    18         $field.find('.frequency-select').on('change', function () {
    19             var freq = $(this).val();
     22            field.$el.find('.acf-field[data-end-type]').each(function () {
     23                if ($(this).data('end-type') != type) {
     24                    $(this).hide();
     25                } else {
     26                    $(this).show();
     27                }
     28            });
     29        }
    2030
    21             $field.find('.acf-field[data-frequency], .freq-suffix[data-frequency]').each(function () {
    22                 if ($(this).data('frequency') != freq) {
    23                     $(this).hide();
    24                 } else {
    25                     $(this).show();
    26                 }
    27             });
    28         }).trigger('change');
     31        const selectMonthlyBy = function ($input) {
     32            var parent = $input.closest('.acf-field');
     33            var value = $input.val() ? $input.val() : "''";
    2934
    30         $field.find('.end-type-select').on('change', function () {
    31             var type = $(this).val();
     35            parent.find('.acf-input').addClass('is-disabled');
     36            parent.find('.acf-input[data-monthly-by=' + value + ']').removeClass('is-disabled');
     37        }
    3238
    33             $field.find('.acf-field[data-end-type]').each(function () {
    34                 if ($(this).data('end-type') != type) {
    35                     $(this).hide();
    36                 } else {
    37                     $(this).show();
    38                 }
    39             });
    40         }).trigger('change');
     39        field.$el.find('.frequency-select').on('change', function () {
     40            selectFrequency($(this));
     41        });
    4142
    42         $field.find('.monthly-by-options').on('change', 'input[type=radio]', function () {
    43             var parent = $(this).closest('.acf-field');
     43        field.$el.find('.end-type-select').on('change', function () {
     44            selectEndType($(this));
     45        });
    4446
    45             parent.find('.acf-input').addClass('is-disabled');
    46             parent.find('.acf-input[data-monthly-by=' + $(this).val() + ']').removeClass('is-disabled');
    47         });
     47        field.$el.find('.monthly-by-options').on('change', 'input[type=radio]', function () {
     48);
     49});
    4850
    49     }
     51        selectFrequency(field.$el.find('.frequency-select'));
     52        selectEndType(field.$el.find('.end-type-select'));
     53        selectMonthlyBy(field.$el.find('.monthly-by-options'));
     54    }
    5055
     56
     57
     58
     59
    5160
    52     if( typeof acf.add_action !== 'undefined' ) {
     61    var Field = acf.Field.extend({
     62        type: 'button_group_multiple',
     63        events: {
     64            'click input[type="checkbox"]': 'onClick'
     65        },
     66        $control: function () {
     67            return this.$('.acf-button-group');
     68        },
     69        $input: function () {
     70            return this.$('input:checked');
     71        },
     72        setValue: function (val) {
     73            this.$('input[value="' + val + '"]').prop('checked', true).trigger('change');
     74        },
     75        onClick: function (e, $el) {
     76            var $label = $el.parent('label');
    5377
    54         /*
    55         *  ready & append (ACF5)
    56         *
    57         *  These two events are called when a field element is ready for initizliation.
    58         *  - ready: on page load similar to $(document).ready()
    59         *  - append: on new DOM elements appended via repeater field or other AJAX calls
    60         *
    61         *  @param   n/a
    62         *  @return  n/a
    63         */
     78            // Toggle active class
     79            if ($el.prop('checked')) {
     80                $label.addClass('selected');
     81            } else {
     82                $label.removeClass('selected');
     83            }
     84        }
     85    });
    6486
    65         acf.add_action('ready_field/type=rrule', initialize_field);
    66         acf.add_action('append_field/type=rrule', initialize_field);
    67 
    68 
    69     } else {
    70 
    71         /*
    72         *  acf/setup_fields (ACF4)
    73         *
    74         *  This single event is called when a field element is ready for initialization.
    75         *
    76         *  @param   event       an event object. This can be ignored
    77         *  @param   element     An element which contains the new HTML
    78         *  @return  n/a
    79         */
    80 
    81         $(document).on('acf/setup_fields', function(e, postbox){
    82 
    83             // find all relevant fields
    84             $(postbox).find('.field[data-field_type="rrule"]').each(function(){
    85 
    86                 // initialize
    87                 initialize_field( $(this) );
    88 
    89             });
    90 
    91         });
    92 
    93     }
     87    acf.registerFieldType(Field);
    9488
    9589})(jQuery);
    96 
    97 (function($, undefined){
    98 
    99     var Field = acf.Field.extend({
    100 
    101         type: 'button_group_multiple',
    102 
    103         events: {
    104             'click input[type="checkbox"]': 'onClick'
    105         },
    106 
    107         $control: function(){
    108             return this.$('.acf-button-group');
    109         },
    110 
    111         $input: function(){
    112             return this.$('input:checked');
    113         },
    114 
    115         setValue: function( val ){
    116             this.$('input[value="' + val + '"]').prop('checked', true).trigger('change');
    117         },
    118 
    119         onClick: function( e, $el ){
    120 
    121             // vars
    122             var $label = $el.parent('label');
    123 
    124             // toggle active class
    125             if ($el.prop('checked')) {
    126                 $label.addClass('selected');
    127             } else {
    128                 $label.removeClass('selected');
    129             }
    130         }
    131     });
    132 
    133     acf.registerFieldType( Field );
    134 
    135 })(jQuery);
  • acf-rrule-field/tags/1.4.2/readme.txt

    r3023435 r3035121  
    55Tested up to: 6.3
    66Requires PHP: 7.2
    7 Stable tag: 1.4.1
     7Stable tag: 1.4.
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3131
    3232== Changelog ==
     33
     34
     35
    3336
    3437= 1.4.1 =
  • acf-rrule-field/trunk/acf-rrule.php

    r3023435 r3035121  
    55Plugin URI: https://github.com/marcbelletre/acf-rrule
    66Description: Create recurring rules with a single ACF field
    7 Version: 1.4.1
     7Version: 1.4.
    88Author: Marc Bellêtre
    99Author URI: https://pixelparfait.fr
     
    4545            // - these will be passed into the field class.
    4646            $this->settings = [
    47                 'version' => '1.4.1',
     47                'version' => '1.4.',
    4848                'url' => plugin_dir_url(__FILE__),
    4949                'path' => plugin_dir_path(__FILE__),
  • acf-rrule-field/trunk/assets/js/input.js

    r2497275 r3035121  
    1 (function($){
     1(function{
    22
     3
     4
     5
     6
     7
     8
    39
    4     /**
    5     *  initialize_field
    6     *
    7     *  This function will initialize the $field.
    8     *
    9     *  @date    30/11/17
    10     *  @since   5.6.5
    11     *
    12     *  @param   n/a
    13     *  @return  n/a
    14     */
     10            field.$el.find('.acf-field[data-frequency], .freq-suffix[data-frequency]').each(function () {
     11                if ($(this).data('frequency') != freq) {
     12                    $(this).hide();
     13                } else {
     14                    $(this).show();
     15                }
     16            });
     17        }
    1518
    16     function initialize_field( $field ) {
     19        const selectEndType = function ($input) {
     20            var type = $input.val();
    1721
    18         $field.find('.frequency-select').on('change', function () {
    19             var freq = $(this).val();
     22            field.$el.find('.acf-field[data-end-type]').each(function () {
     23                if ($(this).data('end-type') != type) {
     24                    $(this).hide();
     25                } else {
     26                    $(this).show();
     27                }
     28            });
     29        }
    2030
    21             $field.find('.acf-field[data-frequency], .freq-suffix[data-frequency]').each(function () {
    22                 if ($(this).data('frequency') != freq) {
    23                     $(this).hide();
    24                 } else {
    25                     $(this).show();
    26                 }
    27             });
    28         }).trigger('change');
     31        const selectMonthlyBy = function ($input) {
     32            var parent = $input.closest('.acf-field');
     33            var value = $input.val() ? $input.val() : "''";
    2934
    30         $field.find('.end-type-select').on('change', function () {
    31             var type = $(this).val();
     35            parent.find('.acf-input').addClass('is-disabled');
     36            parent.find('.acf-input[data-monthly-by=' + value + ']').removeClass('is-disabled');
     37        }
    3238
    33             $field.find('.acf-field[data-end-type]').each(function () {
    34                 if ($(this).data('end-type') != type) {
    35                     $(this).hide();
    36                 } else {
    37                     $(this).show();
    38                 }
    39             });
    40         }).trigger('change');
     39        field.$el.find('.frequency-select').on('change', function () {
     40            selectFrequency($(this));
     41        });
    4142
    42         $field.find('.monthly-by-options').on('change', 'input[type=radio]', function () {
    43             var parent = $(this).closest('.acf-field');
     43        field.$el.find('.end-type-select').on('change', function () {
     44            selectEndType($(this));
     45        });
    4446
    45             parent.find('.acf-input').addClass('is-disabled');
    46             parent.find('.acf-input[data-monthly-by=' + $(this).val() + ']').removeClass('is-disabled');
    47         });
     47        field.$el.find('.monthly-by-options').on('change', 'input[type=radio]', function () {
     48);
     49});
    4850
    49     }
     51        selectFrequency(field.$el.find('.frequency-select'));
     52        selectEndType(field.$el.find('.end-type-select'));
     53        selectMonthlyBy(field.$el.find('.monthly-by-options'));
     54    }
    5055
     56
     57
     58
     59
    5160
    52     if( typeof acf.add_action !== 'undefined' ) {
     61    var Field = acf.Field.extend({
     62        type: 'button_group_multiple',
     63        events: {
     64            'click input[type="checkbox"]': 'onClick'
     65        },
     66        $control: function () {
     67            return this.$('.acf-button-group');
     68        },
     69        $input: function () {
     70            return this.$('input:checked');
     71        },
     72        setValue: function (val) {
     73            this.$('input[value="' + val + '"]').prop('checked', true).trigger('change');
     74        },
     75        onClick: function (e, $el) {
     76            var $label = $el.parent('label');
    5377
    54         /*
    55         *  ready & append (ACF5)
    56         *
    57         *  These two events are called when a field element is ready for initizliation.
    58         *  - ready: on page load similar to $(document).ready()
    59         *  - append: on new DOM elements appended via repeater field or other AJAX calls
    60         *
    61         *  @param   n/a
    62         *  @return  n/a
    63         */
     78            // Toggle active class
     79            if ($el.prop('checked')) {
     80                $label.addClass('selected');
     81            } else {
     82                $label.removeClass('selected');
     83            }
     84        }
     85    });
    6486
    65         acf.add_action('ready_field/type=rrule', initialize_field);
    66         acf.add_action('append_field/type=rrule', initialize_field);
    67 
    68 
    69     } else {
    70 
    71         /*
    72         *  acf/setup_fields (ACF4)
    73         *
    74         *  This single event is called when a field element is ready for initialization.
    75         *
    76         *  @param   event       an event object. This can be ignored
    77         *  @param   element     An element which contains the new HTML
    78         *  @return  n/a
    79         */
    80 
    81         $(document).on('acf/setup_fields', function(e, postbox){
    82 
    83             // find all relevant fields
    84             $(postbox).find('.field[data-field_type="rrule"]').each(function(){
    85 
    86                 // initialize
    87                 initialize_field( $(this) );
    88 
    89             });
    90 
    91         });
    92 
    93     }
     87    acf.registerFieldType(Field);
    9488
    9589})(jQuery);
    96 
    97 (function($, undefined){
    98 
    99     var Field = acf.Field.extend({
    100 
    101         type: 'button_group_multiple',
    102 
    103         events: {
    104             'click input[type="checkbox"]': 'onClick'
    105         },
    106 
    107         $control: function(){
    108             return this.$('.acf-button-group');
    109         },
    110 
    111         $input: function(){
    112             return this.$('input:checked');
    113         },
    114 
    115         setValue: function( val ){
    116             this.$('input[value="' + val + '"]').prop('checked', true).trigger('change');
    117         },
    118 
    119         onClick: function( e, $el ){
    120 
    121             // vars
    122             var $label = $el.parent('label');
    123 
    124             // toggle active class
    125             if ($el.prop('checked')) {
    126                 $label.addClass('selected');
    127             } else {
    128                 $label.removeClass('selected');
    129             }
    130         }
    131     });
    132 
    133     acf.registerFieldType( Field );
    134 
    135 })(jQuery);
  • acf-rrule-field/trunk/readme.txt

    r3023435 r3035121  
    55Tested up to: 6.3
    66Requires PHP: 7.2
    7 Stable tag: 1.4.1
     7Stable tag: 1.4.
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3131
    3232== Changelog ==
     33
     34
     35
    3336
    3437= 1.4.1 =
Note: See TracChangeset for help on using the changeset viewer.