fae-railsz 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (328) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +5 -0
  3. data/Rakefile +37 -0
  4. data/app/assets/fonts/fae/icons.eot +0 -0
  5. data/app/assets/fonts/fae/icons.svg +56 -0
  6. data/app/assets/fonts/fae/icons.ttf +0 -0
  7. data/app/assets/fonts/fae/icons.woff +0 -0
  8. data/app/assets/fonts/fae/lato-bold-webfont.eot +0 -0
  9. data/app/assets/fonts/fae/lato-bold-webfont.svg +4551 -0
  10. data/app/assets/fonts/fae/lato-bold-webfont.ttf +0 -0
  11. data/app/assets/fonts/fae/lato-bold-webfont.woff +0 -0
  12. data/app/assets/fonts/fae/lato-light-webfont.eot +0 -0
  13. data/app/assets/fonts/fae/lato-light-webfont.svg +4241 -0
  14. data/app/assets/fonts/fae/lato-light-webfont.ttf +0 -0
  15. data/app/assets/fonts/fae/lato-light-webfont.woff +0 -0
  16. data/app/assets/fonts/fae/lato-regular-webfont.eot +0 -0
  17. data/app/assets/fonts/fae/lato-regular-webfont.svg +4241 -0
  18. data/app/assets/fonts/fae/lato-regular-webfont.ttf +0 -0
  19. data/app/assets/fonts/fae/lato-regular-webfont.woff +0 -0
  20. data/app/assets/fonts/fae/selection.json +1334 -0
  21. data/app/assets/images/fae/error_bg.jpg +0 -0
  22. data/app/assets/images/fae/error_sad_face.png +0 -0
  23. data/app/assets/images/fae/icons/alert.svg +9 -0
  24. data/app/assets/images/fae/icons/arrow_down.svg +8 -0
  25. data/app/assets/images/fae/icons/arrow_left.svg +9 -0
  26. data/app/assets/images/fae/icons/arrow_right.svg +9 -0
  27. data/app/assets/images/fae/icons/arrow_stacked.svg +8 -0
  28. data/app/assets/images/fae/icons/arrow_up.svg +8 -0
  29. data/app/assets/images/fae/icons/calendar.svg +17 -0
  30. data/app/assets/images/fae/icons/check.svg +7 -0
  31. data/app/assets/images/fae/icons/checkmark.svg +8 -0
  32. data/app/assets/images/fae/icons/chevron_down.svg +7 -0
  33. data/app/assets/images/fae/icons/chevron_left.svg +10 -0
  34. data/app/assets/images/fae/icons/chevron_right.svg +10 -0
  35. data/app/assets/images/fae/icons/chevron_up.svg +7 -0
  36. data/app/assets/images/fae/icons/delete.svg +8 -0
  37. data/app/assets/images/fae/icons/delete_x.svg +8 -0
  38. data/app/assets/images/fae/icons/edit.svg +11 -0
  39. data/app/assets/images/fae/icons/handle.svg +13 -0
  40. data/app/assets/images/fae/icons/home.svg +10 -0
  41. data/app/assets/images/fae/icons/logout.svg +12 -0
  42. data/app/assets/images/fae/icons/magnifying_glass.svg +10 -0
  43. data/app/assets/images/fae/icons/menu.svg +11 -0
  44. data/app/assets/images/fae/icons/offlink.svg +25 -0
  45. data/app/assets/images/fae/icons/plus.svg +8 -0
  46. data/app/assets/images/fae/icons/pulldown.svg +11 -0
  47. data/app/assets/images/fae/icons/search.svg +11 -0
  48. data/app/assets/images/fae/icons/settings.svg +12 -0
  49. data/app/assets/images/fae/icons/sort.svg +11 -0
  50. data/app/assets/images/fae/icons/support.svg +15 -0
  51. data/app/assets/images/fae/icons/trash.svg +10 -0
  52. data/app/assets/images/fae/icons/trumbowyg.svg +1 -0
  53. data/app/assets/images/fae/icons/user.svg +13 -0
  54. data/app/assets/images/fae/icons/users.svg +19 -0
  55. data/app/assets/images/fae/icons/zoom.svg +12 -0
  56. data/app/assets/images/fae/tutorial_model_location.png +0 -0
  57. data/app/assets/images/fae/youtube_helper.jpg +0 -0
  58. data/app/assets/javascripts/fae/_modals.js +60 -0
  59. data/app/assets/javascripts/fae/_tables.js +403 -0
  60. data/app/assets/javascripts/fae/admin.js.erb +11 -0
  61. data/app/assets/javascripts/fae/application.js +63 -0
  62. data/app/assets/javascripts/fae/fae_init.js +8 -0
  63. data/app/assets/javascripts/fae/form/_ajax.js +380 -0
  64. data/app/assets/javascripts/fae/form/_cancel.js +38 -0
  65. data/app/assets/javascripts/fae/form/_filtering.js +276 -0
  66. data/app/assets/javascripts/fae/form/_form.js +60 -0
  67. data/app/assets/javascripts/fae/form/_slugger.js.erb +100 -0
  68. data/app/assets/javascripts/fae/form/_validator.js +459 -0
  69. data/app/assets/javascripts/fae/form/fae_chosen.js +44 -0
  70. data/app/assets/javascripts/fae/form/fileinputer.js +178 -0
  71. data/app/assets/javascripts/fae/form/hinter.js +111 -0
  72. data/app/assets/javascripts/fae/form/inputs/_checkbox.js +27 -0
  73. data/app/assets/javascripts/fae/form/inputs/_color.js +42 -0
  74. data/app/assets/javascripts/fae/form/inputs/_dates.js +78 -0
  75. data/app/assets/javascripts/fae/form/inputs/_select.js +162 -0
  76. data/app/assets/javascripts/fae/form/inputs/_text.js +118 -0
  77. data/app/assets/javascripts/fae/navigation/_global_search.js +184 -0
  78. data/app/assets/javascripts/fae/navigation/_language.js +89 -0
  79. data/app/assets/javascripts/fae/navigation/_navigation.js +206 -0
  80. data/app/assets/javascripts/fae/navigation/_subnav_highlighter.js +81 -0
  81. data/app/assets/javascripts/fae/navigation/sticky.js +186 -0
  82. data/app/assets/javascripts/fae/vendor/chosen.jquery.min.js +2 -0
  83. data/app/assets/javascripts/fae/vendor/frob_core_helpers.js +587 -0
  84. data/app/assets/javascripts/fae/vendor/fryr.js +437 -0
  85. data/app/assets/javascripts/fae/vendor/jqColorPicker.min.js +4 -0
  86. data/app/assets/javascripts/fae/vendor/jquery.daterangepicker.js +1292 -0
  87. data/app/assets/javascripts/fae/vendor/jquery.multi-select.js +534 -0
  88. data/app/assets/javascripts/fae/vendor/jquery.simplemodal.1.4.4.js +719 -0
  89. data/app/assets/javascripts/fae/vendor/jquery.tablesorter.js +1901 -0
  90. data/app/assets/javascripts/fae/vendor/js.cookie.js +139 -0
  91. data/app/assets/javascripts/fae/vendor/moment.min.js +7 -0
  92. data/app/assets/javascripts/fae/vendor/simplemde.min.js +13 -0
  93. data/app/assets/javascripts/fae/vendor/touch_punch.js +11 -0
  94. data/app/assets/javascripts/fae/vendor/trumbowyg.js.erb +4 -0
  95. data/app/assets/javascripts/fae/vendor/trumbowyg/plugins/upload/trumbowyg.upload.js +223 -0
  96. data/app/assets/javascripts/fae/vendor/trumbowyg/trumbowyg.js +1603 -0
  97. data/app/assets/stylesheets/fae/application.css +8 -0
  98. data/app/assets/stylesheets/fae/base.scss +82 -0
  99. data/app/assets/stylesheets/fae/globals/_fonts.scss +43 -0
  100. data/app/assets/stylesheets/fae/globals/_icons.scss +15 -0
  101. data/app/assets/stylesheets/fae/globals/_plugins.scss +51 -0
  102. data/app/assets/stylesheets/fae/globals/_tags.scss +68 -0
  103. data/app/assets/stylesheets/fae/globals/imports/_extends.scss +53 -0
  104. data/app/assets/stylesheets/fae/globals/imports/_mixins.scss +58 -0
  105. data/app/assets/stylesheets/fae/globals/imports/_variables.scss +165 -0
  106. data/app/assets/stylesheets/fae/globals/imports/finescss/_fine.scss +7 -0
  107. data/app/assets/stylesheets/fae/globals/imports/finescss/_fine_functions.scss +88 -0
  108. data/app/assets/stylesheets/fae/globals/imports/finescss/_fine_mixins.scss +280 -0
  109. data/app/assets/stylesheets/fae/globals/imports/finescss/_fine_variables.scss +30 -0
  110. data/app/assets/stylesheets/fae/globals/layout/_base.scss +48 -0
  111. data/app/assets/stylesheets/fae/globals/layout/_breadcrumbs.scss +45 -0
  112. data/app/assets/stylesheets/fae/globals/layout/_content-header.scss +99 -0
  113. data/app/assets/stylesheets/fae/globals/legacy/_pre-1.3.scss +659 -0
  114. data/app/assets/stylesheets/fae/globals/navigation/_base.scss +22 -0
  115. data/app/assets/stylesheets/fae/globals/navigation/_footer.scss +50 -0
  116. data/app/assets/stylesheets/fae/globals/navigation/_header.scss +149 -0
  117. data/app/assets/stylesheets/fae/globals/navigation/_mobilenav.scss +149 -0
  118. data/app/assets/stylesheets/fae/globals/navigation/_search.scss +76 -0
  119. data/app/assets/stylesheets/fae/globals/navigation/_sidenav.scss +142 -0
  120. data/app/assets/stylesheets/fae/globals/navigation/_utility.scss +95 -0
  121. data/app/assets/stylesheets/fae/modules/_alerts.scss +50 -0
  122. data/app/assets/stylesheets/fae/modules/_buttons.scss +62 -0
  123. data/app/assets/stylesheets/fae/modules/_modal.scss +78 -0
  124. data/app/assets/stylesheets/fae/modules/_toggles.scss +48 -0
  125. data/app/assets/stylesheets/fae/modules/forms/_asset-actions.scss +83 -0
  126. data/app/assets/stylesheets/fae/modules/forms/_base.scss +100 -0
  127. data/app/assets/stylesheets/fae/modules/forms/_checkbox.scss +87 -0
  128. data/app/assets/stylesheets/fae/modules/forms/_colorpicker.scss +57 -0
  129. data/app/assets/stylesheets/fae/modules/forms/_date.scss +335 -0
  130. data/app/assets/stylesheets/fae/modules/forms/_hints.scss +40 -0
  131. data/app/assets/stylesheets/fae/modules/forms/_label.scss +57 -0
  132. data/app/assets/stylesheets/fae/modules/forms/_radio.scss +69 -0
  133. data/app/assets/stylesheets/fae/modules/forms/_select.scss +317 -0
  134. data/app/assets/stylesheets/fae/modules/forms/_simple-mde.scss +29 -0
  135. data/app/assets/stylesheets/fae/modules/forms/_text.scss +62 -0
  136. data/app/assets/stylesheets/fae/modules/forms/_textarea.scss +16 -0
  137. data/app/assets/stylesheets/fae/modules/forms/_validation.scss +63 -0
  138. data/app/assets/stylesheets/fae/modules/tables/_actions.scss +41 -0
  139. data/app/assets/stylesheets/fae/modules/tables/_base.scss +63 -0
  140. data/app/assets/stylesheets/fae/modules/tables/_collapsible.scss +76 -0
  141. data/app/assets/stylesheets/fae/modules/tables/_filters.scss +61 -0
  142. data/app/assets/stylesheets/fae/modules/tables/_image.scss +21 -0
  143. data/app/assets/stylesheets/fae/modules/tables/_pagination.scss +34 -0
  144. data/app/assets/stylesheets/fae/modules/tables/_sorting.scss +58 -0
  145. data/app/assets/stylesheets/fae/modules/tables/_sticky.scss +9 -0
  146. data/app/assets/stylesheets/fae/modules/tables/_tooltips.scss +24 -0
  147. data/app/assets/stylesheets/fae/pages/_error.scss +35 -0
  148. data/app/assets/stylesheets/fae/pages/_help.scss +28 -0
  149. data/app/assets/stylesheets/fae/pages/_home.scss +18 -0
  150. data/app/assets/stylesheets/fae/pages/_login.scss +137 -0
  151. data/app/assets/stylesheets/fae/vendor/chosen.css +377 -0
  152. data/app/assets/stylesheets/fae/vendor/daterangepicker.css +227 -0
  153. data/app/assets/stylesheets/fae/vendor/reset.css +48 -0
  154. data/app/assets/stylesheets/fae/vendor/simplemde.min.css +7 -0
  155. data/app/assets/stylesheets/fae/vendor/trumbowyg.css +584 -0
  156. data/app/controllers/concerns/fae/application_controller_concern.rb +1 -0
  157. data/app/controllers/concerns/fae/asset_cloner.rb +46 -0
  158. data/app/controllers/concerns/fae/cloneable.rb +136 -0
  159. data/app/controllers/fae/application_controller.rb +123 -0
  160. data/app/controllers/fae/base_controller.rb +117 -0
  161. data/app/controllers/fae/files_controller.rb +26 -0
  162. data/app/controllers/fae/images_controller.rb +37 -0
  163. data/app/controllers/fae/nested_base_controller.rb +100 -0
  164. data/app/controllers/fae/options_controller.rb +29 -0
  165. data/app/controllers/fae/pages_controller.rb +44 -0
  166. data/app/controllers/fae/setup_controller.rb +54 -0
  167. data/app/controllers/fae/static_pages_controller.rb +54 -0
  168. data/app/controllers/fae/users_controller.rb +71 -0
  169. data/app/controllers/fae/utilities_controller.rb +61 -0
  170. data/app/helpers/fae/application_helper.rb +114 -0
  171. data/app/helpers/fae/fae_helper.rb +6 -0
  172. data/app/helpers/fae/form_helper.rb +240 -0
  173. data/app/helpers/fae/nested_form_helper.rb +39 -0
  174. data/app/helpers/fae/view_helper.rb +175 -0
  175. data/app/inputs/date_range_input.rb +17 -0
  176. data/app/inputs/radio_collection_input.rb +17 -0
  177. data/app/inputs/symbol_input.rb +5 -0
  178. data/app/models/concerns/fae/assets_validatable.rb +12 -0
  179. data/app/models/concerns/fae/authorization_concern.rb +12 -0
  180. data/app/models/concerns/fae/base_model_concern.rb +105 -0
  181. data/app/models/concerns/fae/change_concern.rb +1 -0
  182. data/app/models/concerns/fae/file_concern.rb +1 -0
  183. data/app/models/concerns/fae/image_concern.rb +1 -0
  184. data/app/models/concerns/fae/navigation_concern.rb +10 -0
  185. data/app/models/concerns/fae/option_concern.rb +1 -0
  186. data/app/models/concerns/fae/page_validatable.rb +26 -0
  187. data/app/models/concerns/fae/paper_trailer.rb +8 -0
  188. data/app/models/concerns/fae/role_concern.rb +1 -0
  189. data/app/models/concerns/fae/sortable.rb +51 -0
  190. data/app/models/concerns/fae/static_page_concern.rb +1 -0
  191. data/app/models/concerns/fae/text_area_concern.rb +1 -0
  192. data/app/models/concerns/fae/text_field_concern.rb +1 -0
  193. data/app/models/concerns/fae/trackable.rb +124 -0
  194. data/app/models/concerns/fae/user_concern.rb +7 -0
  195. data/app/models/fae/authorization.rb +8 -0
  196. data/app/models/fae/change.rb +53 -0
  197. data/app/models/fae/file.rb +24 -0
  198. data/app/models/fae/image.rb +33 -0
  199. data/app/models/fae/navigation.rb +132 -0
  200. data/app/models/fae/option.rb +38 -0
  201. data/app/models/fae/role.rb +18 -0
  202. data/app/models/fae/static_page.rb +109 -0
  203. data/app/models/fae/text_area.rb +14 -0
  204. data/app/models/fae/text_field.rb +14 -0
  205. data/app/models/fae/user.rb +67 -0
  206. data/app/uploaders/fae/file_uploader.rb +26 -0
  207. data/app/uploaders/fae/image_uploader.rb +28 -0
  208. data/app/validators/fae/cross_model_uniqueness_validator.rb +14 -0
  209. data/app/views/devise/confirmations/new.html.slim +13 -0
  210. data/app/views/devise/mailer/confirmation_instructions.html.slim +3 -0
  211. data/app/views/devise/mailer/reset_password_instructions.html.slim +5 -0
  212. data/app/views/devise/mailer/unlock_instructions.html.slim +4 -0
  213. data/app/views/devise/passwords/edit.html.slim +10 -0
  214. data/app/views/devise/passwords/new.html.slim +10 -0
  215. data/app/views/devise/registrations/edit.html.slim +22 -0
  216. data/app/views/devise/registrations/new.html.slim +15 -0
  217. data/app/views/devise/sessions/new.html.slim +7 -0
  218. data/app/views/devise/shared/_links.slim +25 -0
  219. data/app/views/devise/unlocks/new.html.slim +13 -0
  220. data/app/views/fae/application/_breadcrumb.html.slim +19 -0
  221. data/app/views/fae/application/_content_form.html.slim +55 -0
  222. data/app/views/fae/application/_credit.slim +6 -0
  223. data/app/views/fae/application/_file_uploader.html.slim +36 -0
  224. data/app/views/fae/application/_flash_messages.slim +2 -0
  225. data/app/views/fae/application/_global_search_results.html.slim +37 -0
  226. data/app/views/fae/application/_header.slim +50 -0
  227. data/app/views/fae/application/_markdown_helper.slim +41 -0
  228. data/app/views/fae/application/_mobilenav.slim +66 -0
  229. data/app/views/fae/application/_sidenav.slim +23 -0
  230. data/app/views/fae/application/_user_log.html.slim +36 -0
  231. data/app/views/fae/images/_image_uploader.html.slim +66 -0
  232. data/app/views/fae/options/_form.html.slim +16 -0
  233. data/app/views/fae/options/edit.html.slim +1 -0
  234. data/app/views/fae/pages/activity_log.html.slim +32 -0
  235. data/app/views/fae/pages/disabled_environment.html.slim +4 -0
  236. data/app/views/fae/pages/error404.html.slim +7 -0
  237. data/app/views/fae/pages/help.html.slim +35 -0
  238. data/app/views/fae/pages/home.html.slim +36 -0
  239. data/app/views/fae/setup/first_user.html.slim +11 -0
  240. data/app/views/fae/shared/_errors.slim +4 -0
  241. data/app/views/fae/shared/_form_header.html.slim +40 -0
  242. data/app/views/fae/shared/_index_header.html.slim +26 -0
  243. data/app/views/fae/shared/_nested_table.html.slim +49 -0
  244. data/app/views/fae/shared/_recent_changes.html.slim +22 -0
  245. data/app/views/fae/shared/_shared_nested_table.html.slim +46 -0
  246. data/app/views/fae/static_pages/index.html.slim +13 -0
  247. data/app/views/fae/users/_form.html.slim +19 -0
  248. data/app/views/fae/users/edit.html.slim +1 -0
  249. data/app/views/fae/users/index.html.slim +23 -0
  250. data/app/views/fae/users/new.html.slim +1 -0
  251. data/app/views/fae/users/settings.html.slim +1 -0
  252. data/app/views/kaminari/fae/_gap.html.slim +8 -0
  253. data/app/views/kaminari/fae/_next_page.html.slim +9 -0
  254. data/app/views/kaminari/fae/_page.html.slim +15 -0
  255. data/app/views/kaminari/fae/_paginator.html.slim +15 -0
  256. data/app/views/kaminari/fae/_prev_page.html.slim +9 -0
  257. data/app/views/layouts/devise.html.slim +29 -0
  258. data/app/views/layouts/fae/application.html.slim +23 -0
  259. data/app/views/layouts/fae/error.html.slim +11 -0
  260. data/config/deploy.rb +73 -0
  261. data/config/deploy/dev.rb +19 -0
  262. data/config/deploy/prod.rb +19 -0
  263. data/config/deploy/stage.rb +19 -0
  264. data/config/initializers/assets.rb +1 -0
  265. data/config/initializers/carrierwave.rb +3 -0
  266. data/config/initializers/devise.rb +258 -0
  267. data/config/initializers/devise_monkeypatch.rb +11 -0
  268. data/config/initializers/fae_judge.rb +3 -0
  269. data/config/initializers/inflections.rb +16 -0
  270. data/config/initializers/kaminari_config.rb +10 -0
  271. data/config/initializers/simple_form.rb +147 -0
  272. data/config/initializers/time_formats.rb +3 -0
  273. data/config/locales/devise.en.yml +59 -0
  274. data/config/locales/devise.zh-CN.yml +59 -0
  275. data/config/locales/fae.en.yml +10 -0
  276. data/config/locales/fae.zh-CN.yml +10 -0
  277. data/config/locales/simple_form.en.yml +26 -0
  278. data/config/locales/simple_form.zh-CN.yml +26 -0
  279. data/config/routes.rb +46 -0
  280. data/db/migrate/20140809222030_add_user_table.rb +49 -0
  281. data/db/migrate/20140822224029_create_fae_roles.rb +10 -0
  282. data/db/migrate/20141008180718_create_fae_images_table.rb +19 -0
  283. data/db/migrate/20141017194616_create_fae_options.rb +16 -0
  284. data/db/migrate/20141021181327_create_fae_files.rb +17 -0
  285. data/db/migrate/20141021183047_create_fae_text_areas.rb +16 -0
  286. data/db/migrate/20141021184311_create_fae_pages.rb +13 -0
  287. data/db/migrate/20141105214814_create_fae_text_fields.rb +15 -0
  288. data/db/migrate/20150930224821_create_fae_changes.rb +17 -0
  289. data/lib/fae-rails.rb +6 -0
  290. data/lib/fae/concerns/models/base.rb +8 -0
  291. data/lib/fae/engine.rb +37 -0
  292. data/lib/fae/options.rb +35 -0
  293. data/lib/fae/validation_helper_collection.rb +76 -0
  294. data/lib/fae/version.rb +3 -0
  295. data/lib/file_size_validator.rb +71 -0
  296. data/lib/generators/fae/base_generator.rb +156 -0
  297. data/lib/generators/fae/controller_generator.rb +13 -0
  298. data/lib/generators/fae/install_generator.rb +61 -0
  299. data/lib/generators/fae/model_generator.rb +11 -0
  300. data/lib/generators/fae/nested_index_scaffold_generator.rb +36 -0
  301. data/lib/generators/fae/nested_scaffold_generator.rb +51 -0
  302. data/lib/generators/fae/page_generator.rb +65 -0
  303. data/lib/generators/fae/scaffold_generator.rb +15 -0
  304. data/lib/generators/fae/templates/assets/fae.js +6 -0
  305. data/lib/generators/fae/templates/assets/fae.scss +2 -0
  306. data/lib/generators/fae/templates/controllers/nested_index_scaffold_controller.rb +81 -0
  307. data/lib/generators/fae/templates/controllers/nested_scaffold_controller.rb +13 -0
  308. data/lib/generators/fae/templates/controllers/scaffold_controller.rb +13 -0
  309. data/lib/generators/fae/templates/controllers/static_pages_controller.rb +10 -0
  310. data/lib/generators/fae/templates/initializers/fae.rb +63 -0
  311. data/lib/generators/fae/templates/initializers/fae_fine.rb +51 -0
  312. data/lib/generators/fae/templates/initializers/judge.rb +6 -0
  313. data/lib/generators/fae/templates/models/concerns/authorization_concern.rb +27 -0
  314. data/lib/generators/fae/templates/models/concerns/navigation_concern.rb +33 -0
  315. data/lib/generators/fae/templates/models/pages_model.rb +14 -0
  316. data/lib/generators/fae/templates/tasks/fae_tasks.rake +19 -0
  317. data/lib/generators/fae/templates/views/_form.html.slim +18 -0
  318. data/lib/generators/fae/templates/views/_form_index_nested.html.slim +13 -0
  319. data/lib/generators/fae/templates/views/_form_nested.html.slim +17 -0
  320. data/lib/generators/fae/templates/views/edit.html.slim +1 -0
  321. data/lib/generators/fae/templates/views/edit_nested.html.slim +3 -0
  322. data/lib/generators/fae/templates/views/index.html.slim +35 -0
  323. data/lib/generators/fae/templates/views/index_nested.html.slim +8 -0
  324. data/lib/generators/fae/templates/views/new.html.slim +1 -0
  325. data/lib/generators/fae/templates/views/new_nested.html.slim +3 -0
  326. data/lib/generators/fae/templates/views/static_page_form.html.slim +15 -0
  327. data/lib/generators/fae/templates/views/table_nested.html.slim +4 -0
  328. metadata +692 -0
