<commit_before>define ['angular', 'modeling', 'breast'], (ng) ->
  ctlrs = ng.module 'qiprofile.controllers', ['qiprofile.modeling', 'qiprofile.breast']

  # The local controller helper methods.
  ctlrs.factory 'ControllerHelper', [
    '$location',
    ($location) ->
      # Resets the browser URL search parameters to include at most
      # a non-default project, since all other search parameters are
      # redundant.
      cleanBrowserUrl: (project) ->
        searchParams = {}
        if project != 'QIN'
          searchParams.project = project
        $location.search(searchParams)
  ]


  ctlrs.controller 'HomeCtrl', [
    '$rootScope', '$scope', '$state',
    ($rootScope, $scope, $state) ->
      $scope.goHome = () ->
        project = $rootScope.project or 'QIN'
        $state.go('quip.home', project: project)
  ]


  ctlrs.controller 'HelpCtrl', [
    '$rootScope', '$scope',
    ($rootScope, $scope) ->
      # Toggles the root scope showHelp flag.
      # This method and the showHelp flag are defined in the root
      # scope in order to share them with the partial template
      # home alert attribute directives.
      $rootScope.toggleHelp = ->
        $rootScope.showHelp = !$rootScope.showHelp

      # Unconditionally hide help when the location changes.
      $scope.$on '$locationChangeStart', (event, next, current) ->
        # Set the showHelp flag on the parent scope, since the
        # flag is shared with the sibling view scope.
        $rootScope.showHelp = false
  ]


  ctlrs.controller 'AccordionGroupCtrl', [
    '$scope',
    ($scope) ->
      # The accordion group is initially open.
      $scope.isOpen = true
  ]


  ctlrs.controller 'SubjectListCtrl', [
    '$rootScope', '$scope', 'project', 'subjects', 'collections',
    ($rootScope, $scope, project, subjects, collections) ->
      # Capture the current project.
      $rootScope.project = project
      # Place the subjects and collections in the scope.
      $scope.subjects = subjects
      $scope.collections = collections
  ]


  ## The Subject Detail page controllers.

  ctlrs.controller 'SubjectDetailCtrl', [
    '$rootScope', '$scope', 'subject', 'ControllerHelper',
    ($rootScope, $scope, subject, ControllerHelper) ->
      # Capture the current project.
      $rootScope.project = subject.project

      # Place the subject in scope.
      $scope.subject = subject

      # If the project is the default, then remove it from the URL.
      ControllerHelper.cleanBrowserUrl($rootScope.project)
  ]


  ctlrs.controller 'RegistrationImageSelectCtrl', [
    '$scope', '$sce',
    ($scope, $sce) ->
      # Place the registration configuration in scope.
      $scope.regConfig = $scope.registration.configuration
      # # Embeds a dynamically built hyperlink into the image selection
      # # row title element.
      # #
      # # This function is necessary since the hyperlink anchor element
      # # text is dynamically determined.
      # $scope.registrationInfoHyperlink = ->
      #   # AngularJS guards against untrusted embedded HTML. The SCE
      #   # (Strict Contextual Escaping) mode marks the HTML as safe.
      #   $sce.trustAsHtml("<a href='' ng-click='open()'" +
      #                    " ng-controller='RegistrationInfoCtrl'>" +
      #                    "#{ $scope.regConfig.technique }</a>")
  ]


  ctlrs.controller 'RegistrationInfoCtrl', [
    '$scope', '$sce', '$modal',
    ($scope, $sce, $modal) ->
      # Embeds a dynamically built registration technique text
      # span element within a hyperlink anchor element.
      #
      # This function is necessary since AngularJS does not
      # evaluate hyperlink anchor element text expressions.
      $scope.registrationTechnique = ->
        # AngularJS guards against untrusted embedded HTML. The SCE
        # (Strict Contextual Escaping) mode marks the HTML as safe.
        $sce.trustAsHtml("<span class='qi-image-selection-title'>" +
                         "#{ $scope.regConfig.technique }</span>")
      
      # Open a modal window to display the registration properties.
      $scope.open = ->
        $modal.open
          controller: 'RegistrationInfoModalCtrl'
          templateUrl: '/partials/registration-info.html'
          size: 'sm'
          resolve:
            # Make the registration configuration injectable in the
            # modal controller.
            regConfig: ->
              $scope.regConfig
  ]


  ctlrs.controller 'RegistrationInfoModalCtrl', [
    '$scope', '$modalInstance', 'regConfig',
    ($scope, $modalInstance, regConfig) ->
      # Since the modal is not contained in the application page, this
      # modal controller scope does not inherit the application page
      # scope. Therefore, place the registration configuration object
      # in the modal scope.
      $scope.regConfig = regConfig
      $scope.close = ->
        $modalInstance.close()
  ]
