active_admin_editor 0.3.6 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (498) hide show
  1. data/README.md +56 -28
  2. data/Rakefile +10 -19
  3. data/app/assets/images/active_admin/editor/loader.gif +0 -0
  4. data/app/assets/javascripts/active_admin/editor.js +14 -6
  5. data/app/assets/javascripts/active_admin/editor/config.js.erb +12 -0
  6. data/app/assets/javascripts/active_admin/editor/editor.js +101 -0
  7. data/app/assets/javascripts/active_admin/editor/parser_rules.js +561 -0
  8. data/app/assets/javascripts/active_admin/editor/templates/toolbar.jst.ejs +47 -0
  9. data/app/assets/javascripts/active_admin/editor/templates/uploader.jst.ejs +6 -0
  10. data/app/assets/stylesheets/active_admin/editor.css.scss +66 -205
  11. data/app/inputs/html_editor_input.rb +9 -79
  12. data/lib/active_admin/editor.rb +2 -2
  13. data/lib/active_admin/editor/config.rb +34 -0
  14. data/lib/active_admin/editor/policy.rb +50 -0
  15. data/lib/active_admin/editor/rails/engine.rb +7 -2
  16. data/lib/active_admin/editor/version.rb +1 -1
  17. data/lib/generators/active_admin/editor/editor_generator.rb +4 -5
  18. data/lib/generators/active_admin/editor/templates/active_admin_editor.rb +6 -0
  19. data/{test → spec}/dummy/README.rdoc +0 -0
  20. data/{test → spec}/dummy/Rakefile +0 -0
  21. data/{test → spec}/dummy/app/admin/dashboards.rb +0 -0
  22. data/{test → spec}/dummy/app/admin/pages.rb +1 -7
  23. data/spec/dummy/app/assets/javascripts/active_admin.js +1 -0
  24. data/{test → spec}/dummy/app/assets/javascripts/application.js +0 -0
  25. data/{test → spec}/dummy/app/assets/stylesheets/active_admin.css.scss +0 -1
  26. data/{test → spec}/dummy/app/assets/stylesheets/application.css +1 -2
  27. data/{test → spec}/dummy/app/controllers/application_controller.rb +0 -0
  28. data/{test → spec}/dummy/app/helpers/application_helper.rb +0 -0
  29. data/{test → spec}/dummy/app/models/admin_user.rb +0 -0
  30. data/{test → spec}/dummy/app/models/page.rb +0 -0
  31. data/{test → spec}/dummy/app/views/layouts/application.html.erb +0 -0
  32. data/{test → spec}/dummy/config.ru +0 -0
  33. data/{test → spec}/dummy/config/application.rb +4 -1
  34. data/{test → spec}/dummy/config/boot.rb +0 -0
  35. data/{test → spec}/dummy/config/database.yml +0 -0
  36. data/{test → spec}/dummy/config/environment.rb +0 -0
  37. data/{test → spec}/dummy/config/environments/development.rb +0 -0
  38. data/{test → spec}/dummy/config/environments/production.rb +1 -1
  39. data/{test → spec}/dummy/config/environments/test.rb +0 -0
  40. data/{test → spec}/dummy/config/initializers/active_admin.rb +0 -0
  41. data/{test → spec}/dummy/config/initializers/backtrace_silencers.rb +0 -0
  42. data/{test → spec}/dummy/config/initializers/devise.rb +1 -1
  43. data/{test → spec}/dummy/config/initializers/inflections.rb +0 -0
  44. data/spec/dummy/config/initializers/konacha.rb +10 -0
  45. data/{test → spec}/dummy/config/initializers/mime_types.rb +0 -0
  46. data/{test → spec}/dummy/config/initializers/secret_token.rb +1 -1
  47. data/{test → spec}/dummy/config/initializers/session_store.rb +0 -0
  48. data/{test → spec}/dummy/config/initializers/wrap_parameters.rb +0 -0
  49. data/{test → spec}/dummy/config/locales/devise.en.yml +0 -0
  50. data/{test → spec}/dummy/config/locales/en.yml +0 -0
  51. data/spec/dummy/config/routes.rb +7 -0
  52. data/{test → spec}/dummy/db/development.sqlite3 +0 -0
  53. data/{test/dummy/db/migrate/20120430130552_create_admin_notes.rb → spec/dummy/db/migrate/20121224120152_create_admin_notes.rb} +0 -0
  54. data/{test/dummy/db/migrate/20120430130553_move_admin_notes_to_comments.rb → spec/dummy/db/migrate/20121224120153_move_admin_notes_to_comments.rb} +0 -0
  55. data/{test/dummy/db/migrate/20120430200549_devise_create_admin_users.rb → spec/dummy/db/migrate/20121224200148_devise_create_admin_users.rb} +0 -0
  56. data/{test/dummy/db/migrate/20120430201522_create_pages.rb → spec/dummy/db/migrate/20121224200305_create_pages.rb} +0 -0
  57. data/{test → spec}/dummy/db/schema.rb +1 -9
  58. data/{test → spec}/dummy/db/test.sqlite3 +0 -0
  59. data/spec/dummy/log/development.log +14689 -0
  60. data/spec/dummy/log/test.log +965 -0
  61. data/{test → spec}/dummy/public/404.html +0 -0
  62. data/{test → spec}/dummy/public/422.html +0 -0
  63. data/{test → spec}/dummy/public/500.html +0 -0
  64. data/{test → spec}/dummy/public/favicon.ico +0 -0
  65. data/{test → spec}/dummy/script/rails +0 -0
  66. data/{test → spec}/dummy/tmp/cache/assets/C17/7E0/sprockets%2F10282a65710402dd907a870692e08e54 +0 -0
  67. data/spec/dummy/tmp/cache/assets/C4C/360/sprockets%2F72117b2727aba75092e90773336f414e +0 -0
  68. data/spec/dummy/tmp/cache/assets/C7E/A00/sprockets%2F792b6f07a3b1f6e7f7020544633d6163 +0 -0
  69. data/spec/dummy/tmp/cache/assets/C7E/A30/sprockets%2F4e07a03809f626374b024b66b14e5b99 +0 -0
  70. data/{test/dummy/tmp/cache/assets/C6F/E20/sprockets%2Fa87763437b13303bb17930a3144e4de2 → spec/dummy/tmp/cache/assets/C8D/BD0/sprockets%2Fb7f30a05e9483519378748810c6b57ec} +0 -0
  71. data/spec/dummy/tmp/cache/assets/C94/D20/sprockets%2F3397997b6066dfc6995b0eaa23913907 +0 -0
  72. data/spec/dummy/tmp/cache/assets/C9D/E70/sprockets%2F4a5d05f556354e305a5184b065c62ac0 +0 -0
  73. data/{test → spec}/dummy/tmp/cache/assets/C9F/170/sprockets%2F5d65e155aad3374ae12771242be22580 +0 -0
  74. data/spec/dummy/tmp/cache/assets/C9F/4B0/sprockets%2Fad8482516a116a14c2049944dc5800cc +0 -0
  75. data/spec/dummy/tmp/cache/assets/CAB/5D0/sprockets%2Fae6053e1f832b219519600e978f40b1e +0 -0
  76. data/spec/dummy/tmp/cache/assets/CB2/5A0/sprockets%2F4e7c202a6f2335881a86d6fc17329d08 +0 -0
  77. data/spec/dummy/tmp/cache/assets/CB7/160/sprockets%2F9b2ab958728324ca63e77600c53e934e +0 -0
  78. data/spec/dummy/tmp/cache/assets/CB7/940/sprockets%2F6d7c27e22691733a4db6968177c22d3c +0 -0
  79. data/spec/dummy/tmp/cache/assets/CB9/F00/sprockets%2F1c8ee45e33fe3869b7816f065d436211 +0 -0
  80. data/spec/dummy/tmp/cache/assets/CC3/E30/sprockets%2F0911249a810f39f82185eef9e0959a9d +0 -0
  81. data/{test/dummy/tmp/cache/assets/C70/420/sprockets%2F53d54131590a8591ad22c925a0077e2b → spec/dummy/tmp/cache/assets/CC7/830/sprockets%2F10abd9e76d16838868b873632597e4eb} +0 -0
  82. data/spec/dummy/tmp/cache/assets/CCB/120/sprockets%2Fb9500896df13a12225b836bda0b7320e +0 -0
  83. data/spec/dummy/tmp/cache/assets/CCC/BA0/sprockets%2F0e0e79da1b5b3033c89cfa8211306074 +0 -0
  84. data/{test/dummy/tmp/cache/assets/D1C/C80/sprockets%2F8c62944dcb299f2c6c52b6c60f57905c → spec/dummy/tmp/cache/assets/CCD/EC0/sprockets%2F9694fc1ad28709775e7a7f82369ed721} +0 -0
  85. data/{test/dummy/tmp/cache/assets/BE7/A60/sprockets%2Fae54231359059e8083a690411099f001 → spec/dummy/tmp/cache/assets/CD6/810/sprockets%2F901ca591b49d076903b08128b26cbdb7} +0 -0
  86. data/spec/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  87. data/spec/dummy/tmp/cache/assets/CD9/350/sprockets%2F32028818c2c71992ada5fba5846a570a +0 -0
  88. data/spec/dummy/tmp/cache/assets/CDA/710/sprockets%2F62127bc83fb039a235ab75167b866cb5 +0 -0
  89. data/spec/dummy/tmp/cache/assets/CDB/040/sprockets%2Fc732474e67003a4eb840eb44c5ca9385 +0 -0
  90. data/spec/dummy/tmp/cache/assets/CDF/420/sprockets%2F0be8c2291b745181fd56b7c4770a7d08 +0 -0
  91. data/spec/dummy/tmp/cache/assets/CE0/970/sprockets%2Fc9f200ae739b9f7b288228ac18346c20 +0 -0
  92. data/spec/dummy/tmp/cache/assets/CE5/570/sprockets%2F22a48aa90a12bd639b68970b85d619f8 +0 -0
  93. data/spec/dummy/tmp/cache/assets/CEE/C80/sprockets%2F18515cf2523bdc58f32fe536665ff657 +0 -0
  94. data/spec/dummy/tmp/cache/assets/CF1/0A0/sprockets%2Ff258b9f7ff79b17799a1014d71d41c64 +0 -0
  95. data/spec/dummy/tmp/cache/assets/CF2/380/sprockets%2Fb7f95440782366509acb6ddd5f6938a5 +0 -0
  96. data/spec/dummy/tmp/cache/assets/CF4/AE0/sprockets%2F764571ead1c1995d83a95d9269da457c +0 -0
  97. data/spec/dummy/tmp/cache/assets/CF7/570/sprockets%2F172af7030e61fae1056ee122c8f0a533 +0 -0
  98. data/spec/dummy/tmp/cache/assets/CF8/0B0/sprockets%2F1fc42b20103cc98d433f230c9e84b10d +0 -0
  99. data/spec/dummy/tmp/cache/assets/D00/490/sprockets%2F60ff8fc770f770b47a563e8cd4696994 +0 -0
  100. data/{test → spec}/dummy/tmp/cache/assets/D03/CD0/sprockets%2Ff025a9441aa20929b3175d8d6ab3c18e +0 -0
  101. data/spec/dummy/tmp/cache/assets/D08/C10/sprockets%2F1905d76e0c7ba5c68fad2376d44d1105 +0 -0
  102. data/spec/dummy/tmp/cache/assets/D09/1E0/sprockets%2F1275ff2f505dc32c9715eb4bc33b0379 +0 -0
  103. data/spec/dummy/tmp/cache/assets/D10/420/sprockets%2Fa4dc298af1d087c33871f077b0f16f17 +0 -0
  104. data/spec/dummy/tmp/cache/assets/D23/ED0/sprockets%2F77308cdf3281f5ef8b5d188bf8e74036 +0 -0
  105. data/spec/dummy/tmp/cache/assets/D2E/800/sprockets%2F4f418afd1d357065fa7bb580041a28aa +0 -0
  106. data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  107. data/spec/dummy/tmp/cache/assets/D34/C90/sprockets%2Fda1e05e39683311b61cb095c6c2fdd63 +0 -0
  108. data/spec/dummy/tmp/cache/assets/D38/540/sprockets%2F86e1ad844bc9df4491a2a52b870421db +0 -0
  109. data/{test/dummy/tmp/cache/assets/CF6/620/sprockets%2Fa2a0cea1f6f3124e713392f0c52704c4 → spec/dummy/tmp/cache/assets/D39/DF0/sprockets%2F1351e4754ff46cdca7cc05f72a1f1780} +0 -0
  110. data/spec/dummy/tmp/cache/assets/D3C/DF0/sprockets%2Ff432a7e254a9b296d3dfa02ce86903a5 +0 -0
  111. data/spec/dummy/tmp/cache/assets/D3E/E70/sprockets%2F038e0e6d5f82f9562663ac2611bbedd4 +0 -0
  112. data/spec/dummy/tmp/cache/assets/D41/2F0/sprockets%2Fe5d704d8dc364cb7e3e822bb4e253916 +0 -0
  113. data/spec/dummy/tmp/cache/assets/D44/C10/sprockets%2F2266669d5531ceb6da3418dd26e7d2df +0 -0
  114. data/spec/dummy/tmp/cache/assets/D46/3F0/sprockets%2F45e4032f9ee82213f32b98dae1e859cc +0 -0
  115. data/spec/dummy/tmp/cache/assets/D48/640/sprockets%2F9f4f18d910b678b1d0777e04cdaf6f24 +0 -0
  116. data/spec/dummy/tmp/cache/assets/D49/DA0/sprockets%2Fff38d1c9e2d93d45642fed29d3e30372 +0 -0
  117. data/spec/dummy/tmp/cache/assets/D4E/8C0/sprockets%2Ffa56f431b696af04ff09e2d98e286e32 +0 -0
  118. data/spec/dummy/tmp/cache/assets/D53/0B0/sprockets%2F4b2b0082dbfd4ae3f0af30c22612865c +0 -0
  119. data/{test → spec}/dummy/tmp/cache/assets/D59/D70/sprockets%2Fed9f0de1b65ae8d7ef89087c83728461 +0 -0
  120. data/spec/dummy/tmp/cache/assets/D5A/070/sprockets%2Fd8818fa8a8ef79eab35083ed7747366b +0 -0
  121. data/spec/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  122. data/spec/dummy/tmp/cache/assets/D5D/520/sprockets%2Fbee57aef677100ff765e815f994b689b +0 -0
  123. data/spec/dummy/tmp/cache/assets/D60/5A0/sprockets%2Fa0350de718dad460b2072ddaee54d981 +0 -0
  124. data/spec/dummy/tmp/cache/assets/D71/A00/sprockets%2F26b65eb6806e407ba2bf573d8e09cfe1 +0 -0
  125. data/spec/dummy/tmp/cache/assets/D75/DD0/sprockets%2Fcaf4a123e55f662a4b9c7ff520872f8e +0 -0
  126. data/spec/dummy/tmp/cache/assets/D76/730/sprockets%2Fd1699d0cbcfe965c5c51a95e31580df2 +0 -0
  127. data/spec/dummy/tmp/cache/assets/D76/DA0/sprockets%2F30e9a50c62e4c0e692f6ecd996ea319c +0 -0
  128. data/spec/dummy/tmp/cache/assets/D77/460/sprockets%2Fe55bb3a682bfa8d973ed7da8075f0760 +0 -0
  129. data/spec/dummy/tmp/cache/assets/D7A/060/sprockets%2F77ca5dbe828fbf2ffd35b5a246726483 +0 -0
  130. data/spec/dummy/tmp/cache/assets/D7C/C30/sprockets%2Ffff7e9e07a287afd2545a319a51e8c74 +0 -0
  131. data/spec/dummy/tmp/cache/assets/D84/5F0/sprockets%2F00b3982f58c6eccfe3eee6487b52f758 +0 -0
  132. data/spec/dummy/tmp/cache/assets/D8A/590/sprockets%2Fefb091963e2f1d4af57368698a8efe5f +0 -0
  133. data/spec/dummy/tmp/cache/assets/D8B/B30/sprockets%2F4dba4514d3a98322b21d72c8eab42cdd +0 -0
  134. data/{test → spec}/dummy/tmp/cache/assets/D93/4C0/sprockets%2F857ecd2092cee11f740b3cf2e373ad2a +0 -0
  135. data/spec/dummy/tmp/cache/assets/D95/830/sprockets%2Ffe3ca69e3c532ba34b060ad2ab88938c +0 -0
  136. data/spec/dummy/tmp/cache/assets/D97/B00/sprockets%2F6320e6270ecefff1d38a7e2ac651c45b +0 -0
  137. data/spec/dummy/tmp/cache/assets/D9E/100/sprockets%2Fa9bd0212de7fa8673e1b643ffb72e4a8 +0 -0
  138. data/spec/dummy/tmp/cache/assets/DA3/CB0/sprockets%2Feed56563f89ef40af5dc3446faa01a75 +0 -0
  139. data/spec/dummy/tmp/cache/assets/DAA/830/sprockets%2Fe3ec7fe8843d4533eb6dc2c3e6a848b4 +0 -0
  140. data/spec/dummy/tmp/cache/assets/DB1/170/sprockets%2F39ccab8b246a72889ae697c84df5a4ce +0 -0
  141. data/spec/dummy/tmp/cache/assets/DB1/BB0/sprockets%2Fb8d3905f9c3da9396b5d2ddf56908fac +0 -0
  142. data/{test/dummy/tmp/cache/assets/E8D/A20/sprockets%2F0d9efcac5ff6e3dc1d79ad04dd2e60fc → spec/dummy/tmp/cache/assets/DBA/6B0/sprockets%2F4acc06bba5e909e9aab90dab06b19503} +0 -0
  143. data/spec/dummy/tmp/cache/assets/DBF/0B0/sprockets%2F1aacf4a74e2d4d026ee99e320d5b03ec +0 -0
  144. data/spec/dummy/tmp/cache/assets/DC4/410/sprockets%2Fd83e593eb29628c1ce0cda1bb52bd3b6 +0 -0
  145. data/spec/dummy/tmp/cache/assets/DCF/600/sprockets%2F8da546237ce6e75da190e3b092eabeef +0 -0
  146. data/{test/dummy/tmp/cache/assets/D2A/340/sprockets%2F989f69c85eb048200d6e8f458eb14cd9 → spec/dummy/tmp/cache/assets/DD5/C40/sprockets%2F7c17ce947d82be9ccfd0af20ea78930c} +0 -0
  147. data/spec/dummy/tmp/cache/assets/DDC/320/sprockets%2F5da6cc4cce8f2187c3c329fdd752f69c +0 -0
  148. data/{test → spec}/dummy/tmp/cache/assets/DDE/420/sprockets%2Ffb8b186d5bf0307f86f65fc787d2adeb +0 -0
  149. data/spec/dummy/tmp/cache/assets/DEC/8B0/sprockets%2F5cccef02565cd21f12b277c63abbfe1c +0 -0
  150. data/spec/dummy/tmp/cache/assets/DF4/CB0/sprockets%2F50c79ab150d98daf2d8b0d03baffdb47 +0 -0
  151. data/spec/dummy/tmp/cache/assets/E02/970/sprockets%2Fa5d6fd3fd2a6d81fbccd14cc929f8145 +0 -0
  152. data/spec/dummy/tmp/cache/assets/E3B/4F0/sprockets%2Fe52b61cae0b3e9ecd57a884f7eefe85b +0 -0
  153. data/spec/dummy/tmp/cache/assets/E54/600/sprockets%2Fec46dd83126fcd2afef6ac23c2c6cc1e +0 -0
  154. data/spec/dummy/tmp/cache/assets/E77/760/sprockets%2F2f147bc1e7bd8ee79edeae7995b7fedc +0 -0
  155. data/spec/dummy/tmp/cache/sass/49e23cf4eab4ccca4c89a71b1b955b60e6f0c9a3/_button.scssc +0 -0
  156. data/spec/dummy/tmp/cache/sass/49e23cf4eab4ccca4c89a71b1b955b60e6f0c9a3/_clearfix.scssc +0 -0
  157. data/{test/dummy/tmp/cache/sass/d4fa0ff2408ef66f63a8a338cbe8bfd596851f99 → spec/dummy/tmp/cache/sass/49e23cf4eab4ccca4c89a71b1b955b60e6f0c9a3}/_font-family.scssc +0 -0
  158. data/spec/dummy/tmp/cache/sass/49e23cf4eab4ccca4c89a71b1b955b60e6f0c9a3/_hide-text.scssc +0 -0
  159. data/spec/dummy/tmp/cache/sass/49e23cf4eab4ccca4c89a71b1b955b60e6f0c9a3/_html5-input-types.scssc +0 -0
  160. data/spec/dummy/tmp/cache/sass/49e23cf4eab4ccca4c89a71b1b955b60e6f0c9a3/_position.scssc +0 -0
  161. data/spec/dummy/tmp/cache/sass/49e23cf4eab4ccca4c89a71b1b955b60e6f0c9a3/_prefixer.scssc +0 -0
  162. data/spec/dummy/tmp/cache/sass/49e23cf4eab4ccca4c89a71b1b955b60e6f0c9a3/_timing-functions.scssc +0 -0
  163. data/spec/dummy/tmp/cache/sass/709e3d65cae1ef23a4e00d6993aebe4c283645f9/_base.css.scssc +0 -0
  164. data/spec/dummy/tmp/cache/sass/709e3d65cae1ef23a4e00d6993aebe4c283645f9/_forms.css.scssc +0 -0
  165. data/spec/dummy/tmp/cache/sass/709e3d65cae1ef23a4e00d6993aebe4c283645f9/_header.css.scssc +0 -0
  166. data/spec/dummy/tmp/cache/sass/709e3d65cae1ef23a4e00d6993aebe4c283645f9/_mixins.css.scssc +0 -0
  167. data/spec/dummy/tmp/cache/sass/709e3d65cae1ef23a4e00d6993aebe4c283645f9/_typography.css.scssc +0 -0
  168. data/spec/dummy/tmp/cache/sass/81344752c8bed34a2e2b1a10124f3a9949022145/editor.css.scssc +0 -0
  169. data/spec/dummy/tmp/cache/sass/ab802d596deb2a86dbfabb589da36878d2b5904f/_dashboard.scssc +0 -0
  170. data/spec/dummy/tmp/cache/sass/ab802d596deb2a86dbfabb589da36878d2b5904f/_logged_out.scssc +0 -0
  171. data/spec/dummy/tmp/cache/sass/b71086e2961ae0986cb398b343b2daedba367837/_blank_slates.scssc +0 -0
  172. data/spec/dummy/tmp/cache/sass/b71086e2961ae0986cb398b343b2daedba367837/_breadcrumbs.scssc +0 -0
  173. data/spec/dummy/tmp/cache/sass/b71086e2961ae0986cb398b343b2daedba367837/_buttons.scssc +0 -0
  174. data/{test/dummy/tmp/cache/sass/fc6d9c30657c60e19616d65bb39967cfb21769bb → spec/dummy/tmp/cache/sass/b71086e2961ae0986cb398b343b2daedba367837}/_columns.scssc +0 -0
  175. data/spec/dummy/tmp/cache/sass/b71086e2961ae0986cb398b343b2daedba367837/_comments.css.scssc +0 -0
  176. data/spec/dummy/tmp/cache/sass/b71086e2961ae0986cb398b343b2daedba367837/_date_picker.css.scssc +0 -0
  177. data/spec/dummy/tmp/cache/sass/b71086e2961ae0986cb398b343b2daedba367837/_flash_messages.css.scssc +0 -0
  178. data/spec/dummy/tmp/cache/sass/b71086e2961ae0986cb398b343b2daedba367837/_grid.scssc +0 -0
  179. data/spec/dummy/tmp/cache/sass/b71086e2961ae0986cb398b343b2daedba367837/_links.scssc +0 -0
  180. data/spec/dummy/tmp/cache/sass/b71086e2961ae0986cb398b343b2daedba367837/_pagination.scssc +0 -0
  181. data/spec/dummy/tmp/cache/sass/b71086e2961ae0986cb398b343b2daedba367837/_panels.scssc +0 -0
  182. data/spec/dummy/tmp/cache/sass/b71086e2961ae0986cb398b343b2daedba367837/_scopes.scssc +0 -0
  183. data/spec/dummy/tmp/cache/sass/b71086e2961ae0986cb398b343b2daedba367837/_status_tags.scssc +0 -0
  184. data/spec/dummy/tmp/cache/sass/b71086e2961ae0986cb398b343b2daedba367837/_table_tools.css.scssc +0 -0
  185. data/spec/dummy/tmp/cache/sass/b71086e2961ae0986cb398b343b2daedba367837/_tables.css.scssc +0 -0
  186. data/spec/dummy/tmp/cache/sass/bbd465490a040c2572db5eef14e0f3c13a72a69a/_animation.scssc +0 -0
  187. data/spec/dummy/tmp/cache/sass/bbd465490a040c2572db5eef14e0f3c13a72a69a/_appearance.scssc +0 -0
  188. data/spec/dummy/tmp/cache/sass/bbd465490a040c2572db5eef14e0f3c13a72a69a/_background-image.scssc +0 -0
  189. data/spec/dummy/tmp/cache/sass/bbd465490a040c2572db5eef14e0f3c13a72a69a/_background-size.scssc +0 -0
  190. data/spec/dummy/tmp/cache/sass/bbd465490a040c2572db5eef14e0f3c13a72a69a/_background.scssc +0 -0
  191. data/{test/dummy/tmp/cache/sass/673f56dad1dad173d9d03084181896c36c0dbf78 → spec/dummy/tmp/cache/sass/bbd465490a040c2572db5eef14e0f3c13a72a69a}/_border-image.scssc +0 -0
  192. data/spec/dummy/tmp/cache/sass/bbd465490a040c2572db5eef14e0f3c13a72a69a/_border-radius.scssc +0 -0
  193. data/spec/dummy/tmp/cache/sass/bbd465490a040c2572db5eef14e0f3c13a72a69a/_box-shadow.scssc +0 -0
  194. data/spec/dummy/tmp/cache/sass/bbd465490a040c2572db5eef14e0f3c13a72a69a/_box-sizing.scssc +0 -0
  195. data/spec/dummy/tmp/cache/sass/bbd465490a040c2572db5eef14e0f3c13a72a69a/_columns.scssc +0 -0
  196. data/spec/dummy/tmp/cache/sass/bbd465490a040c2572db5eef14e0f3c13a72a69a/_flex-box.scssc +0 -0
  197. data/spec/dummy/tmp/cache/sass/bbd465490a040c2572db5eef14e0f3c13a72a69a/_font-face.scssc +0 -0
  198. data/spec/dummy/tmp/cache/sass/bbd465490a040c2572db5eef14e0f3c13a72a69a/_hidpi-media-query.scssc +0 -0
  199. data/spec/dummy/tmp/cache/sass/bbd465490a040c2572db5eef14e0f3c13a72a69a/_image-rendering.scssc +0 -0
  200. data/spec/dummy/tmp/cache/sass/bbd465490a040c2572db5eef14e0f3c13a72a69a/_inline-block.scssc +0 -0
  201. data/spec/dummy/tmp/cache/sass/bbd465490a040c2572db5eef14e0f3c13a72a69a/_linear-gradient.scssc +0 -0
  202. data/spec/dummy/tmp/cache/sass/bbd465490a040c2572db5eef14e0f3c13a72a69a/_perspective.scssc +0 -0
  203. data/spec/dummy/tmp/cache/sass/bbd465490a040c2572db5eef14e0f3c13a72a69a/_radial-gradient.scssc +0 -0
  204. data/spec/dummy/tmp/cache/sass/bbd465490a040c2572db5eef14e0f3c13a72a69a/_transform.scssc +0 -0
  205. data/spec/dummy/tmp/cache/sass/bbd465490a040c2572db5eef14e0f3c13a72a69a/_transition.scssc +0 -0
  206. data/spec/dummy/tmp/cache/sass/bbd465490a040c2572db5eef14e0f3c13a72a69a/_user-select.scssc +0 -0
  207. data/spec/dummy/tmp/cache/sass/c4b0263b663ecd8b52decc9efd85c43eaa5c2434/_compact.scssc +0 -0
  208. data/spec/dummy/tmp/cache/sass/c4b0263b663ecd8b52decc9efd85c43eaa5c2434/_deprecated-webkit-gradient.scssc +0 -0
  209. data/{test/dummy/tmp/cache/sass/8a21f4ddb4e355cd1d27402133b3c3b4d52fef99 → spec/dummy/tmp/cache/sass/c4b0263b663ecd8b52decc9efd85c43eaa5c2434}/_flex-grid.scssc +0 -0
  210. data/{test/dummy/tmp/cache/sass/8a21f4ddb4e355cd1d27402133b3c3b4d52fef99 → spec/dummy/tmp/cache/sass/c4b0263b663ecd8b52decc9efd85c43eaa5c2434}/_grid-width.scssc +0 -0
  211. data/spec/dummy/tmp/cache/sass/c4b0263b663ecd8b52decc9efd85c43eaa5c2434/_linear-gradient.scssc +0 -0
  212. data/{test/dummy/tmp/cache/sass/8a21f4ddb4e355cd1d27402133b3c3b4d52fef99 → spec/dummy/tmp/cache/sass/c4b0263b663ecd8b52decc9efd85c43eaa5c2434}/_modular-scale.scssc +0 -0
  213. data/spec/dummy/tmp/cache/sass/c4b0263b663ecd8b52decc9efd85c43eaa5c2434/_radial-gradient.scssc +0 -0
  214. data/{test/dummy/tmp/cache/sass/8a21f4ddb4e355cd1d27402133b3c3b4d52fef99 → spec/dummy/tmp/cache/sass/c4b0263b663ecd8b52decc9efd85c43eaa5c2434}/_render-gradients.scssc +0 -0
  215. data/spec/dummy/tmp/cache/sass/c4b0263b663ecd8b52decc9efd85c43eaa5c2434/_tint-shade.scssc +0 -0
  216. data/spec/dummy/tmp/cache/sass/c4b0263b663ecd8b52decc9efd85c43eaa5c2434/_transition-property-name.scssc +0 -0
  217. data/spec/dummy/tmp/cache/sass/c841b2fc6dd2fd657ddbe3309936a6f84dd72935/active_admin.css.scssc +0 -0
  218. data/spec/dummy/tmp/cache/sass/d51f47c50caa8cd1f62b5744c3cc3d84c660be11/_footer.scssc +0 -0
  219. data/spec/dummy/tmp/cache/sass/d51f47c50caa8cd1f62b5744c3cc3d84c660be11/_main_structure.scssc +0 -0
  220. data/spec/dummy/tmp/cache/sass/d51f47c50caa8cd1f62b5744c3cc3d84c660be11/_title_bar.scssc +0 -0
  221. data/spec/dummy/tmp/cache/sass/e4457c75f1deecfb1d8551dd1f7b6c94e974342d/_bourbon-deprecated-upcoming.scssc +0 -0
  222. data/spec/dummy/tmp/cache/sass/e4457c75f1deecfb1d8551dd1f7b6c94e974342d/_bourbon.scssc +0 -0
  223. data/{test/dummy/tmp/cache/sass/fae26a125b983ba9d6ccccd7a9247d9c55158fb8 → spec/dummy/tmp/cache/sass/f3dc328b9588c36647c8e87cc67c412cafc8c223}/_all.css.scssc +0 -0
  224. data/spec/dummy/tmp/cache/sass/f3dc328b9588c36647c8e87cc67c412cafc8c223/_buttons.css.scssc +0 -0
  225. data/spec/dummy/tmp/cache/sass/f3dc328b9588c36647c8e87cc67c412cafc8c223/_gradients.css.scssc +0 -0
  226. data/spec/dummy/tmp/cache/sass/f3dc328b9588c36647c8e87cc67c412cafc8c223/_icons.css.scssc +0 -0
  227. data/spec/dummy/tmp/cache/sass/f3dc328b9588c36647c8e87cc67c412cafc8c223/_reset.css.scssc +0 -0
  228. data/spec/dummy/tmp/cache/sass/f3dc328b9588c36647c8e87cc67c412cafc8c223/_rounded.css.scssc +0 -0
  229. data/spec/dummy/tmp/cache/sass/f3dc328b9588c36647c8e87cc67c412cafc8c223/_sections.css.scssc +0 -0
  230. data/{test/dummy/tmp/cache/sass/fae26a125b983ba9d6ccccd7a9247d9c55158fb8 → spec/dummy/tmp/cache/sass/f3dc328b9588c36647c8e87cc67c412cafc8c223}/_shadows.css.scssc +0 -0
  231. data/spec/dummy/tmp/cache/sass/f3dc328b9588c36647c8e87cc67c412cafc8c223/_typography.scssc +0 -0
  232. data/spec/dummy/tmp/cache/sass/f3dc328b9588c36647c8e87cc67c412cafc8c223/_utilities.scssc +0 -0
  233. data/{test/dummy/tmp/cache/sass/fae26a125b983ba9d6ccccd7a9247d9c55158fb8 → spec/dummy/tmp/cache/sass/f3dc328b9588c36647c8e87cc67c412cafc8c223}/_variables.css.scssc +0 -0
  234. data/spec/factories.rb +11 -0
  235. data/spec/javascripts/editor_spec.js +149 -0
  236. data/spec/javascripts/spec_helper.js +5 -0
  237. data/spec/javascripts/support/mock_wysihtml5.js +3 -0
  238. data/spec/javascripts/templates/editor.jst.ejs +7 -0
  239. data/spec/requests/pages_request_spec.rb +12 -0
  240. data/spec/spec_helper.rb +46 -0
  241. data/spec/support/sign_in_helpers.rb +12 -0
  242. data/{test/dummy/tmp/cache/assets/E09/9D0/sprockets%2F6ebd49e8fab7b27e05b33fd5d08ff3e6 → vendor/assets/javascripts/wysihtml5.js} +0 -0
  243. metadata +614 -636
  244. data/app/assets/images/active_admin/editor/icons.png +0 -0
  245. data/app/assets/javascripts/active_admin/editor/core.js.coffee +0 -114
  246. data/app/assets/javascripts/active_admin/editor/quicksave.js +0 -36
  247. data/app/models/asset.rb +0 -3
  248. data/app/models/image_asset.rb +0 -5
  249. data/app/uploaders/image_asset_uploader.rb +0 -62
  250. data/db/migrate/20120510000541_create_assets.rb +0 -10
  251. data/db/migrate/20120511003637_add_dimensions_to_asset.rb +0 -5
  252. data/lib/active_admin/editor/admin/assets.rb +0 -73
  253. data/lib/generators/active_admin/editor/templates/wysiwyg.css +0 -130
  254. data/test/active_admin_editor_test.rb +0 -7
  255. data/test/dummy/app/assets/javascripts/active_admin.js +0 -2
  256. data/test/dummy/app/assets/javascripts/pages.js +0 -2
  257. data/test/dummy/app/assets/stylesheets/pages.css.scss +0 -3
  258. data/test/dummy/app/assets/stylesheets/scaffolds.css.scss +0 -56
  259. data/test/dummy/app/controllers/pages_controller.rb +0 -2
  260. data/test/dummy/app/helpers/pages_helper.rb +0 -2
  261. data/test/dummy/app/views/pages/_form.html.erb +0 -25
  262. data/test/dummy/app/views/pages/edit.html.erb +0 -6
  263. data/test/dummy/app/views/pages/index.html.erb +0 -25
  264. data/test/dummy/app/views/pages/new.html.erb +0 -5
  265. data/test/dummy/app/views/pages/show.html.erb +0 -15
  266. data/test/dummy/config/routes.rb +0 -64
  267. data/test/dummy/db/migrate/20120510000716_create_assets.active_admin_editor.rb +0 -11
  268. data/test/dummy/db/migrate/20120511003700_add_dimensions_to_asset.active_admin_editor.rb +0 -6
  269. data/test/dummy/log/development.log +0 -31941
  270. data/test/dummy/log/test.log +0 -2
  271. data/test/dummy/public/assets/wysiwyg.css +0 -130
  272. data/test/dummy/public/uploads/image_asset/storage/54/download.jpeg +0 -0
  273. data/test/dummy/public/uploads/image_asset/storage/54/half_download.jpeg +0 -0
  274. data/test/dummy/public/uploads/image_asset/storage/54/one_quarter_download.jpeg +0 -0
  275. data/test/dummy/public/uploads/image_asset/storage/54/three_quarters_download.jpeg +0 -0
  276. data/test/dummy/public/uploads/image_asset/storage/54/thumb_download.jpeg +0 -0
  277. data/test/dummy/public/uploads/image_asset/storage/55/Howard_Carter-2012-hp.jpg +0 -0
  278. data/test/dummy/public/uploads/image_asset/storage/55/half_Howard_Carter-2012-hp.jpg +0 -0
  279. data/test/dummy/public/uploads/image_asset/storage/55/one_quarter_Howard_Carter-2012-hp.jpg +0 -0
  280. data/test/dummy/public/uploads/image_asset/storage/55/three_quarters_Howard_Carter-2012-hp.jpg +0 -0
  281. data/test/dummy/public/uploads/image_asset/storage/55/thumb_Howard_Carter-2012-hp.jpg +0 -0
  282. data/test/dummy/public/uploads/image_asset/storage/56/57056_435442738470_535763470_5037008_1205729_o.jpg +0 -0
  283. data/test/dummy/public/uploads/image_asset/storage/56/half_57056_435442738470_535763470_5037008_1205729_o.jpg +0 -0
  284. data/test/dummy/public/uploads/image_asset/storage/56/one_quarter_57056_435442738470_535763470_5037008_1205729_o.jpg +0 -0
  285. data/test/dummy/public/uploads/image_asset/storage/56/three_quarters_57056_435442738470_535763470_5037008_1205729_o.jpg +0 -0
  286. data/test/dummy/public/uploads/image_asset/storage/56/thumb_57056_435442738470_535763470_5037008_1205729_o.jpg +0 -0
  287. data/test/dummy/public/uploads/image_asset/storage/57/half_sonic.gif +0 -0
  288. data/test/dummy/public/uploads/image_asset/storage/57/one_quarter_sonic.gif +0 -0
  289. data/test/dummy/public/uploads/image_asset/storage/57/sonic.gif +0 -0
  290. data/test/dummy/public/uploads/image_asset/storage/57/three_quarters_sonic.gif +0 -0
  291. data/test/dummy/public/uploads/image_asset/storage/57/thumb_sonic.gif +0 -0
  292. data/test/dummy/public/uploads/image_asset/storage/58/download.jpeg +0 -0
  293. data/test/dummy/public/uploads/image_asset/storage/58/half_download.jpeg +0 -0
  294. data/test/dummy/public/uploads/image_asset/storage/58/one_quarter_download.jpeg +0 -0
  295. data/test/dummy/public/uploads/image_asset/storage/58/three_quarters_download.jpeg +0 -0
  296. data/test/dummy/public/uploads/image_asset/storage/58/thumb_download.jpeg +0 -0
  297. data/test/dummy/public/uploads/image_asset/storage/59/half_sonic.gif +0 -0
  298. data/test/dummy/public/uploads/image_asset/storage/59/one_quarter_sonic.gif +0 -0
  299. data/test/dummy/public/uploads/image_asset/storage/59/sonic.gif +0 -0
  300. data/test/dummy/public/uploads/image_asset/storage/59/three_quarters_sonic.gif +0 -0
  301. data/test/dummy/public/uploads/image_asset/storage/59/thumb_sonic.gif +0 -0
  302. data/test/dummy/public/uploads/image_asset/storage/60/download.jpeg +0 -0
  303. data/test/dummy/public/uploads/image_asset/storage/60/half_download.jpeg +0 -0
  304. data/test/dummy/public/uploads/image_asset/storage/60/one_quarter_download.jpeg +0 -0
  305. data/test/dummy/public/uploads/image_asset/storage/60/three_quarters_download.jpeg +0 -0
  306. data/test/dummy/public/uploads/image_asset/storage/60/thumb_download.jpeg +0 -0
  307. data/test/dummy/public/uploads/image_asset/storage/61/half_sonic.gif +0 -0
  308. data/test/dummy/public/uploads/image_asset/storage/61/one_quarter_sonic.gif +0 -0
  309. data/test/dummy/public/uploads/image_asset/storage/61/sonic.gif +0 -0
  310. data/test/dummy/public/uploads/image_asset/storage/61/three_quarters_sonic.gif +0 -0
  311. data/test/dummy/public/uploads/image_asset/storage/61/thumb_sonic.gif +0 -0
  312. data/test/dummy/public/uploads/image_asset/storage/62/Howard_Carter-2012-hp.jpg +0 -0
  313. data/test/dummy/public/uploads/image_asset/storage/62/half_Howard_Carter-2012-hp.jpg +0 -0
  314. data/test/dummy/public/uploads/image_asset/storage/62/one_quarter_Howard_Carter-2012-hp.jpg +0 -0
  315. data/test/dummy/public/uploads/image_asset/storage/62/three_quarters_Howard_Carter-2012-hp.jpg +0 -0
  316. data/test/dummy/public/uploads/image_asset/storage/62/thumb_Howard_Carter-2012-hp.jpg +0 -0
  317. data/test/dummy/public/uploads/image_asset/storage/63/Howard_Carter-2012-hp.jpg +0 -0
  318. data/test/dummy/public/uploads/image_asset/storage/63/half_Howard_Carter-2012-hp.jpg +0 -0
  319. data/test/dummy/public/uploads/image_asset/storage/63/one_quarter_Howard_Carter-2012-hp.jpg +0 -0
  320. data/test/dummy/public/uploads/image_asset/storage/63/three_quarters_Howard_Carter-2012-hp.jpg +0 -0
  321. data/test/dummy/public/uploads/image_asset/storage/63/thumb_Howard_Carter-2012-hp.jpg +0 -0
  322. data/test/dummy/public/uploads/image_asset/storage/64/download.jpeg +0 -0
  323. data/test/dummy/public/uploads/image_asset/storage/64/half_download.jpeg +0 -0
  324. data/test/dummy/public/uploads/image_asset/storage/64/one_quarter_download.jpeg +0 -0
  325. data/test/dummy/public/uploads/image_asset/storage/64/three_quarters_download.jpeg +0 -0
  326. data/test/dummy/public/uploads/image_asset/storage/64/thumb_download.jpeg +0 -0
  327. data/test/dummy/public/uploads/image_asset/storage/65/Howard_Carter-2012-hp.jpg +0 -0
  328. data/test/dummy/public/uploads/image_asset/storage/65/half_Howard_Carter-2012-hp.jpg +0 -0
  329. data/test/dummy/public/uploads/image_asset/storage/65/one_quarter_Howard_Carter-2012-hp.jpg +0 -0
  330. data/test/dummy/public/uploads/image_asset/storage/65/three_quarters_Howard_Carter-2012-hp.jpg +0 -0
  331. data/test/dummy/public/uploads/image_asset/storage/65/thumb_Howard_Carter-2012-hp.jpg +0 -0
  332. data/test/dummy/public/uploads/image_asset/storage/66/57056_435442738470_535763470_5037008_1205729_o.jpg +0 -0
  333. data/test/dummy/public/uploads/image_asset/storage/66/half_57056_435442738470_535763470_5037008_1205729_o.jpg +0 -0
  334. data/test/dummy/public/uploads/image_asset/storage/66/one_quarter_57056_435442738470_535763470_5037008_1205729_o.jpg +0 -0
  335. data/test/dummy/public/uploads/image_asset/storage/66/three_quarters_57056_435442738470_535763470_5037008_1205729_o.jpg +0 -0
  336. data/test/dummy/public/uploads/image_asset/storage/66/thumb_57056_435442738470_535763470_5037008_1205729_o.jpg +0 -0
  337. data/test/dummy/public/uploads/image_asset/storage/67/download.jpeg +0 -0
  338. data/test/dummy/public/uploads/image_asset/storage/67/half_download.jpeg +0 -0
  339. data/test/dummy/public/uploads/image_asset/storage/67/one_quarter_download.jpeg +0 -0
  340. data/test/dummy/public/uploads/image_asset/storage/67/three_quarters_download.jpeg +0 -0
  341. data/test/dummy/public/uploads/image_asset/storage/67/thumb_download.jpeg +0 -0
  342. data/test/dummy/public/uploads/image_asset/storage/68/half_sonic.gif +0 -0
  343. data/test/dummy/public/uploads/image_asset/storage/68/one_quarter_sonic.gif +0 -0
  344. data/test/dummy/public/uploads/image_asset/storage/68/sonic.gif +0 -0
  345. data/test/dummy/public/uploads/image_asset/storage/68/three_quarters_sonic.gif +0 -0
  346. data/test/dummy/public/uploads/image_asset/storage/68/thumb_sonic.gif +0 -0
  347. data/test/dummy/public/uploads/image_asset/storage/69/download.jpeg +0 -0
  348. data/test/dummy/public/uploads/image_asset/storage/69/half_download.jpeg +0 -0
  349. data/test/dummy/public/uploads/image_asset/storage/69/one_quarter_download.jpeg +0 -0
  350. data/test/dummy/public/uploads/image_asset/storage/69/three_quarters_download.jpeg +0 -0
  351. data/test/dummy/public/uploads/image_asset/storage/69/thumb_download.jpeg +0 -0
  352. data/test/dummy/public/uploads/image_asset/storage/70/half_sonic.gif +0 -0
  353. data/test/dummy/public/uploads/image_asset/storage/70/one_quarter_sonic.gif +0 -0
  354. data/test/dummy/public/uploads/image_asset/storage/70/sonic.gif +0 -0
  355. data/test/dummy/public/uploads/image_asset/storage/70/three_quarters_sonic.gif +0 -0
  356. data/test/dummy/public/uploads/image_asset/storage/70/thumb_sonic.gif +0 -0
  357. data/test/dummy/public/uploads/image_asset/storage/71/57056_435442738470_535763470_5037008_1205729_o.jpg +0 -0
  358. data/test/dummy/public/uploads/image_asset/storage/71/half_57056_435442738470_535763470_5037008_1205729_o.jpg +0 -0
  359. data/test/dummy/public/uploads/image_asset/storage/71/one_quarter_57056_435442738470_535763470_5037008_1205729_o.jpg +0 -0
  360. data/test/dummy/public/uploads/image_asset/storage/71/three_quarters_57056_435442738470_535763470_5037008_1205729_o.jpg +0 -0
  361. data/test/dummy/public/uploads/image_asset/storage/71/thumb_57056_435442738470_535763470_5037008_1205729_o.jpg +0 -0
  362. data/test/dummy/public/uploads/image_asset/storage/72/download.jpeg +0 -0
  363. data/test/dummy/public/uploads/image_asset/storage/72/half_download.jpeg +0 -0
  364. data/test/dummy/public/uploads/image_asset/storage/72/one_quarter_download.jpeg +0 -0
  365. data/test/dummy/public/uploads/image_asset/storage/72/three_quarters_download.jpeg +0 -0
  366. data/test/dummy/public/uploads/image_asset/storage/72/thumb_download.jpeg +0 -0
  367. data/test/dummy/public/uploads/image_asset/storage/73/half_sonic.gif +0 -0
  368. data/test/dummy/public/uploads/image_asset/storage/73/one_quarter_sonic.gif +0 -0
  369. data/test/dummy/public/uploads/image_asset/storage/73/sonic.gif +0 -0
  370. data/test/dummy/public/uploads/image_asset/storage/73/three_quarters_sonic.gif +0 -0
  371. data/test/dummy/public/uploads/image_asset/storage/73/thumb_sonic.gif +0 -0
  372. data/test/dummy/public/uploads/image_asset/storage/74/download.jpeg +0 -0
  373. data/test/dummy/public/uploads/image_asset/storage/74/half_download.jpeg +0 -0
  374. data/test/dummy/public/uploads/image_asset/storage/74/one_quarter_download.jpeg +0 -0
  375. data/test/dummy/public/uploads/image_asset/storage/74/three_quarters_download.jpeg +0 -0
  376. data/test/dummy/public/uploads/image_asset/storage/74/thumb_download.jpeg +0 -0
  377. data/test/dummy/public/uploads/image_asset/storage/75/half_sonic.gif +0 -0
  378. data/test/dummy/public/uploads/image_asset/storage/75/one_quarter_sonic.gif +0 -0
  379. data/test/dummy/public/uploads/image_asset/storage/75/sonic.gif +0 -0
  380. data/test/dummy/public/uploads/image_asset/storage/75/three_quarters_sonic.gif +0 -0
  381. data/test/dummy/public/uploads/image_asset/storage/75/thumb_sonic.gif +0 -0
  382. data/test/dummy/public/uploads/image_asset/storage/76/download.jpeg +0 -0
  383. data/test/dummy/public/uploads/image_asset/storage/76/half_download.jpeg +0 -0
  384. data/test/dummy/public/uploads/image_asset/storage/76/one_quarter_download.jpeg +0 -0
  385. data/test/dummy/public/uploads/image_asset/storage/76/three_quarters_download.jpeg +0 -0
  386. data/test/dummy/public/uploads/image_asset/storage/76/thumb_download.jpeg +0 -0
  387. data/test/dummy/public/uploads/image_asset/storage/77/download.jpeg +0 -0
  388. data/test/dummy/public/uploads/image_asset/storage/77/half_download.jpeg +0 -0
  389. data/test/dummy/public/uploads/image_asset/storage/77/one_quarter_download.jpeg +0 -0
  390. data/test/dummy/public/uploads/image_asset/storage/77/three_quarters_download.jpeg +0 -0
  391. data/test/dummy/public/uploads/image_asset/storage/77/thumb_download.jpeg +0 -0
  392. data/test/dummy/spec/spec_helper.rb +0 -32
  393. data/test/dummy/tmp/cache/assets/C72/380/sprockets%2F085743324cb9a032a0440c87176ef50e +0 -0
  394. data/test/dummy/tmp/cache/assets/CA9/330/sprockets%2F0046f25f9e307b161d310611dd9858dd +0 -0
  395. data/test/dummy/tmp/cache/assets/CB2/5A0/sprockets%2F4e7c202a6f2335881a86d6fc17329d08 +0 -0
  396. data/test/dummy/tmp/cache/assets/CB7/160/sprockets%2F9b2ab958728324ca63e77600c53e934e +0 -0
  397. data/test/dummy/tmp/cache/assets/CC6/480/sprockets%2Ff8e54e577438cf26bf468009786a903a +0 -0
  398. data/test/dummy/tmp/cache/assets/CCB/F60/sprockets%2F37e7f721672108ddf565be87f469459b +0 -0
  399. data/test/dummy/tmp/cache/assets/CD4/1E0/sprockets%2F46501789497b9c56ccf438f9888b0ee5 +0 -0
  400. data/test/dummy/tmp/cache/assets/CDB/040/sprockets%2Fc732474e67003a4eb840eb44c5ca9385 +0 -0
  401. data/test/dummy/tmp/cache/assets/CDC/C10/sprockets%2F0b87133dfa360f2799bc4e4a1f605770 +0 -0
  402. data/test/dummy/tmp/cache/assets/CDE/3A0/sprockets%2F0bca93682984766a76d0be1ac5224d63 +0 -0
  403. data/test/dummy/tmp/cache/assets/CDF/3D0/sprockets%2Ff3b4991c7e984391cbed33d0e7307110 +0 -0
  404. data/test/dummy/tmp/cache/assets/CE7/D20/sprockets%2F0cf7e72de6c0096314484bc8741983be +0 -0
  405. data/test/dummy/tmp/cache/assets/CFD/D30/sprockets%2Ff597343ff4246e6b1342a2040eb1aed0 +0 -0
  406. data/test/dummy/tmp/cache/assets/D00/490/sprockets%2F60ff8fc770f770b47a563e8cd4696994 +0 -0
  407. data/test/dummy/tmp/cache/assets/D12/D90/sprockets%2F730166fec55450e25f338d94f25fbdb2 +0 -0
  408. data/test/dummy/tmp/cache/assets/D14/4C0/sprockets%2F3c885645faaced56cd6241ff72731452 +0 -0
  409. data/test/dummy/tmp/cache/assets/D17/140/sprockets%2F84b539318e251143175dc9dddd94ef5a +0 -0
  410. data/test/dummy/tmp/cache/assets/D1A/B10/sprockets%2F5b1418eaf731d31cbde4896984a974b5 +0 -0
  411. data/test/dummy/tmp/cache/assets/D1D/A50/sprockets%2Ff93342e6a970ec28f95fee502f8621f0 +0 -0
  412. data/test/dummy/tmp/cache/assets/D1F/BF0/sprockets%2F1201bb2d37e022d6c51a70b79d2bad62 +0 -0
  413. data/test/dummy/tmp/cache/assets/D38/540/sprockets%2F86e1ad844bc9df4491a2a52b870421db +0 -0
  414. data/test/dummy/tmp/cache/assets/D3B/280/sprockets%2Ff11f6091cf86dad1b6049f0f4a3064d9 +0 -0
  415. data/test/dummy/tmp/cache/assets/D41/2F0/sprockets%2Fe5d704d8dc364cb7e3e822bb4e253916 +0 -0
  416. data/test/dummy/tmp/cache/assets/D41/420/sprockets%2F1990ec015968043c3be576cbaf73aee6 +0 -0
  417. data/test/dummy/tmp/cache/assets/D41/920/sprockets%2F174ee4ee4110194ef4862fd0970b6aef +0 -0
  418. data/test/dummy/tmp/cache/assets/D43/250/sprockets%2Fa8a2dca5967a78460fb409a874f502fb +0 -0
  419. data/test/dummy/tmp/cache/assets/D48/080/sprockets%2Fc0d6a8b862860337a9be9a967eb2e7b1 +0 -0
  420. data/test/dummy/tmp/cache/assets/D48/640/sprockets%2F9f4f18d910b678b1d0777e04cdaf6f24 +0 -0
  421. data/test/dummy/tmp/cache/assets/D4A/4D0/sprockets%2F3556ebc283be58663c77ce3d6bfa0468 +0 -0
  422. data/test/dummy/tmp/cache/assets/D4E/EB0/sprockets%2F486aeddb095486c9fab90c44c193557f +0 -0
  423. data/test/dummy/tmp/cache/assets/D59/9F0/sprockets%2Fe178b2fe035eee0a035dec1307f5310c +0 -0
  424. data/test/dummy/tmp/cache/assets/D76/730/sprockets%2Fd1699d0cbcfe965c5c51a95e31580df2 +0 -0
  425. data/test/dummy/tmp/cache/assets/D7B/3E0/sprockets%2F8e7aef5bf1a26944e3344c59ce8b4a39 +0 -0
  426. data/test/dummy/tmp/cache/assets/D7F/4F0/sprockets%2F873b7bf710fdfa6d498d5d436c2a85f5 +0 -0
  427. data/test/dummy/tmp/cache/assets/D83/9A0/sprockets%2Fa60938962a537af3eabd578c6eff2f69 +0 -0
  428. data/test/dummy/tmp/cache/assets/D9F/8A0/sprockets%2Fc5848f3fb004cba9c50403ec7eeaf794 +0 -0
  429. data/test/dummy/tmp/cache/assets/DB5/060/sprockets%2Fce73aea0ce2d0cd644b010d36398aa5b +0 -0
  430. data/test/dummy/tmp/cache/assets/DBF/0B0/sprockets%2F1aacf4a74e2d4d026ee99e320d5b03ec +0 -0
  431. data/test/dummy/tmp/cache/assets/DC9/930/sprockets%2Fe4a488d2edd179e61b5120a31fbfdc7d +0 -0
  432. data/test/dummy/tmp/cache/assets/E2E/A70/sprockets%2F74bbb7a81546bbbd8dd7cdf128fba84c +0 -0
  433. data/test/dummy/tmp/cache/sass/2c5767f8b54c235968e95862ab983eb40c635a92/active_admin.css.scssc +0 -0
  434. data/test/dummy/tmp/cache/sass/52b571e0119322d02c8cc7bb4b050bea8f5bcd4d/wysiwyg.cssc +0 -0
  435. data/test/dummy/tmp/cache/sass/673f56dad1dad173d9d03084181896c36c0dbf78/_animation.scssc +0 -0
  436. data/test/dummy/tmp/cache/sass/673f56dad1dad173d9d03084181896c36c0dbf78/_appearance.scssc +0 -0
  437. data/test/dummy/tmp/cache/sass/673f56dad1dad173d9d03084181896c36c0dbf78/_background-image.scssc +0 -0
  438. data/test/dummy/tmp/cache/sass/673f56dad1dad173d9d03084181896c36c0dbf78/_background-size.scssc +0 -0
  439. data/test/dummy/tmp/cache/sass/673f56dad1dad173d9d03084181896c36c0dbf78/_border-radius.scssc +0 -0
  440. data/test/dummy/tmp/cache/sass/673f56dad1dad173d9d03084181896c36c0dbf78/_box-shadow.scssc +0 -0
  441. data/test/dummy/tmp/cache/sass/673f56dad1dad173d9d03084181896c36c0dbf78/_box-sizing.scssc +0 -0
  442. data/test/dummy/tmp/cache/sass/673f56dad1dad173d9d03084181896c36c0dbf78/_columns.scssc +0 -0
  443. data/test/dummy/tmp/cache/sass/673f56dad1dad173d9d03084181896c36c0dbf78/_flex-box.scssc +0 -0
  444. data/test/dummy/tmp/cache/sass/673f56dad1dad173d9d03084181896c36c0dbf78/_inline-block.scssc +0 -0
  445. data/test/dummy/tmp/cache/sass/673f56dad1dad173d9d03084181896c36c0dbf78/_linear-gradient.scssc +0 -0
  446. data/test/dummy/tmp/cache/sass/673f56dad1dad173d9d03084181896c36c0dbf78/_radial-gradient.scssc +0 -0
  447. data/test/dummy/tmp/cache/sass/673f56dad1dad173d9d03084181896c36c0dbf78/_transform.scssc +0 -0
  448. data/test/dummy/tmp/cache/sass/673f56dad1dad173d9d03084181896c36c0dbf78/_transition.scssc +0 -0
  449. data/test/dummy/tmp/cache/sass/673f56dad1dad173d9d03084181896c36c0dbf78/_user-select.scssc +0 -0
  450. data/test/dummy/tmp/cache/sass/81344752c8bed34a2e2b1a10124f3a9949022145/editor.css.scssc +0 -0
  451. data/test/dummy/tmp/cache/sass/8a21f4ddb4e355cd1d27402133b3c3b4d52fef99/_deprecated-webkit-gradient.scssc +0 -0
  452. data/test/dummy/tmp/cache/sass/8a21f4ddb4e355cd1d27402133b3c3b4d52fef99/_linear-gradient.scssc +0 -0
  453. data/test/dummy/tmp/cache/sass/8a21f4ddb4e355cd1d27402133b3c3b4d52fef99/_radial-gradient.scssc +0 -0
  454. data/test/dummy/tmp/cache/sass/8a21f4ddb4e355cd1d27402133b3c3b4d52fef99/_tint-shade.scssc +0 -0
  455. data/test/dummy/tmp/cache/sass/9fbb259b21224a40d373efb03472116bfe5b3080/_base.css.scssc +0 -0
  456. data/test/dummy/tmp/cache/sass/9fbb259b21224a40d373efb03472116bfe5b3080/_forms.css.scssc +0 -0
  457. data/test/dummy/tmp/cache/sass/9fbb259b21224a40d373efb03472116bfe5b3080/_header.css.scssc +0 -0
  458. data/test/dummy/tmp/cache/sass/9fbb259b21224a40d373efb03472116bfe5b3080/_mixins.css.scssc +0 -0
  459. data/test/dummy/tmp/cache/sass/9fbb259b21224a40d373efb03472116bfe5b3080/_typography.css.scssc +0 -0
  460. data/test/dummy/tmp/cache/sass/b58525431f2249a229cce8231a7c54e172a70fca/_bourbon.scssc +0 -0
  461. data/test/dummy/tmp/cache/sass/cf06b6cc81899a787b5cd92ca81915d948392791/_dashboard.scssc +0 -0
  462. data/test/dummy/tmp/cache/sass/cf06b6cc81899a787b5cd92ca81915d948392791/_logged_out.scssc +0 -0
  463. data/test/dummy/tmp/cache/sass/d4fa0ff2408ef66f63a8a338cbe8bfd596851f99/_button.scssc +0 -0
  464. data/test/dummy/tmp/cache/sass/d4fa0ff2408ef66f63a8a338cbe8bfd596851f99/_clearfix.scssc +0 -0
  465. data/test/dummy/tmp/cache/sass/d4fa0ff2408ef66f63a8a338cbe8bfd596851f99/_html5-input-types.scssc +0 -0
  466. data/test/dummy/tmp/cache/sass/d4fa0ff2408ef66f63a8a338cbe8bfd596851f99/_position.scssc +0 -0
  467. data/test/dummy/tmp/cache/sass/d4fa0ff2408ef66f63a8a338cbe8bfd596851f99/_timing-functions.scssc +0 -0
  468. data/test/dummy/tmp/cache/sass/ed6594695ffe5aab1687dbefdc87d116d8df5097/_footer.scssc +0 -0
  469. data/test/dummy/tmp/cache/sass/ed6594695ffe5aab1687dbefdc87d116d8df5097/_main_structure.scssc +0 -0
  470. data/test/dummy/tmp/cache/sass/ed6594695ffe5aab1687dbefdc87d116d8df5097/_title_bar.scssc +0 -0
  471. data/test/dummy/tmp/cache/sass/fae26a125b983ba9d6ccccd7a9247d9c55158fb8/_buttons.css.scssc +0 -0
  472. data/test/dummy/tmp/cache/sass/fae26a125b983ba9d6ccccd7a9247d9c55158fb8/_gradients.css.scssc +0 -0
  473. data/test/dummy/tmp/cache/sass/fae26a125b983ba9d6ccccd7a9247d9c55158fb8/_icons.css.scssc +0 -0
  474. data/test/dummy/tmp/cache/sass/fae26a125b983ba9d6ccccd7a9247d9c55158fb8/_reset.css.scssc +0 -0
  475. data/test/dummy/tmp/cache/sass/fae26a125b983ba9d6ccccd7a9247d9c55158fb8/_rounded.css.scssc +0 -0
  476. data/test/dummy/tmp/cache/sass/fae26a125b983ba9d6ccccd7a9247d9c55158fb8/_sections.css.scssc +0 -0
  477. data/test/dummy/tmp/cache/sass/fae26a125b983ba9d6ccccd7a9247d9c55158fb8/_typography.scssc +0 -0
  478. data/test/dummy/tmp/cache/sass/fae26a125b983ba9d6ccccd7a9247d9c55158fb8/_utilities.scssc +0 -0
  479. data/test/dummy/tmp/cache/sass/fc6d9c30657c60e19616d65bb39967cfb21769bb/_blank_slates.scssc +0 -0
  480. data/test/dummy/tmp/cache/sass/fc6d9c30657c60e19616d65bb39967cfb21769bb/_breadcrumbs.scssc +0 -0
  481. data/test/dummy/tmp/cache/sass/fc6d9c30657c60e19616d65bb39967cfb21769bb/_buttons.scssc +0 -0
  482. data/test/dummy/tmp/cache/sass/fc6d9c30657c60e19616d65bb39967cfb21769bb/_comments.css.scssc +0 -0
  483. data/test/dummy/tmp/cache/sass/fc6d9c30657c60e19616d65bb39967cfb21769bb/_date_picker.css.scssc +0 -0
  484. data/test/dummy/tmp/cache/sass/fc6d9c30657c60e19616d65bb39967cfb21769bb/_flash_messages.css.scssc +0 -0
  485. data/test/dummy/tmp/cache/sass/fc6d9c30657c60e19616d65bb39967cfb21769bb/_grid.scssc +0 -0
  486. data/test/dummy/tmp/cache/sass/fc6d9c30657c60e19616d65bb39967cfb21769bb/_links.scssc +0 -0
  487. data/test/dummy/tmp/cache/sass/fc6d9c30657c60e19616d65bb39967cfb21769bb/_pagination.scssc +0 -0
  488. data/test/dummy/tmp/cache/sass/fc6d9c30657c60e19616d65bb39967cfb21769bb/_panels.scssc +0 -0
  489. data/test/dummy/tmp/cache/sass/fc6d9c30657c60e19616d65bb39967cfb21769bb/_scopes.scssc +0 -0
  490. data/test/dummy/tmp/cache/sass/fc6d9c30657c60e19616d65bb39967cfb21769bb/_status_tags.scssc +0 -0
  491. data/test/dummy/tmp/cache/sass/fc6d9c30657c60e19616d65bb39967cfb21769bb/_table_tools.css.scssc +0 -0
  492. data/test/dummy/tmp/cache/sass/fc6d9c30657c60e19616d65bb39967cfb21769bb/_tables.css.scssc +0 -0
  493. data/test/dummy/tmp/restart.txt +0 -0
  494. data/test/test_helper.rb +0 -15
  495. data/vendor/assets/javascripts/active_admin/editor/fileuploader.js +0 -1248
  496. data/vendor/assets/javascripts/active_admin/editor/jquery.paginate.min.js +0 -1
  497. data/vendor/assets/javascripts/active_admin/editor/wysihtml5.min.js +0 -261
  498. data/vendor/assets/javascripts/active_admin/editor/wysihtml5/parser_rules.js +0 -553
