rails-angulate 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6dcb4962532ac0cafd799575cf926491cd8d56cb
4
- data.tar.gz: b0c5a57ff8b21c43ed22de79aa96beabdd7d64a3
3
+ metadata.gz: dc1ba0fb7a42ea13ebf61780f765151d07fe5539
4
+ data.tar.gz: d804286c6df36f8034c415ed9b0c813e804b90e3
5
5
  SHA512:
6
- metadata.gz: c8658c6365dff8c50b9f17a023a36ea78d6a46ec2ee5f93febb2dde04cd908ec992ab41e522f36d9a2123e7bb3dc6650dd15c49dd52977439db3790e079245af
7
- data.tar.gz: 8dae40660d82128ad8db8fb7e8ea7bcf9e6ff62aa9e66570d51bc5214a40f3119dcbda67318df728ee5970e1db2c84c4fd40a2fae888886c8d5b346da101be42
6
+ metadata.gz: 7de6fa68691c96e57b08380640498e8d1bb7e01baa9fbd071d6894e0ba0da2d8bba1eb3b568749e06eb235538c1a9b21af4407f21a66949f256acb0c77f5bafb
7
+ data.tar.gz: c88c4e45b6074d4fee0f037a905fc5b8876c7e63488554e6ed746057eb77a12f725f425a4dee44fd9abd16dd32b06ea985a9266c7dae22a9beb8923b07bdbea8
@@ -25,7 +25,7 @@ formExtensions = ['$timeout', ($timeout) ->
25
25
  element.attr('novalidate', 'novalidate')
26
26
  form.$submitted = false
27
27
  _submit = (e) ->
28
- e.preventDefault()
28
+ e.preventDefault() if attrs.ngSubmit || form.$invalid
29
29
  if form.$invalid
30
30
  e.stopPropagation()
31
31
  e.returnValue = false # IE
@@ -54,6 +54,7 @@ module Rails
54
54
  def apply_builder_options(options)
55
55
  options.dup.tap do |opts|
56
56
  opts[:validate_on] ||= self.options[:validate_on]
57
+ opts[:form_name] ||= self.options.fetch(:html, {})[:name]
57
58
  end
58
59
  end
59
60
  end
@@ -9,7 +9,7 @@ module Rails
9
9
  def ng_form_for(record, options = {}, &block)
10
10
  options[:html] ||= {}
11
11
  options[:html]['ang-form'] = ""
12
- options[:html][:name] ||= options[:as] || ng_form_name(record)
12
+ options[:html][:name] ||= ng_form_name(record)
13
13
  form_for(record, options, &block)
14
14
  end
15
15
 
@@ -56,7 +56,8 @@ module Rails
56
56
  end
57
57
 
58
58
  def form_object_name
59
- "#{@object_name.gsub(/\[.+\]/, '')}_form"
59
+ name = options[:form_name] rescue nil
60
+ name || "#{@object_name.gsub(/\[.+\]/, '')}_form"
60
61
  end
61
62
 
62
63
  def form_field_object_name
@@ -1,5 +1,5 @@
1
1
  module Rails
2
2
  module Angulate
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-angulate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stan Bondi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-11 00:00:00.000000000 Z
11
+ date: 2014-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails