PageSourceSearch

https://jira.nine.ch/includes/jira/field/initLogWorkControls.js

js nine.ch collected 2026-09-25 14:21:02 UTC 2,482 bytes, 46 lines download raw bytes

1define('jira/field/init-log-work-controls', ['jira/util/events', 'jira/util/events/types', 'jira/util/events/reasons', 'jquery'], function (Events, Types, Reasons, jQuery) {
2  'use strict';
3
4  function toggleTimeTrackingContainer(context, activate) {
5    var $logWorkContainer = jQuery(context).find("#worklog-logworkcontainer");
6    var $timeTrackingContainer = jQuery(context).find("#worklog-timetrackingcontainer");
7    var $logWorkCheckbox = jQuery(context).find("#log-work-activate");
8    if (activate) {
9      $logWorkContainer.removeClass("hidden");
10      $timeTrackingContainer.addClass("hidden");
11      $logWorkCheckbox.prop("checked", true);
12    } else {
13      $logWorkContainer.addClass("hidden");
14      $timeTrackingContainer.removeClass("hidden");
15      $logWorkCheckbox.prop("checked", false);
16    }
17  }
18  function applyLogworkControls(context) {
19    jQuery('#log-work-adjust-estimate-new-value, #log-work-adjust-estimate-manual-value', context).attr('disabled', 'disabled');
20    jQuery('#log-work-adjust-estimate-' + jQuery('input[name=worklog_adjustEstimate]:checked,input[name=adjustEstimate]:checked', context).val() + '-value', context).removeAttr('disabled');
21    jQuery('input[name=worklog_adjustEstimate],input[name=adjustEstimate]', context).change(function () {
22      jQuery('#log-work-adjust-estimate-new-value,#log-work-adjust-estimate-manual-value', context).attr('disabled', 'disabled');
23      jQuery('#log-work-adjust-estimate-' + jQuery(this).val() + '-value', context).removeAttr('disabled');
24    });
25    jQuery("#delete-log-work-adjust-estimate-new-value").change(function () {
26      jQuery("#delete-log-work-adjust-estimate-new").prop("checked", true);
27    });
28    jQuery("#delete-log-work-adjust-estimate-manual-value").change(function () {
29      jQuery("#delete-log-work-adjust-estimate-manual").prop("checked", true);
30    });
31    jQuery(context).find("#log-work-activate").change(function () {
32      toggleTimeTrackingContainer(context, jQuery(this).is(":checked"));
33    });
34  }
35
36  // In Quick Edit/Create we need to ensure the container is visible to append error messages
37  Events.bind(Types.VALIDATE_TIMETRACKING, function (e, context) {
38    toggleTimeTrackingContainer(context, true);
39  });
40  Events.bind(Types.NEW_CONTENT_ADDED, function (e, context, reason) {
41    //eslint-disable-line @atlassian/jira-event-checks/no-newcontentadded-handlers
42    if (reason !== Reasons.panelRefreshed) {
43      applyLogworkControls(context);
44    }
45  });
46});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.