parsley_simple_form 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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OWUzZmRiM2RlNTExYTQ0MmIwNDZkMWUzNDA2ZTg2NzM0M2UzNWRhOQ==
4
+ YzQ3ZTU3YjJiYmM2Yzc5NmMyMmMwYzYxNDQzZDBjZDgyN2E3Mzk0MA==
5
5
  data.tar.gz: !binary |-
6
- NTllYWM0Zjc3YTE0ZDc4ODJkOTc3YTgwMzk5ZjJjMjRhYjE5ZTA5ZA==
6
+ ODRmYmUwZDhjZGYwY2RlOTM3MDk2NDNhNmM0NWRjYzllODBiOGQ0MA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NDY0YjRlODBmNGRkZjQwY2RkNmMzZmY0OGYyMDRlMmZhMWE3MjQ4NzIyZjhk
10
- MjBlNWYzMzI1MDA5M2NhNTgwZjUwYmQzNWY3ZjgwYTJlNTBkYmM5ODZhZjQx
11
- MWUwZDNhN2E1NTM5MGY5NGRmMTA0MDI5YzAxMWM3YmIwZDg4MmM=
9
+ OTQxZWNiZDI2NTVhN2JmZjMyMGJkMWZmMzQ3YjRiY2U4NDZiNjc1NzNlZGE2
10
+ NmJhY2E1ODY2YjQ2NmFkZTY0ZDU1Njk4MDhhYTY5NTgwYTZjNDU4YWExNjBj
11
+ MTcyZDYxYzI4YjU1MDhmMmUyM2YxNWFlZDE1ZTU0NGQ3MTdmNGQ=
12
12
  data.tar.gz: !binary |-
13
- ZDljZWMzMjVkMTFkNDYwZjkwODU0NjYyODFmOGJjNzU2YzM0Y2VmZmNlODVh
14
- YTFkZDM5MTc4ZGY1ODVmYzkxY2EzMDY4NTQxMjljNjA1N2RlYTMxZGI0YmFk
15
- NjBhNDg2NWY4ZmY0YTRlYmEzYmQxMDY1MTA2Mjg5MGU1YjQ0YTE=
13
+ NTk3ODhiYjU0NjMxZjc3OTcwYjJhMWFlY2FlNjljOTNkN2MyYzRiZmNmNzI0
14
+ NDQ0OGViMzNlZDBmMjdhOGViMmRmM2FhMDI5MDdhZDJhNGY3ODBjNTJjY2Nk
15
+ NWM2MDM5MWZkNzQ3ZjEyMjAwYzRhNjNmOGU3OThlNTM3ZWNmZWE=
data/README.md CHANGED
@@ -24,4 +24,7 @@ Automatically adds required constraint to inputs which are required attributes,
24
24
  Contributions
25
25
  -------------
26
26
 
