Sha256: 92402556a6160a6ac9e29456e0e5b6d98936961ff4467485d49017514fcb1fa8

Contents?: true

Size: 844 Bytes

Versions: 5

Compression:

Stored size: 844 Bytes

Contents

angular.module("SWAT").directive "revisionName", ($document, RevisionService)->
  restrict: 'AE'
  replace: true
  templateUrl: '/swat/pages/revisions/name.html'
  scope:
    revision: '='

  controller: ($scope, $attrs, $timeout)->
    $scope.init = ->
      $scope.id = ('revision-name-'+$scope.revision.data.time+Math.floor(Math.random()*1000))
      $scope.name = ($scope.revision.data.name || $scope.revision.data.time)

    $scope.save = ->
      value = angular.element('#'+$scope.id).text()
      window.Swat.log(value)
      return if value == $scope.name
      params = { branch: $scope.revision.data.branch, user: $scope.revision.data.user, time: $scope.revision.data.time, name: value }
      RevisionService.setName(params).$promise.then((resp)->
        window.Swat.log(resp)
        $scope.name = value
      )

    $scope.init()

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sw2at-ui-0.0.16 app/assets/javascripts/swat/app/directives/revision_name.coffee
sw2at-ui-0.0.15 app/assets/javascripts/swat/app/directives/revision_name.coffee
sw2at-ui-0.0.14 app/assets/javascripts/swat/app/directives/revision_name.coffee
sw2at-ui-0.0.13 app/assets/javascripts/swat/app/directives/revision_name.coffee
sw2at-ui-0.0.12 app/assets/javascripts/swat/app/directives/revision_name.coffee