rails-angulate 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a43c0dd10b6ea2a418346f98eb497f0bb2836bb
|
4
|
+
data.tar.gz: 53be53d6a4b7512f206c2632fbf7e8fe1aab7f25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d2d7cb1de7704a25bb4f560cb2d49afbf75e681a02d0cfd7a07a23ab3f28b87a67b098208d43b8abc5ff9e737676c290681357ea604bb6e3b47ffe18874101d
|
7
|
+
data.tar.gz: fb52d43038cd80801d8d1f6dc394dd4c4bcd8d0069730ccd28e53e76bb2a979e3f1fdb99c6f86098b74d92f16b22e8c5f61bfab7bde5f397bfa3b9792efa6766
|
@@ -17,24 +17,28 @@ blurifyDirective = ['$timeout', ($timeout) ->
|
|
17
17
|
]
|
18
18
|
|
19
19
|
formExtensions = ['$timeout', ($timeout) ->
|
20
|
-
restrict: 'E'
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
form
|
25
|
-
|
26
|
-
|
20
|
+
restrict: 'E'
|
21
|
+
priority: 10
|
22
|
+
require: 'form'
|
23
|
+
compile: ->
|
24
|
+
pre: (scope, element, attrs, form) ->
|
25
|
+
element.attr('novalidate', 'novalidate')
|
26
|
+
form.$submitted = false
|
27
|
+
_submit = (e) ->
|
27
28
|
e.preventDefault()
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
if form.$invalid
|
30
|
+
e.stopPropagation()
|
31
|
+
e.returnValue = false # IE
|
32
|
+
$timeout ->
|
33
|
+
form.$submit_attempt = true
|
34
|
+
else
|
35
|
+
$timeout ->
|
36
|
+
form.$submitted = true
|
33
37
|
|
34
|
-
|
38
|
+
element.on 'submit', _submit
|
35
39
|
|
36
|
-
|
37
|
-
|
40
|
+
scope.$on '$destroy', ->
|
41
|
+
element.off 'submit', _submit
|
38
42
|
]
|
39
43
|
|
40
44
|
angular.module 'angulate.directives'
|
@@ -45,3 +49,23 @@ angular.module 'angulate.directives'
|
|
45
49
|
.directive('blurify', blurifyDirective)
|
46
50
|
|
47
51
|
.directive('form', formExtensions)
|
52
|
+
.config ['$provide', ($provide) ->
|
53
|
+
$provide.decorator 'ngSubmitDirective', ['$delegate', ($delegate) ->
|
54
|
+
# Remove default ngSubmit
|
55
|
+
$delegate.shift()
|
56
|
+
$delegate
|
57
|
+
]
|
58
|
+
]
|
59
|
+
# Override with our own directive which checks for stopped propagation
|
60
|
+
# TODO: File issue with angular (?)
|
61
|
+
.directive 'ngSubmit', ['$parse', ($parse) ->
|
62
|
+
compile: ($element, attr) ->
|
63
|
+
fn = $parse(attr['ngSubmit'])
|
64
|
+
return (scope, element) ->
|
65
|
+
element.on 'submit', (event) ->
|
66
|
+
unless event.isPropagationStopped?()
|
67
|
+
scope.$apply ->
|
68
|
+
fn(scope, $event: event)
|
69
|
+
return
|
70
|
+
return
|
71
|
+
]
|
@@ -0,0 +1,40 @@
|
|
1
|
+
en:
|
2
|
+
angulate:
|
3
|
+
errors:
|
4
|
+
# * Lifted from ActiveModel *
|
5
|
+
# The default format to use in full error messages.
|
6
|
+
format: "%{attribute} %{message}"
|
7
|
+
|
8
|
+
# The values :model, :attribute and :value are always available for interpolation
|
9
|
+
# The value :count is available when applicable. Can be used for pluralization.
|
10
|
+
messages:
|
11
|
+
presence: "%{attribute} can't be blank"
|
12
|
+
too_long:
|
13
|
+
one: "is too long (maximum is 1 character)"
|
14
|
+
other: "is too long (maximum is %{count} characters)"
|
15
|
+
too_short:
|
16
|
+
one: "is too short (minimum is 1 character)"
|
17
|
+
other: "is too short (minimum is %{count} characters)"
|
18
|
+
wrong_length:
|
19
|
+
one: "is the wrong length (should be 1 character)"
|
20
|
+
other: "is the wrong length (should be %{count} characters)"
|
21
|
+
format: "%{attribute} is invalid"
|
22
|
+
email: "%{attribute} is not correctly formatted"
|
23
|
+
# --
|
24
|
+
inclusion: "is not included in the list"
|
25
|
+
exclusion: "is reserved"
|
26
|
+
invalid: "is invalid"
|
27
|
+
confirmation: "doesn't match %{attribute}"
|
28
|
+
accepted: "must be accepted"
|
29
|
+
empty: "can't be empty"
|
30
|
+
present: "must be blank"
|
31
|
+
not_a_number: "is not a number"
|
32
|
+
not_an_integer: "must be an integer"
|
33
|
+
greater_than: "must be greater than %{count}"
|
34
|
+
greater_than_or_equal_to: "must be greater than or equal to %{count}"
|
35
|
+
equal_to: "must be equal to %{count}"
|
36
|
+
less_than: "must be less than %{count}"
|
37
|
+
less_than_or_equal_to: "must be less than or equal to %{count}"
|
38
|
+
other_than: "must be other than %{count}"
|
39
|
+
odd: "must be odd"
|
40
|
+
even: "must be even"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-angulate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stan Bondi
|
@@ -84,6 +84,7 @@ files:
|
|
84
84
|
- app/assets/javascripts/rails/angulate/directives/module.js.coffee
|
85
85
|
- app/assets/javascripts/rails/angulate/directives/validator.js.coffee
|
86
86
|
- app/assets/javascripts/rails/angulate/module.js.coffee
|
87
|
+
- config/locales/en.yml
|
87
88
|
- lib/rails-angulate.rb
|
88
89
|
- lib/rails/angulate.rb
|
89
90
|
- lib/rails/angulate/configuration.rb
|