27
- Feel free to make a PR or add an issue to the project :)
27
+ Feel free to make a PR or add an issue to the project :)
28
+
29
+ [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/gbmoretti/parsley_simple_form/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
30
+
@@ -15,7 +15,11 @@ module ParsleySimpleForm
15
15
 
16
16
  def input_id(attribute_name, options, &block)
17
17
  input = @form_builder.find_input(attribute_name, options, &block)
18
- (input.lookup_model_names * '_') + '_' + input.attribute_name.to_s
18
+ if input.lookup_model_names.count > 1
19
+ (input.lookup_model_names * '_') + '_attributes_' + input.attribute_name.to_s
20
+ else
21
+ (input.lookup_model_names * '_') + '_' + input.attribute_name.to_s
22
+ end
19
23
  end
20
24
  end
21
25
  end
@@ -12,7 +12,7 @@ module ParsleySimpleForm
12
12
  return {} if @options.nil? || @options[:equalto].nil?
13
13
 
14
14
  attr_equalto = @options[:equalto]
15
- input = @form_builder.find_input(attr_equalto, @options, &@block)
15
+ input = @form_builder.find_input(attr_equalto, @options, &@block)
16
16
  {
17
17
  :'data-equalto' => '#' + input_id(attr_equalto, @options, &@block),
18
18
  :'data-equalto-message' =>
@@ -0,0 +1,28 @@
1
+ module ParsleySimpleForm
2
+ module Constraints
3
+ module Basics
4
+ class TypeConstraint < Constraints::BaseConstraint
5
+ TYPES_CONSTRAINTS = %w(email url urlstrict digits number alphanum dateIso phone)
6
+
7
+ TYPE_MAP = {
8
+ 'decimal' => 'number'
9
+ }
10
+
11
+ def match?
12
+ TYPES_CONSTRAINTS.include?(type)
13
+ end
14
+
15
+ def html_attributes
16
+ type = TYPE_MAP[type] unless TYPE_MAP[type].nil?
17
+ {"data-type-#{type}-message".to_sym => I18n::translate("form_validation.message.#{type}")}
18
+ end
19
+
20
+ private
21
+ def type
22
+ @type ||= @form_builder.find_input(@form_builder.attribute_name, @options, &@block).input_type.to_s
23
+ end
24
+
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,7 +1,9 @@
1
1
  require 'simple_form'
2
2
 
3
3
  module ParsleySimpleForm
4
- class FormBuilder < SimpleForm::FormBuilder
4
+ class FormBuilder < SimpleForm::FormBuilder
5
+ attr_reader :attribute_name
6
+
5
7
  def input(attribute_name, options = {}, &block)
6
8
  @attribute_name = attribute_name
7
9
  @options = options
@@ -26,9 +28,9 @@ module ParsleySimpleForm
26
28
  end
27
29
 
28
30
  def message_by_type
29
- type = find_input(@attribute_name, @options, &@block).input_type.to_s
30
- #puts "data-type-#{type}-message".to_sym.to_s
31
- {"data-type-#{type}-message".to_sym => I18n::translate("form_validation.message.#{type}")}
31
+ type = Constraints::Basics::TypeConstraint.new(self,@options,&@block)
32
+ return type.html_attributes if type.match?
33
+ {}
32
34
  end
33
35
 
34
36
  def message_required
@@ -1,3 +1,3 @@
1
1
  module ParsleySimpleForm
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -1636,3 +1636,830 @@ Connecting to database specified by database.yml
1636
1636
   (0.0ms) rollback transaction
1637
1637
   (0.0ms) begin transaction
1638
1638
   (0.0ms) rollback transaction
1639
+ Connecting to database specified by database.yml
1640
+  (0.2ms) begin transaction
1641
+  (0.1ms) rollback transaction
1642
+  (0.1ms) begin transaction
1643
+  (0.1ms) rollback transaction
1644
+  (0.0ms) begin transaction
1645
+  (0.0ms) rollback transaction
1646
+  (0.0ms) begin transaction
1647
+  (0.0ms) rollback transaction
1648
+  (0.0ms) begin transaction
1649
+  (0.0ms) rollback transaction
1650
+  (0.0ms) begin transaction
1651
+  (0.0ms) rollback transaction
1652
+  (0.0ms) begin transaction
1653
+  (0.0ms) rollback transaction
1654
+  (0.0ms) begin transaction
1655
+  (0.0ms) rollback transaction
1656
+ Connecting to database specified by database.yml
1657
+  (0.2ms) begin transaction
1658
+  (0.1ms) rollback transaction
1659
+  (0.0ms) begin transaction
1660
+  (0.1ms) rollback transaction
1661
+  (0.0ms) begin transaction
1662
+  (0.0ms) rollback transaction
1663
+  (0.0ms) begin transaction
1664
+  (0.0ms) rollback transaction
1665
+  (0.0ms) begin transaction
1666
+  (0.0ms) rollback transaction
1667
+  (0.0ms) begin transaction
1668
+  (0.0ms) rollback transaction
1669
+  (0.0ms) begin transaction
1670
+  (0.0ms) rollback transaction
1671
+  (0.0ms) begin transaction
1672
+  (0.0ms) rollback transaction
1673
+ Connecting to database specified by database.yml
1674
+  (0.2ms) begin transaction
1675
+  (0.1ms) rollback transaction
1676
+  (0.0ms) begin transaction
1677
+  (0.1ms) rollback transaction
1678
+  (0.0ms) begin transaction
1679
+  (0.0ms) rollback transaction
1680
+  (0.0ms) begin transaction
1681
+  (0.0ms) rollback transaction
1682
+  (0.0ms) begin transaction
1683
+  (0.0ms) rollback transaction
1684
+  (0.0ms) begin transaction
1685
+  (0.1ms) rollback transaction
1686
+  (0.0ms) begin transaction
1687
+  (0.1ms) rollback transaction
1688
+  (0.1ms) begin transaction
1689
+  (0.1ms) rollback transaction
1690
+ Connecting to database specified by database.yml
1691
+  (0.2ms) begin transaction
1692
+  (0.1ms) rollback transaction
1693
+  (0.0ms) begin transaction
1694
+  (0.1ms) rollback transaction
1695
+  (0.0ms) begin transaction
1696
+  (0.1ms) rollback transaction
1697
+  (0.0ms) begin transaction
1698
+  (0.1ms) rollback transaction
1699
+  (0.1ms) begin transaction
1700
+  (0.0ms) rollback transaction
1701
+  (0.0ms) begin transaction
1702
+  (0.0ms) rollback transaction
1703
+  (0.0ms) begin transaction
1704
+  (0.1ms) rollback transaction
1705
+  (0.1ms) begin transaction
1706
+  (0.1ms) rollback transaction
1707
+ Connecting to database specified by database.yml
1708
+  (0.2ms) begin transaction
1709
+  (0.1ms) rollback transaction
1710
+  (0.0ms) begin transaction
1711
+  (0.1ms) rollback transaction
1712
+  (0.1ms) begin transaction
1713
+  (0.1ms) rollback transaction
1714
+  (0.0ms) begin transaction
1715
+  (0.0ms) rollback transaction
1716
+  (0.0ms) begin transaction
1717
+  (0.0ms) rollback transaction
1718
+  (0.0ms) begin transaction
1719
+  (0.0ms) rollback transaction
1720
+  (0.0ms) begin transaction
1721
+  (0.0ms) rollback transaction
1722
+  (0.0ms) begin transaction
1723
+  (0.0ms) rollback transaction
1724
+ Connecting to database specified by database.yml
1725
+  (0.2ms) begin transaction
1726
+  (0.1ms) rollback transaction
1727
+  (0.0ms) begin transaction
1728
+  (0.1ms) rollback transaction
1729
+  (0.0ms) begin transaction
1730
+  (0.0ms) rollback transaction
1731
+  (0.0ms) begin transaction
1732
+  (0.0ms) rollback transaction
1733
+  (0.0ms) begin transaction
1734
+  (0.0ms) rollback transaction
1735
+  (0.0ms) begin transaction
1736
+  (0.0ms) rollback transaction
1737
+  (0.0ms) begin transaction
1738
+  (0.0ms) rollback transaction
1739
+  (0.0ms) begin transaction
1740
+  (0.0ms) rollback transaction
1741
+ Connecting to database specified by database.yml
1742
+  (0.2ms) begin transaction
1743
+  (0.1ms) rollback transaction
1744
+  (0.0ms) begin transaction
1745
+  (0.1ms) rollback transaction
1746
+  (0.0ms) begin transaction
1747
+  (0.1ms) rollback transaction
1748
+  (0.0ms) begin transaction
1749
+  (0.0ms) rollback transaction
1750
+  (0.0ms) begin transaction
1751
+  (0.0ms) rollback transaction
1752
+  (0.0ms) begin transaction
1753
+  (0.0ms) rollback transaction
1754
+  (0.0ms) begin transaction
1755
+  (0.0ms) rollback transaction
1756
+  (0.0ms) begin transaction
1757
+  (0.0ms) rollback transaction
1758
+ Connecting to database specified by database.yml
1759
+  (0.3ms) begin transaction
1760
+  (0.1ms) rollback transaction
1761
+  (0.0ms) begin transaction
1762
+  (0.1ms) rollback transaction
1763
+  (0.1ms) begin transaction
1764
+  (0.1ms) rollback transaction
1765
+  (0.0ms) begin transaction
1766
+  (0.1ms) rollback transaction
1767
+  (0.0ms) begin transaction
1768
+  (0.1ms) rollback transaction
1769
+  (0.1ms) begin transaction
1770
+  (0.1ms) rollback transaction
1771
+  (0.0ms) begin transaction
1772
+  (0.1ms) rollback transaction
1773
+  (0.1ms) begin transaction
1774
+  (0.0ms) rollback transaction
1775
+ Connecting to database specified by database.yml
1776
+  (0.3ms) begin transaction
1777
+  (0.1ms) rollback transaction
1778
+  (0.1ms) begin transaction
1779
+  (0.1ms) rollback transaction
1780
+  (0.0ms) begin transaction
1781
+  (0.1ms) rollback transaction
1782
+  (0.0ms) begin transaction
1783
+  (0.0ms) rollback transaction
1784
+  (0.0ms) begin transaction
1785
+  (0.0ms) rollback transaction
1786
+  (0.1ms) begin transaction
1787
+  (0.0ms) rollback transaction
1788
+  (0.0ms) begin transaction
1789
+  (0.1ms) rollback transaction
1790
+  (0.0ms) begin transaction
1791
+  (0.0ms) rollback transaction
1792
+ Connecting to database specified by database.yml
1793
+  (0.2ms) begin transaction
1794
+  (0.1ms) rollback transaction
1795
+  (0.0ms) begin transaction
1796
+  (0.1ms) rollback transaction
1797
+  (0.0ms) begin transaction
1798
+  (0.0ms) rollback transaction
1799
+  (0.0ms) begin transaction
1800
+  (0.0ms) rollback transaction
1801
+  (0.0ms) begin transaction
1802
+  (0.0ms) rollback transaction
1803
+  (0.0ms) begin transaction
1804
+  (0.0ms) rollback transaction
1805
+  (0.0ms) begin transaction
1806
+  (0.0ms) rollback transaction
1807
+  (0.0ms) begin transaction
1808
+  (0.0ms) rollback transaction
1809
+ Connecting to database specified by database.yml
1810
+  (0.2ms) begin transaction
1811
+  (0.1ms) rollback transaction
1812
+  (0.0ms) begin transaction
1813
+  (0.1ms) rollback transaction
1814
+  (0.0ms) begin transaction
1815
+  (0.1ms) rollback transaction
1816
+  (0.0ms) begin transaction
1817
+  (0.1ms) rollback transaction
1818
+  (0.0ms) begin transaction
1819
+  (0.1ms) rollback transaction
1820
+  (0.1ms) begin transaction
1821
+  (0.1ms) rollback transaction
1822
+  (0.0ms) begin transaction
1823
+  (0.1ms) rollback transaction
1824
+  (0.1ms) begin transaction
1825
+  (0.0ms) rollback transaction
1826
+ Connecting to database specified by database.yml
1827
+  (0.3ms) begin transaction
1828
+  (0.1ms) rollback transaction
1829
+  (0.1ms) begin transaction
1830
+  (0.1ms) rollback transaction
1831
+  (0.0ms) begin transaction
1832
+  (0.0ms) rollback transaction
1833
+  (0.0ms) begin transaction
1834
+  (0.0ms) rollback transaction
1835
+  (0.0ms) begin transaction
1836
+  (0.0ms) rollback transaction
1837
+  (0.0ms) begin transaction
1838
+  (0.0ms) rollback transaction
1839
+  (0.0ms) begin transaction
1840
+  (0.0ms) rollback transaction
1841
+  (0.0ms) begin transaction
1842
+  (0.0ms) rollback transaction
1843
+ Connecting to database specified by database.yml
1844
+  (0.2ms) begin transaction
1845
+  (0.1ms) rollback transaction
1846
+  (0.0ms) begin transaction
1847
+  (0.1ms) rollback transaction
1848
+  (0.0ms) begin transaction
1849
+  (0.0ms) rollback transaction
1850
+  (0.0ms) begin transaction
1851
+  (0.0ms) rollback transaction
1852
+  (0.0ms) begin transaction
1853
+  (0.0ms) rollback transaction
1854
+  (0.0ms) begin transaction
1855
+  (0.0ms) rollback transaction
1856
+  (0.0ms) begin transaction
1857
+  (0.0ms) rollback transaction
1858
+  (0.0ms) begin transaction
1859
+  (0.0ms) rollback transaction
1860
+ Connecting to database specified by database.yml
1861
+  (0.2ms) begin transaction
1862
+  (0.1ms) rollback transaction
1863
+  (0.0ms) begin transaction
1864
+  (0.1ms) rollback transaction
1865
+  (0.0ms) begin transaction
1866
+  (0.1ms) rollback transaction
1867
+  (0.0ms) begin transaction
1868
+  (0.1ms) rollback transaction
1869
+  (0.0ms) begin transaction
1870
+  (0.0ms) rollback transaction
1871
+  (0.0ms) begin transaction
1872
+  (0.0ms) rollback transaction
1873
+  (0.0ms) begin transaction
1874
+  (0.0ms) rollback transaction
1875
+  (0.0ms) begin transaction
1876
+  (0.0ms) rollback transaction
1877
+ Connecting to database specified by database.yml
1878
+  (0.3ms) begin transaction
1879
+  (0.1ms) rollback transaction
1880
+  (0.1ms) begin transaction
1881
+  (0.1ms) rollback transaction
1882
+  (0.0ms) begin transaction
1883
+  (0.1ms) rollback transaction
1884
+  (0.0ms) begin transaction
1885
+  (0.1ms) rollback transaction
1886
+  (0.0ms) begin transaction
1887
+  (0.0ms) rollback transaction
1888
+  (0.0ms) begin transaction
1889
+  (0.0ms) rollback transaction
1890
+  (0.0ms) begin transaction
1891
+  (0.0ms) rollback transaction
1892
+  (0.0ms) begin transaction
1893
+  (0.0ms) rollback transaction
1894
+ Connecting to database specified by database.yml
1895
+  (0.3ms) begin transaction
1896
+  (0.1ms) rollback transaction
1897
+  (0.1ms) begin transaction
1898
+  (0.1ms) rollback transaction
1899
+  (0.1ms) begin transaction
1900
+  (0.1ms) rollback transaction
1901
+  (0.0ms) begin transaction
1902
+  (0.0ms) rollback transaction
1903
+  (0.0ms) begin transaction
1904
+  (0.1ms) rollback transaction
1905
+  (0.0ms) begin transaction
1906
+  (0.0ms) rollback transaction
1907
+  (0.0ms) begin transaction
1908
+  (0.0ms) rollback transaction
1909
+  (0.0ms) begin transaction
1910
+  (0.0ms) rollback transaction
1911
+ Connecting to database specified by database.yml
1912
+  (0.2ms) begin transaction
1913
+  (0.1ms) rollback transaction
1914
+  (0.0ms) begin transaction
1915
+  (0.1ms) rollback transaction
1916
+  (0.0ms) begin transaction
1917
+  (0.0ms) rollback transaction
1918
+  (0.0ms) begin transaction
1919
+  (0.0ms) rollback transaction
1920
+  (0.0ms) begin transaction
1921
+  (0.1ms) rollback transaction
1922
+  (0.0ms) begin transaction
1923
+  (0.0ms) rollback transaction
1924
+  (0.0ms) begin transaction
1925
+  (0.0ms) rollback transaction
1926
+  (0.0ms) begin transaction
1927
+  (0.0ms) rollback transaction
1928
+ Connecting to database specified by database.yml
1929
+  (0.2ms) begin transaction
1930
+  (0.1ms) rollback transaction
1931
+  (0.0ms) begin transaction
1932
+  (0.1ms) rollback transaction
1933
+  (0.0ms) begin transaction
1934
+  (0.0ms) rollback transaction
1935
+  (0.0ms) begin transaction
1936
+  (0.1ms) rollback transaction
1937
+  (0.0ms) begin transaction
1938
+  (0.0ms) rollback transaction
1939
+  (0.0ms) begin transaction
1940
+  (0.0ms) rollback transaction
1941
+  (0.0ms) begin transaction
1942
+  (0.0ms) rollback transaction
1943
+  (0.0ms) begin transaction
1944
+  (0.0ms) rollback transaction
1945
+ Connecting to database specified by database.yml
1946
+  (0.3ms) begin transaction
1947
+  (0.1ms) rollback transaction
1948
+  (0.0ms) begin transaction
1949
+  (0.1ms) rollback transaction
1950
+  (0.0ms) begin transaction
1951
+  (0.1ms) rollback transaction
1952
+  (0.0ms) begin transaction
1953
+  (0.1ms) rollback transaction
1954
+  (0.0ms) begin transaction
1955
+  (0.0ms) rollback transaction
1956
+  (0.0ms) begin transaction
1957
+  (0.0ms) rollback transaction
1958
+  (0.0ms) begin transaction
1959
+  (0.0ms) rollback transaction
1960
+  (0.0ms) begin transaction
1961
+  (0.0ms) rollback transaction
1962
+ Connecting to database specified by database.yml
1963
+  (0.3ms) begin transaction
1964
+  (0.1ms) rollback transaction
1965
+  (0.0ms) begin transaction
1966
+  (0.1ms) rollback transaction
1967
+  (0.0ms) begin transaction
1968
+  (0.1ms) rollback transaction
1969
+  (0.0ms) begin transaction
1970
+  (0.0ms) rollback transaction
1971
+  (0.0ms) begin transaction
1972
+  (0.0ms) rollback transaction
1973
+  (0.0ms) begin transaction
1974
+  (0.0ms) rollback transaction
1975
+  (0.0ms) begin transaction
1976
+  (0.0ms) rollback transaction
1977
+  (0.0ms) begin transaction
1978
+  (0.0ms) rollback transaction
1979
+ Connecting to database specified by database.yml
1980
+  (0.2ms) begin transaction
1981
+  (0.1ms) rollback transaction
1982
+  (0.0ms) begin transaction
1983
+  (0.1ms) rollback transaction
1984
+  (0.0ms) begin transaction
1985
+  (0.1ms) rollback transaction
1986
+  (0.0ms) begin transaction
1987
+  (0.0ms) rollback transaction
1988
+  (0.0ms) begin transaction
1989
+  (0.0ms) rollback transaction
1990
+  (0.0ms) begin transaction
1991
+  (0.0ms) rollback transaction
1992
+  (0.0ms) begin transaction
1993
+  (0.1ms) rollback transaction
1994
+  (0.0ms) begin transaction
1995
+  (0.0ms) rollback transaction
1996
+ Connecting to database specified by database.yml
1997
+  (0.2ms) begin transaction
1998
+  (0.1ms) rollback transaction
1999
+  (0.0ms) begin transaction
2000
+  (0.1ms) rollback transaction
2001
+  (0.0ms) begin transaction
2002
+  (0.0ms) rollback transaction
2003
+  (0.0ms) begin transaction
2004
+  (0.1ms) rollback transaction
2005
+  (0.1ms) begin transaction
2006
+  (0.1ms) rollback transaction
2007
+  (0.0ms) begin transaction
2008
+  (0.0ms) rollback transaction
2009
+  (0.0ms) begin transaction
2010
+  (0.0ms) rollback transaction
2011
+  (0.0ms) begin transaction
2012
+  (0.0ms) rollback transaction
2013
+ Connecting to database specified by database.yml
2014
+  (0.2ms) begin transaction
2015
+  (0.1ms) rollback transaction
2016
+  (0.0ms) begin transaction
2017
+  (0.1ms) rollback transaction
2018
+  (0.1ms) begin transaction
2019
+  (0.1ms) rollback transaction
2020
+  (0.0ms) begin transaction
2021
+  (0.0ms) rollback transaction
2022
+  (0.0ms) begin transaction
2023
+  (0.0ms) rollback transaction
2024
+  (0.0ms) begin transaction
2025
+  (0.0ms) rollback transaction
2026
+  (0.0ms) begin transaction
2027
+  (0.0ms) rollback transaction
2028
+  (0.0ms) begin transaction
2029
+  (0.0ms) rollback transaction
2030
+ Connecting to database specified by database.yml
2031
+  (0.2ms) begin transaction
2032
+  (0.1ms) rollback transaction
2033
+  (0.0ms) begin transaction
2034
+  (0.1ms) rollback transaction
2035
+  (0.0ms) begin transaction
2036
+  (0.1ms) rollback transaction
2037
+  (0.1ms) begin transaction
2038
+  (0.1ms) rollback transaction
2039
+  (0.0ms) begin transaction
2040
+  (0.0ms) rollback transaction
2041
+  (0.0ms) begin transaction
2042
+  (0.0ms) rollback transaction
2043
+  (0.0ms) begin transaction
2044
+  (0.0ms) rollback transaction
2045
+  (0.0ms) begin transaction
2046
+  (0.0ms) rollback transaction
2047
+ Connecting to database specified by database.yml
2048
+  (0.2ms) begin transaction
2049
+  (0.1ms) rollback transaction
2050
+  (0.0ms) begin transaction
2051
+  (0.1ms) rollback transaction
2052
+  (0.1ms) begin transaction
2053
+  (0.1ms) rollback transaction
2054
+  (0.0ms) begin transaction
2055
+  (0.1ms) rollback transaction
2056
+  (0.0ms) begin transaction
2057
+  (0.0ms) rollback transaction
2058
+  (0.0ms) begin transaction
2059
+  (0.1ms) rollback transaction
2060
+  (0.1ms) begin transaction
2061
+  (0.1ms) rollback transaction
2062
+  (0.1ms) begin transaction
2063
+  (0.0ms) rollback transaction
2064
+ Connecting to database specified by database.yml
2065
+  (0.2ms) begin transaction
2066
+  (0.1ms) rollback transaction
2067
+  (0.0ms) begin transaction
2068
+  (0.1ms) rollback transaction
2069
+  (0.0ms) begin transaction
2070
+  (0.0ms) rollback transaction
2071
+  (0.0ms) begin transaction
2072
+  (0.0ms) rollback transaction
2073
+  (0.0ms) begin transaction
2074
+  (0.0ms) rollback transaction
2075
+  (0.0ms) begin transaction
2076
+  (0.0ms) rollback transaction
2077
+  (0.0ms) begin transaction
2078
+  (0.0ms) rollback transaction
2079
+  (0.0ms) begin transaction
2080
+  (0.0ms) rollback transaction
2081
+ Connecting to database specified by database.yml
2082
+  (0.2ms) begin transaction
2083
+  (0.1ms) rollback transaction
2084
+  (0.0ms) begin transaction
2085
+  (0.1ms) rollback transaction
2086
+  (0.0ms) begin transaction
2087
+  (0.1ms) rollback transaction
2088
+  (0.0ms) begin transaction
2089
+  (0.0ms) rollback transaction
2090
+  (0.0ms) begin transaction
2091
+  (0.0ms) rollback transaction
2092
+  (0.0ms) begin transaction
2093
+  (0.0ms) rollback transaction
2094
+  (0.0ms) begin transaction
2095
+  (0.0ms) rollback transaction
2096
+  (0.0ms) begin transaction
2097
+  (0.0ms) rollback transaction
2098
+ Connecting to database specified by database.yml
2099
+  (0.2ms) begin transaction
2100
+  (0.1ms) rollback transaction
2101
+  (0.0ms) begin transaction
2102
+  (0.0ms) rollback transaction
2103
+  (0.0ms) begin transaction
2104
+  (0.0ms) rollback transaction
2105
+  (0.0ms) begin transaction
2106
+  (0.0ms) rollback transaction
2107
+  (0.0ms) begin transaction
2108
+  (0.0ms) rollback transaction
2109
+  (0.0ms) begin transaction
2110
+  (0.0ms) rollback transaction
2111
+  (0.0ms) begin transaction
2112
+  (0.0ms) rollback transaction
2113
+  (0.0ms) begin transaction
2114
+  (0.0ms) rollback transaction
2115
+  (0.0ms) begin transaction
2116
+  (0.0ms) rollback transaction
2117
+ Connecting to database specified by database.yml
2118
+  (0.2ms) begin transaction
2119
+  (0.1ms) rollback transaction
2120
+  (0.0ms) begin transaction
2121
+  (0.0ms) rollback transaction
2122
+  (0.0ms) begin transaction
2123
+  (0.0ms) rollback transaction
2124
+  (0.0ms) begin transaction
2125
+  (0.0ms) rollback transaction
2126
+  (0.0ms) begin transaction
2127
+  (0.0ms) rollback transaction
2128
+  (0.0ms) begin transaction
2129
+  (0.0ms) rollback transaction
2130
+  (0.0ms) begin transaction
2131
+  (0.0ms) rollback transaction
2132
+  (0.0ms) begin transaction
2133
+  (0.0ms) rollback transaction
2134
+  (0.0ms) begin transaction
2135
+  (0.0ms) rollback transaction
2136
+ Connecting to database specified by database.yml
2137
+  (0.2ms) begin transaction
2138
+  (0.1ms) rollback transaction
2139
+  (0.0ms) begin transaction
2140
+  (0.0ms) rollback transaction
2141
+  (0.0ms) begin transaction
2142
+  (0.1ms) rollback transaction
2143
+  (0.0ms) begin transaction
2144
+  (0.0ms) rollback transaction
2145
+  (0.0ms) begin transaction
2146
+  (0.0ms) rollback transaction
2147
+  (0.0ms) begin transaction
2148
+  (0.0ms) rollback transaction
2149
+  (0.0ms) begin transaction
2150
+  (0.0ms) rollback transaction
2151
+  (0.0ms) begin transaction
2152
+  (0.0ms) rollback transaction
2153
+  (0.0ms) begin transaction
2154
+  (0.0ms) rollback transaction
2155
+ Connecting to database specified by database.yml
2156
+  (0.3ms) begin transaction
2157
+  (0.1ms) rollback transaction
2158
+  (0.0ms) begin transaction
2159
+  (0.0ms) rollback transaction
2160
+  (0.0ms) begin transaction
2161
+  (0.0ms) rollback transaction
2162
+  (0.0ms) begin transaction
2163
+  (0.1ms) rollback transaction
2164
+  (0.0ms) begin transaction
2165
+  (0.0ms) rollback transaction
2166
+  (0.0ms) begin transaction
2167
+  (0.0ms) rollback transaction
2168
+  (0.0ms) begin transaction
2169
+  (0.0ms) rollback transaction
2170
+  (0.0ms) begin transaction
2171
+  (0.0ms) rollback transaction
2172
+  (0.0ms) begin transaction
2173
+  (0.0ms) rollback transaction
2174
+ Connecting to database specified by database.yml
2175
+  (0.2ms) begin transaction
2176
+  (0.1ms) rollback transaction
2177
+ Connecting to database specified by database.yml
2178
+  (0.2ms) begin transaction
2179
+  (0.1ms) rollback transaction
2180
+ Connecting to database specified by database.yml
2181
+  (0.2ms) begin transaction
2182
+  (0.1ms) rollback transaction
2183
+ Connecting to database specified by database.yml
2184
+  (0.2ms) begin transaction
2185
+  (0.1ms) rollback transaction
2186
+ Connecting to database specified by database.yml
2187
+  (0.2ms) begin transaction
2188
+  (0.1ms) rollback transaction
2189
+  (0.0ms) begin transaction
2190
+  (0.0ms) rollback transaction
2191
+  (0.0ms) begin transaction
2192
+  (0.0ms) rollback transaction
2193
+  (0.0ms) begin transaction
2194
+  (0.0ms) rollback transaction
2195
+  (0.0ms) begin transaction
2196
+  (0.0ms) rollback transaction
2197
+  (0.0ms) begin transaction
2198
+  (0.0ms) rollback transaction
2199
+  (0.0ms) begin transaction
2200
+  (0.1ms) rollback transaction
2201
+  (0.0ms) begin transaction
2202
+  (0.0ms) rollback transaction
2203
+  (0.0ms) begin transaction
2204
+  (0.0ms) rollback transaction
2205
+ Connecting to database specified by database.yml
2206
+  (0.2ms) begin transaction
2207
+  (0.1ms) rollback transaction
2208
+  (0.0ms) begin transaction
2209
+  (0.1ms) rollback transaction
2210
+  (0.0ms) begin transaction
2211
+  (0.0ms) rollback transaction
2212
+  (0.0ms) begin transaction
2213
+  (0.0ms) rollback transaction
2214
+  (0.0ms) begin transaction
2215
+  (0.0ms) rollback transaction
2216
+  (0.0ms) begin transaction
2217
+  (0.0ms) rollback transaction
2218
+  (0.0ms) begin transaction
2219
+  (0.0ms) rollback transaction
2220
+  (0.0ms) begin transaction
2221
+  (0.0ms) rollback transaction
2222
+  (0.0ms) begin transaction
2223
+  (0.0ms) rollback transaction
2224
+ Connecting to database specified by database.yml
2225
+  (0.2ms) begin transaction
2226
+  (0.1ms) rollback transaction
2227
+  (0.1ms) begin transaction
2228
+  (0.1ms) rollback transaction
2229
+  (0.0ms) begin transaction
2230
+  (0.1ms) rollback transaction
2231
+  (0.0ms) begin transaction
2232
+  (0.1ms) rollback transaction
2233
+  (0.1ms) begin transaction
2234
+  (0.1ms) rollback transaction
2235
+  (0.0ms) begin transaction
2236
+  (0.1ms) rollback transaction
2237
+  (0.1ms) begin transaction
2238
+  (0.1ms) rollback transaction
2239
+  (0.0ms) begin transaction
2240
+  (0.1ms) rollback transaction
2241
+  (0.1ms) begin transaction
2242
+  (0.0ms) rollback transaction
2243
+ Connecting to database specified by database.yml
2244
+  (0.2ms) begin transaction
2245
+  (0.1ms) rollback transaction
2246
+  (0.0ms) begin transaction
2247
+  (0.0ms) rollback transaction
2248
+  (0.0ms) begin transaction
2249
+  (0.0ms) rollback transaction
2250
+  (0.0ms) begin transaction
2251
+  (0.1ms) rollback transaction
2252
+  (0.0ms) begin transaction
2253
+  (0.0ms) rollback transaction
2254
+  (0.0ms) begin transaction
2255
+  (0.0ms) rollback transaction
2256
+  (0.0ms) begin transaction
2257
+  (0.0ms) rollback transaction
2258
+  (0.0ms) begin transaction
2259
+  (0.0ms) rollback transaction
2260
+  (0.0ms) begin transaction
2261
+  (0.0ms) rollback transaction
2262
+ Connecting to database specified by database.yml
2263
+  (0.2ms) begin transaction
2264
+  (0.1ms) rollback transaction
2265
+  (0.0ms) begin transaction
2266
+  (0.0ms) rollback transaction
2267
+  (0.0ms) begin transaction
2268
+  (0.1ms) rollback transaction
2269
+  (0.0ms) begin transaction
2270
+  (0.0ms) rollback transaction
2271
+  (0.0ms) begin transaction
2272
+  (0.0ms) rollback transaction
2273
+  (0.0ms) begin transaction
2274
+  (0.0ms) rollback transaction
2275
+  (0.0ms) begin transaction
2276
+  (0.0ms) rollback transaction
2277
+  (0.0ms) begin transaction
2278
+  (0.0ms) rollback transaction
2279
+  (0.0ms) begin transaction
2280
+  (0.0ms) rollback transaction
2281
+ Connecting to database specified by database.yml
2282
+  (0.2ms) begin transaction
2283
+  (0.1ms) rollback transaction
2284
+  (0.0ms) begin transaction
2285
+  (0.0ms) rollback transaction
2286
+  (0.0ms) begin transaction
2287
+  (0.0ms) rollback transaction
2288
+  (0.0ms) begin transaction
2289
+  (0.0ms) rollback transaction
2290
+  (0.0ms) begin transaction
2291
+  (0.0ms) rollback transaction
2292
+  (0.0ms) begin transaction
2293
+  (0.0ms) rollback transaction
2294
+  (0.0ms) begin transaction
2295
+  (0.0ms) rollback transaction
2296
+  (0.0ms) begin transaction
2297
+  (0.0ms) rollback transaction
2298
+  (0.0ms) begin transaction
2299
+  (0.0ms) rollback transaction
2300
+ Connecting to database specified by database.yml
2301
+  (0.2ms) begin transaction
2302
+  (0.1ms) rollback transaction
2303
+  (0.1ms) begin transaction
2304
+  (0.1ms) rollback transaction
2305
+  (0.0ms) begin transaction
2306
+  (0.1ms) rollback transaction
2307
+  (0.1ms) begin transaction
2308
+  (0.0ms) rollback transaction
2309
+  (0.0ms) begin transaction
2310
+  (0.0ms) rollback transaction
2311
+  (0.0ms) begin transaction
2312
+  (0.1ms) rollback transaction
2313
+  (0.1ms) begin transaction
2314
+  (0.1ms) rollback transaction
2315
+  (0.0ms) begin transaction
2316
+  (0.0ms) rollback transaction
2317
+  (0.0ms) begin transaction
2318
+  (0.0ms) rollback transaction
2319
+ Connecting to database specified by database.yml
2320
+  (0.2ms) begin transaction
2321
+  (0.1ms) rollback transaction
2322
+  (0.0ms) begin transaction
2323
+  (0.0ms) rollback transaction
2324
+  (0.0ms) begin transaction
2325
+  (0.0ms) rollback transaction
2326
+  (0.0ms) begin transaction
2327
+  (0.0ms) rollback transaction
2328
+  (0.0ms) begin transaction
2329
+  (0.0ms) rollback transaction
2330
+  (0.0ms) begin transaction
2331
+  (0.0ms) rollback transaction
2332
+  (0.0ms) begin transaction
2333
+  (0.0ms) rollback transaction
2334
+  (0.0ms) begin transaction
2335
+  (0.0ms) rollback transaction
2336
+  (0.0ms) begin transaction
2337
+  (0.0ms) rollback transaction
2338
+  (0.0ms) begin transaction
2339
+  (0.0ms) rollback transaction
2340
+ Connecting to database specified by database.yml
2341
+  (0.2ms) begin transaction
2342
+  (0.1ms) rollback transaction
2343
+  (0.0ms) begin transaction
2344
+  (0.0ms) rollback transaction
2345
+  (0.0ms) begin transaction
2346
+  (0.0ms) rollback transaction
2347
+  (0.0ms) begin transaction
2348
+  (0.0ms) rollback transaction
2349
+  (0.0ms) begin transaction
2350
+  (0.0ms) rollback transaction
2351
+  (0.0ms) begin transaction
2352
+  (0.0ms) rollback transaction
2353
+  (0.0ms) begin transaction
2354
+  (0.0ms) rollback transaction
2355
+  (0.0ms) begin transaction
2356
+  (0.0ms) rollback transaction
2357
+  (0.0ms) begin transaction
2358
+  (0.0ms) rollback transaction
2359
+  (0.0ms) begin transaction
2360
+  (0.0ms) rollback transaction
2361
+ Connecting to database specified by database.yml
2362
+  (0.2ms) begin transaction
2363
+  (0.1ms) rollback transaction
2364
+  (0.0ms) begin transaction
2365
+  (0.0ms) rollback transaction
2366
+  (0.0ms) begin transaction
2367
+  (0.0ms) rollback transaction
2368
+  (0.0ms) begin transaction
2369
+  (0.0ms) rollback transaction
2370
+  (0.0ms) begin transaction
2371
+  (0.1ms) rollback transaction
2372
+  (0.0ms) begin transaction
2373
+  (0.0ms) rollback transaction
2374
+  (0.0ms) begin transaction
2375
+  (0.0ms) rollback transaction
2376
+  (0.0ms) begin transaction
2377
+  (0.0ms) rollback transaction
2378
+  (0.0ms) begin transaction
2379
+  (0.0ms) rollback transaction
2380
+  (0.0ms) begin transaction
2381
+  (0.0ms) rollback transaction
2382
+ Connecting to database specified by database.yml
2383
+  (0.2ms) begin transaction
2384
+  (0.1ms) rollback transaction
2385
+  (0.0ms) begin transaction
2386
+  (0.0ms) rollback transaction
2387
+  (0.0ms) begin transaction
2388
+  (0.0ms) rollback transaction
2389
+  (0.0ms) begin transaction
2390
+  (0.0ms) rollback transaction
2391
+  (0.0ms) begin transaction
2392
+  (0.0ms) rollback transaction
2393
+  (0.0ms) begin transaction
2394
+  (0.0ms) rollback transaction
2395
+  (0.0ms) begin transaction
2396
+  (0.0ms) rollback transaction
2397
+  (0.0ms) begin transaction
2398
+  (0.0ms) rollback transaction
2399
+  (0.0ms) begin transaction
2400
+  (0.0ms) rollback transaction
2401
+  (0.0ms) begin transaction
2402
+  (0.0ms) rollback transaction
2403
+ Connecting to database specified by database.yml
2404
+  (0.2ms) begin transaction
2405
+  (0.1ms) rollback transaction
2406
+  (0.0ms) begin transaction
2407
+  (0.0ms) rollback transaction
2408
+  (0.0ms) begin transaction
2409
+  (0.0ms) rollback transaction
2410
+  (0.0ms) begin transaction
2411
+  (0.0ms) rollback transaction
2412
+  (0.0ms) begin transaction
2413
+  (0.0ms) rollback transaction
2414
+  (0.0ms) begin transaction
2415
+  (0.0ms) rollback transaction
2416
+  (0.0ms) begin transaction
2417
+  (0.0ms) rollback transaction
2418
+  (0.0ms) begin transaction
2419
+  (0.0ms) rollback transaction
2420
+  (0.0ms) begin transaction
2421
+  (0.0ms) rollback transaction
2422
+  (0.0ms) begin transaction
2423
+  (0.0ms) rollback transaction
2424
+ Connecting to database specified by database.yml
2425
+  (0.2ms) begin transaction
2426
+  (0.1ms) rollback transaction
2427
+  (0.0ms) begin transaction
2428
+  (0.0ms) rollback transaction
2429
+  (0.0ms) begin transaction
2430
+  (0.0ms) rollback transaction
2431
+  (0.0ms) begin transaction
2432
+  (0.0ms) rollback transaction
2433
+  (0.0ms) begin transaction
2434
+  (0.0ms) rollback transaction
2435
+  (0.0ms) begin transaction
2436
+  (0.0ms) rollback transaction
2437
+  (0.0ms) begin transaction
2438
+  (0.0ms) rollback transaction
2439
+  (0.0ms) begin transaction
2440
+  (0.0ms) rollback transaction
2441
+  (0.0ms) begin transaction
2442
+  (0.0ms) rollback transaction
2443
+  (0.0ms) begin transaction
2444
+  (0.0ms) rollback transaction
2445
+ Connecting to database specified by database.yml
2446
+  (0.2ms) begin transaction
2447
+  (0.1ms) rollback transaction
2448
+  (0.0ms) begin transaction
2449
+  (0.0ms) rollback transaction
2450
+  (0.0ms) begin transaction
2451
+  (0.0ms) rollback transaction
2452
+  (0.0ms) begin transaction
2453
+  (0.0ms) rollback transaction
2454
+  (0.0ms) begin transaction
2455
+  (0.0ms) rollback transaction
2456
+  (0.0ms) begin transaction
2457
+  (0.0ms) rollback transaction
2458
+  (0.0ms) begin transaction
2459
+  (0.1ms) rollback transaction
2460
+  (0.1ms) begin transaction
2461
+  (0.0ms) rollback transaction
2462
+  (0.0ms) begin transaction
2463
+  (0.0ms) rollback transaction
2464
+  (0.0ms) begin transaction
2465
+  (0.0ms) rollback transaction
@@ -8,6 +8,20 @@ class FormBuilderTest < ActionView::TestCase
8
8
  end
9
9
  end
10
10
 
11
+ test 'adds a valid constraint type i18n' do
12
+ with_parsley_form_for @user do |f|
13
+ f.input :credit_limit
14
+ end
15
+ assert_select 'input'
16
+ end
17
+
18
+ test 'doesnt add invalid constraint type i18n' do
19
+ with_parsley_form_for @user do |f|
20
+ f.input :name
21
+ end
22
+ assert_select 'input[data-type-string-message]', 0
23
+ end
24
+
11
25
  test 'required constraint' do
12
26
  with_parsley_form_for @user do |f|
13
27
  f.input :name, required: true
@@ -23,6 +37,16 @@ class FormBuilderTest < ActionView::TestCase
23
37
  assert_select 'input[data-equalto="#user_password"]'
24
38
  end
25
39
 
40
+ test 'equalto constraint on nested form' do
41
+ with_parsley_form_for @user do |f|
42
+ f.simple_fields_for @post do |posts_form|
43
+ posts_form.input :password
44
+ posts_form.input :password_confirmation, equalto: :password
45
+ end
46
+ end
47
+ assert_select 'input[data-equalto="#user_post_attributes_password"]'
48
+ end
49
+
26
50
  test 'notblank constraint' do
27
51
  with_parsley_form_for @user do |f|
28
52
  f.input :email, notblank: true
@@ -116,4 +116,7 @@ class User
116
116
  def self.readonly_attributes
117
117
  ["credit_card"]
118
118
  end
119
+ end
120
+
121
+ class Post < User
119
122
  end
@@ -15,7 +15,7 @@ require "rails/generators/test_case"
15
15
 
16
16
  require 'simple_form'
17
17
 
18
- require_relative 'support/user'
18
+ require_relative 'support/models'
19
19
 
20
20
  module Rails
21
21
  def self.env
@@ -57,6 +57,7 @@ class ActionView::TestCase
57
57
 
58
58
  def setup_users(extra_attributes = {})
59
59
  @user = User.build(extra_attributes)
60
+ @post = Post.build
60
61
  end
61
62
 
62
63
  alias :users_path :user_path
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parsley_simple_form
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guilherme Moretti
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-16 00:00:00.000000000 Z
11
+ date: 2013-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -78,6 +78,7 @@ files:
78
78
  - lib/parsley_simple_form/action_view_extensions/form_helper.rb
79
79
  - lib/parsley_simple_form/constraints/base_constraint.rb
80
80
  - lib/parsley_simple_form/constraints/basics/equalto_constraint.rb
81
+ - lib/parsley_simple_form/constraints/basics/type_constraint.rb
81
82
  - lib/parsley_simple_form/constraints/basics/notblank_constraint.rb
82
83
  - lib/parsley_simple_form/constraints/basics/required_constraint.rb
83
84
  - lib/parsley_simple_form/form_builder.rb
@@ -118,11 +119,12 @@ files:
118
119
  - test/dummy/app/views/layouts/application.html.erb
119
120
  - test/dummy/app/assets/stylesheets/application.css
120
121
  - test/dummy/app/assets/javascripts/application.js
121
- - test/support/user.rb
122
+ - test/support/models.rb
122
123
  - test/form_builder_test.rb
123
124
  - test/form_helper_test.rb
124
125
  homepage: http://github.com/innvent/parsley_simple_form
125
- licenses: []
126
+ licenses:
127
+ - MIT
126
128
  metadata: {}
127
129
  post_install_message:
128
130
  rdoc_options: []
@@ -177,6 +179,6 @@ test_files:
177
179
  - test/dummy/app/views/layouts/application.html.erb
178
180
  - test/dummy/app/assets/stylesheets/application.css
179
181
  - test/dummy/app/assets/javascripts/application.js
180
- - test/support/user.rb
182
+ - test/support/models.rb
181
183
  - test/form_builder_test.rb
182
184
  - test/form_helper_test.rb