Commit d9be5a2a authored by Randall Leeds's avatar Randall Leeds

Set auth forms to pristine after success

And get rid of the resettable directive. Since Angular added the
`$setPristine` method, we can wrap the errors in a check that the
control is dirty.
parent 510a00ef
......@@ -718,6 +718,8 @@ class Auth
authentication["$#{form.$name}"] ->
_reset()
$scope.$emit 'success', form.$name
for own _, ctrl of $scope when typeof ctrl?.$setPristine is 'function'
ctrl.$setPristine()
class Editor
......
......@@ -104,20 +104,6 @@ recursive = ['$compile', '$timeout', ($compile, $timeout) ->
]
resettable = ->
compile: (tElement, tAttrs, transclude) ->
post: (scope, iElement, iAttrs) ->
reset = ->
transclude scope, (el) ->
iElement.replaceWith el
iElement = el
reset()
scope.$on '$reset', reset
priority: 5000
restrict: 'A'
transclude: 'element'
###
# The slow validation directive ties an to a model controller and hides
# it while the model is being edited. This behavior improves the user
......@@ -427,7 +413,6 @@ angular.module('h.directives', ['ngSanitize'])
.directive('markdown', markdown)
.directive('privacy', privacy)
.directive('recursive', recursive)
.directive('resettable', resettable)
.directive('slowValidate', slowValidate)
.directive('tabReveal', tabReveal)
.directive('tags', tags)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment