fae-railsz 2.1.0

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 (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,403 @@
1
+ /* global Fae, FCH, Cookies */
2
+
3
+ /**
4
+ * Fae tables
5
+ * @namespace tables
6
+ * @memberof Fae
7
+ */
8
+ Fae.tables = {
9
+
10
+ /**
11
+ * Base cookie string for sorting per site per page
12
+ * @type {String}
13
+ * @see {@link tables.defaultSortCookie}
14
+ * @see {@link tables.columnSorting}
15
+ * @see {@link tables.sortColumnsFromCookies}
16
+ */
17
+ sort_cookie_name: 'Fae_table_sort_preferences',
18
+
19
+ ready: function() {
20
+ if (FCH.exists('.js-sort-column')) {
21
+ this.dateColumnSorting();
22
+ this.columnSorting();
23
+ this.defaultSortCookie();
24
+ this.sortColumnsFromCookies();
25
+ }
26
+
27
+ if (FCH.exists('.sortable-handle')) {
28
+ this.rowSorting();
29
+ }
30
+
31
+ this.stickyTableHeader();
32
+
33
+ if (FCH.exists('.collapsible')) {
34
+ this.collapsibleTable();
35
+ }
36
+
37
+ this.endingSelectShim();
38
+
39
+ if (FCH.exists('.js-tooltip')) {
40
+ this.tooltip();
41
+ }
42
+ },
43
+
44
+ /**
45
+ * Sort columns in tables if applicable
46
+ */
47
+ columnSorting: function() {
48
+ var _this = this;
49
+ var path = window.location.pathname;
50
+ var cookie_value = Cookies.getJSON(_this.sort_cookie_name);
51
+
52
+ $('.js-sort-column')
53
+ .tablesorter()
54
+ .on('sortEnd', function(e) {
55
+ var $this = $(this);
56
+ cookie_value = Cookies.getJSON(_this.sort_cookie_name);
57
+ var idx = $this.index() - 1;
58
+
59
+ // Create object if the index isn't available at this path
60
+ if (!cookie_value[path].hasOwnProperty(idx)) {
61
+ cookie_value[path][idx] = {};
62
+ }
63
+
64
+ // Insert the sort data at the index of the table in the array
65
+ cookie_value[path][idx] = $this.data('tablesorter').sortList;
66
+
67
+ // Save it to the cookie as a string
68
+ Cookies.set(_this.sort_cookie_name, cookie_value);
69
+
70
+ // Replace sticky table headers w/ newly sorted headers
71
+ $this.siblings('.sticky-table-header')
72
+ .find('thead')
73
+ .html(
74
+ $this.find('thead').html()
75
+ );
76
+ });
77
+ },
78
+
79
+ /**
80
+ * Add smart sorting for dates
81
+ * @has_test {features/date_sort_spec.rb}
82
+ */
83
+ dateColumnSorting: function() {
84
+ $.tablesorter.addParser({
85
+ id: 'mmddyy',
86
+ is: function(s) {
87
+ // testing for ##-##-#### or ####-##-##, so it's not perfect; time can be included
88
+ return (/(^\d{1,2}[\/\s]\d{1,2}[\/\s]\d{2})/).test((s || '').replace(/\s+/g, ' ').replace(/[\-.,]/g, '/'));
89
+ },
90
+ format: function(s, table, cell, cellIndex) {
91
+ if (s) {
92
+ var c = table.config,
93
+ ci = c.$headers.filter('[data-column=' + cellIndex + ']:last'),
94
+ format = ci.length && ci[0].dateFormat || $.tablesorter.getData( ci, $.tablesorter.getColumnData( table, c.headers, cellIndex ), 'dateFormat') || c.dateFormat;
95
+ s = s.replace(/\s+/g, ' ').replace(/[\-.,]/g, '/'); // escaped - because JSHint in Firefox was showing it as an error
96
+ if (format === 'mmddyy') {
97
+ s = s.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{2})/, '$3/$1/$2');
98
+ }
99
+ }
100
+ return s ? $.tablesorter.formatFloat( (new Date(s).getTime() || s), table) : s;
101
+ },
102
+ type: 'numeric'
103
+ });
104
+ },
105
+
106
+ /**
107
+ * Ensure this page has a key in the table sort hash cookie
108
+ */
109
+ defaultSortCookie: function() {
110
+ var path = window.location.pathname;
111
+ var cookie_value = Cookies.getJSON(this.sort_cookie_name);
112
+
113
+ // If cookie hasn't been created for this session
114
+ if (!cookie_value || $.isEmptyObject(cookie_value)) {
115
+ cookie_value = {};
116
+ }
117
+
118
+ // Create hash object for this path if it hasn't been done yet
119
+ if (!cookie_value.hasOwnProperty(path)) {
120
+ cookie_value[path] = {};
121
+ }
122
+
123
+ Cookies.set(this.sort_cookie_name, cookie_value);
124
+ },
125
+
126
+ /**
127
+ * Sort column by stored cookie
128
+ * @has_test {requests/fae_table_sort_spec.rb}
129
+ */
130
+ sortColumnsFromCookies: function() {
131
+ var path = window.location.pathname;
132
+ var cookie_value = Cookies.getJSON(this.sort_cookie_name);
133
+
134
+ // Exit early if sort cookie is nothing or there's no cookie at the present path
135
+ if (!cookie_value || $.isEmptyObject(cookie_value) || !cookie_value[path] || $.isEmptyObject(cookie_value[path])) {
136
+ return;
137
+ }
138
+
139
+ $('.js-sort-column').each(function(idx) {
140
+ // If this table exists in the cookie hash
141
+ if (cookie_value[path].hasOwnProperty(idx)) {
142
+ // Use array value within another array because of how tablesorter accepts this argument
143
+ $(this).trigger('sorton', [ cookie_value[path][idx] ]);
144
+ }
145
+ });
146
+ },
147
+
148
+ /**
149
+ * Make table rows draggable by user
150
+ */
151
+ rowSorting: function() {
152
+ $('.js-sort-row').sortable({
153
+ items: 'tbody tr',
154
+ opacity: 0.8,
155
+ handle: ('.sortable-handle'),
156
+
157
+ //helper function to preserve the width of the table row
158
+ helper: function(e, $tr) {
159
+ var $originals = $tr.children();
160
+ var $helper = $tr.clone();
161
+ var $ths = $tr.closest('table').find('th');
162
+
163
+ $helper.children().each(function(index) {
164
+ // Set helper cell sizes to match the original sizes
165
+ $(this).width($originals.eq(index).width());
166
+ //set the THs width so they don't go collapsey
167
+ $ths.eq(index).width($ths.eq(index).width());
168
+ });
169
+
170
+ return $helper;
171
+ },
172
+
173
+ // on stop, set the THs back to no inline width for repsonsivity
174
+ stop: function(e, ui) {
175
+ $(ui.item).closest('table').find('th').css('width', '');
176
+ },
177
+
178
+ update: function() {
179
+ var $this = $(this);
180
+ var serial = $this.sortable('serialize');
181
+ var object = serial.substr(0, serial.indexOf('['));
182
+
183
+ $.ajax({
184
+ url: Fae.path+'/sort/'+object,
185
+ type: 'post',
186
+ data: serial,
187
+ dataType: 'script',
188
+ complete: function(request){
189
+ // sort complete messaging can go here
190
+ }
191
+ });
192
+ }
193
+ });
194
+ },
195
+
196
+ /**
197
+ * Enable collapsible tables by clicking the h3 preceding a table. Also enables open/close all
198
+ */
199
+ collapsibleTable: function() {
200
+ var $collapsible = $('.collapsible');
201
+ var $toggle = $('.collapsible-toggle');
202
+
203
+ // If there's only one table, don't bother with collapsing everything
204
+ // Also, remove the open/close all toggle and the table subheaders
205
+ if ($collapsible.length === 1) {
206
+ $collapsible.removeClass('collapsible');
207
+ $collapsible.find('h3').remove();
208
+ $toggle.remove();
209
+
210
+ return;
211
+ }
212
+
213
+ $toggle.click(function() {
214
+ var $this = $(this);
215
+
216
+ if ($this.hasClass('close-all')) {
217
+ $this.text('Open All');
218
+ $collapsible.removeClass('active');
219
+
220
+ } else {
221
+ $this.text('Close All');
222
+ $collapsible.addClass('active');
223
+
224
+ }
225
+
226
+ Fae.tables.sizeFixedHeader();
227
+
228
+ $this.toggleClass('close-all');
229
+ });
230
+
231
+ $('.collapsible h3').click(function() {
232
+ var $this = $(this);
233
+ /** @type {Boolean} */
234
+ var toggleHasCloseAll = $toggle.hasClass('close-all');
235
+
236
+ $this.parent().toggleClass('active');
237
+
238
+ // Change toggle messaging as appropriate
239
+ // First check if there are open drawers
240
+ if ($('.collapsible.active').length > 1) {
241
+
242
+ // Change toggle text if it isn't already close all
243
+ if(!toggleHasCloseAll) {
244
+ $toggle.text('Close All');
245
+ $toggle.addClass('close-all');
246
+ }
247
+ } else {
248
+
249
+ // Change toggle text if it isn't already open all
250
+ if(toggleHasCloseAll) {
251
+ $toggle.text('Open All');
252
+ $toggle.removeClass('close-all');
253
+ }
254
+ }
255
+
256
+ Fae.tables.sizeFixedHeader();
257
+ });
258
+ },
259
+
260
+ /**
261
+ * Add extra space if the last item in a form is a select menu so the dropdown doesn't run off the screen or section
262
+ */
263
+ endingSelectShim: function() {
264
+ $('form .content:last-of-type').each(function() {
265
+ var $last_item = $(this).find('.input:last-of-type');
266
+
267
+ if( $last_item.hasClass('select') ) {
268
+ $(this).addClass('-bottom-shim');
269
+ }
270
+ });
271
+ },
272
+
273
+ /**
274
+ * Fix a table header to the top of the view on scroll
275
+ */
276
+ stickyTableHeader: function() {
277
+ var $sticky_tables = $('.content table:not(.stuck-table)');
278
+
279
+ // Add sticky psuedo tables after our main table to hold the fixed header
280
+ $sticky_tables.each(function() {
281
+ var $this = $(this);
282
+ var $header = $this.find('thead').clone();
283
+
284
+ var $fixed_header = $('<table />', {
285
+ class: 'sticky-table-header stuck-table'
286
+ });
287
+
288
+ $fixed_header.append( $header );
289
+ $this.after($fixed_header);
290
+
291
+ // Proxy clicks from .sticky-table-header to underlying tablesorter instance
292
+ if ($this.hasClass('tablesorter')) {
293
+ $fixed_header.on('click', 'th', function(e) {
294
+ $this
295
+ .find("th[data-column='" + $(e.currentTarget).data('column') + "']")
296
+ .trigger('sort');
297
+ });
298
+ }
299
+ });
300
+
301
+ /**
302
+ * FCH callback for scroll - If the table header is in range, show it, otherwise hide it
303
+ * @private
304
+ */
305
+ function stickyTableHeaderScroll() {
306
+ var offset = FCH.$window.scrollTop();
307
+
308
+ $('.sticky-table-header').each(function() {
309
+ var $this = $(this);
310
+ var top_offset = $this.data('table-top');
311
+ var tableBottom = $this.data('table-bottom');
312
+
313
+ if (offset >= top_offset && offset <= tableBottom) {
314
+ $this.show();
315
+ } else {
316
+ $this.hide();
317
+ }
318
+ });
319
+ }
320
+
321
+ FCH.load.push( Fae.tables.sizeFixedHeader );
322
+ FCH.resize.push( Fae.tables.sizeFixedHeader );
323
+ FCH.scroll.push(stickyTableHeaderScroll);
324
+ },
325
+
326
+ /**
327
+ * Cache offset and height values to spare expensive calculations on scroll
328
+ */
329
+ sizeFixedHeader: function() {
330
+ var $tables = $('.content table');
331
+
332
+ var header_height = $('.js-content-header').outerHeight();
333
+ if(FCH.large_down) {
334
+ header_height = $('#js-main-header').outerHeight();
335
+ }
336
+
337
+ /**
338
+ * Add offset and height values per each table
339
+ * @private
340
+ */
341
+ function applyOffset() {
342
+ var $this = $(this);
343
+
344
+ // If this is a collapsible item and the table is hidden, forget it
345
+ if($this.parent().hasClass('collapsible') && !$this.parent().hasClass('active')) {
346
+ return;
347
+ }
348
+
349
+ // Content header is not present on mobile but the main header is stuck
350
+ if (FCH.bp.large_down) {
351
+ header_height = $('#js-main-header').outerHeight();
352
+ }
353
+
354
+ var top_offset = $this.offset().top - header_height;
355
+ var thead_height = $this.find('thead').outerHeight();
356
+ var bottom_offset = $this.height() + top_offset - thead_height;
357
+ var $fixed_header = $this.next('.sticky-table-header');
358
+
359
+ // For whatever reason IE9 does not pickup the .sticky plugin
360
+ if(!FCH.exists('.js-will-be-sticky')) {
361
+ top_offset += header_height;
362
+ header_height = 0;
363
+ }
364
+
365
+ // Force offsets to be greater than the header_height
366
+ top_offset = Math.max(header_height, top_offset);
367
+ bottom_offset = Math.max(header_height, bottom_offset);
368
+
369
+ $fixed_header.data({
370
+ 'table-top' : top_offset,
371
+ 'table-bottom' : bottom_offset
372
+ });
373
+
374
+ $fixed_header.css({
375
+ width: $this.outerWidth(),
376
+ height: thead_height,
377
+ top: header_height
378
+ });
379
+ }
380
+
381
+ $tables.each( applyOffset );
382
+
383
+ Fae.navigation.lockFooter();
384
+ },
385
+
386
+ /**
387
+ * Generate a tooltip for all .js-tooltip elements using their title attribute
388
+ */
389
+ tooltip: function() {
390
+ // Generate tooltip
391
+ $('.js-tooltip').each(function() {
392
+ var $this = $(this);
393
+ var $tooltip_element = $('<span />', {
394
+ class: 'tooltip',
395
+ text: $this.attr('title')
396
+ });
397
+
398
+ $this.addClass('tooltip-parent');
399
+
400
+ $this.prepend( $tooltip_element );
401
+ });
402
+ }
403
+ };
@@ -0,0 +1,11 @@
1
+ // This file is named Admin because child-project asset folders should have a fae.js file to override or add functionality to the admin
2
+ /**
3
+ * Fae
4
+ * @module Fae
5
+ * @namespace Fae
6
+ */
7
+ var Fae = {
8
+ path: '<%= Rails.application.routes.url_helpers.fae_path %>',
9
+ };
10
+
11
+ judge.enginePath = '<%= Rails.application.routes.url_helpers.fae_path %>/judge';
@@ -0,0 +1,63 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require jquery.remotipart
16
+ //= require jquery-ui/widgets/sortable
17
+ //= require jquery-ui/widgets/datepicker
18
+ //= require underscore
19
+ //= require json2
20
+ //= require judge
21
+
22
+ //= require fae/vendor/chosen.jquery.min
23
+ //= require fae/vendor/frob_core_helpers
24
+ //= require fae/vendor/fryr
25
+ //= require fae/vendor/moment.min
26
+ //= require fae/vendor/jquery.daterangepicker
27
+ //= require fae/vendor/jqColorPicker.min
28
+ //= require fae/vendor/jquery.multi-select
29
+ //= require fae/vendor/jquery.simplemodal.1.4.4
30
+ //= require fae/vendor/jquery.tablesorter
31
+ //= require fae/vendor/js.cookie
32
+ //= require fae/vendor/touch_punch
33
+ //= require fae/vendor/simplemde.min
34
+
35
+ //= require fae/admin
36
+
37
+ //= require fae/form/hinter
38
+ //= require fae/form/_form
39
+ //= require fae/form/inputs/_dates
40
+ //= require fae/form/inputs/_color
41
+ //= require fae/form/inputs/_select
42
+ //= require fae/form/inputs/_text
43
+ //= require fae/form/inputs/_checkbox
44
+ //= require fae/form/_slugger
45
+ //= require fae/form/_validator
46
+ //= require fae/form/_cancel
47
+ //= require fae/form/_ajax
48
+ //= require fae/form/_filtering
49
+ //= require fae/form/fae_chosen
50
+ //= require fae/form/fileinputer
51
+
52
+ //= require fae/navigation/sticky
53
+ //= require fae/navigation/_navigation
54
+ //= require fae/navigation/_subnav_highlighter
55
+ //= require fae/navigation/_language
56
+ //= require fae/navigation/_global_search
57
+
58
+ //= require fae/_modals
59
+ //= require fae/_tables
60
+
61
+ //= require fae
62
+
63
+ //= require fae/fae_init