File without changes
@@ -1,15 +0,0 @@
1
- # Configure Rails Environment
2
- ENV["RAILS_ENV"] = "test"
3
-
4
- require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
- require "rails/test_help"
6
-
7
- Rails.backtrace_cleaner.remove_silencers!
8
-
9
- # Load support files
10
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
11
-
12
- # Load fixtures from the engine
13
- if ActiveSupport::TestCase.method_defined?(:fixture_path=)
14
- ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
15
- end
@@ -1,1248 +0,0 @@
1
- /**
2
- * http://github.com/valums/file-uploader
3
- *
4
- * Multiple file upload component with progress-bar, drag-and-drop.
5
- * © 2010 Andrew Valums ( andrew(at)valums.com )
6
- *
7
- * Licensed under GNU GPL 2 or later and GNU LGPL 2 or later, see license.txt.
8
- */
9
-
10
- //
11
- // Helper functions
12
- //
13
-
14
- var qq = qq || {};
15
-
16
- /**
17
- * Adds all missing properties from second obj to first obj
18
- */
19
- qq.extend = function(first, second){
20
- for (var prop in second){
21
- first[prop] = second[prop];
22
- }
23
- };
24
-
25
- /**
26
- * Searches for a given element in the array, returns -1 if it is not present.
27
- * @param {Number} [from] The index at which to begin the search
28
- */
29
- qq.indexOf = function(arr, elt, from){
30
- if (arr.indexOf) return arr.indexOf(elt, from);
31
-
32
- from = from || 0;
33
- var len = arr.length;
34
-
35
- if (from < 0) from += len;
36
-
37
- for (; from < len; from++){
38
- if (from in arr && arr[from] === elt){
39
- return from;
40
- }
41
- }
42
- return -1;
43
- };
44
-
45
- qq.getUniqueId = (function(){
46
- var id = 0;
47
- return function(){ return id++; };
48
- })();
49
-
50
- //
51
- // Events
52
-
53
- qq.attach = function(element, type, fn){
54
- if (element.addEventListener){
55
- element.addEventListener(type, fn, false);
56
- } else if (element.attachEvent){
57
- element.attachEvent('on' + type, fn);
58
- }
59
- };
60
- qq.detach = function(element, type, fn){
61
- if (element.removeEventListener){
62
- element.removeEventListener(type, fn, false);
63
- } else if (element.attachEvent){
64
- element.detachEvent('on' + type, fn);
65
- }
66
- };
67
-
68
- qq.preventDefault = function(e){
69
- if (e.preventDefault){
70
- e.preventDefault();
71
- } else{
72
- e.returnValue = false;
73
- }
74
- };
75
-
76
- //
77
- // Node manipulations
78
-
79
- /**
80
- * Insert node a before node b.
81
- */
82
- qq.insertBefore = function(a, b){
83
- b.parentNode.insertBefore(a, b);
84
- };
85
- qq.remove = function(element){
86
- element.parentNode.removeChild(element);
87
- };
88
-
89
- qq.contains = function(parent, descendant){
90
- // compareposition returns false in this case
91
- if (parent == descendant) return true;
92
-
93
- if (parent.contains){
94
- return parent.contains(descendant);
95
- } else {
96
- return !!(descendant.compareDocumentPosition(parent) & 8);
97
- }
98
- };
99
-
100
- /**
101
- * Creates and returns element from html string
102
- * Uses innerHTML to create an element
103
- */
104
- qq.toElement = (function(){
105
- var div = document.createElement('div');
106
- return function(html){
107
- div.innerHTML = html;
108
- var element = div.firstChild;
109
- div.removeChild(element);
110
- return element;
111
- };
112
- })();
113
-
114
- //
115
- // Node properties and attributes
116
-
117
- /**
118
- * Sets styles for an element.
119
- * Fixes opacity in IE6-8.
120
- */
121
- qq.css = function(element, styles){
122
- if (styles.opacity != null){
123
- if (typeof element.style.opacity != 'string' && typeof(element.filters) != 'undefined'){
124
- styles.filter = 'alpha(opacity=' + Math.round(100 * styles.opacity) + ')';
125
- }
126
- }
127
- qq.extend(element.style, styles);
128
- };
129
- qq.hasClass = function(element, name){
130
- var re = new RegExp('(^| )' + name + '( |$)');
131
- return re.test(element.className);
132
- };
133
- qq.addClass = function(element, name){
134
- if (!qq.hasClass(element, name)){
135
- element.className += ' ' + name;
136
- }
137
- };
138
- qq.removeClass = function(element, name){
139
- var re = new RegExp('(^| )' + name + '( |$)');
140
- element.className = element.className.replace(re, ' ').replace(/^\s+|\s+$/g, "");
141
- };
142
- qq.setText = function(element, text){
143
- element.innerText = text;
144
- element.textContent = text;
145
- };
146
-
147
- //
148
- // Selecting elements
149
-
150
- qq.children = function(element){
151
- var children = [],
152
- child = element.firstChild;
153
-
154
- while (child){
155
- if (child.nodeType == 1){
156
- children.push(child);
157
- }
158
- child = child.nextSibling;
159
- }
160
-
161
- return children;
162
- };
163
-
164
- qq.getByClass = function(element, className){
165
- if (element.querySelectorAll){
166
- return element.querySelectorAll('.' + className);
167
- }
168
-
169
- var result = [];
170
- var candidates = element.getElementsByTagName("*");
171
- var len = candidates.length;
172
-
173
- for (var i = 0; i < len; i++){
174
- if (qq.hasClass(candidates[i], className)){
175
- result.push(candidates[i]);
176
- }
177
- }
178
- return result;
179
- };
180
-
181
- /**
182
- * obj2url() takes a json-object as argument and generates
183
- * a querystring. pretty much like jQuery.param()
184
- *
185
- * how to use:
186
- *
187
- * `qq.obj2url({a:'b',c:'d'},'http://any.url/upload?otherParam=value');`
188
- *
189
- * will result in:
190
- *
191
- * `http://any.url/upload?otherParam=value&a=b&c=d`
192
- *
193
- * @param Object JSON-Object
194
- * @param String current querystring-part
195
- * @return String encoded querystring
196
- */
197
- qq.obj2url = function(obj, temp, prefixDone){
198
- var uristrings = [],
199
- prefix = '&',
200
- add = function(nextObj, i){
201
- var nextTemp = temp
202
- ? (/\[\]$/.test(temp)) // prevent double-encoding
203
- ? temp
204
- : temp+'['+i+']'
205
- : i;
206
- if ((nextTemp != 'undefined') && (i != 'undefined')) {
207
- uristrings.push(
208
- (typeof nextObj === 'object')
209
- ? qq.obj2url(nextObj, nextTemp, true)
210
- : (Object.prototype.toString.call(nextObj) === '[object Function]')
211
- ? encodeURIComponent(nextTemp) + '=' + encodeURIComponent(nextObj())
212
- : encodeURIComponent(nextTemp) + '=' + encodeURIComponent(nextObj)
213
- );
214
- }
215
- };
216
-
217
- if (!prefixDone && temp) {
218
- prefix = (/\?/.test(temp)) ? (/\?$/.test(temp)) ? '' : '&' : '?';
219
- uristrings.push(temp);
220
- uristrings.push(qq.obj2url(obj));
221
- } else if ((Object.prototype.toString.call(obj) === '[object Array]') && (typeof obj != 'undefined') ) {
222
- // we wont use a for-in-loop on an array (performance)
223
- for (var i = 0, len = obj.length; i < len; ++i){
224
- add(obj[i], i);
225
- }
226
- } else if ((typeof obj != 'undefined') && (obj !== null) && (typeof obj === "object")){
227
- // for anything else but a scalar, we will use for-in-loop
228
- for (var i in obj){
229
- add(obj[i], i);
230
- }
231
- } else {
232
- uristrings.push(encodeURIComponent(temp) + '=' + encodeURIComponent(obj));
233
- }
234
-
235
- return uristrings.join(prefix)
236
- .replace(/^&/, '')
237
- .replace(/%20/g, '+');
238
- };
239
-
240
- //
241
- //
242
- // Uploader Classes
243
- //
244
- //
245
-
246
- var qq = qq || {};
247
-
248
- /**
249
- * Creates upload button, validates upload, but doesn't create file list or dd.
250
- */
251
- qq.FileUploaderBasic = function(o){
252
- this._options = {
253
- // set to true to see the server response
254
- debug: false,
255
- action: '/server/upload',
256
- params: {},
257
- button: null,
258
- multiple: true,
259
- maxConnections: 3,
260
- // validation
261
- allowedExtensions: [],
262
- sizeLimit: 0,
263
- minSizeLimit: 0,
264
- // events
265
- // return false to cancel submit
266
- onSubmit: function(id, fileName){},
267
- onProgress: function(id, fileName, loaded, total){},
268
- onComplete: function(id, fileName, responseJSON){},
269
- onCancel: function(id, fileName){},
270
- // messages
271
- messages: {
272
- typeError: "{file} has invalid extension. Only {extensions} are allowed.",
273
- sizeError: "{file} is too large, maximum file size is {sizeLimit}.",
274
- minSizeError: "{file} is too small, minimum file size is {minSizeLimit}.",
275
- emptyError: "{file} is empty, please select files again without it.",
276
- onLeave: "The files are being uploaded, if you leave now the upload will be cancelled."
277
- },
278
- showMessage: function(message){
279
- alert(message);
280
- }
281
- };
282
- qq.extend(this._options, o);
283
-
284
- // number of files being uploaded
285
- this._filesInProgress = 0;
286
- this._handler = this._createUploadHandler();
287
-
288
- if (this._options.button){
289
- this._button = this._createUploadButton(this._options.button);
290
- }
291
-
292
- this._preventLeaveInProgress();
293
- };
294
-
295
- qq.FileUploaderBasic.prototype = {
296
- setParams: function(params){
297
- this._options.params = params;
298
- },
299
- getInProgress: function(){
300
- return this._filesInProgress;
301
- },
302
- _createUploadButton: function(element){
303
- var self = this;
304
-
305
- return new qq.UploadButton({
306
- element: element,
307
- multiple: this._options.multiple && qq.UploadHandlerXhr.isSupported(),
308
- onChange: function(input){
309
- self._onInputChange(input);
310
- }
311
- });
312
- },
313
- _createUploadHandler: function(){
314
- var self = this,
315
- handlerClass;
316
-
317
- if(qq.UploadHandlerXhr.isSupported()){
318
- handlerClass = 'UploadHandlerXhr';
319
- } else {
320
- handlerClass = 'UploadHandlerForm';
321
- }
322
-
323
- var handler = new qq[handlerClass]({
324
- debug: this._options.debug,
325
- action: this._options.action,
326
- maxConnections: this._options.maxConnections,
327
- onProgress: function(id, fileName, loaded, total){
328
- self._onProgress(id, fileName, loaded, total);
329
- self._options.onProgress(id, fileName, loaded, total);
330
- },
331
- onComplete: function(id, fileName, result){
332
- self._onComplete(id, fileName, result);
333
- self._options.onComplete(id, fileName, result);
334
- },
335
- onCancel: function(id, fileName){
336
- self._onCancel(id, fileName);
337
- self._options.onCancel(id, fileName);
338
- }
339
- });
340
-
341
- return handler;
342
- },
343
- _preventLeaveInProgress: function(){
344
- var self = this;
345
-
346
- qq.attach(window, 'beforeunload', function(e){
347
- if (!self._filesInProgress){return;}
348
-
349
- var e = e || window.event;
350
- // for ie, ff
351
- e.returnValue = self._options.messages.onLeave;
352
- // for webkit
353
- return self._options.messages.onLeave;
354
- });
355
- },
356
- _onSubmit: function(id, fileName){
357
- this._filesInProgress++;
358
- },
359
- _onProgress: function(id, fileName, loaded, total){
360
- },
361
- _onComplete: function(id, fileName, result){
362
- this._filesInProgress--;
363
- if (result.error){
364
- this._options.showMessage(result.error);
365
- }
366
- },
367
- _onCancel: function(id, fileName){
368
- this._filesInProgress--;
369
- },
370
- _onInputChange: function(input){
371
- if (this._handler instanceof qq.UploadHandlerXhr){
372
- this._uploadFileList(input.files);
373
- } else {
374
- if (this._validateFile(input)){
375
- this._uploadFile(input);
376
- }
377
- }
378
- this._button.reset();
379
- },
380
- _uploadFileList: function(files){
381
- for (var i=0; i<files.length; i++){
382
- if ( !this._validateFile(files[i])){
383
- return;
384
- }
385
- }
386
-
387
- for (var i=0; i<files.length; i++){
388
- this._uploadFile(files[i]);
389
- }
390
- },
391
- _uploadFile: function(fileContainer){
392
- var id = this._handler.add(fileContainer);
393
- var fileName = this._handler.getName(id);
394
-
395
- if (this._options.onSubmit(id, fileName) !== false){
396
- this._onSubmit(id, fileName);
397
- this._handler.upload(id, this._options.params);
398
- }
399
- },
400
- _validateFile: function(file){
401
- var name, size;
402
-
403
- if (file.value){
404
- // it is a file input
405
- // get input value and remove path to normalize
406
- name = file.value.replace(/.*(\/|\\)/, "");
407
- } else {
408
- // fix missing properties in Safari
409
- name = file.fileName != null ? file.fileName : file.name;
410
- size = file.fileSize != null ? file.fileSize : file.size;
411
- }
412
-
413
- if (! this._isAllowedExtension(name)){
414
- this._error('typeError', name);
415
- return false;
416
-
417
- } else if (size === 0){
418
- this._error('emptyError', name);
419
- return false;
420
-
421
- } else if (size && this._options.sizeLimit && size > this._options.sizeLimit){
422
- this._error('sizeError', name);
423
- return false;
424
-
425
- } else if (size && size < this._options.minSizeLimit){
426
- this._error('minSizeError', name);
427
- return false;
428
- }
429
-
430
- return true;
431
- },
432
- _error: function(code, fileName){
433
- var message = this._options.messages[code];
434
- function r(name, replacement){ message = message.replace(name, replacement); }
435
-
436
- r('{file}', this._formatFileName(fileName));
437
- r('{extensions}', this._options.allowedExtensions.join(', '));
438
- r('{sizeLimit}', this._formatSize(this._options.sizeLimit));
439
- r('{minSizeLimit}', this._formatSize(this._options.minSizeLimit));
440
-
441
- this._options.showMessage(message);
442
- },
443
- _formatFileName: function(name){
444
- if (name.length > 33){
445
- name = name.slice(0, 19) + '...' + name.slice(-13);
446
- }
447
- return name;
448
- },
449
- _isAllowedExtension: function(fileName){
450
- var ext = (-1 !== fileName.indexOf('.')) ? fileName.replace(/.*[.]/, '').toLowerCase() : '';
451
- var allowed = this._options.allowedExtensions;
452
-
453
- if (!allowed.length){return true;}
454
-
455
- for (var i=0; i<allowed.length; i++){
456
- if (allowed[i].toLowerCase() == ext){ return true;}
457
- }
458
-
459
- return false;
460
- },
461
- _formatSize: function(bytes){
462
- var i = -1;
463
- do {
464
- bytes = bytes / 1024;
465
- i++;
466
- } while (bytes > 99);
467
-
468
- return Math.max(bytes, 0.1).toFixed(1) + ['kB', 'MB', 'GB', 'TB', 'PB', 'EB'][i];
469
- }
470
- };
471
-
472
-
473
- /**
474
- * Class that creates upload widget with drag-and-drop and file list
475
- * @inherits qq.FileUploaderBasic
476
- */
477
- qq.FileUploader = function(o){
478
- // call parent constructor
479
- qq.FileUploaderBasic.apply(this, arguments);
480
-
481
- // additional options
482
- qq.extend(this._options, {
483
- element: null,
484
- // if set, will be used instead of qq-upload-list in template
485
- listElement: null,
486
-
487
- template: '<div class="qq-uploader">' +
488
- '<div class="qq-upload-drop-area"><span>Drop files here to upload</span></div>' +
489
- '<div class="qq-upload-button">Upload a file</div>' +
490
- '<ul class="qq-upload-list"></ul>' +
491
- '</div>',
492
-
493
- // template for one item in file list
494
- fileTemplate: '<li>' +
495
- '<span class="qq-upload-file"></span>' +
496
- '<span class="qq-upload-spinner"></span>' +
497
- '<span class="qq-upload-size"></span>' +
498
- '<a class="qq-upload-cancel" href="#">Cancel</a>' +
499
- '<span class="qq-upload-failed-text">Failed</span>' +
500
- '</li>',
501
-
502
- classes: {
503
- // used to get elements from templates
504
- button: 'qq-upload-button',
505
- drop: 'qq-upload-drop-area',
506
- dropActive: 'qq-upload-drop-area-active',
507
- list: 'qq-upload-list',
508
-
509
- file: 'qq-upload-file',
510
- spinner: 'qq-upload-spinner',
511
- size: 'qq-upload-size',
512
- cancel: 'qq-upload-cancel',
513
-
514
- // added to list item when upload completes
515
- // used in css to hide progress spinner
516
- success: 'qq-upload-success',
517
- fail: 'qq-upload-fail'
518
- }
519
- });
520
- // overwrite options with user supplied
521
- qq.extend(this._options, o);
522
-
523
- this._element = this._options.element;
524
- this._element.innerHTML = this._options.template;
525
- this._listElement = this._options.listElement || this._find(this._element, 'list');
526
-
527
- this._classes = this._options.classes;
528
-
529
- this._button = this._createUploadButton(this._find(this._element, 'button'));
530
-
531
- this._bindCancelEvent();
532
- this._setupDragDrop();
533
- };
534
-
535
- // inherit from Basic Uploader
536
- qq.extend(qq.FileUploader.prototype, qq.FileUploaderBasic.prototype);
537
-
538
- qq.extend(qq.FileUploader.prototype, {
539
- /**
540
- * Gets one of the elements listed in this._options.classes
541
- **/
542
- _find: function(parent, type){
543
- var element = qq.getByClass(parent, this._options.classes[type])[0];
544
- if (!element){
545
- throw new Error('element not found ' + type);
546
- }
547
-
548
- return element;
549
- },
550
- _setupDragDrop: function(){
551
- var self = this,
552
- dropArea = this._find(this._element, 'drop');
553
-
554
- var dz = new qq.UploadDropZone({
555
- element: dropArea,
556
- onEnter: function(e){
557
- qq.addClass(dropArea, self._classes.dropActive);
558
- e.stopPropagation();
559
- },
560
- onLeave: function(e){
561
- e.stopPropagation();
562
- },
563
- onLeaveNotDescendants: function(e){
564
- qq.removeClass(dropArea, self._classes.dropActive);
565
- },
566
- onDrop: function(e){
567
- dropArea.style.display = 'none';
568
- qq.removeClass(dropArea, self._classes.dropActive);
569
- self._uploadFileList(e.dataTransfer.files);
570
- }
571
- });
572
-
573
- dropArea.style.display = 'none';
574
-
575
- qq.attach(document, 'dragenter', function(e){
576
- if (!dz._isValidFileDrag(e)) return;
577
-
578
- dropArea.style.display = 'block';
579
- });
580
- qq.attach(document, 'dragleave', function(e){
581
- if (!dz._isValidFileDrag(e)) return;
582
-
583
- var relatedTarget = document.elementFromPoint(e.clientX, e.clientY);
584
- // only fire when leaving document out
585
- if ( ! relatedTarget || relatedTarget.nodeName == "HTML"){
586
- dropArea.style.display = 'none';
587
- }
588
- });
589
- },
590
- _onSubmit: function(id, fileName){
591
- qq.FileUploaderBasic.prototype._onSubmit.apply(this, arguments);
592
- this._addToList(id, fileName);
593
- },
594
- _onProgress: function(id, fileName, loaded, total){
595
- qq.FileUploaderBasic.prototype._onProgress.apply(this, arguments);
596
-
597
- var item = this._getItemByFileId(id);
598
- var size = this._find(item, 'size');
599
- size.style.display = 'inline';
600
-
601
- var text;
602
- if (loaded != total){
603
- text = Math.round(loaded / total * 100) + '% from ' + this._formatSize(total);
604
- } else {
605
- text = this._formatSize(total);
606
- }
607
-
608
- qq.setText(size, text);
609
- },
610
- _onComplete: function(id, fileName, result){
611
- qq.FileUploaderBasic.prototype._onComplete.apply(this, arguments);
612
-
613
- // mark completed
614
- var item = this._getItemByFileId(id);
615
- qq.remove(this._find(item, 'cancel'));
616
- qq.remove(this._find(item, 'spinner'));
617
-
618
- if (result.success){
619
- qq.addClass(item, this._classes.success);
620
- } else {
621
- qq.addClass(item, this._classes.fail);
622
- }
623
- },
624
- _addToList: function(id, fileName){
625
- var item = qq.toElement(this._options.fileTemplate);
626
- item.qqFileId = id;
627
-
628
- var fileElement = this._find(item, 'file');
629
- qq.setText(fileElement, this._formatFileName(fileName));
630
- this._find(item, 'size').style.display = 'none';
631
-
632
- this._listElement.appendChild(item);
633
- },
634
- _getItemByFileId: function(id){
635
- var item = this._listElement.firstChild;
636
-
637
- // there can't be txt nodes in dynamically created list
638
- // and we can use nextSibling
639
- while (item){
640
- if (item.qqFileId == id) return item;
641
- item = item.nextSibling;
642
- }
643
- },
644
- /**
645
- * delegate click event for cancel link
646
- **/
647
- _bindCancelEvent: function(){
648
- var self = this,
649
- list = this._listElement;
650
-
651
- qq.attach(list, 'click', function(e){
652
- e = e || window.event;
653
- var target = e.target || e.srcElement;
654
-
655
- if (qq.hasClass(target, self._classes.cancel)){
656
- qq.preventDefault(e);
657
-
658
- var item = target.parentNode;
659
- self._handler.cancel(item.qqFileId);
660
- qq.remove(item);
661
- }
662
- });
663
- }
664
- });
665
-
666
- qq.UploadDropZone = function(o){
667
- this._options = {
668
- element: null,
669
- onEnter: function(e){},
670
- onLeave: function(e){},
671
- // is not fired when leaving element by hovering descendants
672
- onLeaveNotDescendants: function(e){},
673
- onDrop: function(e){}
674
- };
675
- qq.extend(this._options, o);
676
-
677
- this._element = this._options.element;
678
-
679
- this._disableDropOutside();
680
- this._attachEvents();
681
- };
682
-
683
- qq.UploadDropZone.prototype = {
684
- _disableDropOutside: function(e){
685
- // run only once for all instances
686
- if (!qq.UploadDropZone.dropOutsideDisabled ){
687
-
688
- qq.attach(document, 'dragover', function(e){
689
- if (e.dataTransfer){
690
- e.dataTransfer.dropEffect = 'none';
691
- e.preventDefault();
692
- }
693
- });
694
-
695
- qq.UploadDropZone.dropOutsideDisabled = true;
696
- }
697
- },
698
- _attachEvents: function(){
699
- var self = this;
700
-
701
- qq.attach(self._element, 'dragover', function(e){
702
- if (!self._isValidFileDrag(e)) return;
703
-
704
- var effect = e.dataTransfer.effectAllowed;
705
- if (effect == 'move' || effect == 'linkMove'){
706
- e.dataTransfer.dropEffect = 'move'; // for FF (only move allowed)
707
- } else {
708
- e.dataTransfer.dropEffect = 'copy'; // for Chrome
709
- }
710
-
711
- e.stopPropagation();
712
- e.preventDefault();
713
- });
714
-
715
- qq.attach(self._element, 'dragenter', function(e){
716
- if (!self._isValidFileDrag(e)) return;
717
-
718
- self._options.onEnter(e);
719
- });
720
-
721
- qq.attach(self._element, 'dragleave', function(e){
722
- if (!self._isValidFileDrag(e)) return;
723
-
724
- self._options.onLeave(e);
725
-
726
- var relatedTarget = document.elementFromPoint(e.clientX, e.clientY);
727
- // do not fire when moving a mouse over a descendant
728
- if (qq.contains(this, relatedTarget)) return;
729
-
730
- self._options.onLeaveNotDescendants(e);
731
- });
732
-
733
- qq.attach(self._element, 'drop', function(e){
734
- if (!self._isValidFileDrag(e)) return;
735
-
736
- e.preventDefault();
737
- self._options.onDrop(e);
738
- });
739
- },
740
- _isValidFileDrag: function(e){
741
- var dt = e.dataTransfer,
742
- // do not check dt.types.contains in webkit, because it crashes safari 4
743
- isWebkit = navigator.userAgent.indexOf("AppleWebKit") > -1;
744
-
745
- // dt.effectAllowed is none in Safari 5
746
- // dt.types.contains check is for firefox
747
- return dt && dt.effectAllowed != 'none' &&
748
- (dt.files || (!isWebkit && dt.types.contains && dt.types.contains('Files')));
749
-
750
- }
751
- };
752
-
753
- qq.UploadButton = function(o){
754
- this._options = {
755
- element: null,
756
- // if set to true adds multiple attribute to file input
757
- multiple: false,
758
- // name attribute of file input
759
- name: 'file',
760
- onChange: function(input){},
761
- hoverClass: 'qq-upload-button-hover',
762
- focusClass: 'qq-upload-button-focus'
763
- };
764
-
765
- qq.extend(this._options, o);
766
-
767
- this._element = this._options.element;
768
-
769
- // make button suitable container for input
770
- qq.css(this._element, {
771
- position: 'relative',
772
- overflow: 'hidden',
773
- // Make sure browse button is in the right side
774
- // in Internet Explorer
775
- direction: 'ltr'
776
- });
777
-
778
- this._input = this._createInput();
779
- };
780
-
781
- qq.UploadButton.prototype = {
782
- /* returns file input element */
783
- getInput: function(){
784
- return this._input;
785
- },
786
- /* cleans/recreates the file input */
787
- reset: function(){
788
- if (this._input.parentNode){
789
- qq.remove(this._input);
790
- }
791
-
792
- qq.removeClass(this._element, this._options.focusClass);
793
- this._input = this._createInput();
794
- },
795
- _createInput: function(){
796
- var input = document.createElement("input");
797
-
798
- if (this._options.multiple){
799
- input.setAttribute("multiple", "multiple");
800
- }
801
-
802
- input.setAttribute("type", "file");
803
- input.setAttribute("name", this._options.name);
804
-
805
- qq.css(input, {
806
- position: 'absolute',
807
- // in Opera only 'browse' button
808
- // is clickable and it is located at
809
- // the right side of the input
810
- right: 0,
811
- top: 0,
812
- fontFamily: 'Arial',
813
- // 4 persons reported this, the max values that worked for them were 243, 236, 236, 118
814
- fontSize: '118px',
815
- margin: 0,
816
- padding: 0,
817
- cursor: 'pointer',
818
- opacity: 0
819
- });
820
-
821
- this._element.appendChild(input);
822
-
823
- var self = this;
824
- qq.attach(input, 'change', function(){
825
- self._options.onChange(input);
826
- });
827
-
828
- qq.attach(input, 'mouseover', function(){
829
- qq.addClass(self._element, self._options.hoverClass);
830
- });
831
- qq.attach(input, 'mouseout', function(){
832
- qq.removeClass(self._element, self._options.hoverClass);
833
- });
834
- qq.attach(input, 'focus', function(){
835
- qq.addClass(self._element, self._options.focusClass);
836
- });
837
- qq.attach(input, 'blur', function(){
838
- qq.removeClass(self._element, self._options.focusClass);
839
- });
840
-
841
- // IE and Opera, unfortunately have 2 tab stops on file input
842
- // which is unacceptable in our case, disable keyboard access
843
- if (window.attachEvent){
844
- // it is IE or Opera
845
- input.setAttribute('tabIndex', "-1");
846
- }
847
-
848
- return input;
849
- }
850
- };
851
-
852
- /**
853
- * Class for uploading files, uploading itself is handled by child classes
854
- */
855
- qq.UploadHandlerAbstract = function(o){
856
- this._options = {
857
- debug: false,
858
- action: '/upload.php',
859
- // maximum number of concurrent uploads
860
- maxConnections: 999,
861
- onProgress: function(id, fileName, loaded, total){},
862
- onComplete: function(id, fileName, response){},
863
- onCancel: function(id, fileName){}
864
- };
865
- qq.extend(this._options, o);
866
-
867
- this._queue = [];
868
- // params for files in queue
869
- this._params = [];
870
- };
871
- qq.UploadHandlerAbstract.prototype = {
872
- log: function(str){
873
- if (this._options.debug && window.console) console.log('[uploader] ' + str);
874
- },
875
- /**
876
- * Adds file or file input to the queue
877
- * @returns id
878
- **/
879
- add: function(file){},
880
- /**
881
- * Sends the file identified by id and additional query params to the server
882
- */
883
- upload: function(id, params){
884
- var len = this._queue.push(id);
885
-
886
- var copy = {};
887
- qq.extend(copy, params);
888
- this._params[id] = copy;
889
-
890
- // if too many active uploads, wait...
891
- if (len <= this._options.maxConnections){
892
- this._upload(id, this._params[id]);
893
- }
894
- },
895
- /**
896
- * Cancels file upload by id
897
- */
898
- cancel: function(id){
899
- this._cancel(id);
900
- this._dequeue(id);
901
- },
902
- /**
903
- * Cancells all uploads
904
- */
905
- cancelAll: function(){
906
- for (var i=0; i<this._queue.length; i++){
907
- this._cancel(this._queue[i]);
908
- }
909
- this._queue = [];
910
- },
911
- /**
912
- * Returns name of the file identified by id
913
- */
914
- getName: function(id){},
915
- /**
916
- * Returns size of the file identified by id
917
- */
918
- getSize: function(id){},
919
- /**
920
- * Returns id of files being uploaded or
921
- * waiting for their turn
922
- */
923
- getQueue: function(){
924
- return this._queue;
925
- },
926
- /**
927
- * Actual upload method
928
- */
929
- _upload: function(id){},
930
- /**
931
- * Actual cancel method
932
- */
933
- _cancel: function(id){},
934
- /**
935
- * Removes element from queue, starts upload of next
936
- */
937
- _dequeue: function(id){
938
- var i = qq.indexOf(this._queue, id);
939
- this._queue.splice(i, 1);
940
-
941
- var max = this._options.maxConnections;
942
-
943
- if (this._queue.length >= max && i < max){
944
- var nextId = this._queue[max-1];
945
- this._upload(nextId, this._params[nextId]);
946
- }
947
- }
948
- };
949
-
950
- /**
951
- * Class for uploading files using form and iframe
952
- * @inherits qq.UploadHandlerAbstract
953
- */
954
- qq.UploadHandlerForm = function(o){
955
- qq.UploadHandlerAbstract.apply(this, arguments);
956
-
957
- this._inputs = {};
958
- };
959
- // @inherits qq.UploadHandlerAbstract
960
- qq.extend(qq.UploadHandlerForm.prototype, qq.UploadHandlerAbstract.prototype);
961
-
962
- qq.extend(qq.UploadHandlerForm.prototype, {
963
- add: function(fileInput){
964
- fileInput.setAttribute('name', 'qqfile');
965
- var id = 'qq-upload-handler-iframe' + qq.getUniqueId();
966
-
967
- this._inputs[id] = fileInput;
968
-
969
- // remove file input from DOM
970
- if (fileInput.parentNode){
971
- qq.remove(fileInput);
972
- }
973
-
974
- return id;
975
- },
976
- getName: function(id){
977
- // get input value and remove path to normalize
978
- return this._inputs[id].value.replace(/.*(\/|\\)/, "");
979
- },
980
- _cancel: function(id){
981
- this._options.onCancel(id, this.getName(id));
982
-
983
- delete this._inputs[id];
984
-
985
- var iframe = document.getElementById(id);
986
- if (iframe){
987
- // to cancel request set src to something else
988
- // we use src="javascript:false;" because it doesn't
989
- // trigger ie6 prompt on https
990
- iframe.setAttribute('src', 'javascript:false;');
991
-
992
- qq.remove(iframe);
993
- }
994
- },
995
- _upload: function(id, params){
996
- var input = this._inputs[id];
997
-
998
- if (!input){
999
- throw new Error('file with passed id was not added, or already uploaded or cancelled');
1000
- }
1001
-
1002
- var fileName = this.getName(id);
1003
-
1004
- var iframe = this._createIframe(id);
1005
- var form = this._createForm(iframe, params);
1006
- form.appendChild(input);
1007
-
1008
- var self = this;
1009
- this._attachLoadEvent(iframe, function(){
1010
- self.log('iframe loaded');
1011
-
1012
- var response = self._getIframeContentJSON(iframe);
1013
-
1014
- self._options.onComplete(id, fileName, response);
1015
- self._dequeue(id);
1016
-
1017
- delete self._inputs[id];
1018
- // timeout added to fix busy state in FF3.6
1019
- setTimeout(function(){
1020
- qq.remove(iframe);
1021
- }, 1);
1022
- });
1023
-
1024
- form.submit();
1025
- qq.remove(form);
1026
-
1027
- return id;
1028
- },
1029
- _attachLoadEvent: function(iframe, callback){
1030
- qq.attach(iframe, 'load', function(){
1031
- // when we remove iframe from dom
1032
- // the request stops, but in IE load
1033
- // event fires
1034
- if (!iframe.parentNode){
1035
- return;
1036
- }
1037
-
1038
- // fixing Opera 10.53
1039
- if (iframe.contentDocument &&
1040
- iframe.contentDocument.body &&
1041
- iframe.contentDocument.body.innerHTML == "false"){
1042
- // In Opera event is fired second time
1043
- // when body.innerHTML changed from false
1044
- // to server response approx. after 1 sec
1045
- // when we upload file with iframe
1046
- return;
1047
- }
1048
-
1049
- callback();
1050
- });
1051
- },
1052
- /**
1053
- * Returns json object received by iframe from server.
1054
- */
1055
- _getIframeContentJSON: function(iframe){
1056
- // iframe.contentWindow.document - for IE<7
1057
- var doc = iframe.contentDocument ? iframe.contentDocument: iframe.contentWindow.document,
1058
- response;
1059
-
1060
- this.log("converting iframe's innerHTML to JSON");
1061
- this.log("innerHTML = " + doc.body.innerHTML);
1062
-
1063
- try {
1064
- response = eval("(" + doc.body.innerHTML + ")");
1065
- } catch(err){
1066
- response = {};
1067
- }
1068
-
1069
- return response;
1070
- },
1071
- /**
1072
- * Creates iframe with unique name
1073
- */
1074
- _createIframe: function(id){
1075
- // We can't use following code as the name attribute
1076
- // won't be properly registered in IE6, and new window
1077
- // on form submit will open
1078
- // var iframe = document.createElement('iframe');
1079
- // iframe.setAttribute('name', id);
1080
-
1081
- var iframe = qq.toElement('<iframe src="javascript:false;" name="' + id + '" />');
1082
- // src="javascript:false;" removes ie6 prompt on https
1083
-
1084
- iframe.setAttribute('id', id);
1085
-
1086
- iframe.style.display = 'none';
1087
- document.body.appendChild(iframe);
1088
-
1089
- return iframe;
1090
- },
1091
- /**
1092
- * Creates form, that will be submitted to iframe
1093
- */
1094
- _createForm: function(iframe, params){
1095
- // We can't use the following code in IE6
1096
- // var form = document.createElement('form');
1097
- // form.setAttribute('method', 'post');
1098
- // form.setAttribute('enctype', 'multipart/form-data');
1099
- // Because in this case file won't be attached to request
1100
- var form = qq.toElement('<form method="post" enctype="multipart/form-data"></form>');
1101
-
1102
- var queryString = qq.obj2url(params, this._options.action);
1103
-
1104
- form.setAttribute('action', queryString);
1105
- form.setAttribute('target', iframe.name);
1106
- form.style.display = 'none';
1107
- document.body.appendChild(form);
1108
-
1109
- return form;
1110
- }
1111
- });
1112
-
1113
- /**
1114
- * Class for uploading files using xhr
1115
- * @inherits qq.UploadHandlerAbstract
1116
- */
1117
- qq.UploadHandlerXhr = function(o){
1118
- qq.UploadHandlerAbstract.apply(this, arguments);
1119
-
1120
- this._files = [];
1121
- this._xhrs = [];
1122
-
1123
- // current loaded size in bytes for each file
1124
- this._loaded = [];
1125
- };
1126
-
1127
- // static method
1128
- qq.UploadHandlerXhr.isSupported = function(){
1129
- var input = document.createElement('input');
1130
- input.type = 'file';
1131
-
1132
- return (
1133
- 'multiple' in input &&
1134
- typeof File != "undefined" &&
1135
- typeof (new XMLHttpRequest()).upload != "undefined" );
1136
- };
1137
-
1138
- // @inherits qq.UploadHandlerAbstract
1139
- qq.extend(qq.UploadHandlerXhr.prototype, qq.UploadHandlerAbstract.prototype)
1140
-
1141
- qq.extend(qq.UploadHandlerXhr.prototype, {
1142
- /**
1143
- * Adds file to the queue
1144
- * Returns id to use with upload, cancel
1145
- **/
1146
- add: function(file){
1147
- if (!(file instanceof File)){
1148
- throw new Error('Passed obj in not a File (in qq.UploadHandlerXhr)');
1149
- }
1150
-
1151
- return this._files.push(file) - 1;
1152
- },
1153
- getName: function(id){
1154
- var file = this._files[id];
1155
- // fix missing name in Safari 4
1156
- return file.fileName != null ? file.fileName : file.name;
1157
- },
1158
- getSize: function(id){
1159
- var file = this._files[id];
1160
- return file.fileSize != null ? file.fileSize : file.size;
1161
- },
1162
- /**
1163
- * Returns uploaded bytes for file identified by id
1164
- */
1165
- getLoaded: function(id){
1166
- return this._loaded[id] || 0;
1167
- },
1168
- /**
1169
- * Sends the file identified by id and additional query params to the server
1170
- * @param {Object} params name-value string pairs
1171
- */
1172
- _upload: function(id, params){
1173
- var file = this._files[id],
1174
- name = this.getName(id),
1175
- size = this.getSize(id);
1176
-
1177
- this._loaded[id] = 0;
1178
-
1179
- var xhr = this._xhrs[id] = new XMLHttpRequest();
1180
- var self = this;
1181
-
1182
- xhr.upload.onprogress = function(e){
1183
- if (e.lengthComputable){
1184
- self._loaded[id] = e.loaded;
1185
- self._options.onProgress(id, name, e.loaded, e.total);
1186
- }
1187
- };
1188
-
1189
- xhr.onreadystatechange = function(){
1190
- if (xhr.readyState == 4){
1191
- self._onComplete(id, xhr);
1192
- }
1193
- };
1194
-
1195
- // build query string
1196
- params = params || {};
1197
- params['qqfile'] = name;
1198
- var queryString = qq.obj2url(params, this._options.action);
1199
-
1200
- xhr.open("POST", queryString, true);
1201
- xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
1202
- xhr.setRequestHeader("X-File-Name", encodeURIComponent(name));
1203
- xhr.setRequestHeader("Content-Type", "application/octet-stream");
1204
- xhr.setRequestHeader("X-CSRF-Token", $('meta[name="csrf-token"]').attr('content'));
1205
- xhr.send(file);
1206
- },
1207
- _onComplete: function(id, xhr){
1208
- // the request was aborted/cancelled
1209
- if (!this._files[id]) return;
1210
-
1211
- var name = this.getName(id);
1212
- var size = this.getSize(id);
1213
-
1214
- this._options.onProgress(id, name, size, size);
1215
-
1216
- if (xhr.status == 200){
1217
- this.log("xhr - server response received");
1218
- this.log("responseText = " + xhr.responseText);
1219
-
1220
- var response;
1221
-
1222
- try {
1223
- response = eval("(" + xhr.responseText + ")");
1224
- } catch(err){
1225
- response = {};
1226
- }
1227
-
1228
- this._options.onComplete(id, name, response);
1229
-
1230
- } else {
1231
- this._options.onComplete(id, name, {});
1232
- }
1233
-
1234
- this._files[id] = null;
1235
- this._xhrs[id] = null;
1236
- this._dequeue(id);
1237
- },
1238
- _cancel: function(id){
1239
- this._options.onCancel(id, this.getName(id));
1240
-
1241
- this._files[id] = null;
1242
-
1243
- if (this._xhrs[id]){
1244
- this._xhrs[id].abort();
1245
- this._xhrs[id] = null;
1246
- }
1247
- }
1248
- });