<commit_before>define([
  'angular',
  'text!./cam-tasklist-task-detail-form-plugin.html',
], function(
  angular,
  template
) {
  'use strict';

  var Controller = [
   '$scope',
   '$location',
   'camAPI',
   'assignNotification',
  function (
    $scope,
    $location,
    camAPI,
    assignNotification
  ) {

    // setup ///////////////////////////////////////////////////////////

    var errorHandler = $scope.errorHandler;
    var successHandler = $scope.successHandler;
    var Task = camAPI.resource('task');

    var DEFAULT_OPTIONS = $scope.options = {
      hideCompleteButton: false,
      disableCompleteButton: false,
      disableForm: false,
      disableAddVariableButton: false
    };

    var taskFormData = $scope.taskData.newChild($scope);

    // observer ///////////////////////////////////////////////////////////

    taskFormData.observe(['task', 'isAssignee', function(task, isAssignee) {
      if (task && task.id) {
        $scope.options = angular.extend({}, { taskId : task.id }, DEFAULT_OPTIONS);
      }
      else {
        $scope.options = DEFAULT_OPTIONS;
      }

      $scope.options.disableCompleteButton = !isAssignee;
      $scope.options.disableForm = !isAssignee;
      $scope.options.disableAddVariableButton = !isAssignee;
    }]);

    $scope.taskFormState = taskFormData.observe('taskForm', function(taskForm) {
      $scope.taskForm = angular.copy(taskForm);
    });

    // task form /////////////////////////////////////////////////////////////////////////

    function clearTask() {
      // reseting the location leads that
      // the taskId will set to null and
      // the current selected task will
      // also be set to null, so that the
      // view gets clear
      $location.search({});

      // list of tasks must be reloaded as<commit_msg>fix(task/form): set params for task forms<commit_after>define([
  'angular',
  'text!./cam-tasklist-task-detail-form-plugin.html',
], function(
  angular,
  template
) {
  'use strict';

  var Controller = [
   '$scope',
   '$location',
   'camAPI',
   'assignNotification',
  function (
    $scope,
    $location,
    camAPI,
    assignNotification
  ) {

    // setup ///////////////////////////////////////////////////////////

    var errorHandler = $scope.errorHandler;
    var successHandler = $scope.successHandler;
    var Task = camAPI.resource('task');

    var DEFAULT_OPTIONS = $scope.options = {
      hideCompleteButton: false,
      disableCompleteButton: false,
      disableForm: false,
      disableAddVariableButton: false
    };

    var taskFormData = $scope.taskData.newChild($scope);

    // observer ///////////////////////////////////////////////////////////

    taskFormData.observe(['task', 'isAssignee', function(task, isAssignee) {
      $scope.options = angular.copy(DEFAULT_OPTIONS);

      if (task && task.id) {
        $scope.params = { taskId : task.id };
      }
      else {
        $scope.params = null;
      }

      $scope.options.disableCompleteButton = !isAssignee;
      $scope.options.disableForm = !isAssignee;
      $scope.options.disableAddVariableButton = !isAssignee;
    }]);

    $scope.taskFormState = taskFormData.observe('taskForm', function(taskForm) {
      $scope.taskForm = angular.copy(taskForm);
    });

    // task form /////////////////////////////////////////////////////////////////////////

    function clearTask() {
      // reseting the location leads that
      // the taskId will set to null and
      // the current selected task will
      // also be set to null, so that the
      // view gets clear
      $location.search({});

      // list of tasks must be reloaded as
{'fraction_non_alphanumeric': 0.21633433488118, 'fraction_numerical': 0.0, 'mean_word_length': 1.829984544049459, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4363063', 'n_tokens_mistral': 1007, 'n_tokens_neox': 971, 'n_words': 224}