xref: /plugin/bez/scripts/task.js (revision f2c81100fea44d21a0a4b15304beb7e2baf91080)
1bez.ctl.task = function() {
2    var $task_form = jQuery('.bez_task_form');
3
4    if ($task_form.length > 0) {
5        //date picker
6        jQuery("input[name=plan_date]").datepicker({
7            dateFormat: "yy-mm-dd"
8            });
9        if (jQuery("input[name=all_day_event]").is(":checked")) {
10            jQuery('#task_datapair').hide();
11        }
12        jQuery("input[name=all_day_event]").on('change', function() {
13            if (jQuery(this).is(":checked")) {
14                jQuery('#task_datapair').hide();
15            } else {
16                jQuery('#task_datapair').show();
17            }
18        });
19
20        //time picker
21        jQuery('#task_datapair .time').timepicker({
22                'showDuration': true,
23                'timeFormat': 'H:i'
24            });
25        var timeDatepair = new Datepair(jQuery('#task_datapair').get(0));
26        bez.rich_text_editor($task_form.find('textarea'), $task_form.find('.bez_toolbar'));
27    }
28
29    if (jQuery('#reason').length > 0) {
30		bez.rich_text_editor(jQuery('#reason'), jQuery('.bez_reason_toolbar'));
31	}
32};