pen-rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9ce91a2a956d66676a07ed5389198e7634932140
4
+ data.tar.gz: 3eeb027390d2caf54fb76be006109bfa9de75bc1
5
+ SHA512:
6
+ metadata.gz: 27979c6b3a244d98c596ffdf60bdaa0208605eedbd0196a34113bf3769f696c05c3b2e81e1ebf8d48f68cacf3681caffe2dd4b3e746c005a78f923698ffa29c2
7
+ data.tar.gz: c9482407a64708ad68924a2045df64c1bdd80558a2fb8e46443ff4e9f73df57c27e5f2ff7fa62d3b1761fdaf8c7c380466de3a49ff99a2273050d1d4825309f4
@@ -0,0 +1,7 @@
1
+ Copyright (C) 2012 Peter Hamilton
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,30 @@
1
+ # Backbone.Validation Gem for Rails
2
+
3
+ A wrapper for the [Backbone.Validation](https://github.com/thedersen/backbone.validation) plugin for [Backbone](https://github.com/documentcloud/backbone/)
4
+
5
+ ## Version
6
+ The version of this gem follows that of the associated Backbone.Validation version
7
+
8
+ Currently: **v0.8.0**
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ gem 'backbone-validation-rails'
15
+
16
+ And then execute:
17
+
18
+ $ bundle install
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install backbone-validation-rails
23
+
24
+ ## Contributing
25
+
26
+ 1. Fork it
27
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
28
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
29
+ 4. Push to the branch (`git push origin my-new-feature`)
30
+ 5. Create new Pull Request
@@ -0,0 +1,9 @@
1
+ require "pen-rails/version"
2
+
3
+ module Pen
4
+ module Rails
5
+ class Engine < ::Rails::Engine
6
+
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ module Pen
2
+ module Rails
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,36 @@
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>Copyright (C) 2012 by original authors @ fontello.com</metadata>
5
+ <defs>
6
+ <font id="fontello" horiz-adv-x="1000" >
7
+ <font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
8
+ <missing-glyph horiz-adv-x="1000" />
9
+ <glyph glyph-name="location" unicode="&#xe815;" d="M429 493q0 59-42 101t-101 42-101-42-42-101 42-101 101-42 101 42 42 101z m143 0q0-61-18-100l-203-432q-9-18-27-29t-38-11-38 11-26 29l-204 432q-18 39-18 100 0 118 84 202t202 84 202-84 84-202z" horiz-adv-x="571.429" />
10
+ <glyph glyph-name="fit" unicode="&#xe80f;" d="M429 314l0-250q0-15-11-25t-25-11-25 11l-80 80-185-185q-6-6-13-6t-13 6l-64 64q-6 6-6 13t6 13l185 185-80 80q-11 11-11 25t11 25 25 11l250 0q15 0 25-11t11-25z m421 375q0-7-6-13l-185-185 80-80q11-11 11-25t-11-25-25-11l-250 0q-15 0-25 11t-11 25l0 250q0 15 11 25t25 11 25-11l80-80 185 185q6 6 13 6t13-6l64-64q6-6 6-13z" horiz-adv-x="857.143" />
11
+ <glyph glyph-name="bold" unicode="&#xe805;" d="M310 1q42-18 78-18 73 0 121 23t68 63q21 39 21 101 0 64-23 100-32 52-79 70-45 18-138 18-41 0-56-6l0-80-1-97 2-151q0-8 7-25z m-8 416q24-4 61-4 98 0 147 36t50 125q0 62-47 104t-142 42q-29 0-73-7 0-25 1-43 4-68 3-156l-1-55q0-24 1-43z m-302-496l1 52q25 5 38 7 43 7 69 17 9 15 12 28 5 37 5 108l-1 277q-3 143-5 225-1 49-6 61-1 2-7 7-10 7-39 8-17 1-64 7l-2 46 145 3 212 7 25 1q3 0 8 0t8 0q1 0 12 0t23 0l41 0q49 0 107-15 24-7 54-22 32-16 57-42t36-58 12-68q0-39-18-71t-53-59q-15-11-84-43 99-23 149-81 51-59 51-132 0-42-16-90-12-35-40-65-37-40-78-60t-113-33q-46-8-110-6l-110 2q-47 1-166-6-18-2-152-6z" horiz-adv-x="785.714" />
12
+ <glyph glyph-name="italic" unicode="&#xe806;" d="M0-77l9 47q2 1 43 11 42 11 65 22 16 21 23 56l15 78 31 150 7 36q4 25 9 47t9 37 7 26 5 17 2 6l16 88 9 35 12 75 4 28 0 21q-23 12-80 16-16 1-21 2l11 57 177-8q22-1 41-1 37 0 119 5 18 1 38 3t20 1q-1-11-3-21-4-16-7-28-31-11-61-17-36-9-56-17-7-17-13-49-5-25-7-46-25-111-37-171l-34-174-21-88-24-131-7-25q-1-4 1-15 36-8 66-12 20-3 37-6-1-16-4-32-4-17-5-23-10 0-13-1-13-1-23-1-5 0-16 2t-81 9l-110 1q-23 1-97-6-41-4-55-5z" horiz-adv-x="571.429" />
13
+ <glyph glyph-name="justifyleft" unicode="&#xe80a;" d="M1000 100l0-71q0-15-11-25t-25-11l-929 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l929 0q15 0 25-11t11-25z m-214 214l0-71q0-15-11-25t-25-11l-714 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l714 0q15 0 25-11t11-25z m143 214l0-71q0-15-11-25t-25-11l-857 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l857 0q15 0 25-11t11-25z m-214 214l0-71q0-15-11-25t-25-11l-643 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l643 0q15 0 25-11t11-25z" horiz-adv-x="1000" />
14
+ <glyph glyph-name="justifycenter" unicode="&#xe80b;" d="M1000 100l0-71q0-15-11-25t-25-11l-929 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l929 0q15 0 25-11t11-25z m-214 214l0-71q0-15-11-25t-25-11l-500 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l500 0q15 0 25-11t11-25z m143 214l0-71q0-15-11-25t-25-11l-786 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l786 0q15 0 25-11t11-25z m-214 214l0-71q0-15-11-25t-25-11l-357 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l357 0q15 0 25-11t11-25z" horiz-adv-x="1000" />
15
+ <glyph glyph-name="justifyright" unicode="&#xe80c;" d="M1000 100l0-71q0-15-11-25t-25-11l-929 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l929 0q15 0 25-11t11-25z m0 214l0-71q0-15-11-25t-25-11l-714 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l714 0q15 0 25-11t11-25z m0 214l0-71q0-15-11-25t-25-11l-857 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l857 0q15 0 25-11t11-25z m0 214l0-71q0-15-11-25t-25-11l-643 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l643 0q15 0 25-11t11-25z" horiz-adv-x="1000" />
16
+ <glyph glyph-name="justifyfull" unicode="&#xe80d;" d="M1000 100l0-71q0-15-11-25t-25-11l-929 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l929 0q15 0 25-11t11-25z m0 214l0-71q0-15-11-25t-25-11l-929 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l929 0q15 0 25-11t11-25z m0 214l0-71q0-15-11-25t-25-11l-929 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l929 0q15 0 25-11t11-25z m0 214l0-71q0-15-11-25t-25-11l-929 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l929 0q15 0 25-11t11-25z" horiz-adv-x="1000" />
17
+ <glyph glyph-name="outdent" unicode="&#xe800;" d="M214 546l0-321q0-7-5-13t-13-5q-8 0-13 5l-161 161q-5 5-5 13t5 13l161 161q5 5 13 5 7 0 13-5t5-13z m786-429l0-107q0-7-5-13t-13-5l-964 0q-7 0-13 5t-5 13l0 107q0 7 5 13t13 5l964 0q7 0 13-5t5-13z m0 214l0-107q0-7-5-13t-13-5l-607 0q-7 0-13 5t-5 13l0 107q0 7 5 13t13 5l607 0q7 0 13-5t5-13z m0 214l0-107q0-7-5-13t-13-5l-607 0q-7 0-13 5t-5 13l0 107q0 7 5 13t13 5l607 0q7 0 13-5t5-13z m0 214l0-107q0-7-5-13t-13-5l-964 0q-7 0-13 5t-5 13l0 107q0 7 5 13t13 5l964 0q7 0 13-5t5-13z" horiz-adv-x="1000" />
18
+ <glyph glyph-name="indent" unicode="&#xe801;" d="M196 386q0-8-5-13l-161-161q-5-5-13-5-7 0-13 5t-5 13l0 321q0 7 5 13t13 5q8 0 13-5l161-161q5-5 5-13z m804-268l0-107q0-7-5-13t-13-5l-964 0q-7 0-13 5t-5 13l0 107q0 7 5 13t13 5l964 0q7 0 13-5t5-13z m0 214l0-107q0-7-5-13t-13-5l-607 0q-7 0-13 5t-5 13l0 107q0 7 5 13t13 5l607 0q7 0 13-5t5-13z m0 214l0-107q0-7-5-13t-13-5l-607 0q-7 0-13 5t-5 13l0 107q0 7 5 13t13 5l607 0q7 0 13-5t5-13z m0 214l0-107q0-7-5-13t-13-5l-964 0q-7 0-13 5t-5 13l0 107q0 7 5 13t13 5l964 0q7 0 13-5t5-13z" horiz-adv-x="1000" />
19
+ <glyph glyph-name="mode" unicode="&#xe813;" d="M429 46l0 607q-83 0-152-41t-110-110-41-152 41-152 110-110 152-41z m429 304q0-117-57-215t-156-156-215-57-215 57-156 156-57 215 57 215 156 156 215 57 215-57 156-156 57-215z" horiz-adv-x="857.143" />
20
+ <glyph glyph-name="fullscreen" unicode="&#xe80e;" d="M716 548l-198-198 198-198 80 80q16 17 39 8 22-9 22-33l0-250q0-15-11-25t-25-11l-250 0q-23 0-33 22-9 22 8 39l80 80-198 198-198-198 80-80q17-17 8-39t-33-22l-250 0q-15 0-25 11t-11 25l0 250q0 23 22 33 22 9 39-8l80-80 198 198-198 198-80-80q-11-11-25-11-7 0-13 3-22 9-22 33l0 250q0 15 11 25t25 11l250 0q23 0 33-22 9-22-8-39l-80-80 198-198 198 198-80 80q-17 17-8 39t33 22l250 0q15 0 25-11t11-25l0-250q0-23-22-33-7-3-14-3-15 0-25 11z" horiz-adv-x="857.143" />
21
+ <glyph glyph-name="insertunorderedlist" unicode="&#xe802;" d="M214 64q0-45-31-76t-76-31-76 31-31 76 31 76 76 31 76-31 31-76z m0 286q0-45-31-76t-76-31-76 31-31 76 31 76 76 31 76-31 31-76z m786-232l0-107q0-7-5-13t-13-5l-679 0q-7 0-13 5t-5 13l0 107q0 7 5 13t13 5l679 0q7 0 13-5t5-13z m-786 518q0-45-31-76t-76-31-76 31-31 76 31 76 76 31 76-31 31-76z m786-232l0-107q0-7-5-13t-13-5l-679 0q-7 0-13 5t-5 13l0 107q0 7 5 13t13 5l679 0q7 0 13-5t5-13z m0 286l0-107q0-7-5-13t-13-5l-679 0q-7 0-13 5t-5 13l0 107q0 7 5 13t13 5l679 0q7 0 13-5t5-13z" horiz-adv-x="1000" />
22
+ <glyph glyph-name="insertorderedlist" unicode="&#xe803;" d="M213-54q0-45-30-70t-76-26q-59 0-96 37l32 49q27-25 59-25 16 0 28 8t12 24q0 36-59 31l-15 31q4 6 18 24t24 30 21 21l0 1q-9 0-27-1t-27-1l0-30-59 0 0 85 186 0 0-49-53-64q28-7 45-27t17-49z m1 350l0-89-202 0q-3 20-3 30 0 28 13 52t32 38 37 27 32 24 13 25q0 14-8 21t-22 8q-26 0-45-32l-47 33q13 28 40 44t59 16q41 0 69-23t28-63q0-28-19-51t-42-36-42-28-20-29l71 0 0 33 59 0z m786-178l0-107q0-7-5-13t-13-5l-679 0q-7 0-13 5t-5 13l0 107q0 8 5 13t13 5l679 0q7 0 13-5t5-13z m-786 502l0-55-187 0 0 55 60 0q0 23 0 68t0 68l0 7-1 0q-4-9-28-30l-40 42 76 71 59 0 0-225 60 0z m786-216l0-107q0-7-5-13t-13-5l-679 0q-7 0-13 5t-5 13l0 107q0 8 5 13t13 5l679 0q7 0 13-5t5-13z m0 286l0-107q0-7-5-13t-13-5l-679 0q-7 0-13 5t-5 13l0 107q0 7 5 13t13 5l679 0q7 0 13-5t5-13z" horiz-adv-x="1000" />
23
+ <glyph glyph-name="strikethrough" unicode="&#xe807;" d="M982 350q8 0 13-5t5-13l0-36q0-8-5-13t-13-5l-964 0q-8 0-13 5t-5 13l0 36q0 8 5 13t13 5l964 0z m-713 36q-16 20-28 45-27 54-27 105 0 101 75 172 74 71 219 71 28 0 93-11 37-7 99-27 6-21 12-66 8-69 8-102 0-10-3-25l-7-2-47 3-8 1q-28 83-57 114-49 51-117 51-64 0-102-33-37-32-37-81 0-41 37-78t156-72q39-11 97-37 32-16 53-29l-415 0z m283-143l229 0q4-22 4-51 0-62-23-118-13-31-40-58-21-20-61-45-45-27-85-37-45-12-113-12-64 0-109 13l-78 22q-32 9-40 16-4 4-4 12l0 7q0 60-1 87-1 17 0 38l1 21 0 25 57 1q8-19 17-40t13-31 7-15q20-32 45-52 24-20 59-32 33-12 74-12 36 0 78 15 43 15 68 48 26 34 26 72 0 47-45 88-19 16-76 40z" horiz-adv-x="1000" />
24
+ <glyph glyph-name="underline" unicode="&#xe804;" d="M27 726q-21 1-25 2l-2 49q7 1 22 1 33 0 62-2 74-4 93-4 48 0 94 2 65 2 81 3 31 0 48 1l-1-8 1-36 0-5q-33-5-69-5-33 0-44-14-7-8-7-74 0-7 0-18t0-14l1-128 8-156q3-69 28-113 20-33 54-51 49-26 99-26 58 0 107 16 31 10 55 28 27 20 36 36 20 31 30 64 12 41 12 128 0 44-2 71t-6 68-8 89l-2 33q-3 37-13 49-19 20-43 19l-56-1-8 2 1 48 47 0 114-6q42-2 109 6l10-1q3-21 3-28 0-4-2-17-25-7-47-7-41-6-44-9-8-8-8-23 0-4 1-15t1-17q4-11 12-221 3-109-8-170-8-42-23-68-21-36-62-69-42-32-102-50-61-18-142-18-93 0-158 26-66 26-100 68t-46 109q-9 45-9 132l0 186q0 105-9 119-14 20-82 22z m830-786l0 36q0 8-5 13t-13 5l-821 0q-8 0-13-5t-5-13l0-36q0-8 5-13t13-5l821 0q8 0 13 5t5 13z" horiz-adv-x="857.143" />
25
+ <glyph glyph-name="blockquote" unicode="&#xe814;" d="M429 671l0-393q0-58-23-111t-61-91-91-61-111-23l-36 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l36 0q59 0 101 42t42 101l0 18q0 22-16 38t-38 16l-125 0q-45 0-76 31t-31 76l0 214q0 45 31 76t76 31l214 0q45 0 76-31t31-76z m500 0l0-393q0-58-23-111t-61-91-91-61-111-23l-36 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l36 0q59 0 101 42t42 101l0 18q0 22-16 38t-38 16l-125 0q-45 0-76 31t-31 76l0 214q0 45 31 76t76 31l214 0q45 0 76-31t31-76z" horiz-adv-x="928.571" />
26
+ <glyph glyph-name="undo" unicode="&#xe817;" d="M1000 225q0-93-71-252-2-4-6-13t-8-17-7-12q-7-9-16-9-8 0-13 6t-5 14q0 5 1 15t1 13q3 38 3 69 0 56-10 101t-27 77-45 56-59 39-74 24-86 12-98 3l-125 0 0-143q0-15-11-25t-25-11-25 11l-286 286q-11 11-11 25t11 25l286 286q11 11 25 11t25-11 11-25l0-143 125 0q398 0 488-225 30-75 30-186z" horiz-adv-x="1000" />
27
+ <glyph glyph-name="code" unicode="&#xe816;" d="M344 69l-28-28q-6-6-13-6t-13 6l-260 260q-6 6-6 13t6 13l260 260q6 6 13 6t13-6l28-28q6-6 6-13t-6-13l-219-219 219-219q6-6 6-13t-6-13z m330 595l-208-720q-2-7-9-11t-13-1l-35 9q-7 2-11 9t-1 14l208 720q2 7 9 11t13 1l35-9q7-2 11-9t1-14z m367-363l-260-260q-6-6-13-6t-13 6l-28 28q-6 6-6 13t6 13l219 219-219 219q-6 6-6 13t6 13l28 28q6 6 13 6t13-6l260-260q6-6 6-13t-6-13z" horiz-adv-x="1071.429" />
28
+ <glyph glyph-name="unlink" unicode="&#xe811;" d="M245 141l-143-143q-6-5-13-5t-13 5q-5 6-5 13t5 13l143 143q6 5 13 5t13-5q5-6 5-13t-5-13z m94-23l0-179q0-8-5-13t-13-5-13 5-5 13l0 179q0 8 5 13t13 5 13-5 5-13z m-125 125q0-8-5-13t-13-5l-179 0q-8 0-13 5t-5 13 5 13 13 5l179 0q8 0 13-5t5-13z m705-71q0-67-47-113l-82-81q-46-46-113-46-68 0-114 47l-186 187q-12 12-23 31l133 10 152-153q15-15 38-15t38 15l82 81q16 16 16 37 0 22-16 38l-153 153 10 133q20-12 31-23l187-187q47-48 47-114z m-344 404l-133-10-152 153q-16 16-38 16t-38-15l-82-81q-16-16-16-37 0-22 16-38l153-153-10-134q-20 12-31 23l-187 187q-47 48-47 114 0 67 47 113l82 81q46 46 113 46 68 0 114-47l186-187q12-12 23-31z m353-47q0-8-5-13t-13-5l-179 0q-8 0-13 5t-5 13 5 13 13 5l179 0q8 0 13-5t5-13z m-304 304l0-179q0-8-5-13t-13-5-13 5-5 13l0 179q0 8 5 13t13 5 13-5 5-13z m227-84l-143-143q-6-5-13-5t-13 5q-5 6-5 13t5 13l143 143q6 5 13 5t13-5q5-6 5-13t-5-13z" horiz-adv-x="928.571" />
29
+ <glyph glyph-name="superscript" unicode="&#xe808;" d="M501 86l0-93-138 0-89 141-13 23q-4 5-6 12l-2 0-5-12q-6-11-14-25l-86-140-144 0 0 93 71 0 110 162-103 152-76 0 0 94 154 0 78-127q1-2 13-23 4-5 6-12l2 0q2 5 6 12l14 23 78 127 143 0 0-94-70 0-103-149 114-165 61 0z m355 379l0-115-287 0-2 15q-2 16-2 26 0 36 15 65t36 48 47 36 47 30 36 30 15 36q0 21-16 35t-39 14q-28 0-54-22-8-6-20-21l-59 51q15 21 35 37 46 36 105 36 61 0 99-33t38-88q0-31-14-57t-35-43-45-33-46-28-37-29-17-35l129 0 0 45 70 0z" horiz-adv-x="857.143" />
30
+ <glyph glyph-name="subscript" unicode="&#xe809;" d="M501 86l0-93-138 0-89 141-13 23q-4 5-6 12l-2 0-5-12q-6-11-14-25l-86-140-144 0 0 93 71 0 110 162-103 152-76 0 0 94 154 0 78-127q1-2 13-23 4-5 6-12l2 0q2 5 6 12l14 23 78 127 143 0 0-94-70 0-103-149 114-165 61 0z m357-121l0-115-287 0-2 15q-2 25-2 26 0 36 15 65t36 48 47 36 47 30 36 30 15 36q0 21-16 35t-39 14q-28 0-54-22-8-6-20-21l-59 51q15 21 35 37 45 36 105 36 61 0 99-33t38-88q0-37-19-66t-47-48-56-35-49-35-23-41l129 0 0 45 70 0z" horiz-adv-x="857.143" />
31
+ <glyph glyph-name="inserthorizontalrule" unicode="&#xe818;" d="M214 439l0-107q0-22-16-38t-38-16l-107 0q-22 0-38 16t-16 38l0 107q0 22 16 38t38 16l107 0q22 0 38-16t16-38z m286 0l0-107q0-22-16-38t-38-16l-107 0q-22 0-38 16t-16 38l0 107q0 22 16 38t38 16l107 0q22 0 38-16t16-38z m286 0l0-107q0-22-16-38t-38-16l-107 0q-22 0-38 16t-16 38l0 107q0 22 16 38t38 16l107 0q22 0 38-16t16-38z" horiz-adv-x="785.714" />
32
+ <glyph glyph-name="pin" unicode="&#xe812;" d="M268 368l0 250q0 8-5 13t-13 5-13-5-5-13l0-250q0-8 5-13t13-5 13 5 5 13z m375-196q0-15-11-25t-25-11l-239 0-28-270q-1-7-6-11t-11-5l-1 0q-15 0-18 15l-42 271-225 0q-15 0-25 11t-11 25q0 69 44 124t99 55l0 286q-29 0-50 21t-21 50 21 50 50 21l357 0q29 0 50-21t21-50-21-50-50-21l0-286q55 0 99-55t44-124z" horiz-adv-x="642.857" />
33
+ <glyph glyph-name="createlink" unicode="&#xe810;" d="M812 171q0 22-16 38l-116 116q-16 16-38 16-23 0-40-18 2-2 11-10t12-12 8-11 7-14 2-15q0-22-16-38t-38-16q-8 0-15 2t-14 7-11 8-12 12-10 11q-18-17-18-41 0-22 16-38l115-116q15-15 38-15 22 0 38 15l82 81q16 16 16 37z m-392 393q0 22-16 38l-115 116q-16 16-38 16t-38-15l-82-81q-16-16-16-37 0-22 16-38l116-116q15-15 38-15t40 17q-2 2-11 10t-12 12-8 11-7 14-2 15q0 22 16 38t38 16q8 0 15-2t14-7 11-8 12-12 10-11q18 17 18 41z m499-393q0-67-47-113l-82-81q-46-46-113-46-68 0-114 47l-115 116q-46 46-46 113 0 69 49 117l-49 49q-48-49-116-49-67 0-114 47l-116 116q-47 47-47 114t47 113l82 81q46 46 113 46 68 0 114-47l115-116q46-46 46-113 0-69-49-117l49-49q48 49 116 49 67 0 114-47l116-116q47-47 47-114z" horiz-adv-x="928.571" />
34
+ </font>
35
+ </defs>
36
+ </svg>
@@ -0,0 +1,605 @@
1
+ // Backbone.Validation v0.8.0
2
+ //
3
+ // Copyright (c) 2011-2013 Thomas Pedersen
4
+ // Distributed under MIT License
5
+ //
6
+ // Documentation and full license available at:
7
+ // http://thedersen.com/projects/backbone-validation
8
+ Backbone.Validation = (function(_){
9
+ 'use strict';
10
+
11
+ // Default options
12
+ // ---------------
13
+
14
+ var defaultOptions = {
15
+ forceUpdate: false,
16
+ selector: 'name',
17
+ labelFormatter: 'sentenceCase',
18
+ valid: Function.prototype,
19
+ invalid: Function.prototype
20
+ };
21
+
22
+
23
+ // Helper functions
24
+ // ----------------
25
+
26
+ // Formatting functions used for formatting error messages
27
+ var formatFunctions = {
28
+ // Uses the configured label formatter to format the attribute name
29
+ // to make it more readable for the user
30
+ formatLabel: function(attrName, model) {
31
+ return defaultLabelFormatters[defaultOptions.labelFormatter](attrName, model);
32
+ },
33
+
34
+ // Replaces nummeric placeholders like {0} in a string with arguments
35
+ // passed to the function
36
+ format: function() {
37
+ var args = Array.prototype.slice.call(arguments),
38
+ text = args.shift();
39
+ return text.replace(/\{(\d+)\}/g, function(match, number) {
40
+ return typeof args[number] !== 'undefined' ? args[number] : match;
41
+ });
42
+ }
43
+ };
44
+
45
+ // Flattens an object
46
+ // eg:
47
+ //
48
+ // var o = {
49
+ // address: {
50
+ // street: 'Street',
51
+ // zip: 1234
52
+ // }
53
+ // };
54
+ //
55
+ // becomes:
56
+ //
57
+ // var o = {
58
+ // 'address.street': 'Street',
59
+ // 'address.zip': 1234
60
+ // };
61
+ var flatten = function (obj, into, prefix) {
62
+ into = into || {};
63
+ prefix = prefix || '';
64
+
65
+ _.each(obj, function(val, key) {
66
+ if(obj.hasOwnProperty(key)) {
67
+ if (val && typeof val === 'object' && !(
68
+ val instanceof Date ||
69
+ val instanceof RegExp ||
70
+ val instanceof Backbone.Model ||
71
+ val instanceof Backbone.Collection)
72
+ ) {
73
+ flatten(val, into, prefix + key + '.');
74
+ }
75
+ else {
76
+ into[prefix + key] = val;
77
+ }
78
+ }
79
+ });
80
+
81
+ return into;
82
+ };
83
+
84
+ // Validation
85
+ // ----------
86
+
87
+ var Validation = (function(){
88
+
89
+ // Returns an object with undefined properties for all
90
+ // attributes on the model that has defined one or more
91
+ // validation rules.
92
+ var getValidatedAttrs = function(model) {
93
+ return _.reduce(_.keys(model.validation || {}), function(memo, key) {
94
+ memo[key] = void 0;
95
+ return memo;
96
+ }, {});
97
+ };
98
+
99
+ // Looks on the model for validations for a specified
100
+ // attribute. Returns an array of any validators defined,
101
+ // or an empty array if none is defined.
102
+ var getValidators = function(model, attr) {
103
+ var attrValidationSet = model.validation ? model.validation[attr] || {} : {};
104
+
105
+ // If the validator is a function or a string, wrap it in a function validator
106
+ if (_.isFunction(attrValidationSet) || _.isString(attrValidationSet)) {
107
+ attrValidationSet = {
108
+ fn: attrValidationSet
109
+ };
110
+ }
111
+
112
+ // Stick the validator object into an array
113
+ if(!_.isArray(attrValidationSet)) {
114
+ attrValidationSet = [attrValidationSet];
115
+ }
116
+
117
+ // Reduces the array of validators into a new array with objects
118
+ // with a validation method to call, the value to validate against
119
+ // and the specified error message, if any
120
+ return _.reduce(attrValidationSet, function(memo, attrValidation) {
121
+ _.each(_.without(_.keys(attrValidation), 'msg'), function(validator) {
122
+ memo.push({
123
+ fn: defaultValidators[validator],
124
+ val: attrValidation[validator],
125
+ msg: attrValidation.msg
126
+ });
127
+ });
128
+ return memo;
129
+ }, []);
130
+ };
131
+
132
+ // Validates an attribute against all validators defined
133
+ // for that attribute. If one or more errors are found,
134
+ // the first error message is returned.
135
+ // If the attribute is valid, an empty string is returned.
136
+ var validateAttr = function(model, attr, value, computed) {
137
+ // Reduces the array of validators to an error message by
138
+ // applying all the validators and returning the first error
139
+ // message, if any.
140
+ return _.reduce(getValidators(model, attr), function(memo, validator){
141
+ // Pass the format functions plus the default
142
+ // validators as the context to the validator
143
+ var ctx = _.extend({}, formatFunctions, defaultValidators),
144
+ result = validator.fn.call(ctx, value, attr, validator.val, model, computed);
145
+
146
+ if(result === false || memo === false) {
147
+ return false;
148
+ }
149
+ if (result && !memo) {
150
+ return validator.msg || result;
151
+ }
152
+ return memo;
153
+ }, '');
154
+ };
155
+
156
+ // Loops through the model's attributes and validates them all.
157
+ // Returns and object containing names of invalid attributes
158
+ // as well as error messages.
159
+ var validateModel = function(model, attrs) {
160
+ var error,
161
+ invalidAttrs = {},
162
+ isValid = true,
163
+ computed = _.clone(attrs),
164
+ flattened = flatten(attrs);
165
+
166
+ _.each(flattened, function(val, attr) {
167
+ error = validateAttr(model, attr, val, computed);
168
+ if (error) {
169
+ invalidAttrs[attr] = error;
170
+ isValid = false;
171
+ }
172
+ });
173
+
174
+ return {
175
+ invalidAttrs: invalidAttrs,
176
+ isValid: isValid
177
+ };
178
+ };
179
+
180
+ // Contains the methods that are mixed in on the model when binding
181
+ var mixin = function(view, options) {
182
+ return {
183
+
184
+ // Check whether or not a value passes validation
185
+ // without updating the model
186
+ preValidate: function(attr, value) {
187
+ return validateAttr(this, attr, value, _.extend({}, this.attributes));
188
+ },
189
+
190
+ // Check to see if an attribute, an array of attributes or the
191
+ // entire model is valid. Passing true will force a validation
192
+ // of the model.
193
+ isValid: function(option) {
194
+ var flattened = flatten(this.attributes);
195
+
196
+ if(_.isString(option)){
197
+ return !validateAttr(this, option, flattened[option], _.extend({}, this.attributes));
198
+ }
199
+ if(_.isArray(option)){
200
+ return _.reduce(option, function(memo, attr) {
201
+ return memo && !validateAttr(this, attr, flattened[attr], _.extend({}, this.attributes));
202
+ }, true, this);
203
+ }
204
+ if(option === true) {
205
+ this.validate();
206
+ }
207
+ return this.validation ? this._isValid : true;
208
+ },
209
+
210
+ // This is called by Backbone when it needs to perform validation.
211
+ // You can call it manually without any parameters to validate the
212
+ // entire model.
213
+ validate: function(attrs, setOptions){
214
+ var model = this,
215
+ validateAll = !attrs,
216
+ opt = _.extend({}, options, setOptions),
217
+ validatedAttrs = getValidatedAttrs(model),
218
+ allAttrs = _.extend({}, validatedAttrs, model.attributes, attrs),
219
+ changedAttrs = flatten(attrs || allAttrs),
220
+
221
+ result = validateModel(model, allAttrs);
222
+
223
+ model._isValid = result.isValid;
224
+
225
+ // After validation is performed, loop through all changed attributes
226
+ // and call the valid callbacks so the view is updated.
227
+ _.each(validatedAttrs, function(val, attr){
228
+ var invalid = result.invalidAttrs.hasOwnProperty(attr);
229
+ if(!invalid){
230
+ opt.valid(view, attr, opt.selector);
231
+ }
232
+ });
233
+
234
+ // After validation is performed, loop through all changed attributes
235
+ // and call the invalid callback so the view is updated.
236
+ _.each(validatedAttrs, function(val, attr){
237
+ var invalid = result.invalidAttrs.hasOwnProperty(attr),
238
+ changed = changedAttrs.hasOwnProperty(attr);
239
+
240
+ if(invalid && (changed || validateAll)){
241
+ opt.invalid(view, attr, result.invalidAttrs[attr], opt.selector);
242
+ }
243
+ });
244
+
245
+ // Trigger validated events.
246
+ // Need to defer this so the model is actually updated before
247
+ // the event is triggered.
248
+ _.defer(function() {
249
+ model.trigger('validated', model._isValid, model, result.invalidAttrs);
250
+ model.trigger('validated:' + (model._isValid ? 'valid' : 'invalid'), model, result.invalidAttrs);
251
+ });
252
+
253
+ // Return any error messages to Backbone, unless the forceUpdate flag is set.
254
+ // Then we do not return anything and fools Backbone to believe the validation was
255
+ // a success. That way Backbone will update the model regardless.
256
+ if (!opt.forceUpdate && _.intersection(_.keys(result.invalidAttrs), _.keys(changedAttrs)).length > 0) {
257
+ return result.invalidAttrs;
258
+ }
259
+ }
260
+ };
261
+ };
262
+
263
+ // Helper to mix in validation on a model
264
+ var bindModel = function(view, model, options) {
265
+ _.extend(model, mixin(view, options));
266
+ };
267
+
268
+ // Removes the methods added to a model
269
+ var unbindModel = function(model) {
270
+ delete model.validate;
271
+ delete model.preValidate;
272
+ delete model.isValid;
273
+ };
274
+
275
+ // Mix in validation on a model whenever a model is
276
+ // added to a collection
277
+ var collectionAdd = function(model) {
278
+ bindModel(this.view, model, this.options);
279
+ };
280
+
281
+ // Remove validation from a model whenever a model is
282
+ // removed from a collection
283
+ var collectionRemove = function(model) {
284
+ unbindModel(model);
285
+ };
286
+
287
+ // Returns the public methods on Backbone.Validation
288
+ return {
289
+
290
+ // Current version of the library
291
+ version: '0.8.0',
292
+
293
+ // Called to configure the default options
294
+ configure: function(options) {
295
+ _.extend(defaultOptions, options);
296
+ },
297
+
298
+ // Hooks up validation on a view with a model
299
+ // or collection
300
+ bind: function(view, options) {
301
+ var model = view.model,
302
+ collection = view.collection;
303
+
304
+ options = _.extend({}, defaultOptions, defaultCallbacks, options);
305
+
306
+ if(typeof model === 'undefined' && typeof collection === 'undefined'){
307
+ throw 'Before you execute the binding your view must have a model or a collection.\n' +
308
+ 'See http://thedersen.com/projects/backbone-validation/#using-form-model-validation for more information.';
309
+ }
310
+
311
+ if(model) {
312
+ bindModel(view, model, options);
313
+ }
314
+ else if(collection) {
315
+ collection.each(function(model){
316
+ bindModel(view, model, options);
317
+ });
318
+ collection.bind('add', collectionAdd, {view: view, options: options});
319
+ collection.bind('remove', collectionRemove);
320
+ }
321
+ },
322
+
323
+ // Removes validation from a view with a model
324
+ // or collection
325
+ unbind: function(view) {
326
+ var model = view.model,
327
+ collection = view.collection;
328
+
329
+ if(model) {
330
+ unbindModel(view.model);
331
+ }
332
+ if(collection) {
333
+ collection.each(function(model){
334
+ unbindModel(model);
335
+ });
336
+ collection.unbind('add', collectionAdd);
337
+ collection.unbind('remove', collectionRemove);
338
+ }
339
+ },
340
+
341
+ // Used to extend the Backbone.Model.prototype
342
+ // with validation
343
+ mixin: mixin(null, defaultOptions)
344
+ };
345
+ }());
346
+
347
+
348
+ // Callbacks
349
+ // ---------
350
+
351
+ var defaultCallbacks = Validation.callbacks = {
352
+
353
+ // Gets called when a previously invalid field in the
354
+ // view becomes valid. Removes any error message.
355
+ // Should be overridden with custom functionality.
356
+ valid: function(view, attr, selector) {
357
+ view.$('[' + selector + '~="' + attr + '"]')
358
+ .removeClass('invalid')
359
+ .removeAttr('data-error');
360
+ },
361
+
362
+ // Gets called when a field in the view becomes invalid.
363
+ // Adds a error message.
364
+ // Should be overridden with custom functionality.
365
+ invalid: function(view, attr, error, selector) {
366
+ view.$('[' + selector + '~="' + attr + '"]')
367
+ .addClass('invalid')
368
+ .attr('data-error', error);
369
+ }
370
+ };
371
+
372
+
373
+ // Patterns
374
+ // --------
375
+
376
+ var defaultPatterns = Validation.patterns = {
377
+ // Matches any digit(s) (i.e. 0-9)
378
+ digits: /^\d+$/,
379
+
380
+ // Matched any number (e.g. 100.000)
381
+ number: /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/,
382
+
383
+ // Matches a valid email address (e.g. mail@example.com)
384
+ email: /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i,
385
+
386
+ // Mathes any valid url (e.g. http://www.xample.com)
387
+ url: /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i
388
+ };
389
+
390
+
391
+ // Error messages
392
+ // --------------
393
+
394
+ // Error message for the build in validators.
395
+ // {x} gets swapped out with arguments form the validator.
396
+ var defaultMessages = Validation.messages = {
397
+ required: '{0} is required',
398
+ acceptance: '{0} must be accepted',
399
+ min: '{0} must be greater than or equal to {1}',
400
+ max: '{0} must be less than or equal to {1}',
401
+ range: '{0} must be between {1} and {2}',
402
+ length: '{0} must be {1} characters',
403
+ minLength: '{0} must be at least {1} characters',
404
+ maxLength: '{0} must be at most {1} characters',
405
+ rangeLength: '{0} must be between {1} and {2} characters',
406
+ oneOf: '{0} must be one of: {1}',
407
+ equalTo: '{0} must be the same as {1}',
408
+ pattern: '{0} must be a valid {1}'
409
+ };
410
+
411
+ // Label formatters
412
+ // ----------------
413
+
414
+ // Label formatters are used to convert the attribute name
415
+ // to a more human friendly label when using the built in
416
+ // error messages.
417
+ // Configure which one to use with a call to
418
+ //
419
+ // Backbone.Validation.configure({
420
+ // labelFormatter: 'label'
421
+ // });
422
+ var defaultLabelFormatters = Validation.labelFormatters = {
423
+
424
+ // Returns the attribute name with applying any formatting
425
+ none: function(attrName) {
426
+ return attrName;
427
+ },
428
+
429
+ // Converts attributeName or attribute_name to Attribute name
430
+ sentenceCase: function(attrName) {
431
+ return attrName.replace(/(?:^\w|[A-Z]|\b\w)/g, function(match, index) {
432
+ return index === 0 ? match.toUpperCase() : ' ' + match.toLowerCase();
433
+ }).replace('_', ' ');
434
+ },
435
+
436
+ // Looks for a label configured on the model and returns it
437
+ //
438
+ // var Model = Backbone.Model.extend({
439
+ // validation: {
440
+ // someAttribute: {
441
+ // required: true
442
+ // }
443
+ // },
444
+ //
445
+ // labels: {
446
+ // someAttribute: 'Custom label'
447
+ // }
448
+ // });
449
+ label: function(attrName, model) {
450
+ return (model.labels && model.labels[attrName]) || defaultLabelFormatters.sentenceCase(attrName, model);
451
+ }
452
+ };
453
+
454
+
455
+ // Built in validators
456
+ // -------------------
457
+
458
+ var defaultValidators = Validation.validators = (function(){
459
+ // Use native trim when defined
460
+ var trim = String.prototype.trim ?
461
+ function(text) {
462
+ return text === null ? '' : String.prototype.trim.call(text);
463
+ } :
464
+ function(text) {
465
+ var trimLeft = /^\s+/,
466
+ trimRight = /\s+$/;
467
+
468
+ return text === null ? '' : text.toString().replace(trimLeft, '').replace(trimRight, '');
469
+ };
470
+
471
+ // Determines whether or not a value is a number
472
+ var isNumber = function(value){
473
+ return _.isNumber(value) || (_.isString(value) && value.match(defaultPatterns.number));
474
+ };
475
+
476
+ // Determines whether or not not a value is empty
477
+ var hasValue = function(value) {
478
+ return !(_.isNull(value) || _.isUndefined(value) || (_.isString(value) && trim(value) === ''));
479
+ };
480
+
481
+ return {
482
+ // Function validator
483
+ // Lets you implement a custom function used for validation
484
+ fn: function(value, attr, fn, model, computed) {
485
+ if(_.isString(fn)){
486
+ fn = model[fn];
487
+ }
488
+ return fn.call(model, value, attr, computed);
489
+ },
490
+
491
+ // Required validator
492
+ // Validates if the attribute is required or not
493
+ required: function(value, attr, required, model, computed) {
494
+ var isRequired = _.isFunction(required) ? required.call(model, value, attr, computed) : required;
495
+ if(!isRequired && !hasValue(value)) {
496
+ return false; // overrides all other validators
497
+ }
498
+ if (isRequired && !hasValue(value)) {
499
+ return this.format(defaultMessages.required, this.formatLabel(attr, model));
500
+ }
501
+ },
502
+
503
+ // Acceptance validator
504
+ // Validates that something has to be accepted, e.g. terms of use
505
+ // `true` or 'true' are valid
506
+ acceptance: function(value, attr, accept, model) {
507
+ if(value !== 'true' && (!_.isBoolean(value) || value === false)) {
508
+ return this.format(defaultMessages.acceptance, this.formatLabel(attr, model));
509
+ }
510
+ },
511
+
512
+ // Min validator
513
+ // Validates that the value has to be a number and equal to or greater than
514
+ // the min value specified
515
+ min: function(value, attr, minValue, model) {
516
+ if (!isNumber(value) || value < minValue) {
517
+ return this.format(defaultMessages.min, this.formatLabel(attr, model), minValue);
518
+ }
519
+ },
520
+
521
+ // Max validator
522
+ // Validates that the value has to be a number and equal to or less than
523
+ // the max value specified
524
+ max: function(value, attr, maxValue, model) {
525
+ if (!isNumber(value) || value > maxValue) {
526
+ return this.format(defaultMessages.max, this.formatLabel(attr, model), maxValue);
527
+ }
528
+ },
529
+
530
+ // Range validator
531
+ // Validates that the value has to be a number and equal to or between
532
+ // the two numbers specified
533
+ range: function(value, attr, range, model) {
534
+ if(!isNumber(value) || value < range[0] || value > range[1]) {
535
+ return this.format(defaultMessages.range, this.formatLabel(attr, model), range[0], range[1]);
536
+ }
537
+ },
538
+
539
+ // Length validator
540
+ // Validates that the value has to be a string with length equal to
541
+ // the length value specified
542
+ length: function(value, attr, length, model) {
543
+ if (!hasValue(value) || trim(value).length !== length) {
544
+ return this.format(defaultMessages.length, this.formatLabel(attr, model), length);
545
+ }
546
+ },
547
+
548
+ // Min length validator
549
+ // Validates that the value has to be a string with length equal to or greater than
550
+ // the min length value specified
551
+ minLength: function(value, attr, minLength, model) {
552
+ if (!hasValue(value) || trim(value).length < minLength) {
553
+ return this.format(defaultMessages.minLength, this.formatLabel(attr, model), minLength);
554
+ }
555
+ },
556
+
557
+ // Max length validator
558
+ // Validates that the value has to be a string with length equal to or less than
559
+ // the max length value specified
560
+ maxLength: function(value, attr, maxLength, model) {
561
+ if (!hasValue(value) || trim(value).length > maxLength) {
562
+ return this.format(defaultMessages.maxLength, this.formatLabel(attr, model), maxLength);
563
+ }
564
+ },
565
+
566
+ // Range length validator
567
+ // Validates that the value has to be a string and equal to or between
568
+ // the two numbers specified
569
+ rangeLength: function(value, attr, range, model) {
570
+ if(!hasValue(value) || trim(value).length < range[0] || trim(value).length > range[1]) {
571
+ return this.format(defaultMessages.rangeLength, this.formatLabel(attr, model), range[0], range[1]);
572
+ }
573
+ },
574
+
575
+ // One of validator
576
+ // Validates that the value has to be equal to one of the elements in
577
+ // the specified array. Case sensitive matching
578
+ oneOf: function(value, attr, values, model) {
579
+ if(!_.include(values, value)){
580
+ return this.format(defaultMessages.oneOf, this.formatLabel(attr, model), values.join(', '));
581
+ }
582
+ },
583
+
584
+ // Equal to validator
585
+ // Validates that the value has to be equal to the value of the attribute
586
+ // with the name specified
587
+ equalTo: function(value, attr, equalTo, model, computed) {
588
+ if(value !== computed[equalTo]) {
589
+ return this.format(defaultMessages.equalTo, this.formatLabel(attr, model), this.formatLabel(equalTo, model));
590
+ }
591
+ },
592
+
593
+ // Pattern validator
594
+ // Validates that the value has to match the pattern specified.
595
+ // Can be a regular expression or the name of one of the built in patterns
596
+ pattern: function(value, attr, pattern, model) {
597
+ if (!hasValue(value) || !value.toString().match(defaultPatterns[pattern] || pattern)) {
598
+ return this.format(defaultMessages.pattern, this.formatLabel(attr, model), pattern);
599
+ }
600
+ }
601
+ };
602
+ }());
603
+
604
+ return Validation;
605
+ }(_));