Sha256: 8546485625b71376339f42f6085bb19c0b30bb4a66a1060372c1cd1da186e392

Contents?: true

Size: 844 Bytes

Versions: 5

Compression:

Stored size: 844 Bytes

Contents

UsersController = ($scope, $state, $cookieStore, Restangular, $stateParams) ->
  $scope.store = Restangular.all('users')
  $scope.store.getList().then (users)->
    $scope.users = users

  if $stateParams.id
    $scope.store.get($stateParams.id).then (user)->
      $scope.user = user
  else
    $scope.user = {role: 'content_manager'}

  $scope.create = ->
    $scope.store.customPOST($scope.user, 'from_kms').then ->
      $state.go('users')
    ,->
      console.log('bug')

  #$scope.update = ->
    #$scope.user.put().then ->
      #$state.go('users')
    #,->
      #console.log('bug')

  $scope.destroy = (user)->
    user.remove().then ->
      $scope.users = _.without($scope.users, user)


angular.module('KMS')
    .controller('UsersController', ['$scope', '$state', '$cookieStore', 'Restangular', '$stateParams', UsersController])

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kms-0.6.0 app/assets/javascripts/kms/application/controllers/users_controller.coffee
kms-0.5.0 app/assets/javascripts/kms/application/controllers/users_controller.coffee
kms-0.4.2 app/assets/javascripts/kms/application/controllers/users_controller.coffee
kms-0.4.1 app/assets/javascripts/kms/application/controllers/users_controller.coffee
kms-0.4.0 app/assets/javascripts/kms/application/controllers/users_controller.coffee