Sha256: d10f9e06442852fb5e2b4c6c61eccf4f28cf135cae7785887d869ffc6194582e

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

angular.module("SWAT").controller "ConsoleCtrl", ($rootScope, $scope, $state, $stateParams,
    ConfirmationDialog, ConsoleService) ->

  $scope.init = ->
    $scope.clean =
      branch: { name: '' }
      user: { name: '' }
      period: { name: '' }
      revision: { name: '' }
    $rootScope.globalControl.setReloader($scope.loadConsoleData)
    $rootScope.globalControl.reload()


  $scope.loadConsoleData = ->
    $scope.consoleDataPromise = ConsoleService.data()
    $scope.consoleDataPromise.$promise.then((resp)->
      $scope.consoleData = resp
    )
    $scope.consoleDataPromise

  $scope.sum = (data)->
   _.sum(_.values(data))

  $scope.remove = (attribute)->
    message = 'Are you sure you want to remove revisions of ' + attribute + ' <strong>' + $scope.clean[attribute].name + '<strong>?'
    action =  ->
      promise = ConsoleService.clean(attribute: attribute, value: $scope.clean[attribute].name)
      promise.$promise.then($scope.loadConsoleData)
      promise

    new ConfirmationDialog(message, action)

  $scope.init()

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sw2at-ui-0.0.16 app/assets/javascripts/swat/app/controllers/management/console.coffee