dust-cms 0.0.05

Sign up to get free protection for your applications and to get access to all the features.
Files changed (294) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +3 -0
  3. data/Rakefile +5 -0
  4. data/app/assets/images/admin/blank.png +0 -0
  5. data/app/assets/images/admin/dust-letterpress.png +0 -0
  6. data/app/assets/images/admin/main-back.png +0 -0
  7. data/app/assets/images/admin/ui/delete-icon.png +0 -0
  8. data/app/assets/images/admin/ui/edit-icon.png +0 -0
  9. data/app/assets/images/admin/ui/handle.png +0 -0
  10. data/app/assets/images/admin/ui/icons.png +0 -0
  11. data/app/assets/images/admin/ui/index-icon.png +0 -0
  12. data/app/assets/images/admin/ui/new-icon.png +0 -0
  13. data/app/assets/images/entypo/entypo.eot +0 -0
  14. data/app/assets/images/entypo/entypo.svg +13 -0
  15. data/app/assets/images/entypo/entypo.ttf +0 -0
  16. data/app/assets/images/entypo/entypo.woff +0 -0
  17. data/app/assets/images/entypo-social/entypo-social.eot +0 -0
  18. data/app/assets/images/entypo-social/entypo-social.svg +13 -0
  19. data/app/assets/images/entypo-social/entypo-social.ttf +0 -0
  20. data/app/assets/images/entypo-social/entypo-social.woff +0 -0
  21. data/app/assets/images/fancybox/blank.gif +0 -0
  22. data/app/assets/images/fancybox/fancy_close.png +0 -0
  23. data/app/assets/images/fancybox/fancy_loading.png +0 -0
  24. data/app/assets/images/fancybox/fancy_nav_left.png +0 -0
  25. data/app/assets/images/fancybox/fancy_nav_right.png +0 -0
  26. data/app/assets/images/fancybox/fancy_shadow_e.png +0 -0
  27. data/app/assets/images/fancybox/fancy_shadow_n.png +0 -0
  28. data/app/assets/images/fancybox/fancy_shadow_ne.png +0 -0
  29. data/app/assets/images/fancybox/fancy_shadow_nw.png +0 -0
  30. data/app/assets/images/fancybox/fancy_shadow_s.png +0 -0
  31. data/app/assets/images/fancybox/fancy_shadow_se.png +0 -0
  32. data/app/assets/images/fancybox/fancy_shadow_sw.png +0 -0
  33. data/app/assets/images/fancybox/fancy_shadow_w.png +0 -0
  34. data/app/assets/images/fancybox/fancy_title_left.png +0 -0
  35. data/app/assets/images/fancybox/fancy_title_main.png +0 -0
  36. data/app/assets/images/fancybox/fancy_title_over.png +0 -0
  37. data/app/assets/images/fancybox/fancy_title_right.png +0 -0
  38. data/app/assets/images/fancybox/fancybox-x.png +0 -0
  39. data/app/assets/images/fancybox/fancybox-y.png +0 -0
  40. data/app/assets/images/fancybox/fancybox.png +0 -0
  41. data/app/assets/javascripts/cms/dust/defaults.js.coffee +31 -0
  42. data/app/assets/javascripts/cms/dust/gallery/photo.js.coffee +1 -0
  43. data/app/assets/javascripts/cms/dust/gallery/photo_view.js.coffee +21 -0
  44. data/app/assets/javascripts/cms/dust/gallery/photos.js.coffee +6 -0
  45. data/app/assets/javascripts/cms/dust/gallery/photos_view.js.coffee +12 -0
  46. data/app/assets/javascripts/cms/dust/gallery/router.js.coffee +14 -0
  47. data/app/assets/javascripts/cms/dust/gallery.js.coffee +31 -0
  48. data/app/assets/javascripts/cms/dust/nav.js.coffee +21 -0
  49. data/app/assets/javascripts/cms/dust/sections.js.coffee +21 -0
  50. data/app/assets/javascripts/cms/dust/sortables.js.coffee +64 -0
  51. data/app/assets/javascripts/cms/dust/window.js.coffee +11 -0
  52. data/app/assets/javascripts/cms/dust.js.coffee +19 -0
  53. data/app/assets/javascripts/cms/lib/backbone.js +42 -0
  54. data/app/assets/javascripts/cms/lib/fineuploader-3.0.js +71 -0
  55. data/app/assets/javascripts/cms/lib/handlebars.js +1920 -0
  56. data/app/assets/javascripts/cms/lib/spin.js +2 -0
  57. data/app/assets/javascripts/cms/lib/underscore.js +1 -0
  58. data/app/assets/javascripts/cms.js +14 -0
  59. data/app/assets/javascripts/core/jquery.form.js +785 -0
  60. data/app/assets/javascripts/core/jquery.html5.js +29 -0
  61. data/app/assets/javascripts/core/jquery.mousewheel-3.0.2.pack.js +13 -0
  62. data/app/assets/javascripts/core/jquery.placeholder.min.js +11 -0
  63. data/app/assets/javascripts/core/nestedsortables.js +429 -0
  64. data/app/assets/javascripts/core/serializelist.js +66 -0
  65. data/app/assets/javascripts/core/tipTip.js +21 -0
  66. data/app/assets/javascripts/core.js +4 -0
  67. data/app/assets/javascripts/front_end/application-main.js.coffee +27 -0
  68. data/app/assets/javascripts/front_end/map.js +34 -0
  69. data/app/assets/javascripts/front_end/video.js +4569 -0
  70. data/app/assets/javascripts/front_end.js +18 -0
  71. data/app/assets/stylesheets/cms/flash_messages.css.scss +17 -0
  72. data/app/assets/stylesheets/cms/footer.css.scss +12 -0
  73. data/app/assets/stylesheets/cms/forms.css.scss +67 -0
  74. data/app/assets/stylesheets/cms/gallery.css.scss +21 -0
  75. data/app/assets/stylesheets/cms/icons.css.scss +123 -0
  76. data/app/assets/stylesheets/cms/jquery-ui.custom.scss +6 -0
  77. data/app/assets/stylesheets/cms/layout.css.scss +162 -0
  78. data/app/assets/stylesheets/cms/lib/grid.css.scss +116 -0
  79. data/app/assets/stylesheets/cms/lib/mixins.css.scss +20 -0
  80. data/app/assets/stylesheets/cms/login.scss +12 -0
  81. data/app/assets/stylesheets/cms/main.old +155 -0
  82. data/app/assets/stylesheets/cms/nav.css.scss +73 -0
  83. data/app/assets/stylesheets/cms/sections.scss +17 -0
  84. data/app/assets/stylesheets/cms/sortables.scss +20 -0
  85. data/app/assets/stylesheets/cms.css.scss +30 -0
  86. data/app/assets/stylesheets/core/app/defaults.css.scss +556 -0
  87. data/app/assets/stylesheets/core/plugins/PIE.htc +96 -0
  88. data/app/assets/stylesheets/core/plugins/jquery-ui-1.8.5.custom.old +572 -0
  89. data/app/assets/stylesheets/core/plugins/jquery.fancybox-1.3.1.css +364 -0
  90. data/app/assets/stylesheets/core/plugins/skeleton.css +155 -0
  91. data/app/assets/stylesheets/core/plugins/tipTip.css +115 -0
  92. data/app/assets/stylesheets/core/plugins/uploadify.css +25 -0
  93. data/app/assets/stylesheets/core/reset/reset.css +211 -0
  94. data/app/assets/stylesheets/core/reset/text.css +86 -0
  95. data/app/assets/stylesheets/core.css.scss +14 -0
  96. data/app/assets/stylesheets/front_end/app/just-delete-me-and-start-over.css.scss +70 -0
  97. data/app/assets/stylesheets/front_end.css +14 -0
  98. data/app/controllers/authentication_controller.rb +30 -0
  99. data/app/controllers/dust/blocks_controller.rb +49 -0
  100. data/app/controllers/dust/contacts_controller.rb +89 -0
  101. data/app/controllers/dust/dashboard_controller.rb +26 -0
  102. data/app/controllers/dust/gallery/albums_controller.rb +49 -0
  103. data/app/controllers/dust/gallery/api/photos_controller.rb +28 -0
  104. data/app/controllers/dust/gallery/photos_controller.rb +47 -0
  105. data/app/controllers/dust/menu_items_controller.rb +51 -0
  106. data/app/controllers/dust/menus_controller.rb +47 -0
  107. data/app/controllers/dust/pages_controller.rb +52 -0
  108. data/app/controllers/dust/password_resets_controller.rb +48 -0
  109. data/app/controllers/dust/posts_controller.rb +47 -0
  110. data/app/controllers/dust/roles_controller.rb +47 -0
  111. data/app/controllers/dust/sessions_controller.rb +29 -0
  112. data/app/controllers/dust/site_wides_controller.rb +28 -0
  113. data/app/controllers/dust/sortable_controller.rb +17 -0
  114. data/app/controllers/dust/users_controller.rb +52 -0
  115. data/app/controllers/front_end/page_controller.rb +27 -0
  116. data/app/controllers/front_end/post_controller.rb +14 -0
  117. data/app/controllers/front_end/sitemap_controller.rb +11 -0
  118. data/app/controllers/front_end_controller.rb +18 -0
  119. data/app/helpers/error_messages_helper.rb +23 -0
  120. data/app/helpers/exceptions.rb +4 -0
  121. data/app/helpers/layout_helper.rb +28 -0
  122. data/app/helpers/misc_helper.rb +29 -0
  123. data/app/helpers/region_helper.rb +32 -0
  124. data/app/mailers/post_office.rb +39 -0
  125. data/app/models/ckeditor/asset.rb +7 -0
  126. data/app/models/ckeditor/attachment_file.rb +7 -0
  127. data/app/models/ckeditor/picture.rb +7 -0
  128. data/app/models/dust/block.rb +114 -0
  129. data/app/models/dust/builder/page.rb +84 -0
  130. data/app/models/dust/builder/site_wide.rb +50 -0
  131. data/app/models/dust/contact.rb +34 -0
  132. data/app/models/dust/gallery/album.rb +14 -0
  133. data/app/models/dust/gallery/photo.rb +23 -0
  134. data/app/models/dust/handlebar.rb +59 -0
  135. data/app/models/dust/map.rb +21 -0
  136. data/app/models/dust/menu/item_dependency.rb +66 -0
  137. data/app/models/dust/menu.rb +11 -0
  138. data/app/models/dust/menu_item.rb +64 -0
  139. data/app/models/dust/page.rb +52 -0
  140. data/app/models/dust/post.rb +39 -0
  141. data/app/models/dust/role.rb +9 -0
  142. data/app/models/dust/section.rb +11 -0
  143. data/app/models/dust/session.rb +28 -0
  144. data/app/models/dust/site_wide.rb +41 -0
  145. data/app/models/dust/sort.rb +52 -0
  146. data/app/models/dust/sortable_item.rb +21 -0
  147. data/app/models/dust/user.rb +49 -0
  148. data/app/uploaders/ckeditor_attachment_file_uploader.rb +42 -0
  149. data/app/uploaders/ckeditor_picture_uploader.rb +53 -0
  150. data/app/uploaders/gallery_photo_uploader.rb +52 -0
  151. data/app/uploaders/image_uploader.rb +51 -0
  152. data/app/uploaders/slide_image_uploader.rb +51 -0
  153. data/app/views/dust/blocks/_block.html.haml +20 -0
  154. data/app/views/dust/blocks/_form.html.haml +50 -0
  155. data/app/views/dust/blocks/_normal_block_content.html.haml +1 -0
  156. data/app/views/dust/blocks/_search.html.haml +4 -0
  157. data/app/views/dust/blocks/edit.html.haml +4 -0
  158. data/app/views/dust/blocks/index.html.haml +16 -0
  159. data/app/views/dust/blocks/new.html.haml +3 -0
  160. data/app/views/dust/contacts/_form.html.haml +37 -0
  161. data/app/views/dust/contacts/_import_csv.html.haml +8 -0
  162. data/app/views/dust/contacts/_instance.html.haml +13 -0
  163. data/app/views/dust/contacts/_search.html.haml +4 -0
  164. data/app/views/dust/contacts/edit.html.haml +2 -0
  165. data/app/views/dust/contacts/index.html.haml +17 -0
  166. data/app/views/dust/contacts/index.json.haml +6 -0
  167. data/app/views/dust/contacts/new.html.haml +3 -0
  168. data/app/views/dust/dashboard/_options.html.haml +6 -0
  169. data/app/views/dust/dashboard/show.html.haml +33 -0
  170. data/app/views/dust/dashboard/update.html.haml +6 -0
  171. data/app/views/dust/gallery/albums/_form.html.haml +52 -0
  172. data/app/views/dust/gallery/albums/_photo.html.haml +12 -0
  173. data/app/views/dust/gallery/albums/edit.html.haml +3 -0
  174. data/app/views/dust/gallery/albums/index.html.haml +18 -0
  175. data/app/views/dust/gallery/albums/new.html.haml +4 -0
  176. data/app/views/dust/gallery/albums/show.html.haml +2 -0
  177. data/app/views/dust/gallery/photos/_form.html.haml +26 -0
  178. data/app/views/dust/gallery/photos/edit.html.haml +3 -0
  179. data/app/views/dust/gallery/photos/index.html.haml +18 -0
  180. data/app/views/dust/gallery/photos/new.html.haml +4 -0
  181. data/app/views/dust/gallery/photos/show.json.jbuilder +5 -0
  182. data/app/views/dust/menu_items/_form.html.haml +24 -0
  183. data/app/views/dust/menu_items/_roots.html.haml +3 -0
  184. data/app/views/dust/menu_items/_search.html.haml +4 -0
  185. data/app/views/dust/menu_items/_tree.html.haml +11 -0
  186. data/app/views/dust/menu_items/edit.html.haml +2 -0
  187. data/app/views/dust/menu_items/index.html.haml +19 -0
  188. data/app/views/dust/menu_items/new.html.haml +2 -0
  189. data/app/views/dust/menus/_form.html.haml +39 -0
  190. data/app/views/dust/menus/edit.html.haml +3 -0
  191. data/app/views/dust/menus/index.html.haml +18 -0
  192. data/app/views/dust/menus/new.html.haml +4 -0
  193. data/app/views/dust/menus/show.html.haml +2 -0
  194. data/app/views/dust/pages/_form.html.haml +68 -0
  195. data/app/views/dust/pages/_search.html.haml +4 -0
  196. data/app/views/dust/pages/edit.html.haml +3 -0
  197. data/app/views/dust/pages/index.html.haml +16 -0
  198. data/app/views/dust/pages/new.html.haml +3 -0
  199. data/app/views/dust/password_resets/edit.html.haml +6 -0
  200. data/app/views/dust/password_resets/new.html.haml +10 -0
  201. data/app/views/dust/posts/_form.html.haml +39 -0
  202. data/app/views/dust/posts/edit.html.haml +3 -0
  203. data/app/views/dust/posts/index.html.haml +18 -0
  204. data/app/views/dust/posts/new.html.haml +4 -0
  205. data/app/views/dust/posts/show.html.haml +2 -0
  206. data/app/views/dust/roles/_form.html.haml +11 -0
  207. data/app/views/dust/roles/edit.html.haml +2 -0
  208. data/app/views/dust/roles/index.html.haml +14 -0
  209. data/app/views/dust/roles/new.html.haml +2 -0
  210. data/app/views/dust/sessions/_form.html.haml +18 -0
  211. data/app/views/dust/sessions/new.html.haml +2 -0
  212. data/app/views/dust/site_wides/new.html.haml +19 -0
  213. data/app/views/dust/slides/_form.html.haml +26 -0
  214. data/app/views/dust/slides/_search.html.haml +4 -0
  215. data/app/views/dust/slides/_slideshow.html.haml +12 -0
  216. data/app/views/dust/slides/edit.html.haml +5 -0
  217. data/app/views/dust/slides/index.html.haml +25 -0
  218. data/app/views/dust/slides/index.js.haml +2 -0
  219. data/app/views/dust/slides/new.html.haml +6 -0
  220. data/app/views/dust/slides/show.html.haml +15 -0
  221. data/app/views/dust/sortable/sort.js.coffee +10 -0
  222. data/app/views/dust/users/_form.html.haml +27 -0
  223. data/app/views/dust/users/_search.html.haml +4 -0
  224. data/app/views/dust/users/_user_bar.html.haml +10 -0
  225. data/app/views/dust/users/dashboard.html.haml +40 -0
  226. data/app/views/dust/users/edit.html.haml +2 -0
  227. data/app/views/dust/users/index.html.haml +16 -0
  228. data/app/views/dust/users/new.html.haml +2 -0
  229. data/app/views/front_end/page/_admin.html.haml +6 -0
  230. data/app/views/front_end/page/search.html.haml +9 -0
  231. data/app/views/front_end/page/show.html.haml +8 -0
  232. data/app/views/front_end/post/_admin.html.haml +7 -0
  233. data/app/views/front_end/post/show.html.haml +12 -0
  234. data/app/views/front_end/sitemap/index.html.haml +4 -0
  235. data/app/views/front_end/sitemap/index.xml.haml +9 -0
  236. data/app/views/layouts/app_partials/_analytics.html.haml +11 -0
  237. data/app/views/layouts/app_partials/_application_tree.html.haml +6 -0
  238. data/app/views/layouts/cms.html.haml +52 -0
  239. data/app/views/layouts/cms_partials/_nav.html.haml +5 -0
  240. data/app/views/layouts/front_end.html.haml +22 -0
  241. data/app/views/layouts/sessions.html.haml +19 -0
  242. data/app/views/post_office/contact_confirmation.html.haml +7 -0
  243. data/app/views/post_office/contact_request.html.haml +24 -0
  244. data/app/views/post_office/password_reset_instructions.html.haml +6 -0
  245. data/app/views/widgets/_contact_form.html.haml +20 -0
  246. data/app/views/widgets/_map.html.haml +16 -0
  247. data/app/views/widgets/_quick_contact_form.html.haml +10 -0
  248. data/app/views/widgets/_site_map.html.haml +7 -0
  249. data/app/views/widgets/_site_menu.html.haml +10 -0
  250. data/app/views/widgets/_slider.html.haml +0 -0
  251. data/app/views/widgets/_user_login.html.haml +13 -0
  252. data/app/views/widgets/galleries/_archive.html.haml +1 -0
  253. data/app/views/widgets/galleries/_show.html.haml +0 -0
  254. data/app/views/widgets/posts/_index.html.haml +1 -0
  255. data/app/views/widgets/posts/_show.html.haml +0 -0
  256. data/config/authorization_rules.rb +23 -0
  257. data/config/generators/templates/haml/scaffold/_form.html.haml +19 -0
  258. data/config/generators/templates/haml/scaffold/edit.html.haml +3 -0
  259. data/config/generators/templates/haml/scaffold/index.html.haml +18 -0
  260. data/config/generators/templates/haml/scaffold/new.html.haml +4 -0
  261. data/config/generators/templates/haml/scaffold/show.html.haml +2 -0
  262. data/config/generators/templates/rails/scaffold_controller/controller.rb +51 -0
  263. data/config/initializers/app_string_io.rb +12 -0
  264. data/config/initializers/ckeditor.rb +18 -0
  265. data/config/initializers/client_side_validations.rb +13 -0
  266. data/config/initializers/dust_config.rb +22 -0
  267. data/config/initializers/dust_core_reloader.rb +11 -0
  268. data/config/initializers/sorcery.rb +398 -0
  269. data/config/initializers/wrap_parameters.rb +14 -0
  270. data/config/routes.rb +55 -0
  271. data/db/migrate/20101206025845_create_roles.rb +11 -0
  272. data/db/migrate/20110217212357_create_ckeditor_assets.rb +31 -0
  273. data/db/migrate/20110218000640_create_pages.rb +15 -0
  274. data/db/migrate/20110218000641_create_sections.rb +15 -0
  275. data/db/migrate/20110218002220_create_contacts.rb +22 -0
  276. data/db/migrate/20110218020608_create_menu_items.rb +21 -0
  277. data/db/migrate/20110507014158_create_blocks.rb +23 -0
  278. data/db/migrate/20121106195938_sorcery_core.rb +17 -0
  279. data/db/migrate/20121106195939_sorcery_remember_me.rb +15 -0
  280. data/db/migrate/20121106195940_sorcery_reset_password.rb +17 -0
  281. data/db/migrate/20121106195941_sorcery_activity_logging.rb +17 -0
  282. data/db/migrate/20121106200754_sorcery_user_activation.rb +17 -0
  283. data/db/migrate/20130220044031_create_site_wides.rb +11 -0
  284. data/db/migrate/20130220051658_create_menus.rb +11 -0
  285. data/db/migrate/20130223030136_create_albums.rb +13 -0
  286. data/db/migrate/20130223040911_create_photos.rb +15 -0
  287. data/db/migrate/20130223044553_create_posts.rb +15 -0
  288. data/lib/dust/engine.rb +18 -0
  289. data/lib/dust/utils.rb +14 -0
  290. data/lib/dust/version.rb +3 -0
  291. data/lib/dust-cms.rb +53 -0
  292. data/lib/tasks/dust_tasks.rake +51 -0
  293. data/lib/tasks/seed.rb +46 -0
  294. metadata +613 -0
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2013 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,3 @@
1
+ = Dust
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ # run `rake -T` to view available rake tasks
4
+ # push this gem to our local gem server with `gem inabox pkg/gem_name-version.gem`
5
+
Binary file
Binary file
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" > <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">
2
+ <defs >
3
+ <font id="entypo" horiz-adv-x="508" ><font-face
4
+ font-family="Entypo"
5
+ units-per-em="1000"
6
+ panose-1="0 0 0 0 0 0 0 0 0 0"
7
+ ascent="750"
8
+ descent="-250"
9
+ alphabetic="0" />
10
+ <missing-glyph horiz-adv-x="500" />
11
+ </font>
12
+ </defs>
13
+ </svg>
Binary file
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" > <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">
2
+ <defs >
3
+ <font id="entypo-social" horiz-adv-x="555" ><font-face
4
+ font-family="Entypo Social"
5
+ units-per-em="1000"
6
+ panose-1="0 0 0 0 0 0 0 0 0 0"
7
+ ascent="750"
8
+ descent="-250"
9
+ alphabetic="0" />
10
+ <missing-glyph horiz-adv-x="500" />
11
+ </font>
12
+ </defs>
13
+ </svg>
@@ -0,0 +1,31 @@
1
+ Dust.defaults = {
2
+
3
+ accOpts :
4
+ autoHeight: false,
5
+ navigation: true,
6
+ collapsible: true,
7
+ active: false
8
+
9
+ spinnerOpts :
10
+ lines: 11 # The number of lines to draw
11
+ length: 0 # The length of each line
12
+ width: 3 # The line thickness
13
+ radius: 6 # The radius of the inner circle
14
+ corners: 1 # Corner roundness (0..1)
15
+ rotate: 0 # The rotation offset
16
+ color: "#000" # #rgb or #rrggbb
17
+ speed: 0.9 # Rounds per second
18
+ trail: 42 # Afterglow percentage
19
+ shadow: false # Whether to render a shadow
20
+ hwaccel: false # Whether to use hardware acceleration
21
+ className: "spinner" # The CSS class to assign to the spinner
22
+ zIndex: 2e9 # The z-index (defaults to 2000000000)
23
+ top: "auto" # Top position relative to parent in px
24
+ left: "auto" # Left position relative to parent in px
25
+
26
+ init : ()->
27
+ $( ".accordion" ).accordion Dust.defaults.accOpts
28
+ $(".tip").tipTip()
29
+ Dust.spinner = new Spinner(Dust.defaults.spinnerOpts)
30
+
31
+ }
@@ -0,0 +1 @@
1
+ Dust.gallery.Photo = Backbone.Model.extend({})
@@ -0,0 +1,21 @@
1
+ Dust.gallery.PhotoView = Backbone.View.extend({
2
+
3
+ className: 'index-item photo-teaser'
4
+
5
+ initialize: (options)->
6
+ @model = options.model
7
+ @model.bind('destroy', @remove, @)
8
+ @model.bind('change', @spinnerInit, @)
9
+
10
+ render: (template='#photo-template')->
11
+ self = @
12
+ template = Handlebars.compile($(template).html())
13
+ @.$el.html template(self.model.attributes)
14
+ @.$el.attr('data-id', @model.get('id'))
15
+ $('.photos').append @el
16
+ @el
17
+
18
+ spinnerInit: ()->
19
+ Dust.spinner.spin($('body')[0])
20
+
21
+ })
@@ -0,0 +1,6 @@
1
+ Dust.gallery.Photos = Backbone.Collection.extend({
2
+
3
+ model: Dust.gallery.Photo
4
+ url: "dust/gallery/api/photos"
5
+
6
+ })
@@ -0,0 +1,12 @@
1
+ Dust.gallery.PhotosView = Backbone.View.extend({
2
+
3
+ className: 'photos'
4
+
5
+ initialize: (options)->
6
+ @collecton = options.collection
7
+
8
+ render: ()->
9
+ @collection.each (model)->
10
+ photoView = new Dust.gallery.PhotoView({model:model})
11
+ photoView.render()
12
+ })
@@ -0,0 +1,14 @@
1
+
2
+ Dust.WorkSpace = Backbone.Router.extend(
3
+ routes:
4
+ "" : "album"
5
+
6
+ album: (album_id) ->
7
+ if window.photos
8
+ Dust.photos = new Dust.gallery.Photos(window.photos)
9
+ Dust.photosView = new Dust.gallery.PhotosView(collection: Dust.photos)
10
+ Dust.photosView.render()
11
+
12
+
13
+ )
14
+
@@ -0,0 +1,31 @@
1
+ Dust.gallery = {
2
+
3
+ uploaderInit: ()->
4
+ if window.album
5
+ Dust.gallery.uploader = new qq.FineUploaderBasic
6
+ button: $("#uploader")[0]
7
+ request:
8
+ endpoint: "/dust/gallery/api/photos"
9
+ params:
10
+ album_id: window.album.id
11
+ authenticity_token: $('meta[name="csrf-token"]').attr('content')
12
+ callbacks:
13
+ onComplete: (id, fileName, responseJSON)->
14
+ Dust.spinner.stop()
15
+ photo = new Dust.gallery.Photo(responseJSON)
16
+ view = new Dust.gallery.PhotoView(model: photo)
17
+ view.render()
18
+ onSubmit: (id, fileName)->
19
+ Dust.spinner.spin($('body')[0])
20
+
21
+ init: ()->
22
+ Dust.gallery.uploaderInit()
23
+
24
+ if window.album
25
+ new Dust.WorkSpace()
26
+ Backbone.history.start()
27
+
28
+ $('.photos').sortable()
29
+ $( ".photos" ).disableSelection()
30
+
31
+ }
@@ -0,0 +1,21 @@
1
+ Dust.nav = {
2
+
3
+ init : ()->
4
+ $('.main-wrap').data('state', 'open')
5
+
6
+ $('#nav .section').bind 'click', ()->
7
+ state = $('.main-wrap').data('state')
8
+ Dust.nav[state]()
9
+
10
+ open : ()->
11
+ $('.main-wrap').animate {'width': ($(window).width() - 190)}, 100, (a)->
12
+ $("#nav").toggleClass('nav-open')
13
+ $('.main-wrap').data('state', 'close')
14
+
15
+ close : ()->
16
+ $('.main-wrap').animate {'width': ($(window).width() - 45)}, 100, (a)->
17
+ $("#nav").toggleClass('nav-open')
18
+ $('.main-wrap').data('state', 'open')
19
+
20
+ }
21
+
@@ -0,0 +1,21 @@
1
+ $(document).ready ->
2
+ $('form').on 'click', '.remove_fields', (event) ->
3
+ $(this).siblings('input[type=hidden]').val('1')
4
+ $(this).closest('.item').hide()
5
+ return false
6
+
7
+ $('form').on 'click', '.add_fields', (event) ->
8
+ time = new Date().getTime()
9
+ regexp = new RegExp('section_id', 'g')
10
+ section = $('#placeholder-section').html()
11
+ $('.sections').append(section.replace(regexp, time))
12
+ $('.section-data-more').unbind 'click'
13
+ $('.section-data-more').bind 'click', (e)->
14
+ $(e.target).siblings('.section-additional-data').toggle()
15
+ return false
16
+
17
+ $('.section-data-more').bind 'click', (e)->
18
+ $(e.target).siblings('.section-additional-data').toggle()
19
+
20
+
21
+
@@ -0,0 +1,64 @@
1
+ Dust.sortables = {
2
+
3
+ options :
4
+ disableNesting: "no-nest"
5
+ forcePlaceholderSize: true
6
+ handle: ".handle"
7
+ listType: "ul"
8
+ items: "li"
9
+ maxLevels: 2
10
+ opacity: .6
11
+ placeholder: "placeholder"
12
+ tabSize: 15
13
+ tolerance: "pointer"
14
+ revert: 250
15
+ toleranceElement: "> div"
16
+
17
+ init : ()->
18
+ $("ul#tree").nestedSortable @options
19
+
20
+ $('.order').bind 'click', ()=>
21
+ @saveItems()
22
+ false
23
+
24
+ saveItems : (list, url)->
25
+ list = @buildData()
26
+ url = $('.order').data('url')
27
+
28
+ #$.post url, list
29
+
30
+ buildData: ()->
31
+ return {
32
+ class_name: @className()
33
+ list: @list()
34
+ }
35
+
36
+ className: ()->
37
+ $('.order').data('class')
38
+
39
+ list: ()->
40
+ children = new Array()
41
+ @itemList = _.map($('.index-item, .sortable-item'), (item, index)->
42
+ data =
43
+ id: $(item).data('id')
44
+ position: index
45
+ parent_id: $(item).parent().parent().data('id')
46
+ children: new Array()
47
+ if data.parent_id
48
+ children.push(data)
49
+ return false
50
+ else
51
+ return data
52
+ )
53
+ @buildChildren(children)
54
+ console.log @itemList
55
+ console.log children
56
+
57
+ _.compact(@itemList)
58
+
59
+ buildChildren: (children)->
60
+ _.each children, (item)=>
61
+ parent = _.findWhere(@itemList, {id: item.parent_id})
62
+ parent.children.push(item)
63
+
64
+ }
@@ -0,0 +1,11 @@
1
+ Dust.window = {
2
+
3
+ init : ()->
4
+ $('.item.link a').css('opacity', .125)
5
+ $('.main-wrap').css('width', ($(window).width() - 45))
6
+
7
+ onResize : ()->
8
+ $(window).resize ()->
9
+ $('.main-wrap').css('width', ($(window).width() - 45))
10
+
11
+ }
@@ -0,0 +1,19 @@
1
+ $.ajaxSetup
2
+ beforeSend: (xhr)->
3
+ xhr.setRequestHeader("Accept", "text/javascript")
4
+
5
+ window.Dust = {}
6
+
7
+ Dust.init = ()->
8
+ Dust.defaults.init()
9
+ Dust.window.init()
10
+ Dust.window.onResize()
11
+ Dust.nav.init()
12
+ Dust.sortables.init()
13
+ Dust.gallery.init()
14
+ Dust
15
+
16
+ $(document).ready ()->
17
+ Dust.init()
18
+
19
+
@@ -0,0 +1,42 @@
1
+ // Backbone.js 0.9.10
2
+
3
+ // (c) 2010-2012 Jeremy Ashkenas, DocumentCloud Inc.
4
+ // Backbone may be freely distributed under the MIT license.
5
+ // For all details and documentation:
6
+ // http://backbonejs.org
7
+ (function(){var n=this,B=n.Backbone,h=[],C=h.push,u=h.slice,D=h.splice,g;g="undefined"!==typeof exports?exports:n.Backbone={};g.VERSION="0.9.10";var f=n._;!f&&"undefined"!==typeof require&&(f=require("underscore"));g.$=n.jQuery||n.Zepto||n.ender;g.noConflict=function(){n.Backbone=B;return this};g.emulateHTTP=!1;g.emulateJSON=!1;var v=/\s+/,q=function(a,b,c,d){if(!c)return!0;if("object"===typeof c)for(var e in c)a[b].apply(a,[e,c[e]].concat(d));else if(v.test(c)){c=c.split(v);e=0;for(var f=c.length;e<
8
+ f;e++)a[b].apply(a,[c[e]].concat(d))}else return!0},w=function(a,b){var c,d=-1,e=a.length;switch(b.length){case 0:for(;++d<e;)(c=a[d]).callback.call(c.ctx);break;case 1:for(;++d<e;)(c=a[d]).callback.call(c.ctx,b[0]);break;case 2:for(;++d<e;)(c=a[d]).callback.call(c.ctx,b[0],b[1]);break;case 3:for(;++d<e;)(c=a[d]).callback.call(c.ctx,b[0],b[1],b[2]);break;default:for(;++d<e;)(c=a[d]).callback.apply(c.ctx,b)}},h=g.Events={on:function(a,b,c){if(!q(this,"on",a,[b,c])||!b)return this;this._events||(this._events=
9
+ {});(this._events[a]||(this._events[a]=[])).push({callback:b,context:c,ctx:c||this});return this},once:function(a,b,c){if(!q(this,"once",a,[b,c])||!b)return this;var d=this,e=f.once(function(){d.off(a,e);b.apply(this,arguments)});e._callback=b;this.on(a,e,c);return this},off:function(a,b,c){var d,e,t,g,j,l,k,h;if(!this._events||!q(this,"off",a,[b,c]))return this;if(!a&&!b&&!c)return this._events={},this;g=a?[a]:f.keys(this._events);j=0;for(l=g.length;j<l;j++)if(a=g[j],d=this._events[a]){t=[];if(b||
10
+ c){k=0;for(h=d.length;k<h;k++)e=d[k],(b&&b!==e.callback&&b!==e.callback._callback||c&&c!==e.context)&&t.push(e)}this._events[a]=t}return this},trigger:function(a){if(!this._events)return this;var b=u.call(arguments,1);if(!q(this,"trigger",a,b))return this;var c=this._events[a],d=this._events.all;c&&w(c,b);d&&w(d,arguments);return this},listenTo:function(a,b,c){var d=this._listeners||(this._listeners={}),e=a._listenerId||(a._listenerId=f.uniqueId("l"));d[e]=a;a.on(b,"object"===typeof b?this:c,this);
11
+ return this},stopListening:function(a,b,c){var d=this._listeners;if(d){if(a)a.off(b,"object"===typeof b?this:c,this),!b&&!c&&delete d[a._listenerId];else{"object"===typeof b&&(c=this);for(var e in d)d[e].off(b,c,this);this._listeners={}}return this}}};h.bind=h.on;h.unbind=h.off;f.extend(g,h);var r=g.Model=function(a,b){var c,d=a||{};this.cid=f.uniqueId("c");this.attributes={};b&&b.collection&&(this.collection=b.collection);b&&b.parse&&(d=this.parse(d,b)||{});if(c=f.result(this,"defaults"))d=f.defaults({},
12
+ d,c);this.set(d,b);this.changed={};this.initialize.apply(this,arguments)};f.extend(r.prototype,h,{changed:null,idAttribute:"id",initialize:function(){},toJSON:function(){return f.clone(this.attributes)},sync:function(){return g.sync.apply(this,arguments)},get:function(a){return this.attributes[a]},escape:function(a){return f.escape(this.get(a))},has:function(a){return null!=this.get(a)},set:function(a,b,c){var d,e,g,p,j,l,k;if(null==a)return this;"object"===typeof a?(e=a,c=b):(e={})[a]=b;c||(c={});
13
+ if(!this._validate(e,c))return!1;g=c.unset;p=c.silent;a=[];j=this._changing;this._changing=!0;j||(this._previousAttributes=f.clone(this.attributes),this.changed={});k=this.attributes;l=this._previousAttributes;this.idAttribute in e&&(this.id=e[this.idAttribute]);for(d in e)b=e[d],f.isEqual(k[d],b)||a.push(d),f.isEqual(l[d],b)?delete this.changed[d]:this.changed[d]=b,g?delete k[d]:k[d]=b;if(!p){a.length&&(this._pending=!0);b=0;for(d=a.length;b<d;b++)this.trigger("change:"+a[b],this,k[a[b]],c)}if(j)return this;
14
+ if(!p)for(;this._pending;)this._pending=!1,this.trigger("change",this,c);this._changing=this._pending=!1;return this},unset:function(a,b){return this.set(a,void 0,f.extend({},b,{unset:!0}))},clear:function(a){var b={},c;for(c in this.attributes)b[c]=void 0;return this.set(b,f.extend({},a,{unset:!0}))},hasChanged:function(a){return null==a?!f.isEmpty(this.changed):f.has(this.changed,a)},changedAttributes:function(a){if(!a)return this.hasChanged()?f.clone(this.changed):!1;var b,c=!1,d=this._changing?
15
+ this._previousAttributes:this.attributes,e;for(e in a)if(!f.isEqual(d[e],b=a[e]))(c||(c={}))[e]=b;return c},previous:function(a){return null==a||!this._previousAttributes?null:this._previousAttributes[a]},previousAttributes:function(){return f.clone(this._previousAttributes)},fetch:function(a){a=a?f.clone(a):{};void 0===a.parse&&(a.parse=!0);var b=a.success;a.success=function(a,d,e){if(!a.set(a.parse(d,e),e))return!1;b&&b(a,d,e)};return this.sync("read",this,a)},save:function(a,b,c){var d,e,g=this.attributes;
16
+ null==a||"object"===typeof a?(d=a,c=b):(d={})[a]=b;if(d&&(!c||!c.wait)&&!this.set(d,c))return!1;c=f.extend({validate:!0},c);if(!this._validate(d,c))return!1;d&&c.wait&&(this.attributes=f.extend({},g,d));void 0===c.parse&&(c.parse=!0);e=c.success;c.success=function(a,b,c){a.attributes=g;var k=a.parse(b,c);c.wait&&(k=f.extend(d||{},k));if(f.isObject(k)&&!a.set(k,c))return!1;e&&e(a,b,c)};a=this.isNew()?"create":c.patch?"patch":"update";"patch"===a&&(c.attrs=d);a=this.sync(a,this,c);d&&c.wait&&(this.attributes=
17
+ g);return a},destroy:function(a){a=a?f.clone(a):{};var b=this,c=a.success,d=function(){b.trigger("destroy",b,b.collection,a)};a.success=function(a,b,e){(e.wait||a.isNew())&&d();c&&c(a,b,e)};if(this.isNew())return a.success(this,null,a),!1;var e=this.sync("delete",this,a);a.wait||d();return e},url:function(){var a=f.result(this,"urlRoot")||f.result(this.collection,"url")||x();return this.isNew()?a:a+("/"===a.charAt(a.length-1)?"":"/")+encodeURIComponent(this.id)},parse:function(a){return a},clone:function(){return new this.constructor(this.attributes)},
18
+ isNew:function(){return null==this.id},isValid:function(a){return!this.validate||!this.validate(this.attributes,a)},_validate:function(a,b){if(!b.validate||!this.validate)return!0;a=f.extend({},this.attributes,a);var c=this.validationError=this.validate(a,b)||null;if(!c)return!0;this.trigger("invalid",this,c,b||{});return!1}});var s=g.Collection=function(a,b){b||(b={});b.model&&(this.model=b.model);void 0!==b.comparator&&(this.comparator=b.comparator);this.models=[];this._reset();this.initialize.apply(this,
19
+ arguments);a&&this.reset(a,f.extend({silent:!0},b))};f.extend(s.prototype,h,{model:r,initialize:function(){},toJSON:function(a){return this.map(function(b){return b.toJSON(a)})},sync:function(){return g.sync.apply(this,arguments)},add:function(a,b){a=f.isArray(a)?a.slice():[a];b||(b={});var c,d,e,g,p,j,l,k,h,m;l=[];k=b.at;h=this.comparator&&null==k&&!1!=b.sort;m=f.isString(this.comparator)?this.comparator:null;c=0;for(d=a.length;c<d;c++)(e=this._prepareModel(g=a[c],b))?(p=this.get(e))?b.merge&&(p.set(g===
20
+ e?e.attributes:g,b),h&&(!j&&p.hasChanged(m))&&(j=!0)):(l.push(e),e.on("all",this._onModelEvent,this),this._byId[e.cid]=e,null!=e.id&&(this._byId[e.id]=e)):this.trigger("invalid",this,g,b);l.length&&(h&&(j=!0),this.length+=l.length,null!=k?D.apply(this.models,[k,0].concat(l)):C.apply(this.models,l));j&&this.sort({silent:!0});if(b.silent)return this;c=0;for(d=l.length;c<d;c++)(e=l[c]).trigger("add",e,this,b);j&&this.trigger("sort",this,b);return this},remove:function(a,b){a=f.isArray(a)?a.slice():[a];
21
+ b||(b={});var c,d,e,g;c=0;for(d=a.length;c<d;c++)if(g=this.get(a[c]))delete this._byId[g.id],delete this._byId[g.cid],e=this.indexOf(g),this.models.splice(e,1),this.length--,b.silent||(b.index=e,g.trigger("remove",g,this,b)),this._removeReference(g);return this},push:function(a,b){a=this._prepareModel(a,b);this.add(a,f.extend({at:this.length},b));return a},pop:function(a){var b=this.at(this.length-1);this.remove(b,a);return b},unshift:function(a,b){a=this._prepareModel(a,b);this.add(a,f.extend({at:0},
22
+ b));return a},shift:function(a){var b=this.at(0);this.remove(b,a);return b},slice:function(a,b){return this.models.slice(a,b)},get:function(a){if(null!=a)return this._idAttr||(this._idAttr=this.model.prototype.idAttribute),this._byId[a.id||a.cid||a[this._idAttr]||a]},at:function(a){return this.models[a]},where:function(a){return f.isEmpty(a)?[]:this.filter(function(b){for(var c in a)if(a[c]!==b.get(c))return!1;return!0})},sort:function(a){if(!this.comparator)throw Error("Cannot sort a set without a comparator");
23
+ a||(a={});f.isString(this.comparator)||1===this.comparator.length?this.models=this.sortBy(this.comparator,this):this.models.sort(f.bind(this.comparator,this));a.silent||this.trigger("sort",this,a);return this},pluck:function(a){return f.invoke(this.models,"get",a)},update:function(a,b){b=f.extend({add:!0,merge:!0,remove:!0},b);b.parse&&(a=this.parse(a,b));var c,d,e,g,h=[],j=[],l={};f.isArray(a)||(a=a?[a]:[]);if(b.add&&!b.remove)return this.add(a,b);d=0;for(e=a.length;d<e;d++)c=a[d],g=this.get(c),
24
+ b.remove&&g&&(l[g.cid]=!0),(b.add&&!g||b.merge&&g)&&h.push(c);if(b.remove){d=0;for(e=this.models.length;d<e;d++)c=this.models[d],l[c.cid]||j.push(c)}j.length&&this.remove(j,b);h.length&&this.add(h,b);return this},reset:function(a,b){b||(b={});b.parse&&(a=this.parse(a,b));for(var c=0,d=this.models.length;c<d;c++)this._removeReference(this.models[c]);b.previousModels=this.models.slice();this._reset();a&&this.add(a,f.extend({silent:!0},b));b.silent||this.trigger("reset",this,b);return this},fetch:function(a){a=
25
+ a?f.clone(a):{};void 0===a.parse&&(a.parse=!0);var b=a.success;a.success=function(a,d,e){a[e.update?"update":"reset"](d,e);b&&b(a,d,e)};return this.sync("read",this,a)},create:function(a,b){b=b?f.clone(b):{};if(!(a=this._prepareModel(a,b)))return!1;b.wait||this.add(a,b);var c=this,d=b.success;b.success=function(a,b,f){f.wait&&c.add(a,f);d&&d(a,b,f)};a.save(null,b);return a},parse:function(a){return a},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0;this.models.length=
26
+ 0;this._byId={}},_prepareModel:function(a,b){if(a instanceof r)return a.collection||(a.collection=this),a;b||(b={});b.collection=this;var c=new this.model(a,b);return!c._validate(a,b)?!1:c},_removeReference:function(a){this===a.collection&&delete a.collection;a.off("all",this._onModelEvent,this)},_onModelEvent:function(a,b,c,d){("add"===a||"remove"===a)&&c!==this||("destroy"===a&&this.remove(b,d),b&&a==="change:"+b.idAttribute&&(delete this._byId[b.previous(b.idAttribute)],null!=b.id&&(this._byId[b.id]=
27
+ b)),this.trigger.apply(this,arguments))},sortedIndex:function(a,b,c){b||(b=this.comparator);var d=f.isFunction(b)?b:function(a){return a.get(b)};return f.sortedIndex(this.models,a,d,c)}});f.each("forEach each map collect reduce foldl inject reduceRight foldr find detect filter select reject every all some any include contains invoke max min toArray size first head take initial rest tail drop last without indexOf shuffle lastIndexOf isEmpty chain".split(" "),function(a){s.prototype[a]=function(){var b=
28
+ u.call(arguments);b.unshift(this.models);return f[a].apply(f,b)}});f.each(["groupBy","countBy","sortBy"],function(a){s.prototype[a]=function(b,c){var d=f.isFunction(b)?b:function(a){return a.get(b)};return f[a](this.models,d,c)}});var y=g.Router=function(a){a||(a={});a.routes&&(this.routes=a.routes);this._bindRoutes();this.initialize.apply(this,arguments)},E=/\((.*?)\)/g,F=/(\(\?)?:\w+/g,G=/\*\w+/g,H=/[\-{}\[\]+?.,\\\^$|#\s]/g;f.extend(y.prototype,h,{initialize:function(){},route:function(a,b,c){f.isRegExp(a)||
29
+ (a=this._routeToRegExp(a));c||(c=this[b]);g.history.route(a,f.bind(function(d){d=this._extractParameters(a,d);c&&c.apply(this,d);this.trigger.apply(this,["route:"+b].concat(d));this.trigger("route",b,d);g.history.trigger("route",this,b,d)},this));return this},navigate:function(a,b){g.history.navigate(a,b);return this},_bindRoutes:function(){if(this.routes)for(var a,b=f.keys(this.routes);null!=(a=b.pop());)this.route(a,this.routes[a])},_routeToRegExp:function(a){a=a.replace(H,"\\$&").replace(E,"(?:$1)?").replace(F,
30
+ function(a,c){return c?a:"([^/]+)"}).replace(G,"(.*?)");return RegExp("^"+a+"$")},_extractParameters:function(a,b){return a.exec(b).slice(1)}});var m=g.History=function(){this.handlers=[];f.bindAll(this,"checkUrl");"undefined"!==typeof window&&(this.location=window.location,this.history=window.history)},z=/^[#\/]|\s+$/g,I=/^\/+|\/+$/g,J=/msie [\w.]+/,K=/\/$/;m.started=!1;f.extend(m.prototype,h,{interval:50,getHash:function(a){return(a=(a||this).location.href.match(/#(.*)$/))?a[1]:""},getFragment:function(a,
31
+ b){if(null==a)if(this._hasPushState||!this._wantsHashChange||b){a=this.location.pathname;var c=this.root.replace(K,"");a.indexOf(c)||(a=a.substr(c.length))}else a=this.getHash();return a.replace(z,"")},start:function(a){if(m.started)throw Error("Backbone.history has already been started");m.started=!0;this.options=f.extend({},{root:"/"},this.options,a);this.root=this.options.root;this._wantsHashChange=!1!==this.options.hashChange;this._wantsPushState=!!this.options.pushState;this._hasPushState=!(!this.options.pushState||
32
+ !this.history||!this.history.pushState);a=this.getFragment();var b=document.documentMode,b=J.exec(navigator.userAgent.toLowerCase())&&(!b||7>=b);this.root=("/"+this.root+"/").replace(I,"/");b&&this._wantsHashChange&&(this.iframe=g.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(a));if(this._hasPushState)g.$(window).on("popstate",this.checkUrl);else if(this._wantsHashChange&&"onhashchange"in window&&!b)g.$(window).on("hashchange",this.checkUrl);
33
+ else this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval));this.fragment=a;a=this.location;b=a.pathname.replace(/[^\/]$/,"$&/")===this.root;if(this._wantsHashChange&&this._wantsPushState&&!this._hasPushState&&!b)return this.fragment=this.getFragment(null,!0),this.location.replace(this.root+this.location.search+"#"+this.fragment),!0;this._wantsPushState&&(this._hasPushState&&b&&a.hash)&&(this.fragment=this.getHash().replace(z,""),this.history.replaceState({},document.title,
34
+ this.root+this.fragment+a.search));if(!this.options.silent)return this.loadUrl()},stop:function(){g.$(window).off("popstate",this.checkUrl).off("hashchange",this.checkUrl);clearInterval(this._checkUrlInterval);m.started=!1},route:function(a,b){this.handlers.unshift({route:a,callback:b})},checkUrl:function(){var a=this.getFragment();a===this.fragment&&this.iframe&&(a=this.getFragment(this.getHash(this.iframe)));if(a===this.fragment)return!1;this.iframe&&this.navigate(a);this.loadUrl()||this.loadUrl(this.getHash())},
35
+ loadUrl:function(a){var b=this.fragment=this.getFragment(a);return f.any(this.handlers,function(a){if(a.route.test(b))return a.callback(b),!0})},navigate:function(a,b){if(!m.started)return!1;if(!b||!0===b)b={trigger:b};a=this.getFragment(a||"");if(this.fragment!==a){this.fragment=a;var c=this.root+a;if(this._hasPushState)this.history[b.replace?"replaceState":"pushState"]({},document.title,c);else if(this._wantsHashChange)this._updateHash(this.location,a,b.replace),this.iframe&&a!==this.getFragment(this.getHash(this.iframe))&&
36
+ (b.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,a,b.replace));else return this.location.assign(c);b.trigger&&this.loadUrl(a)}},_updateHash:function(a,b,c){c?(c=a.href.replace(/(javascript:|#).*$/,""),a.replace(c+"#"+b)):a.hash="#"+b}});g.history=new m;var A=g.View=function(a){this.cid=f.uniqueId("view");this._configure(a||{});this._ensureElement();this.initialize.apply(this,arguments);this.delegateEvents()},L=/^(\S+)\s*(.*)$/,M="model collection el id attributes className tagName events".split(" ");
37
+ f.extend(A.prototype,h,{tagName:"div",$:function(a){return this.$el.find(a)},initialize:function(){},render:function(){return this},remove:function(){this.$el.remove();this.stopListening();return this},setElement:function(a,b){this.$el&&this.undelegateEvents();this.$el=a instanceof g.$?a:g.$(a);this.el=this.$el[0];!1!==b&&this.delegateEvents();return this},delegateEvents:function(a){if(a||(a=f.result(this,"events"))){this.undelegateEvents();for(var b in a){var c=a[b];f.isFunction(c)||(c=this[a[b]]);
38
+ if(!c)throw Error('Method "'+a[b]+'" does not exist');var d=b.match(L),e=d[1],d=d[2],c=f.bind(c,this),e=e+(".delegateEvents"+this.cid);if(""===d)this.$el.on(e,c);else this.$el.on(e,d,c)}}},undelegateEvents:function(){this.$el.off(".delegateEvents"+this.cid)},_configure:function(a){this.options&&(a=f.extend({},f.result(this,"options"),a));f.extend(this,f.pick(a,M));this.options=a},_ensureElement:function(){if(this.el)this.setElement(f.result(this,"el"),!1);else{var a=f.extend({},f.result(this,"attributes"));
39
+ this.id&&(a.id=f.result(this,"id"));this.className&&(a["class"]=f.result(this,"className"));a=g.$("<"+f.result(this,"tagName")+">").attr(a);this.setElement(a,!1)}}});var N={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};g.sync=function(a,b,c){var d=N[a];f.defaults(c||(c={}),{emulateHTTP:g.emulateHTTP,emulateJSON:g.emulateJSON});var e={type:d,dataType:"json"};c.url||(e.url=f.result(b,"url")||x());if(null==c.data&&b&&("create"===a||"update"===a||"patch"===a))e.contentType="application/json",
40
+ e.data=JSON.stringify(c.attrs||b.toJSON(c));c.emulateJSON&&(e.contentType="application/x-www-form-urlencoded",e.data=e.data?{model:e.data}:{});if(c.emulateHTTP&&("PUT"===d||"DELETE"===d||"PATCH"===d)){e.type="POST";c.emulateJSON&&(e.data._method=d);var h=c.beforeSend;c.beforeSend=function(a){a.setRequestHeader("X-HTTP-Method-Override",d);if(h)return h.apply(this,arguments)}}"GET"!==e.type&&!c.emulateJSON&&(e.processData=!1);var m=c.success;c.success=function(a){m&&m(b,a,c);b.trigger("sync",b,a,c)};
41
+ var j=c.error;c.error=function(a){j&&j(b,a,c);b.trigger("error",b,a,c)};a=c.xhr=g.ajax(f.extend(e,c));b.trigger("request",b,a,c);return a};g.ajax=function(){return g.$.ajax.apply(g.$,arguments)};r.extend=s.extend=y.extend=A.extend=m.extend=function(a,b){var c=this,d;d=a&&f.has(a,"constructor")?a.constructor:function(){return c.apply(this,arguments)};f.extend(d,c,b);var e=function(){this.constructor=d};e.prototype=c.prototype;d.prototype=new e;a&&f.extend(d.prototype,a);d.__super__=c.prototype;return d};
42
+ var x=function(){throw Error('A "url" property or function must be specified');}}).call(this);