<commit_msg>Replace the reg config with the reg profile.<commit_after>define ['angular', 'modeling', 'breast'], (ng) ->
  ctlrs = ng.module 'qiprofile.controllers', ['qiprofile.modeling', 'qiprofile.breast']

  # The local controller helper methods.
  ctlrs.factory 'ControllerHelper', [
    '$location',
    ($location) ->
      # Resets the browser URL search parameters to include at most
      # a non-default project, since all other search parameters are
      # redundant.
      cleanBrowserUrl: (project) ->
        searchParams = {}
        if project != 'QIN'
          searchParams.project = project
        $location.search(searchParams)
  ]


  ctlrs.controller 'HomeCtrl', [
    '$rootScope', '$scope', '$state',
    ($rootScope, $scope, $state) ->
      $scope.goHome = () ->
        project = $rootScope.project or 'QIN'
        $state.go('quip.home', project: project)
  ]


  ctlrs.controller 'HelpCtrl', [
    '$rootScope', '$scope',
    ($rootScope, $scope) ->
      # Toggles the root scope showHelp flag.
      # This method and the showHelp flag are defined in the root
      # scope in order to share them with the partial template
      # home alert attribute directives.
      $rootScope.toggleHelp = ->
        $rootScope.showHelp = !$rootScope.showHelp

      # Unconditionally hide help when the location changes.
      $scope.$on '$locationChangeStart', (event, next, current) ->
        # Set the showHelp flag on the parent scope, since the
        # flag is shared with the sibling view scope.
        $rootScope.showHelp = false
  ]


  ctlrs.controller 'AccordionGroupCtrl', [
    '$scope',
    ($scope) ->
      # The accordion group is initially open.
      $scope.isOpen = true
  ]


  ctlrs.controller 'SubjectListCtrl', [
    '$rootScope', '$scope', 'project', 'subjects', 'collections',
    ($rootScope, $scope, project, subjects, collections) ->
      # Capture the current project.
      $rootScope.project = project
      # Place the subjects and collections in the scope.
      $scope.subjects = subjects
      $scope.collections = collections
  ]


  ## The Subject Detail page controllers.

  ctlrs.controller 'SubjectDetailCtrl', [
    '$rootScope', '$scope', 'subject', 'ControllerHelper',
    ($rootScope, $scope, subject, ControllerHelper) ->
      # Capture the current project.
      $rootScope.project = subject.project

      # Place the subject in scope.
      $scope.subject = subject

      # If the project is the default, then remove it from the URL.
      ControllerHelper.cleanBrowserUrl($rootScope.project)
  ]


  ctlrs.controller 'RegistrationImageSelectCtrl', [
    '$scope', '$sce',
    ($scope, $sce) ->
      # Place the registration configuration in scope.
      $scope.regConfig = $scope.registration.configuration
      # # Embeds a dynamically built hyperlink into the image selection
      # # row title element.
      # #
      # # This function is necessary since the hyperlink anchor element
      # # text is dynamically determined.
      # $scope.registrationInfoHyperlink = ->
      #   # AngularJS guards against untrusted embedded HTML. The SCE
      #   # (Strict Contextual Escaping) mode marks the HTML as safe.
      #   $sce.trustAsHtml("<a href='' ng-click='open()'" +
      #                    " ng-controller='RegistrationInfoCtrl'>" +
      #                    "#{ $scope.regConfig.technique }</a>")
  ]


  ctlrs.controller 'RegistrationProtocolCtrl', [
    '$scope', '$sce', '$modal',
    ($scope, $sce, $modal) ->
      # Embeds a dynamically built registration technique text
      # span element within a hyperlink anchor element.
      #
      # This function is necessary since AngularJS does not
      # evaluate hyperlink anchor element text expressions.
      $scope.registrationTechnique = ->
        # AngularJS guards against untrusted embedded HTML. The SCE
        # (Strict Contextual Escaping) mode marks the HTML as safe.
        $sce.trustAsHtml("<span class='qi-image-selection-title'>" +
                         "#{ $scope.regConfig.technique }</span>")
      
      # Open a modal window to display the registration properties.
      $scope.open = ->
        $modal.open
          controller: 'RegistrationProtocolModalCtrl'
          templateUrl: '/partials/registration-protocol.html'
          size: 'sm'
          resolve:
            # Make the registration profile injectable in the
            # modal controller.
            profile: ->
              $scope.profile
  ]


  ctlrs.controller 'RegistrationProtocolModalCtrl', [
    '$scope', '$modalInstance', 'regConfig',
    ($scope, $modalInstance, regConfig) ->
      # Since the modal is not contained in the application page, this
      # modal controller scope does not inherit the application page
      # scope. Therefore, place the registration profile object
      # in the modal scope.
      $scope.profile = profile
      $scope.close = ->
        $modalInstance.close()
  ]

{'fraction_non_alphanumeric': 0.10953490728543926, 'fraction_numerical': 0.0, 'mean_word_length': 2.5877862595419847, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 49, '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': '2627994', 'n_tokens_mistral': 2704, 'n_tokens_neox': 2595, 'n_words': 831}