@@ -0,0 +1,719 @@
1
+ /* Line 244 contains a hack derived from here: http://stackoverflow.com/a/18022855/2347675 to enable simplemodal in IE9 */
2
+
3
+ /*
4
+ * SimpleModal 1.4.4 - jQuery Plugin
5
+ * http://simplemodal.com/
6
+ * Copyright (c) 2013 Eric Martin
7
+ * Licensed under MIT and GPL
8
+ * Date: Sun, Jan 20 2013 15:58:56 -0800
9
+ */
10
+
11
+ /**
12
+ * SimpleModal is a lightweight jQuery plugin that provides a simple
13
+ * interface to create a modal dialog.
14
+ *
15
+ * The goal of SimpleModal is to provide developers with a cross-browser
16
+ * overlay and container that will be populated with data provided to
17
+ * SimpleModal.
18
+ *
19
+ * There are two ways to call SimpleModal:
20
+ * 1) As a chained function on a jQuery object, like $('#myDiv').modal();.
21
+ * This call would place the DOM object, #myDiv, inside a modal dialog.
22
+ * Chaining requires a jQuery object. An optional options object can be
23
+ * passed as a parameter.
24
+ *
25
+ * @example $('<div>my data</div>').modal({options});
26
+ * @example $('#myDiv').modal({options});
27
+ * @example jQueryObject.modal({options});
28
+ *
29
+ * 2) As a stand-alone function, like $.modal(data). The data parameter
30
+ * is required and an optional options object can be passed as a second
31
+ * parameter. This method provides more flexibility in the types of data
32
+ * that are allowed. The data could be a DOM object, a jQuery object, HTML
33
+ * or a string.
34
+ *
35
+ * @example $.modal('<div>my data</div>', {options});
36
+ * @example $.modal('my data', {options});
37
+ * @example $.modal($('#myDiv'), {options});
38
+ * @example $.modal(jQueryObject, {options});
39
+ * @example $.modal(document.getElementById('myDiv'), {options});
40
+ *
41
+ * A SimpleModal call can contain multiple elements, but only one modal
42
+ * dialog can be created at a time. Which means that all of the matched
43
+ * elements will be displayed within the modal container.
44
+ *
45
+ * SimpleModal internally sets the CSS needed to display the modal dialog
46
+ * properly in all browsers, yet provides the developer with the flexibility
47
+ * to easily control the look and feel. The styling for SimpleModal can be
48
+ * done through external stylesheets, or through SimpleModal, using the
49
+ * overlayCss, containerCss, and dataCss options.
50
+ *
51
+ * SimpleModal has been tested in the following browsers:
52
+ * - IE 6+
53
+ * - Firefox 2+
54
+ * - Opera 9+
55
+ * - Safari 3+
56
+ * - Chrome 1+
57
+ *
58
+ * @name SimpleModal
59
+ * @type jQuery
60
+ * @requires jQuery v1.3
61
+ * @cat Plugins/Windows and Overlays
62
+ * @author Eric Martin (http://ericmmartin.com)
63
+ * @version 1.4.4
64
+ */
65
+
66
+ ;(function (factory) {
67
+ if (typeof define === 'function' && define.amd) {
68
+ // AMD. Register as an anonymous module.
69
+ define(['jquery'], factory);
70
+ } else {
71
+ // Browser globals
72
+ factory(jQuery);
73
+ }
74
+ }
75
+ (function ($) {
76
+ var d = [],
77
+ doc = $(document),
78
+ ua = navigator.userAgent.toLowerCase(),
79
+ wndw = $(window),
80
+ w = [];
81
+
82
+ var browser = {
83
+ ieQuirks: null,
84
+ msie: /msie/.test(ua) && !/opera/.test(ua),
85
+ opera: /opera/.test(ua)
86
+ };
87
+ browser.ie6 = browser.msie && /msie 6./.test(ua) && typeof window['XMLHttpRequest'] !== 'object';
88
+ browser.ie7 = browser.msie && /msie 7.0/.test(ua);
89
+
90
+ /*
91
+ * Create and display a modal dialog.
92
+ *
93
+ * @param {string, object} data A string, jQuery object or DOM object
94
+ * @param {object} [options] An optional object containing options overrides
95
+ */
96
+ $.modal = function (data, options) {
97
+ return $.modal.impl.init(data, options);
98
+ };
99
+
100
+ /*
101
+ * Close the modal dialog.
102
+ */
103
+ $.modal.close = function () {
104
+ $.modal.impl.close();
105
+ };
106
+
107
+ /*
108
+ * Set focus on first or last visible input in the modal dialog. To focus on the last
109
+ * element, call $.modal.focus('last'). If no input elements are found, focus is placed
110
+ * on the data wrapper element.
111
+ */
112
+ $.modal.focus = function (pos) {
113
+ $.modal.impl.focus(pos);
114
+ };
115
+
116
+ /*
117
+ * Determine and set the dimensions of the modal dialog container.
118
+ * setPosition() is called if the autoPosition option is true.
119
+ */
120
+ $.modal.setContainerDimensions = function () {
121
+ $.modal.impl.setContainerDimensions();
122
+ };
123
+
124
+ /*
125
+ * Re-position the modal dialog.
126
+ */
127
+ $.modal.setPosition = function () {
128
+ $.modal.impl.setPosition();
129
+ };
130
+
131
+ /*
132
+ * Update the modal dialog. If new dimensions are passed, they will be used to determine
133
+ * the dimensions of the container.
134
+ *
135
+ * setContainerDimensions() is called, which in turn calls setPosition(), if enabled.
136
+ * Lastly, focus() is called is the focus option is true.
137
+ */
138
+ $.modal.update = function (height, width) {
139
+ $.modal.impl.update(height, width);
140
+ };
141
+
142
+ /*
143
+ * Chained function to create a modal dialog.
144
+ *
145
+ * @param {object} [options] An optional object containing options overrides
146
+ */
147
+ $.fn.modal = function (options) {
148
+ return $.modal.impl.init(this, options);
149
+ };
150
+
151
+ /*
152
+ * SimpleModal default options
153
+ *
154
+ * appendTo: (String:'body') The jQuery selector to append the elements to. For .NET, use 'form'.
155
+ * focus: (Boolean:true) Focus in the first visible, enabled element?
156
+ * opacity: (Number:50) The opacity value for the overlay div, from 0 - 100
157
+ * overlayId: (String:'simplemodal-overlay') The DOM element id for the overlay div
158
+ * overlayCss: (Object:{}) The CSS styling for the overlay div
159
+ * containerId: (String:'simplemodal-container') The DOM element id for the container div
160
+ * containerCss: (Object:{}) The CSS styling for the container div
161
+ * dataId: (String:'simplemodal-data') The DOM element id for the data div
162
+ * dataCss: (Object:{}) The CSS styling for the data div
163
+ * minHeight: (Number:null) The minimum height for the container
164
+ * minWidth: (Number:null) The minimum width for the container
165
+ * maxHeight: (Number:null) The maximum height for the container. If not specified, the window height is used.
166
+ * maxWidth: (Number:null) The maximum width for the container. If not specified, the window width is used.
167
+ * autoResize: (Boolean:false) Automatically resize the container if it exceeds the browser window dimensions?
168
+ * autoPosition: (Boolean:true) Automatically position the container upon creation and on window resize?
169
+ * zIndex: (Number: 1000) Starting z-index value
170
+ * close: (Boolean:true) If true, closeHTML, escClose and overClose will be used if set.
171
+ If false, none of them will be used.
172
+ * closeHTML: (String:'<a class="modalCloseImg" title="Close"></a>') The HTML for the default close link.
173
+ SimpleModal will automatically add the closeClass to this element.
174
+ * closeClass: (String:'simplemodal-close') The CSS class used to bind to the close event
175
+ * escClose: (Boolean:true) Allow Esc keypress to close the dialog?
176
+ * overlayClose: (Boolean:false) Allow click on overlay to close the dialog?
177
+ * fixed: (Boolean:true) If true, the container will use a fixed position. If false, it will use a
178
+ absolute position (the dialog will scroll with the page)
179
+ * position: (Array:null) Position of container [top, left]. Can be number of pixels or percentage
180
+ * persist: (Boolean:false) Persist the data across modal calls? Only used for existing
181
+ DOM elements. If true, the data will be maintained across modal calls, if false,
182
+ the data will be reverted to its original state.
183
+ * modal: (Boolean:true) User will be unable to interact with the page below the modal or tab away from the dialog.
184
+ If false, the overlay, iframe, and certain events will be disabled allowing the user to interact
185
+ with the page below the dialog.
186
+ * onOpen: (Function:null) The callback function used in place of SimpleModal's open
187
+ * onShow: (Function:null) The callback function used after the modal dialog has opened
188
+ * onClose: (Function:null) The callback function used in place of SimpleModal's close
189
+ */
190
+ $.modal.defaults = {
191
+ appendTo: 'body',
192
+ focus: true,
193
+ opacity: 50,
194
+ overlayId: 'simplemodal-overlay',
195
+ overlayCss: {},
196
+ containerId: 'simplemodal-container',
197
+ containerCss: {},
198
+ dataId: 'simplemodal-data',
199
+ dataCss: {},
200
+ minHeight: null,
201
+ minWidth: null,
202
+ maxHeight: null,
203
+ maxWidth: null,
204
+ autoResize: false,
205
+ autoPosition: true,
206
+ zIndex: 1000,
207
+ close: true,
208
+ closeHTML: '<a class="modalCloseImg" title="Close"></a>',
209
+ closeClass: 'simplemodal-close',
210
+ escClose: true,
211
+ overlayClose: false,
212
+ fixed: true,
213
+ position: null,
214
+ persist: false,
215
+ modal: true,
216
+ onOpen: null,
217
+ onShow: null,
218
+ onClose: null
219
+ };
220
+
221
+ /*
222
+ * Main modal object
223
+ * o = options
224
+ */
225
+ $.modal.impl = {
226
+ /*
227
+ * Contains the modal dialog elements and is the object passed
228
+ * back to the callback (onOpen, onShow, onClose) functions
229
+ */
230
+ d: {},
231
+ /*
232
+ * Initialize the modal dialog
233
+ */
234
+ init: function (data, options) {
235
+ var s = this;
236
+
237
+ // don't allow multiple calls
238
+ if (s.d.data) {
239
+ return false;
240
+ }
241
+
242
+ // $.support.boxModel is undefined if checked earlier
243
+ // browser.ieQuirks = browser.msie && !$.support.boxModel;
244
+ browser.ieQuirks = browser.msie && (document.compatMode === "BackCompat");
245
+
246
+ // merge defaults and user options
247
+ s.o = $.extend({}, $.modal.defaults, options);
248
+
249
+ // keep track of z-index
250
+ s.zIndex = s.o.zIndex;
251
+
252
+ // set the onClose callback flag
253
+ s.occb = false;
254
+
255
+ // determine how to handle the data based on its type
256
+ if (typeof data === 'object') {
257
+ // convert DOM object to a jQuery object
258
+ data = data instanceof $ ? data : $(data);
259
+ s.d.placeholder = false;
260
+
261
+ // if the object came from the DOM, keep track of its parent
262
+ if (data.parent().parent().size() > 0) {
263
+ data.before($('<span></span>')
264
+ .attr('id', 'simplemodal-placeholder')
265
+ .css({display: 'none'}));
266
+
267
+ s.d.placeholder = true;
268
+ s.display = data.css('display');
269
+
270
+ // persist changes? if not, make a clone of the element
271
+ if (!s.o.persist) {
272
+ s.d.orig = data.clone(true);
273
+ }
274
+ }
275
+ }
276
+ else if (typeof data === 'string' || typeof data === 'number') {
277
+ // just insert the data as innerHTML
278
+ data = $('<div></div>').html(data);
279
+ }
280
+ else {
281
+ // unsupported data type!
282
+ alert('SimpleModal Error: Unsupported data type: ' + typeof data);
283
+ return s;
284
+ }
285
+
286
+ // create the modal overlay, container and, if necessary, iframe
287
+ s.create(data);
288
+ data = null;
289
+
290
+ // display the modal dialog
291
+ s.open();
292
+
293
+ // useful for adding events/manipulating data in the modal dialog
294
+ if ($.isFunction(s.o.onShow)) {
295
+ s.o.onShow.apply(s, [s.d]);
296
+ }
297
+
298
+ // don't break the chain =)
299
+ return s;
300
+ },
301
+ /*
302
+ * Create and add the modal overlay and container to the page
303
+ */
304
+ create: function (data) {
305
+ var s = this;
306
+
307
+ // get the window properties
308
+ s.getDimensions();
309
+
310
+ // add an iframe to prevent select options from bleeding through
311
+ if (s.o.modal && browser.ie6) {
312
+ s.d.iframe = $('<iframe src="javascript:false;"></iframe>')
313
+ .css($.extend(s.o.iframeCss, {
314
+ display: 'none',
315
+ opacity: 0,
316
+ position: 'fixed',
317
+ height: w[0],
318
+ width: w[1],
319
+ zIndex: s.o.zIndex,
320
+ top: 0,
321
+ left: 0
322
+ }))
323
+ .appendTo(s.o.appendTo);
324
+ }
325
+
326
+ // create the overlay
327
+ s.d.overlay = $('<div></div>')
328
+ .attr('id', s.o.overlayId)
329
+ .addClass('simplemodal-overlay')
330
+ .css($.extend(s.o.overlayCss, {
331
+ display: 'none',
332
+ opacity: s.o.opacity / 100,
333
+ height: s.o.modal ? d[0] : 0,
334
+ width: s.o.modal ? d[1] : 0,
335
+ position: 'fixed',
336
+ left: 0,
337
+ top: 0,
338
+ zIndex: s.o.zIndex + 1
339
+ }))
340
+ .appendTo(s.o.appendTo);
341
+
342
+ // create the container
343
+ s.d.container = $('<div></div>')
344
+ .attr('id', s.o.containerId)
345
+ .addClass('simplemodal-container')
346
+ .css($.extend(
347
+ {position: s.o.fixed ? 'fixed' : 'absolute'},
348
+ s.o.containerCss,
349
+ {display: 'none', zIndex: s.o.zIndex + 2}
350
+ ))
351
+ .append(s.o.close && s.o.closeHTML
352
+ ? $(s.o.closeHTML).addClass(s.o.closeClass)
353
+ : '')
354
+ .appendTo(s.o.appendTo);
355
+
356
+ s.d.wrap = $('<div></div>')
357
+ .attr('tabIndex', -1)
358
+ .addClass('simplemodal-wrap')
359
+ .css({height: '100%', outline: 0, width: '100%'})
360
+ .appendTo(s.d.container);
361
+
362
+ // add styling and attributes to the data
363
+ // append to body to get correct dimensions, then move to wrap
364
+ s.d.data = data
365
+ .attr('id', data.attr('id') || s.o.dataId)
366
+ .addClass('simplemodal-data')
367
+ .css($.extend(s.o.dataCss, {
368
+ display: 'none'
369
+ }))
370
+ .appendTo('body');
371
+ data = null;
372
+
373
+ s.setContainerDimensions();
374
+ s.d.data.appendTo(s.d.wrap);
375
+
376
+ // fix issues with IE
377
+ if (browser.ie6 || browser.ieQuirks) {
378
+ s.fixIE();
379
+ }
380
+ },
381
+ /*
382
+ * Bind events
383
+ */
384
+ bindEvents: function () {
385
+ var s = this;
386
+
387
+ // bind the close event to any element with the closeClass class
388
+ $('.' + s.o.closeClass).bind('click.simplemodal', function (e) {
389
+ e.preventDefault();
390
+ s.close();
391
+ });
392
+
393
+ // bind the overlay click to the close function, if enabled
394
+ if (s.o.modal && s.o.close && s.o.overlayClose) {
395
+ s.d.overlay.bind('click.simplemodal', function (e) {
396
+ e.preventDefault();
397
+ s.close();
398
+ });
399
+ }
400
+
401
+ // bind keydown events
402
+ doc.bind('keydown.simplemodal', function (e) {
403
+ if (s.o.modal && e.keyCode === 9) { // TAB
404
+ s.watchTab(e);
405
+ }
406
+ else if ((s.o.close && s.o.escClose) && e.keyCode === 27) { // ESC
407
+ e.preventDefault();
408
+ s.close();
409
+ }
410
+ });
411
+
412
+ // update window size
413
+ wndw.bind('resize.simplemodal orientationchange.simplemodal', function () {
414
+ // redetermine the window width/height
415
+ s.getDimensions();
416
+
417
+ // reposition the dialog
418
+ s.o.autoResize ? s.setContainerDimensions() : s.o.autoPosition && s.setPosition();
419
+
420
+ if (browser.ie6 || browser.ieQuirks) {
421
+ s.fixIE();
422
+ }
423
+ else if (s.o.modal) {
424
+ // update the iframe & overlay
425
+ s.d.iframe && s.d.iframe.css({height: w[0], width: w[1]});
426
+ s.d.overlay.css({height: d[0], width: d[1]});
427
+ }
428
+ });
429
+ },
430
+ /*
431
+ * Unbind events
432
+ */
433
+ unbindEvents: function () {
434
+ $('.' + this.o.closeClass).unbind('click.simplemodal');
435
+ doc.unbind('keydown.simplemodal');
436
+ wndw.unbind('.simplemodal');
437
+ this.d.overlay.unbind('click.simplemodal');
438
+ },
439
+ /*
440
+ * Fix issues in IE6 and IE7 in quirks mode
441
+ */
442
+ fixIE: function () {
443
+ var s = this, p = s.o.position;
444
+
445
+ // simulate fixed position - adapted from BlockUI
446
+ $.each([s.d.iframe || null, !s.o.modal ? null : s.d.overlay, s.d.container.css('position') === 'fixed' ? s.d.container : null], function (i, el) {
447
+ if (el) {
448
+ var bch = 'document.body.clientHeight', bcw = 'document.body.clientWidth',
449
+ bsh = 'document.body.scrollHeight', bsl = 'document.body.scrollLeft',
450
+ bst = 'document.body.scrollTop', bsw = 'document.body.scrollWidth',
451
+ ch = 'document.documentElement.clientHeight', cw = 'document.documentElement.clientWidth',
452
+ sl = 'document.documentElement.scrollLeft', st = 'document.documentElement.scrollTop',
453
+ s = el[0].style;
454
+
455
+ s.position = 'absolute';
456
+ if (i < 2) {
457
+ s.removeExpression('height');
458
+ s.removeExpression('width');
459
+ s.setExpression('height','' + bsh + ' > ' + bch + ' ? ' + bsh + ' : ' + bch + ' + "px"');
460
+ s.setExpression('width','' + bsw + ' > ' + bcw + ' ? ' + bsw + ' : ' + bcw + ' + "px"');
461
+ }
462
+ else {
463
+ var te, le;
464
+ if (p && p.constructor === Array) {
465
+ var top = p[0]
466
+ ? typeof p[0] === 'number' ? p[0].toString() : p[0].replace(/px/, '')
467
+ : el.css('top').replace(/px/, '');
468
+ te = top.indexOf('%') === -1
469
+ ? top + ' + (t = ' + st + ' ? ' + st + ' : ' + bst + ') + "px"'
470
+ : parseInt(top.replace(/%/, '')) + ' * ((' + ch + ' || ' + bch + ') / 100) + (t = ' + st + ' ? ' + st + ' : ' + bst + ') + "px"';
471
+
472
+ if (p[1]) {
473
+ var left = typeof p[1] === 'number' ? p[1].toString() : p[1].replace(/px/, '');
474
+ le = left.indexOf('%') === -1
475
+ ? left + ' + (t = ' + sl + ' ? ' + sl + ' : ' + bsl + ') + "px"'
476
+ : parseInt(left.replace(/%/, '')) + ' * ((' + cw + ' || ' + bcw + ') / 100) + (t = ' + sl + ' ? ' + sl + ' : ' + bsl + ') + "px"';
477
+ }
478
+ }
479
+ else {
480
+ te = '(' + ch + ' || ' + bch + ') / 2 - (this.offsetHeight / 2) + (t = ' + st + ' ? ' + st + ' : ' + bst + ') + "px"';
481
+ le = '(' + cw + ' || ' + bcw + ') / 2 - (this.offsetWidth / 2) + (t = ' + sl + ' ? ' + sl + ' : ' + bsl + ') + "px"';
482
+ }
483
+ s.removeExpression('top');
484
+ s.removeExpression('left');
485
+ s.setExpression('top', te);
486
+ s.setExpression('left', le);
487
+ }
488
+ }
489
+ });
490
+ },
491
+ /*
492
+ * Place focus on the first or last visible input
493
+ */
494
+ focus: function (pos) {
495
+ var s = this, p = pos && $.inArray(pos, ['first', 'last']) !== -1 ? pos : 'first';
496
+
497
+ // focus on dialog or the first visible/enabled input element
498
+ var input = $(':input:enabled:visible:' + p, s.d.wrap);
499
+ setTimeout(function () {
500
+ input.length > 0 ? input.focus() : s.d.wrap.focus();
501
+ }, 10);
502
+ },
503
+ getDimensions: function () {
504
+ // fix a jQuery bug with determining the window height - use innerHeight if available
505
+ var s = this,
506
+ h = typeof window.innerHeight === 'undefined' ? wndw.height() : window.innerHeight;
507
+
508
+ d = [doc.height(), doc.width()];
509
+ w = [h, wndw.width()];
510
+ },
511
+ getVal: function (v, d) {
512
+ return v ? (typeof v === 'number' ? v
513
+ : v === 'auto' ? 0
514
+ : v.indexOf('%') > 0 ? ((parseInt(v.replace(/%/, '')) / 100) * (d === 'h' ? w[0] : w[1]))
515
+ : parseInt(v.replace(/px/, '')))
516
+ : null;
517
+ },
518
+ /*
519
+ * Update the container. Set new dimensions, if provided.
520
+ * Focus, if enabled. Re-bind events.
521
+ */
522
+ update: function (height, width) {
523
+ var s = this;
524
+
525
+ // prevent update if dialog does not exist
526
+ if (!s.d.data) {
527
+ return false;
528
+ }
529
+
530
+ // reset orig values
531
+ s.d.origHeight = s.getVal(height, 'h');
532
+ s.d.origWidth = s.getVal(width, 'w');
533
+
534
+ // hide data to prevent screen flicker
535
+ s.d.data.hide();
536
+ height && s.d.container.css('height', height);
537
+ width && s.d.container.css('width', width);
538
+ s.setContainerDimensions();
539
+ s.d.data.show();
540
+ s.o.focus && s.focus();
541
+
542
+ // rebind events
543
+ s.unbindEvents();
544
+ s.bindEvents();
545
+ },
546
+ setContainerDimensions: function () {
547
+ var s = this,
548
+ badIE = browser.ie6 || browser.ie7;
549
+
550
+ // get the dimensions for the container and data
551
+ var ch = s.d.origHeight ? s.d.origHeight : browser.opera ? s.d.container.height() : s.getVal(badIE ? s.d.container[0].currentStyle['height'] : s.d.container.css('height'), 'h'),
552
+ cw = s.d.origWidth ? s.d.origWidth : browser.opera ? s.d.container.width() : s.getVal(badIE ? s.d.container[0].currentStyle['width'] : s.d.container.css('width'), 'w'),
553
+ dh = s.d.data.outerHeight(true), dw = s.d.data.outerWidth(true);
554
+
555
+ s.d.origHeight = s.d.origHeight || ch;
556
+ s.d.origWidth = s.d.origWidth || cw;
557
+
558
+ // mxoh = max option height, mxow = max option width
559
+ var mxoh = s.o.maxHeight ? s.getVal(s.o.maxHeight, 'h') : null,
560
+ mxow = s.o.maxWidth ? s.getVal(s.o.maxWidth, 'w') : null,
561
+ mh = mxoh && mxoh < w[0] ? mxoh : w[0],
562
+ mw = mxow && mxow < w[1] ? mxow : w[1];
563
+
564
+ // moh = min option height
565
+ var moh = s.o.minHeight ? s.getVal(s.o.minHeight, 'h') : 'auto';
566
+ if (!ch) {
567
+ if (!dh) {ch = moh;}
568
+ else {
569
+ if (dh > mh) {ch = mh;}
570
+ else if (s.o.minHeight && moh !== 'auto' && dh < moh) {ch = moh;}
571
+ else {ch = dh;}
572
+ }
573
+ }
574
+ else {
575
+ ch = s.o.autoResize && ch > mh ? mh : ch < moh ? moh : ch;
576
+ }
577
+
578
+ // mow = min option width
579
+ var mow = s.o.minWidth ? s.getVal(s.o.minWidth, 'w') : 'auto';
580
+ if (!cw) {
581
+ if (!dw) {cw = mow;}
582
+ else {
583
+ if (dw > mw) {cw = mw;}
584
+ else if (s.o.minWidth && mow !== 'auto' && dw < mow) {cw = mow;}
585
+ else {cw = dw;}
586
+ }
587
+ }
588
+ else {
589
+ cw = s.o.autoResize && cw > mw ? mw : cw < mow ? mow : cw;
590
+ }
591
+
592
+ s.d.container.css({height: ch, width: cw});
593
+ s.d.wrap.css({overflow: (dh > ch || dw > cw) ? 'auto' : 'visible'});
594
+ s.o.autoPosition && s.setPosition();
595
+ },
596
+ setPosition: function () {
597
+ var s = this, top, left,
598
+ hc = (w[0]/2) - (s.d.container.outerHeight(true)/2),
599
+ vc = (w[1]/2) - (s.d.container.outerWidth(true)/2),
600
+ st = s.d.container.css('position') !== 'fixed' ? wndw.scrollTop() : 0;
601
+
602
+ if (s.o.position && Object.prototype.toString.call(s.o.position) === '[object Array]') {
603
+ top = st + (s.o.position[0] || hc);
604
+ left = s.o.position[1] || vc;
605
+ } else {
606
+ top = st + hc;
607
+ left = vc;
608
+ }
609
+ s.d.container.css({left: left, top: top});
610
+ },
611
+ watchTab: function (e) {
612
+ var s = this;
613
+
614
+ if ($(e.target).parents('.simplemodal-container').length > 0) {
615
+ // save the list of inputs
616
+ s.inputs = $(':input:enabled:visible:first, :input:enabled:visible:last', s.d.data[0]);
617
+
618
+ // if it's the first or last tabbable element, refocus
619
+ if ((!e.shiftKey && e.target === s.inputs[s.inputs.length -1]) ||
620
+ (e.shiftKey && e.target === s.inputs[0]) ||
621
+ s.inputs.length === 0) {
622
+ e.preventDefault();
623
+ var pos = e.shiftKey ? 'last' : 'first';
624
+ s.focus(pos);
625
+ }
626
+ }
627
+ else {
628
+ // might be necessary when custom onShow callback is used
629
+ e.preventDefault();
630
+ s.focus();
631
+ }
632
+ },
633
+ /*
634
+ * Open the modal dialog elements
635
+ * - Note: If you use the onOpen callback, you must "show" the
636
+ * overlay and container elements manually
637
+ * (the iframe will be handled by SimpleModal)
638
+ */
639
+ open: function () {
640
+ var s = this;
641
+ // display the iframe
642
+ s.d.iframe && s.d.iframe.show();
643
+
644
+ if ($.isFunction(s.o.onOpen)) {
645
+ // execute the onOpen callback
646
+ s.o.onOpen.apply(s, [s.d]);
647
+ }
648
+ else {
649
+ // display the remaining elements
650
+ s.d.overlay.show();
651
+ s.d.container.show();
652
+ s.d.data.show();
653
+ }
654
+
655
+ s.o.focus && s.focus();
656
+
657
+ // bind default events
658
+ s.bindEvents();
659
+ },
660
+ /*
661
+ * Close the modal dialog
662
+ * - Note: If you use an onClose callback, you must remove the
663
+ * overlay, container and iframe elements manually
664
+ *
665
+ * @param {boolean} external Indicates whether the call to this
666
+ * function was internal or external. If it was external, the
667
+ * onClose callback will be ignored
668
+ */
669
+ close: function () {
670
+ var s = this;
671
+
672
+ // prevent close when dialog does not exist
673
+ if (!s.d.data) {
674
+ return false;
675
+ }
676
+
677
+ // remove the default events
678
+ s.unbindEvents();
679
+
680
+ if ($.isFunction(s.o.onClose) && !s.occb) {
681
+ // set the onClose callback flag
682
+ s.occb = true;
683
+
684
+ // execute the onClose callback
685
+ s.o.onClose.apply(s, [s.d]);
686
+ }
687
+ else {
688
+ // if the data came from the DOM, put it back
689
+ if (s.d.placeholder) {
690
+ var ph = $('#simplemodal-placeholder');
691
+ // save changes to the data?
692
+ if (s.o.persist) {
693
+ // insert the (possibly) modified data back into the DOM
694
+ ph.replaceWith(s.d.data.removeClass('simplemodal-data').css('display', s.display));
695
+ }
696
+ else {
697
+ // remove the current and insert the original,
698
+ // unmodified data back into the DOM
699
+ s.d.data.hide().remove();
700
+ ph.replaceWith(s.d.orig);
701
+ }
702
+ }
703
+ else {
704
+ // otherwise, remove it
705
+ s.d.data.hide().remove();
706
+ }
707
+
708
+ // remove the remaining elements
709
+ s.d.container.hide().remove();
710
+ s.d.overlay.hide();
711
+ s.d.iframe && s.d.iframe.hide().remove();
712
+ s.d.overlay.remove();
713
+
714
+ // reset the dialog object
715
+ s.d = {};
716
+ }
717
+ }
718
+ };
719
+ }));