wheels 0.1.8 → 0.1.9

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.
Files changed (243) hide show
  1. data/Gemfile +20 -0
  2. data/VERSION +1 -1
  3. data/app/controllers/app_configs_controller.rb +12 -0
  4. data/app/controllers/application_controller.rb +39 -0
  5. data/app/helpers/application_helper.rb +24 -2
  6. data/app/models/sitemap.rb +7 -0
  7. data/app/views/app_configs/css.css.haml +2 -0
  8. data/app/views/layouts/application.html.haml +21 -15
  9. data/app/views/pages/_form_fields.html.haml +2 -0
  10. data/app/views/sitemaps/index.html.haml +68 -76
  11. data/db/migrate/0000_devise_create_users.rb +26 -0
  12. data/db/migrate/0180_acts_as_taggable_on_migration.rb +28 -0
  13. data/lib/generators/app_layout/app_layout_generator.rb +1 -1
  14. data/lib/generators/{wheels/core_extensions.rb → core_extensions.rb} +42 -1
  15. data/lib/generators/recipes/wheels.rb +46 -0
  16. data/lib/generators/recipes/wheels_update.rb +18 -0
  17. data/lib/generators/wheels/wheels_generator.rb +3 -1
  18. data/lib/generators/wheels_checkout_assets/USAGE +8 -0
  19. data/lib/generators/wheels_checkout_assets/wheels_checkout_assets_generator.rb +9 -0
  20. data/lib/generators/wheels_checkout_assets_readonly/USAGE +8 -0
  21. data/lib/generators/wheels_checkout_assets_readonly/wheels_checkout_assets_readonly_generator.rb +10 -0
  22. data/lib/generators/wheels_controller/USAGE +8 -0
  23. data/lib/generators/wheels_controller/wheels_controller_generator.rb +14 -0
  24. data/lib/generators/{wheels_views → wheels_model}/USAGE +1 -1
  25. data/lib/generators/wheels_model/wheels_model_generator.rb +14 -0
  26. data/lib/generators/{update_wheels/update_wheels_generator.rb → wheels_update/wheels_update_generator.rb} +7 -13
  27. data/lib/generators/wheels_view/USAGE +8 -0
  28. data/lib/generators/wheels_view/wheels_view_generator.rb +14 -0
  29. data/lib/wheels/routes.rb +7 -1
  30. data/wheels.gemspec +44 -218
  31. metadata +44 -218
  32. data/lib/generators/app_layout/core_extensions.rb +0 -51
  33. data/lib/generators/update_wheels/core_extensions.rb +0 -51
  34. data/lib/generators/update_wheels/recipes/wheels.rb +0 -11
  35. data/lib/generators/update_wheels/templates/haml/app/views/layouts/application.html.haml +0 -9
  36. data/lib/generators/wheels/install_generator.rb +0 -25
  37. data/lib/generators/wheels/recipes/wheels.rb +0 -66
  38. data/lib/generators/wheels/templates/cancan/ability.rb +0 -13
  39. data/lib/generators/wheels/templates/database/postgresql.yml +0 -19
  40. data/lib/generators/wheels/templates/git/gitignore +0 -8
  41. data/lib/generators/wheels/templates/mongoid/features/step_definitions/mongoid_steps.rb +0 -4
  42. data/lib/generators/wheels/templates/mongoid/features/support/hooks.rb +0 -3
  43. data/lib/generators/wheels/views_generator.rb +0 -15
  44. data/lib/generators/wheels_views/LICENCE +0 -20
  45. data/lib/generators/wheels_views/wheels_views_generator.rb +0 -15
  46. data/lib/wheels/base.rb +0 -7
  47. data/public/404.html +0 -26
  48. data/public/422.html +0 -26
  49. data/public/500.html +0 -26
  50. data/public/favicon.ico +0 -0
  51. data/public/images/dreamy/Thumbs.db +0 -0
  52. data/public/images/dreamy/bg-ad-top.png +0 -0
  53. data/public/images/dreamy/bg-body.png +0 -0
  54. data/public/images/dreamy/bg-feed.gif +0 -0
  55. data/public/images/dreamy/bg-footer.jpg +0 -0
  56. data/public/images/dreamy/bg-header.jpg +0 -0
  57. data/public/images/dreamy/bg-menu-hover.png +0 -0
  58. data/public/images/dreamy/bg-menu.png +0 -0
  59. data/public/images/dreamy/bg-sidebar-bottom.gif +0 -0
  60. data/public/images/dreamy/button-feed.png +0 -0
  61. data/public/images/dreamy/icon-comment.png +0 -0
  62. data/public/images/growl/error.png +0 -0
  63. data/public/images/growl/growl_bottom.png +0 -0
  64. data/public/images/growl/growl_repeat.png +0 -0
  65. data/public/images/growl/growl_top.png +0 -0
  66. data/public/images/growl/info.png +0 -0
  67. data/public/images/menu/item-pointer-mover.gif +0 -0
  68. data/public/images/menu/item-pointer.gif +0 -0
  69. data/public/images/menu/lava.gif +0 -0
  70. data/public/images/menu/lava.png +0 -0
  71. data/public/images/menu/main-bg.png +0 -0
  72. data/public/images/menu/main-delimiter.png +0 -0
  73. data/public/javascripts/galleries/configure_ckeditor.js +0 -8
  74. data/public/javascripts/jqUrl.js +0 -28
  75. data/public/javascripts/jquery-validate/additional-methods.js +0 -259
  76. data/public/javascripts/jquery-validate/changelog.txt +0 -239
  77. data/public/javascripts/jquery-validate/jquery.validate.js +0 -1146
  78. data/public/javascripts/jquery-validate/jquery.validate.min.js +0 -16
  79. data/public/javascripts/jquery-validate/jquery.validate.pack.js +0 -15
  80. data/public/javascripts/jquery-validate/lib/jquery-1.4.2.js +0 -6240
  81. data/public/javascripts/jquery-validate/lib/jquery.form.js +0 -660
  82. data/public/javascripts/jquery-validate/lib/jquery.js +0 -4376
  83. data/public/javascripts/jquery-validate/lib/jquery.metadata.js +0 -122
  84. data/public/javascripts/jquery-validate/localization/messages_ar.js +0 -24
  85. data/public/javascripts/jquery-validate/localization/messages_bg.js +0 -23
  86. data/public/javascripts/jquery-validate/localization/messages_cn.js +0 -23
  87. data/public/javascripts/jquery-validate/localization/messages_cs.js +0 -23
  88. data/public/javascripts/jquery-validate/localization/messages_da.js +0 -20
  89. data/public/javascripts/jquery-validate/localization/messages_de.js +0 -20
  90. data/public/javascripts/jquery-validate/localization/messages_el.js +0 -24
  91. data/public/javascripts/jquery-validate/localization/messages_es.js +0 -23
  92. data/public/javascripts/jquery-validate/localization/messages_fa.js +0 -23
  93. data/public/javascripts/jquery-validate/localization/messages_fi.js +0 -21
  94. data/public/javascripts/jquery-validate/localization/messages_fr.js +0 -23
  95. data/public/javascripts/jquery-validate/localization/messages_he.js +0 -23
  96. data/public/javascripts/jquery-validate/localization/messages_hu.js +0 -20
  97. data/public/javascripts/jquery-validate/localization/messages_it.js +0 -23
  98. data/public/javascripts/jquery-validate/localization/messages_kk.js +0 -23
  99. data/public/javascripts/jquery-validate/localization/messages_lt.js +0 -23
  100. data/public/javascripts/jquery-validate/localization/messages_lv.js +0 -23
  101. data/public/javascripts/jquery-validate/localization/messages_nl.js +0 -23
  102. data/public/javascripts/jquery-validate/localization/messages_no.js +0 -23
  103. data/public/javascripts/jquery-validate/localization/messages_pl.js +0 -23
  104. data/public/javascripts/jquery-validate/localization/messages_ptbr.js +0 -23
  105. data/public/javascripts/jquery-validate/localization/messages_ptpt.js +0 -23
  106. data/public/javascripts/jquery-validate/localization/messages_ro.js +0 -23
  107. data/public/javascripts/jquery-validate/localization/messages_ru.js +0 -23
  108. data/public/javascripts/jquery-validate/localization/messages_se.js +0 -21
  109. data/public/javascripts/jquery-validate/localization/messages_sk.js +0 -20
  110. data/public/javascripts/jquery-validate/localization/messages_tr.js +0 -23
  111. data/public/javascripts/jquery-validate/localization/messages_tw.js +0 -23
  112. data/public/javascripts/jquery-validate/localization/messages_ua.js +0 -23
  113. data/public/javascripts/jquery-validate/localization/methods_de.js +0 -12
  114. data/public/javascripts/jquery-validate/localization/methods_nl.js +0 -9
  115. data/public/javascripts/jquery-validate/localization/methods_pt.js +0 -9
  116. data/public/javascripts/jquery-validate/todo +0 -172
  117. data/public/javascripts/jquery.cookie.js +0 -96
  118. data/public/javascripts/jquery.filedrop.js +0 -253
  119. data/public/javascripts/jquery.growl.js +0 -143
  120. data/public/javascripts/jquery.hotkeys.js +0 -99
  121. data/public/javascripts/jquery.js +0 -6240
  122. data/public/javascripts/jquery.jstree.js +0 -3510
  123. data/public/javascripts/jquery.uploadify.js +0 -26
  124. data/public/javascripts/jquery.validate.js +0 -1147
  125. data/public/javascripts/loadbehind.js +0 -0
  126. data/public/javascripts/menu.js +0 -247
  127. data/public/javascripts/sitemap_jstree.js +0 -329
  128. data/public/javascripts/swfobject.js +0 -4
  129. data/public/jstree/_demo/_dump.sql +0 -20
  130. data/public/jstree/_demo/_inc/__mysql_errors.log +0 -0
  131. data/public/jstree/_demo/_inc/class._database.php +0 -146
  132. data/public/jstree/_demo/_inc/class._database_i.php +0 -152
  133. data/public/jstree/_demo/_inc/class.tree.php +0 -602
  134. data/public/jstree/_demo/_install.txt +0 -6
  135. data/public/jstree/_demo/config.php +0 -14
  136. data/public/jstree/_demo/index.html +0 -262
  137. data/public/jstree/_demo/server.php +0 -69
  138. data/public/jstree/_docs/!style.css +0 -37
  139. data/public/jstree/_docs/_drive.png +0 -0
  140. data/public/jstree/_docs/_html_data.html +0 -2
  141. data/public/jstree/_docs/_json_data.json +0 -4
  142. data/public/jstree/_docs/_search_data.json +0 -6
  143. data/public/jstree/_docs/_search_result.json +0 -1
  144. data/public/jstree/_docs/_xml_flat.xml +0 -12
  145. data/public/jstree/_docs/_xml_nest.xml +0 -18
  146. data/public/jstree/_docs/checkbox.html +0 -148
  147. data/public/jstree/_docs/contextmenu.html +0 -120
  148. data/public/jstree/_docs/cookies.html +0 -96
  149. data/public/jstree/_docs/core.html +0 -622
  150. data/public/jstree/_docs/crrm.html +0 -315
  151. data/public/jstree/_docs/dnd.html +0 -197
  152. data/public/jstree/_docs/hotkeys.html +0 -81
  153. data/public/jstree/_docs/html_data.html +0 -174
  154. data/public/jstree/_docs/index.html +0 -75
  155. data/public/jstree/_docs/json_data.html +0 -240
  156. data/public/jstree/_docs/languages.html +0 -138
  157. data/public/jstree/_docs/search.html +0 -114
  158. data/public/jstree/_docs/sort.html +0 -84
  159. data/public/jstree/_docs/syntax/!script.js +0 -2232
  160. data/public/jstree/_docs/syntax/!style.css +0 -511
  161. data/public/jstree/_docs/syntax/clipboard.swf +0 -0
  162. data/public/jstree/_docs/syntax/help.png +0 -0
  163. data/public/jstree/_docs/syntax/magnifier.png +0 -0
  164. data/public/jstree/_docs/syntax/page_white_code.png +0 -0
  165. data/public/jstree/_docs/syntax/page_white_copy.png +0 -0
  166. data/public/jstree/_docs/syntax/printer.png +0 -0
  167. data/public/jstree/_docs/syntax/wrapping.png +0 -0
  168. data/public/jstree/_docs/themeroller.html +0 -98
  169. data/public/jstree/_docs/themes.html +0 -126
  170. data/public/jstree/_docs/types.html +0 -173
  171. data/public/jstree/_docs/ui.html +0 -188
  172. data/public/jstree/_docs/unique.html +0 -70
  173. data/public/jstree/_docs/xml_data.html +0 -214
  174. data/public/jstree/_lib/jquery.cookie.js +0 -96
  175. data/public/jstree/_lib/jquery.hotkeys.js +0 -99
  176. data/public/jstree/_lib/jquery.js +0 -6240
  177. data/public/jstree/jquery.jstree.js +0 -3510
  178. data/public/jstree/jstree.html +0 -237
  179. data/public/jstree/themes/apple/bg.jpg +0 -0
  180. data/public/jstree/themes/apple/d.png +0 -0
  181. data/public/jstree/themes/apple/dot_for_ie.gif +0 -0
  182. data/public/jstree/themes/apple/style.css +0 -60
  183. data/public/jstree/themes/apple/throbber.gif +0 -0
  184. data/public/jstree/themes/classic/d.png +0 -0
  185. data/public/jstree/themes/classic/dot_for_ie.gif +0 -0
  186. data/public/jstree/themes/classic/style.css +0 -59
  187. data/public/jstree/themes/classic/throbber.gif +0 -0
  188. data/public/jstree/themes/default/d.gif +0 -0
  189. data/public/jstree/themes/default/d.png +0 -0
  190. data/public/jstree/themes/default/style.css +0 -73
  191. data/public/jstree/themes/default/throbber.gif +0 -0
  192. data/public/jstree/themes/default-rtl/d.gif +0 -0
  193. data/public/jstree/themes/default-rtl/d.png +0 -0
  194. data/public/jstree/themes/default-rtl/dots.gif +0 -0
  195. data/public/jstree/themes/default-rtl/style.css +0 -83
  196. data/public/jstree/themes/default-rtl/throbber.gif +0 -0
  197. data/public/stylesheets/dreamy.css +0 -183
  198. data/public/stylesheets/menu.css +0 -101
  199. data/public/stylesheets/sass/dreamy.sass +0 -165
  200. data/public/stylesheets/sass/menu.sass +0 -139
  201. data/public/stylesheets/sass/uploadify.sass +0 -52
  202. data/public/stylesheets/sass/wheels.sass +0 -25
  203. data/public/stylesheets/scaffold.css +0 -56
  204. data/public/stylesheets/ui-lightness/images/ui-anim_basic_16x16.gif +0 -0
  205. data/public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  206. data/public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  207. data/public/stylesheets/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
  208. data/public/stylesheets/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  209. data/public/stylesheets/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  210. data/public/stylesheets/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  211. data/public/stylesheets/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  212. data/public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  213. data/public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  214. data/public/stylesheets/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
  215. data/public/stylesheets/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
  216. data/public/stylesheets/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
  217. data/public/stylesheets/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
  218. data/public/stylesheets/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
  219. data/public/stylesheets/ui-lightness/jquery-ui-1.8.2.custom.css +0 -359
  220. data/public/stylesheets/ui-lightness/jquery-ui-1.8.4.custom.css +0 -549
  221. data/public/test.html +0 -18
  222. /data/lib/generators/{wheels/recipes → recipes}/cancan.rb +0 -0
  223. /data/lib/generators/{wheels/recipes → recipes}/cucumber.rb +0 -0
  224. /data/lib/generators/{wheels/recipes → recipes}/default.rb +0 -0
  225. /data/lib/generators/{wheels/recipes → recipes}/design.rb +0 -0
  226. /data/lib/generators/{wheels/recipes → recipes}/devise.rb +0 -0
  227. /data/lib/generators/{wheels/recipes → recipes}/factory_girl.rb +0 -0
  228. /data/lib/generators/{wheels/recipes → recipes}/haml.rb +0 -0
  229. /data/lib/generators/{wheels/recipes → recipes}/jquery.rb +0 -0
  230. /data/lib/generators/{wheels/recipes → recipes}/mongoid.rb +0 -0
  231. /data/lib/generators/{wheels/recipes → recipes}/postgresql.rb +0 -0
  232. /data/lib/generators/{wheels/recipes → recipes}/recipes.rb +0 -0
  233. /data/lib/generators/{wheels/recipes → recipes}/remarkable.rb +0 -0
  234. /data/lib/generators/{wheels/recipes → recipes}/rspec.rb +0 -0
  235. /data/lib/generators/{wheels/snippets → snippets}/cucumber/database_config +0 -0
  236. /data/lib/generators/{update_wheels/templates → templates}/cancan/ability.rb +0 -0
  237. /data/lib/generators/{update_wheels/templates → templates}/database/postgresql.yml +0 -0
  238. /data/lib/generators/{update_wheels/templates → templates}/git/gitignore +0 -0
  239. /data/lib/generators/{wheels/templates → templates}/haml/app/views/layouts/application.html.haml +0 -0
  240. /data/lib/generators/{update_wheels/templates → templates}/mongoid/features/step_definitions/mongoid_steps.rb +0 -0
  241. /data/lib/generators/{update_wheels/templates → templates}/mongoid/features/support/hooks.rb +0 -0
  242. /data/lib/generators/{update_wheels → wheels_update}/LICENCE +0 -0
  243. /data/lib/generators/{update_wheels → wheels_update}/USAGE +0 -0
data/public/404.html DELETED
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The page you were looking for doesn't exist (404)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/404.html -->
21
- <div class="dialog">
22
- <h1>The page you were looking for doesn't exist.</h1>
23
- <p>You may have mistyped the address or the page may have moved.</p>
24
- </div>
25
- </body>
26
- </html>
data/public/422.html DELETED
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The change you wanted was rejected (422)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/422.html -->
21
- <div class="dialog">
22
- <h1>The change you wanted was rejected.</h1>
23
- <p>Maybe you tried to change something you didn't have access to.</p>
24
- </div>
25
- </body>
26
- </html>
data/public/500.html DELETED
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>We're sorry, but something went wrong (500)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/500.html -->
21
- <div class="dialog">
22
- <h1>We're sorry, but something went wrong.</h1>
23
- <p>We've been notified about this issue and we'll take a look at it shortly.</p>
24
- </div>
25
- </body>
26
- </html>
data/public/favicon.ico DELETED
File without changes
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,8 +0,0 @@
1
-
2
- $(function(){
3
- config = {
4
- filebrowserBrowseUrl : '/galleries'
5
- };
6
- $('.ckeditor_textarea').ckeditor(config);
7
- });
8
-
@@ -1,28 +0,0 @@
1
- function QSObject(querystring){
2
- //Create regular expression object to retrieve the qs part
3
- var qsReg = new RegExp("[?][^#]*","i");
4
- hRef = unescape(querystring);
5
- var qsMatch = hRef.match(qsReg);
6
-
7
- //removes the question mark from the url
8
- qsMatch = new String(qsMatch);
9
- qsMatch = qsMatch.substr(1, qsMatch.length -1);
10
-
11
- //split it up
12
- var rootArr = qsMatch.split("&");
13
- for(i=0;i<rootArr.length;i++){
14
- var tempArr = rootArr[i].split("=");
15
- if(tempArr.length ==2){
16
- tempArr[0] = unescape(tempArr[0]);
17
- tempArr[1] = unescape(tempArr[1]);
18
-
19
- this[tempArr[0]]= tempArr[1];
20
- }
21
- }
22
- }
23
-
24
- function queryParamFor(jsFile) {
25
- url = $('script[src~='+jsFile+']').attr('src').toLowerCase();
26
- return new QSObject(url);
27
- }
28
-
@@ -1,259 +0,0 @@
1
- (function() {
2
-
3
- function stripHtml(value) {
4
- // remove html tags and space chars
5
- return value.replace(/<.[^<>]*?>/g, ' ').replace(/&nbsp;|&#160;/gi, ' ')
6
- // remove numbers and punctuation
7
- .replace(/[0-9.(),;:!?%#$'"_+=\/-]*/g,'');
8
- }
9
- jQuery.validator.addMethod("maxWords", function(value, element, params) {
10
- return this.optional(element) || stripHtml(value).match(/\b\w+\b/g).length < params;
11
- }, jQuery.validator.format("Please enter {0} words or less."));
12
-
13
- jQuery.validator.addMethod("minWords", function(value, element, params) {
14
- return this.optional(element) || stripHtml(value).match(/\b\w+\b/g).length >= params;
15
- }, jQuery.validator.format("Please enter at least {0} words."));
16
-
17
- jQuery.validator.addMethod("rangeWords", function(value, element, params) {
18
- return this.optional(element) || stripHtml(value).match(/\b\w+\b/g).length >= params[0] && value.match(/bw+b/g).length < params[1];
19
- }, jQuery.validator.format("Please enter between {0} and {1} words."));
20
-
21
- })();
22
-
23
- jQuery.validator.addMethod("letterswithbasicpunc", function(value, element) {
24
- return this.optional(element) || /^[a-z-.,()'\"\s]+$/i.test(value);
25
- }, "Letters or punctuation only please");
26
-
27
- jQuery.validator.addMethod("alphanumeric", function(value, element) {
28
- return this.optional(element) || /^\w+$/i.test(value);
29
- }, "Letters, numbers, spaces or underscores only please");
30
-
31
- jQuery.validator.addMethod("lettersonly", function(value, element) {
32
- return this.optional(element) || /^[a-z]+$/i.test(value);
33
- }, "Letters only please");
34
-
35
- jQuery.validator.addMethod("nowhitespace", function(value, element) {
36
- return this.optional(element) || /^\S+$/i.test(value);
37
- }, "No white space please");
38
-
39
- jQuery.validator.addMethod("ziprange", function(value, element) {
40
- return this.optional(element) || /^90[2-5]\d\{2}-\d{4}$/.test(value);
41
- }, "Your ZIP-code must be in the range 902xx-xxxx to 905-xx-xxxx");
42
-
43
- jQuery.validator.addMethod("integer", function(value, element) {
44
- return this.optional(element) || /^-?\d+$/.test(value);
45
- }, "A positive or negative non-decimal number please");
46
-
47
- /**
48
- * Return true, if the value is a valid vehicle identification number (VIN).
49
- *
50
- * Works with all kind of text inputs.
51
- *
52
- * @example <input type="text" size="20" name="VehicleID" class="{required:true,vinUS:true}" />
53
- * @desc Declares a required input element whose value must be a valid vehicle identification number.
54
- *
55
- * @name jQuery.validator.methods.vinUS
56
- * @type Boolean
57
- * @cat Plugins/Validate/Methods
58
- */
59
- jQuery.validator.addMethod(
60
- "vinUS",
61
- function(v){
62
- if (v.length != 17)
63
- return false;
64
- var i, n, d, f, cd, cdv;
65
- var LL = ["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"];
66
- var VL = [1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9];
67
- var FL = [8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2];
68
- var rs = 0;
69
- for(i = 0; i < 17; i++){
70
- f = FL[i];
71
- d = v.slice(i,i+1);
72
- if(i == 8){
73
- cdv = d;
74
- }
75
- if(!isNaN(d)){
76
- d *= f;
77
- }
78
- else{
79
- for(n = 0; n < LL.length; n++){
80
- if(d.toUpperCase() === LL[n]){
81
- d = VL[n];
82
- d *= f;
83
- if(isNaN(cdv) && n == 8){
84
- cdv = LL[n];
85
- }
86
- break;
87
- }
88
- }
89
- }
90
- rs += d;
91
- }
92
- cd = rs % 11;
93
- if(cd == 10){cd = "X";}
94
- if(cd == cdv){return true;}
95
- return false;
96
- },
97
- "The specified vehicle identification number (VIN) is invalid."
98
- );
99
-
100
- /**
101
- * Return true, if the value is a valid date, also making this formal check dd/mm/yyyy.
102
- *
103
- * @example jQuery.validator.methods.date("01/01/1900")
104
- * @result true
105
- *
106
- * @example jQuery.validator.methods.date("01/13/1990")
107
- * @result false
108
- *
109
- * @example jQuery.validator.methods.date("01.01.1900")
110
- * @result false
111
- *
112
- * @example <input name="pippo" class="{dateITA:true}" />
113
- * @desc Declares an optional input element whose value must be a valid date.
114
- *
115
- * @name jQuery.validator.methods.dateITA
116
- * @type Boolean
117
- * @cat Plugins/Validate/Methods
118
- */
119
- jQuery.validator.addMethod(
120
- "dateITA",
121
- function(value, element) {
122
- var check = false;
123
- var re = /^\d{1,2}\/\d{1,2}\/\d{4}$/;
124
- if( re.test(value)){
125
- var adata = value.split('/');
126
- var gg = parseInt(adata[0],10);
127
- var mm = parseInt(adata[1],10);
128
- var aaaa = parseInt(adata[2],10);
129
- var xdata = new Date(aaaa,mm-1,gg);
130
- if ( ( xdata.getFullYear() == aaaa ) && ( xdata.getMonth () == mm - 1 ) && ( xdata.getDate() == gg ) )
131
- check = true;
132
- else
133
- check = false;
134
- } else
135
- check = false;
136
- return this.optional(element) || check;
137
- },
138
- "Please enter a correct date"
139
- );
140
-
141
- jQuery.validator.addMethod("dateNL", function(value, element) {
142
- return this.optional(element) || /^\d\d?[\.\/-]\d\d?[\.\/-]\d\d\d?\d?$/.test(value);
143
- }, "Vul hier een geldige datum in."
144
- );
145
-
146
- jQuery.validator.addMethod("time", function(value, element) {
147
- return this.optional(element) || /^([01][0-9])|(2[0123]):([0-5])([0-9])$/.test(value);
148
- }, "Please enter a valid time, between 00:00 and 23:59"
149
- );
150
-
151
- /**
152
- * matches US phone number format
153
- *
154
- * where the area code may not start with 1 and the prefix may not start with 1
155
- * allows '-' or ' ' as a separator and allows parens around area code
156
- * some people may want to put a '1' in front of their number
157
- *
158
- * 1(212)-999-2345
159
- * or
160
- * 212 999 2344
161
- * or
162
- * 212-999-0983
163
- *
164
- * but not
165
- * 111-123-5434
166
- * and not
167
- * 212 123 4567
168
- */
169
- jQuery.validator.addMethod("phoneUS", function(phone_number, element) {
170
- phone_number = phone_number.replace(/\s+/g, "");
171
- return this.optional(element) || phone_number.length > 9 &&
172
- phone_number.match(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/);
173
- }, "Please specify a valid phone number");
174
-
175
- jQuery.validator.addMethod('phoneUK', function(phone_number, element) {
176
- return this.optional(element) || phone_number.length > 9 &&
177
- phone_number.match(/^(\(?(0|\+44)[1-9]{1}\d{1,4}?\)?\s?\d{3,4}\s?\d{3,4})$/);
178
- }, 'Please specify a valid phone number');
179
-
180
- jQuery.validator.addMethod('mobileUK', function(phone_number, element) {
181
- return this.optional(element) || phone_number.length > 9 &&
182
- phone_number.match(/^((0|\+44)7(5|6|7|8|9){1}\d{2}\s?\d{6})$/);
183
- }, 'Please specify a valid mobile number');
184
-
185
- // TODO check if value starts with <, otherwise don't try stripping anything
186
- jQuery.validator.addMethod("strippedminlength", function(value, element, param) {
187
- return jQuery(value).text().length >= param;
188
- }, jQuery.validator.format("Please enter at least {0} characters"));
189
-
190
- // same as email, but TLD is optional
191
- jQuery.validator.addMethod("email2", function(value, element, param) {
192
- return this.optional(element) || /^((([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.test(value);
193
- }, jQuery.validator.messages.email);
194
-
195
- // same as url, but TLD is optional
196
- jQuery.validator.addMethod("url2", function(value, element, param) {
197
- return this.optional(element) || /^(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.test(value);
198
- }, jQuery.validator.messages.url);
199
-
200
- // NOTICE: Modified version of Castle.Components.Validator.CreditCardValidator
201
- // Redistributed under the the Apache License 2.0 at http://www.apache.org/licenses/LICENSE-2.0
202
- // Valid Types: mastercard, visa, amex, dinersclub, enroute, discover, jcb, unknown, all (overrides all other settings)
203
- jQuery.validator.addMethod("creditcardtypes", function(value, element, param) {
204
-
205
- if (/[^0-9-]+/.test(value))
206
- return false;
207
-
208
- value = value.replace(/\D/g, "");
209
-
210
- var validTypes = 0x0000;
211
-
212
- if (param.mastercard)
213
- validTypes |= 0x0001;
214
- if (param.visa)
215
- validTypes |= 0x0002;
216
- if (param.amex)
217
- validTypes |= 0x0004;
218
- if (param.dinersclub)
219
- validTypes |= 0x0008;
220
- if (param.enroute)
221
- validTypes |= 0x0010;
222
- if (param.discover)
223
- validTypes |= 0x0020;
224
- if (param.jcb)
225
- validTypes |= 0x0040;
226
- if (param.unknown)
227
- validTypes |= 0x0080;
228
- if (param.all)
229
- validTypes = 0x0001 | 0x0002 | 0x0004 | 0x0008 | 0x0010 | 0x0020 | 0x0040 | 0x0080;
230
-
231
- if (validTypes & 0x0001 && /^(51|52|53|54|55)/.test(value)) { //mastercard
232
- return value.length == 16;
233
- }
234
- if (validTypes & 0x0002 && /^(4)/.test(value)) { //visa
235
- return value.length == 16;
236
- }
237
- if (validTypes & 0x0004 && /^(34|37)/.test(value)) { //amex
238
- return value.length == 15;
239
- }
240
- if (validTypes & 0x0008 && /^(300|301|302|303|304|305|36|38)/.test(value)) { //dinersclub
241
- return value.length == 14;
242
- }
243
- if (validTypes & 0x0010 && /^(2014|2149)/.test(value)) { //enroute
244
- return value.length == 15;
245
- }
246
- if (validTypes & 0x0020 && /^(6011)/.test(value)) { //discover
247
- return value.length == 16;
248
- }
249
- if (validTypes & 0x0040 && /^(3)/.test(value)) { //jcb
250
- return value.length == 16;
251
- }
252
- if (validTypes & 0x0040 && /^(2131|1800)/.test(value)) { //jcb
253
- return value.length == 15;
254
- }
255
- if (validTypes & 0x0080) { //unknown
256
- return true;
257
- }
258
- return false;
259
- }, "Please enter a valid credit card number.");