lady_josephine 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (304) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +32 -0
  4. data/app/assets/fonts/lady_josephine/icons/icons.eot +0 -0
  5. data/app/assets/fonts/lady_josephine/icons/icons.svg +215 -0
  6. data/app/assets/fonts/lady_josephine/icons/icons.ttf +0 -0
  7. data/app/assets/fonts/lady_josephine/icons/icons.woff +0 -0
  8. data/app/assets/javascripts/lady_josephine/blocks/facebook.js +25 -0
  9. data/app/assets/javascripts/lady_josephine/blocks/instagram.js +22 -0
  10. data/app/assets/javascripts/lady_josephine/blocks/soundcloud.js +24 -0
  11. data/app/assets/javascripts/lady_josephine/blocks/twitter.js +25 -0
  12. data/app/assets/javascripts/lady_josephine/blocks/vimeo.js +55 -0
  13. data/app/assets/javascripts/lady_josephine/blocks/youtube.js +64 -0
  14. data/app/assets/javascripts/lady_josephine/editor.js +40 -0
  15. data/app/assets/javascripts/lady_josephine/lady_josephine.js +4 -0
  16. data/app/assets/javascripts/lady_josephine/lady_josephine_view.js +6 -0
  17. data/app/assets/stylesheets/lady_josephine/content.sass +33 -0
  18. data/app/assets/stylesheets/lady_josephine/icons.sass +175 -0
  19. data/app/assets/stylesheets/lady_josephine/lady_josephine.sass +6 -0
  20. data/app/assets/stylesheets/lady_josephine/sir_trevor.sass +619 -0
  21. data/app/assets/stylesheets/lady_josephine/vars.sass +36 -0
  22. data/app/controllers/lady_josephine/application_controller.rb +4 -0
  23. data/app/controllers/lady_josephine/editor_controller.rb +40 -0
  24. data/app/controllers/lady_josephine/images_controller.rb +26 -0
  25. data/app/helpers/lady_josephine/helper.rb +25 -0
  26. data/app/helpers/lady_josephine/sir_trevor_helper.rb +172 -0
  27. data/app/models/lady_josephine/concerns/model.rb +29 -0
  28. data/app/models/lady_josephine/concerns/pingable.rb +28 -0
  29. data/app/models/lady_josephine/concerns/server_uuid.rb +24 -0
  30. data/app/models/lady_josephine/concerns/sir_trevor_images.rb +38 -0
  31. data/app/models/lady_josephine/image.rb +41 -0
  32. data/app/uploader/lady_josephine/base_uploader.rb +47 -0
  33. data/app/uploader/lady_josephine/image_uploader.rb +149 -0
  34. data/app/views/lady_josephine/blocks/_audio_block.haml +2 -0
  35. data/app/views/lady_josephine/blocks/_definition_block.haml +4 -0
  36. data/app/views/lady_josephine/blocks/_divider_block.haml +2 -0
  37. data/app/views/lady_josephine/blocks/_extended_image_block.haml +63 -0
  38. data/app/views/lady_josephine/blocks/_extended_quote_block.haml +5 -0
  39. data/app/views/lady_josephine/blocks/_extended_tweet_block.haml +2 -0
  40. data/app/views/lady_josephine/blocks/_facebook_post_block.haml +2 -0
  41. data/app/views/lady_josephine/blocks/_heading_block.haml +2 -0
  42. data/app/views/lady_josephine/blocks/_html_block.haml +1 -0
  43. data/app/views/lady_josephine/blocks/_instagram_block.haml +2 -0
  44. data/app/views/lady_josephine/blocks/_list_block.haml +3 -0
  45. data/app/views/lady_josephine/blocks/_quote_block.haml +5 -0
  46. data/app/views/lady_josephine/blocks/_text_block.html.haml +2 -0
  47. data/app/views/lady_josephine/blocks/_video_block.haml +9 -0
  48. data/config/routes.rb +9 -0
  49. data/db/migrate/20160222151500_lady_josephine_image.rb +18 -0
  50. data/lib/generators/lady_josephine_migration/USAGE +9 -0
  51. data/lib/generators/lady_josephine_migration/lady_josephine_migration_generator.rb +17 -0
  52. data/lib/generators/lady_josephine_migration/templates/migration.rb +9 -0
  53. data/lib/lady_josephine.rb +18 -0
  54. data/lib/lady_josephine/engine.rb +18 -0
  55. data/lib/lady_josephine/redcarpet/custom_markdown_formatter.rb +63 -0
  56. data/lib/lady_josephine/renderer/sir_trevor_renderer.rb +16 -0
  57. data/lib/lady_josephine/version.rb +3 -0
  58. data/lib/lady_josephine/whitelist.rb +26 -0
  59. data/lib/tasks/lady_josephine_tasks.rake +4 -0
  60. data/spec/controllers/lady_josephine/editor_controller_spec.rb +58 -0
  61. data/spec/dummy/README.rdoc +28 -0
  62. data/spec/dummy/Rakefile +6 -0
  63. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  64. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  65. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  66. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  67. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  68. data/spec/dummy/bin/bundle +3 -0
  69. data/spec/dummy/bin/rails +4 -0
  70. data/spec/dummy/bin/rake +4 -0
  71. data/spec/dummy/bin/setup +29 -0
  72. data/spec/dummy/config.ru +4 -0
  73. data/spec/dummy/config/application.rb +26 -0
  74. data/spec/dummy/config/boot.rb +5 -0
  75. data/spec/dummy/config/database.yml +25 -0
  76. data/spec/dummy/config/environment.rb +5 -0
  77. data/spec/dummy/config/environments/development.rb +41 -0
  78. data/spec/dummy/config/environments/production.rb +79 -0
  79. data/spec/dummy/config/environments/test.rb +42 -0
  80. data/spec/dummy/config/initializers/assets.rb +11 -0
  81. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  82. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  83. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  84. data/spec/dummy/config/initializers/inflections.rb +16 -0
  85. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  86. data/spec/dummy/config/initializers/session_store.rb +3 -0
  87. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  88. data/spec/dummy/config/locales/en.yml +23 -0
  89. data/spec/dummy/config/routes.rb +4 -0
  90. data/spec/dummy/config/secrets.yml +22 -0
  91. data/spec/dummy/db/development.sqlite3 +0 -0
  92. data/spec/dummy/db/schema.rb +16 -0
  93. data/spec/dummy/db/test.sqlite3 +0 -0
  94. data/spec/dummy/log/bla +0 -0
  95. data/spec/dummy/public/404.html +67 -0
  96. data/spec/dummy/public/422.html +67 -0
  97. data/spec/dummy/public/500.html +66 -0
  98. data/spec/dummy/public/favicon.ico +0 -0
  99. data/spec/spec_helper.rb +17 -0
  100. data/vendor/assets/components/Eventable/README.md +12 -0
  101. data/vendor/assets/components/Eventable/bower.json +10 -0
  102. data/vendor/assets/components/Eventable/component.json +11 -0
  103. data/vendor/assets/components/Eventable/eventable.js +207 -0
  104. data/vendor/assets/components/Eventable/package.json +15 -0
  105. data/vendor/assets/components/jquery-autosize/bower.json +30 -0
  106. data/vendor/assets/components/jquery-autosize/demo.html +36 -0
  107. data/vendor/assets/components/jquery-autosize/jquery.autosize.js +273 -0
  108. data/vendor/assets/components/jquery-autosize/jquery.autosize.min.js +6 -0
  109. data/vendor/assets/components/jquery-autosize/package.json +32 -0
  110. data/vendor/assets/components/jquery-autosize/readme.md +216 -0
  111. data/vendor/assets/components/jquery/AUTHORS.txt +163 -0
  112. data/vendor/assets/components/jquery/CONTRIBUTING.md +216 -0
  113. data/vendor/assets/components/jquery/Gruntfile.js +496 -0
  114. data/vendor/assets/components/jquery/MIT-LICENSE.txt +21 -0
  115. data/vendor/assets/components/jquery/README.md +415 -0
  116. data/vendor/assets/components/jquery/build/release-notes.js +59 -0
  117. data/vendor/assets/components/jquery/build/release.js +246 -0
  118. data/vendor/assets/components/jquery/component.json +13 -0
  119. data/vendor/assets/components/jquery/composer.json +35 -0
  120. data/vendor/assets/components/jquery/jquery-migrate.js +496 -0
  121. data/vendor/assets/components/jquery/jquery-migrate.min.js +3 -0
  122. data/vendor/assets/components/jquery/jquery.js +9597 -0
  123. data/vendor/assets/components/jquery/jquery.min.js +5 -0
  124. data/vendor/assets/components/jquery/jquery.min.map +1 -0
  125. data/vendor/assets/components/jquery/package.json +39 -0
  126. data/vendor/assets/components/jquery/speed/benchmark.js +15 -0
  127. data/vendor/assets/components/jquery/speed/benchmarker.css +65 -0
  128. data/vendor/assets/components/jquery/speed/benchmarker.js +181 -0
  129. data/vendor/assets/components/jquery/speed/closest.html +39 -0
  130. data/vendor/assets/components/jquery/speed/css.html +82 -0
  131. data/vendor/assets/components/jquery/speed/event.html +58 -0
  132. data/vendor/assets/components/jquery/speed/filter.html +183 -0
  133. data/vendor/assets/components/jquery/speed/find.html +179 -0
  134. data/vendor/assets/components/jquery/speed/index.html +72 -0
  135. data/vendor/assets/components/jquery/speed/jquery-basis.js +6238 -0
  136. data/vendor/assets/components/jquery/speed/slice.vs.concat.html +47 -0
  137. data/vendor/assets/components/jquery/src/ajax.js +851 -0
  138. data/vendor/assets/components/jquery/src/ajax/jsonp.js +80 -0
  139. data/vendor/assets/components/jquery/src/ajax/script.js +86 -0
  140. data/vendor/assets/components/jquery/src/ajax/xhr.js +207 -0
  141. data/vendor/assets/components/jquery/src/attributes.js +661 -0
  142. data/vendor/assets/components/jquery/src/callbacks.js +196 -0
  143. data/vendor/assets/components/jquery/src/core.js +949 -0
  144. data/vendor/assets/components/jquery/src/css.js +679 -0
  145. data/vendor/assets/components/jquery/src/data.js +340 -0
  146. data/vendor/assets/components/jquery/src/deferred.js +141 -0
  147. data/vendor/assets/components/jquery/src/deprecated.js +4 -0
  148. data/vendor/assets/components/jquery/src/dimensions.js +41 -0
  149. data/vendor/assets/components/jquery/src/effects.js +730 -0
  150. data/vendor/assets/components/jquery/src/event-alias.js +15 -0
  151. data/vendor/assets/components/jquery/src/event.js +991 -0
  152. data/vendor/assets/components/jquery/src/exports.js +18 -0
  153. data/vendor/assets/components/jquery/src/intro.js +20 -0
  154. data/vendor/assets/components/jquery/src/manipulation.js +796 -0
  155. data/vendor/assets/components/jquery/src/offset.js +169 -0
  156. data/vendor/assets/components/jquery/src/outro.js +2 -0
  157. data/vendor/assets/components/jquery/src/queue.js +147 -0
  158. data/vendor/assets/components/jquery/src/serialize.js +99 -0
  159. data/vendor/assets/components/jquery/src/sizzle-jquery.js +9 -0
  160. data/vendor/assets/components/jquery/src/support.js +241 -0
  161. data/vendor/assets/components/jquery/src/traversing.js +275 -0
  162. data/vendor/assets/components/jquery/test/csp.php +16 -0
  163. data/vendor/assets/components/jquery/test/data/1x1.jpg +0 -0
  164. data/vendor/assets/components/jquery/test/data/ajax/unreleasedXHR.html +25 -0
  165. data/vendor/assets/components/jquery/test/data/atom+xml.php +4 -0
  166. data/vendor/assets/components/jquery/test/data/badcall.js +1 -0
  167. data/vendor/assets/components/jquery/test/data/badjson.js +1 -0
  168. data/vendor/assets/components/jquery/test/data/cleanScript.html +10 -0
  169. data/vendor/assets/components/jquery/test/data/core/cc_on.html +22 -0
  170. data/vendor/assets/components/jquery/test/data/dashboard.xml +11 -0
  171. data/vendor/assets/components/jquery/test/data/dimensions/documentLarge.html +17 -0
  172. data/vendor/assets/components/jquery/test/data/dimensions/documentSmall.html +21 -0
  173. data/vendor/assets/components/jquery/test/data/echoData.php +1 -0
  174. data/vendor/assets/components/jquery/test/data/echoQuery.php +1 -0
  175. data/vendor/assets/components/jquery/test/data/errorWithText.php +5 -0
  176. data/vendor/assets/components/jquery/test/data/etag.php +21 -0
  177. data/vendor/assets/components/jquery/test/data/evalScript.php +1 -0
  178. data/vendor/assets/components/jquery/test/data/event/longLoadScript.php +4 -0
  179. data/vendor/assets/components/jquery/test/data/event/promiseReady.html +17 -0
  180. data/vendor/assets/components/jquery/test/data/event/syncReady.html +23 -0
  181. data/vendor/assets/components/jquery/test/data/headers.php +18 -0
  182. data/vendor/assets/components/jquery/test/data/if_modified_since.php +20 -0
  183. data/vendor/assets/components/jquery/test/data/iframe.html +8 -0
  184. data/vendor/assets/components/jquery/test/data/jquery-1.8.2.ajax_xhr.min.js +2 -0
  185. data/vendor/assets/components/jquery/test/data/json.php +13 -0
  186. data/vendor/assets/components/jquery/test/data/json_obj.js +1 -0
  187. data/vendor/assets/components/jquery/test/data/jsonp.php +14 -0
  188. data/vendor/assets/components/jquery/test/data/manipulation/iframe-denied.html +36 -0
  189. data/vendor/assets/components/jquery/test/data/name.html +1 -0
  190. data/vendor/assets/components/jquery/test/data/name.php +24 -0
  191. data/vendor/assets/components/jquery/test/data/nocontent.php +5 -0
  192. data/vendor/assets/components/jquery/test/data/offset/absolute.html +41 -0
  193. data/vendor/assets/components/jquery/test/data/offset/body.html +26 -0
  194. data/vendor/assets/components/jquery/test/data/offset/fixed.html +34 -0
  195. data/vendor/assets/components/jquery/test/data/offset/relative.html +31 -0
  196. data/vendor/assets/components/jquery/test/data/offset/scroll.html +39 -0
  197. data/vendor/assets/components/jquery/test/data/offset/static.html +31 -0
  198. data/vendor/assets/components/jquery/test/data/offset/table.html +43 -0
  199. data/vendor/assets/components/jquery/test/data/params_html.php +12 -0
  200. data/vendor/assets/components/jquery/test/data/readywaitasset.js +1 -0
  201. data/vendor/assets/components/jquery/test/data/readywaitloader.js +25 -0
  202. data/vendor/assets/components/jquery/test/data/script.php +11 -0
  203. data/vendor/assets/components/jquery/test/data/selector/html5_selector.html +114 -0
  204. data/vendor/assets/components/jquery/test/data/selector/sizzle_cache.html +21 -0
  205. data/vendor/assets/components/jquery/test/data/statusText.php +5 -0
  206. data/vendor/assets/components/jquery/test/data/support/bodyBackground.html +28 -0
  207. data/vendor/assets/components/jquery/test/data/support/shrinkWrapBlocks.html +23 -0
  208. data/vendor/assets/components/jquery/test/data/support/testElementCrash.html +17 -0
  209. data/vendor/assets/components/jquery/test/data/test.html +7 -0
  210. data/vendor/assets/components/jquery/test/data/test.js +3 -0
  211. data/vendor/assets/components/jquery/test/data/test.php +7 -0
  212. data/vendor/assets/components/jquery/test/data/test2.html +5 -0
  213. data/vendor/assets/components/jquery/test/data/test3.html +3 -0
  214. data/vendor/assets/components/jquery/test/data/testinit.js +269 -0
  215. data/vendor/assets/components/jquery/test/data/testrunner.js +368 -0
  216. data/vendor/assets/components/jquery/test/data/testsuite.css +155 -0
  217. data/vendor/assets/components/jquery/test/data/text.php +12 -0
  218. data/vendor/assets/components/jquery/test/data/ua.txt +272 -0
  219. data/vendor/assets/components/jquery/test/data/with_fries.xml +25 -0
  220. data/vendor/assets/components/jquery/test/data/with_fries_over_jsonp.php +7 -0
  221. data/vendor/assets/components/jquery/test/delegatetest.html +228 -0
  222. data/vendor/assets/components/jquery/test/hovertest.html +158 -0
  223. data/vendor/assets/components/jquery/test/index.html +330 -0
  224. data/vendor/assets/components/jquery/test/localfile.html +75 -0
  225. data/vendor/assets/components/jquery/test/networkerror.html +84 -0
  226. data/vendor/assets/components/jquery/test/polluted.php +110 -0
  227. data/vendor/assets/components/jquery/test/readywait.html +70 -0
  228. data/vendor/assets/components/jquery/test/unit/ajax.js +1971 -0
  229. data/vendor/assets/components/jquery/test/unit/attributes.js +1332 -0
  230. data/vendor/assets/components/jquery/test/unit/callbacks.js +326 -0
  231. data/vendor/assets/components/jquery/test/unit/core.js +1332 -0
  232. data/vendor/assets/components/jquery/test/unit/css.js +1036 -0
  233. data/vendor/assets/components/jquery/test/unit/data.js +636 -0
  234. data/vendor/assets/components/jquery/test/unit/deferred.js +440 -0
  235. data/vendor/assets/components/jquery/test/unit/deprecated.js +1 -0
  236. data/vendor/assets/components/jquery/test/unit/dimensions.js +461 -0
  237. data/vendor/assets/components/jquery/test/unit/effects.js +2050 -0
  238. data/vendor/assets/components/jquery/test/unit/event.js +2690 -0
  239. data/vendor/assets/components/jquery/test/unit/exports.js +7 -0
  240. data/vendor/assets/components/jquery/test/unit/manipulation.js +2242 -0
  241. data/vendor/assets/components/jquery/test/unit/offset.js +549 -0
  242. data/vendor/assets/components/jquery/test/unit/queue.js +316 -0
  243. data/vendor/assets/components/jquery/test/unit/selector.js +185 -0
  244. data/vendor/assets/components/jquery/test/unit/serialize.js +146 -0
  245. data/vendor/assets/components/jquery/test/unit/support.js +384 -0
  246. data/vendor/assets/components/jquery/test/unit/traversing.js +667 -0
  247. data/vendor/assets/components/jquery/test/xhtml.php +5 -0
  248. data/vendor/assets/components/sir-trevor-js/CHANGELOG.md +44 -0
  249. data/vendor/assets/components/sir-trevor-js/Gemfile +3 -0
  250. data/vendor/assets/components/sir-trevor-js/Gemfile.lock +10 -0
  251. data/vendor/assets/components/sir-trevor-js/Gruntfile.js +109 -0
  252. data/vendor/assets/components/sir-trevor-js/MIT-LICENCE +20 -0
  253. data/vendor/assets/components/sir-trevor-js/Readme.md +84 -0
  254. data/vendor/assets/components/sir-trevor-js/bower.json +21 -0
  255. data/vendor/assets/components/sir-trevor-js/component.json +42 -0
  256. data/vendor/assets/components/sir-trevor-js/contributing.md +74 -0
  257. data/vendor/assets/components/sir-trevor-js/examples-component/component.json +14 -0
  258. data/vendor/assets/components/sir-trevor-js/examples-component/index.html +33 -0
  259. data/vendor/assets/components/sir-trevor-js/examples-component/index.js +29 -0
  260. data/vendor/assets/components/sir-trevor-js/examples-component/javascript/example_block.js +203 -0
  261. data/vendor/assets/components/sir-trevor-js/examples-component/javascript/limit_chars.js +46 -0
  262. data/vendor/assets/components/sir-trevor-js/examples-component/sir-trevor.gif +0 -0
  263. data/vendor/assets/components/sir-trevor-js/locales/cn.js +51 -0
  264. data/vendor/assets/components/sir-trevor-js/locales/de.js +51 -0
  265. data/vendor/assets/components/sir-trevor-js/locales/es.js +51 -0
  266. data/vendor/assets/components/sir-trevor-js/locales/fi.js +51 -0
  267. data/vendor/assets/components/sir-trevor-js/locales/fr.js +51 -0
  268. data/vendor/assets/components/sir-trevor-js/locales/pt.js +52 -0
  269. data/vendor/assets/components/sir-trevor-js/package.json +23 -0
  270. data/vendor/assets/components/sir-trevor-js/sir-trevor-icons.css +6 -0
  271. data/vendor/assets/components/sir-trevor-js/sir-trevor.css +393 -0
  272. data/vendor/assets/components/sir-trevor-js/sir-trevor.css.map +7 -0
  273. data/vendor/assets/components/sir-trevor-js/sir-trevor.js +5481 -0
  274. data/vendor/assets/components/sir-trevor-js/sir-trevor.min.js +13 -0
  275. data/vendor/assets/components/underscore/CNAME +1 -0
  276. data/vendor/assets/components/underscore/CONTRIBUTING.md +9 -0
  277. data/vendor/assets/components/underscore/LICENSE +22 -0
  278. data/vendor/assets/components/underscore/README.md +19 -0
  279. data/vendor/assets/components/underscore/Rakefile +10 -0
  280. data/vendor/assets/components/underscore/docs/docco.css +192 -0
  281. data/vendor/assets/components/underscore/docs/favicon.ico +0 -0
  282. data/vendor/assets/components/underscore/docs/images/background.png +0 -0
  283. data/vendor/assets/components/underscore/docs/images/underscore.png +0 -0
  284. data/vendor/assets/components/underscore/docs/underscore.html +823 -0
  285. data/vendor/assets/components/underscore/favicon.ico +0 -0
  286. data/vendor/assets/components/underscore/index.html +2467 -0
  287. data/vendor/assets/components/underscore/index.js +1 -0
  288. data/vendor/assets/components/underscore/package.json +16 -0
  289. data/vendor/assets/components/underscore/test/arrays.js +200 -0
  290. data/vendor/assets/components/underscore/test/chaining.js +59 -0
  291. data/vendor/assets/components/underscore/test/collections.js +453 -0
  292. data/vendor/assets/components/underscore/test/functions.js +265 -0
  293. data/vendor/assets/components/underscore/test/index.html +44 -0
  294. data/vendor/assets/components/underscore/test/objects.js +570 -0
  295. data/vendor/assets/components/underscore/test/speed.js +75 -0
  296. data/vendor/assets/components/underscore/test/utility.js +266 -0
  297. data/vendor/assets/components/underscore/test/vendor/jquery.js +9404 -0
  298. data/vendor/assets/components/underscore/test/vendor/jslitmus.js +670 -0
  299. data/vendor/assets/components/underscore/test/vendor/qunit.css +235 -0
  300. data/vendor/assets/components/underscore/test/vendor/qunit.js +1977 -0
  301. data/vendor/assets/components/underscore/test/vendor/runner.js +98 -0
  302. data/vendor/assets/components/underscore/underscore-min.js +1 -0
  303. data/vendor/assets/components/underscore/underscore.js +1226 -0
  304. metadata +473 -0
@@ -0,0 +1,36 @@
1
+ // Sir Trevor
2
+
3
+ // Lengths
4
+ $base-spacing: 20px
5
+ $half-spacing: $base-spacing / 2
6
+ $quarter-spacing: $half-spacing / 2
7
+ $double-spacing: $base-spacing * 2
8
+ $text-line-height: 32px
9
+ $small-media-width: 280px
10
+ $base-spacing-unit: $base-spacing
11
+ $base-font-size: 18px
12
+
13
+
14
+ // Colours
15
+ $c-white: #ffffff
16
+ $c-gray-medium: #dddddd
17
+ $c-gray-dark: #555555
18
+ $c-light-grey: #e4e4e4
19
+ $c-dark-grey: #808080
20
+ $c-smoke: #f2f2f2
21
+ $c-green: #5BB85D
22
+ $c-red: #D55552
23
+
24
+ $c-text: #333
25
+ $c-negative: #990000
26
+ $c-rejected: $c-red
27
+ $c-verified: $c-green
28
+ $c-highlight: #337ab7
29
+ $st-autosave-color: #0A87B0
30
+
31
+
32
+ // Animations
33
+ $easeOutExpo: cubic-bezier(.19,1,.22,1)
34
+ $transition-duration: .15s
35
+
36
+ $control-width: 15rem
@@ -0,0 +1,4 @@
1
+ module LadyJosephine
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,40 @@
1
+ module LadyJosephine
2
+ class EditorController < ::ApplicationController
3
+
4
+ def ping
5
+ if @resource = find_resource
6
+ result = {ping: {}}
7
+
8
+ if @resource.ping(current_user, params[:update] == "force")
9
+ @resource.save
10
+ result[:ping][:state] = "OK"
11
+ else
12
+ result[:ping][:state] = "CONFLICT"
13
+ end
14
+
15
+ result[:ping][:ping_date] = @resource.ping_date
16
+ result[:ping][:user_id] = @resource.ping_user.try :id
17
+ result[:ping][:user_name] = @resource.ping_user.try :name
18
+ render json: result
19
+ end
20
+ end
21
+
22
+ def version
23
+ if @resource = find_resource
24
+ render json: @resource
25
+ end
26
+ end
27
+
28
+ private
29
+
30
+ def find_resource
31
+ if (@resource = params[:resource].capitalize.constantize.where(server_uuid: params[:id]).first)
32
+ @resource
33
+ else
34
+ render nothing: true, status: 404
35
+ nil
36
+ end
37
+ end
38
+
39
+ end
40
+ end
@@ -0,0 +1,26 @@
1
+ module LadyJosephine
2
+ class ImagesController < ::ApplicationController
3
+
4
+ def create
5
+ image = Image.from_params image_params
6
+
7
+ if image.save
8
+ response = {file: {url: image.file.url}}
9
+ render json: response.as_json, status: 200
10
+ else
11
+ render json: image.file.errors, status: 500
12
+ end
13
+
14
+ end
15
+
16
+ def image_params
17
+ params.require(:attachment).permit([:name, :file])
18
+ params.require("block-uuid")
19
+ params.require("article-uuid")
20
+ params.require("model-name")
21
+ params.require("column-name")
22
+ params
23
+ end
24
+
25
+ end
26
+ end
@@ -0,0 +1,25 @@
1
+ module LadyJosephine
2
+ module Helper
3
+
4
+ def lady_josephine_field(model, column, blocks=nil)
5
+ class_name = model.class.to_s.underscore
6
+
7
+ options = {
8
+ "modelName" => class_name,
9
+ "columnName" => "#{column}",
10
+ "baseURL" => "#{LadyJosephine.mount_path}/content/#{class_name}/",
11
+ }
12
+ options["blockTypes"] = blocks if blocks.present?
13
+
14
+ text_field_tag "#{class_name}[#{column}]", model.send(column),
15
+ class: "js-st-instance sir_trevor_editor",
16
+ data: { sir_trevor: options.to_json }
17
+ end
18
+
19
+ def lady_josephine_render(data)
20
+ renderer = LadyJosephine::Renderer::SirTrevorRenderer.new(data)
21
+ renderer.render_body
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,172 @@
1
+ require 'redcarpet'
2
+
3
+ module LadyJosephine
4
+ module SirTrevorHelper
5
+
6
+ def render_sir_trevor(json, without_notes = true, image_type = 'large')
7
+ if hash = parse_sir_trevor(json)
8
+ first_definition_block = true
9
+ hash.map { |object|
10
+ if object["data"]["note"] != "yes" || !without_notes
11
+ if object["type"] == "definition"
12
+ options = {first: first_definition_block}
13
+ first_definition_block = false
14
+ render_sir_trevor_block(object, image_type, options)
15
+ else
16
+ render_sir_trevor_block(object, image_type)
17
+ end
18
+ end
19
+ }.compact.join.html_safe
20
+ else
21
+ ''
22
+ end
23
+ end
24
+
25
+ def component_attributes_for(block, classes)
26
+ classes = [classes].flatten(1).map do |klass|
27
+ if klass.is_a? Hash
28
+ key = block[klass.keys.first.to_s]
29
+ [klass.values.first, key].reject(&:blank?).join("--")
30
+ else
31
+ klass
32
+ end
33
+ end
34
+
35
+ if block["note"] != "yes"
36
+ {"data-article_component" => block["uuid"], "notes_count" => block["references_count"], "ng-class" => "{'is-active': active}", "class" => classes}
37
+ else
38
+ {}
39
+ end
40
+ end
41
+
42
+ def sir_trevor_markdown(text)
43
+ markdown = ::Redcarpet::Markdown.new(LadyJosephine::Redcarpet::CustomMarkdownFormatter.new(escape_html: true, safe_links_only: true))
44
+ markdown.render(text).html_safe
45
+ end
46
+
47
+ def image_with_srcset_tag(srcset, sizes, options = {})
48
+ src = protocol_relative path_to_image(srcset.split(', ').first.split(' ').first)
49
+
50
+ tag "img", options.merge(:src => src, :srcset => srcset, :sizes => sizes)
51
+ end
52
+
53
+ def protocol_relative(path)
54
+ path.gsub(/\Ahttps?:/, '')
55
+ end
56
+
57
+ def sir_trevor_video(block)
58
+
59
+ if block["source"] == "youtube"
60
+
61
+ options = {
62
+ frameborder: 0,
63
+ wmode: nil,
64
+ autoplay: false,
65
+ hide_related: true,
66
+ showinfo: 0,
67
+ color: "white",
68
+ modestbranding: 1,
69
+ iv_load_policy: 3,
70
+ theme: "light",
71
+ fullscreen: block["note"] == "yes" ? 0 : 1
72
+ }
73
+
74
+ src = "//www.youtube.com/embed/#{block['remote_id']}"
75
+
76
+ params = []
77
+ params << "wmode=#{options[:wmode]}" if options[:wmode]
78
+ params << "autoplay=1" if options[:autoplay]
79
+ params << "rel=0" if options[:hide_related]
80
+ params << "showinfo=#{options[:showinfo]}" if options[:showinfo]
81
+ params << "modestbranding=#{options[:modestbranding]}" if options[:modestbranding]
82
+ params << "color=#{options[:color]}" if options[:color]
83
+ params << "iv_load_policy=#{options[:iv_load_policy]}" if options[:iv_load_policy]
84
+ params << "theme=#{options[:theme]}" if options[:theme]
85
+ params << "fs=#{options[:fullscreen]}" if options[:fullscreen]
86
+
87
+ src += "?#{params.join '&'}" unless params.empty?
88
+
89
+ %{<div class="ratio-container youtube-block" data-youtube-url=#{src} data-video-id=#{block['remote_id']}></div>}
90
+
91
+
92
+ elsif block["source"] == "vimeo"
93
+
94
+ options = {
95
+ show_title: false,
96
+ show_byline: false,
97
+ show_portrait: false,
98
+ frameborder: 0
99
+ }
100
+
101
+
102
+ frameborder = options[:frameborder] || 0
103
+ src = "//player.vimeo.com/video/#{block['remote_id']}"
104
+
105
+ params = []
106
+
107
+ params << "title=0" unless options[:show_title]
108
+ params << "byline=0" if options[:autoplay]
109
+ params << "portrait=0" if options[:hide_related]
110
+
111
+ src += "?#{params.join '&'}" unless params.empty?
112
+
113
+ %{<div class="ratio-container vimeo-block" data-vimeo-url=#{src} data-video-id=#{block['remote_id']}></div>}
114
+
115
+ else
116
+
117
+ ""
118
+
119
+ end
120
+
121
+ end
122
+
123
+ private
124
+
125
+ def parse_sir_trevor(json)
126
+ hash = JSON.parse(json)
127
+
128
+ return false unless hash.has_key?("data")
129
+ digest hash["data"]
130
+ end
131
+
132
+ def digest(component_array)
133
+ reference_uid = "default"
134
+ structure_hash = {}
135
+ sequence_array = []
136
+
137
+ component_array.each do |object|
138
+ current_uuid = object["data"]["uuid"]
139
+
140
+ object["data"] = object["data"].merge "references_uuid" => nil, "references_count" => 0
141
+ structure_hash[current_uuid] = object
142
+ sequence_array << current_uuid
143
+
144
+ if object["data"]["note"] != "yes"
145
+ reference_uid = current_uuid
146
+ else
147
+ structure_hash[current_uuid]["data"]["references_uuid"] = reference_uid
148
+ if structure_hash[reference_uid].present?
149
+ structure_hash[reference_uid]["data"]["references_count"] += 1
150
+ end
151
+ end
152
+ end
153
+
154
+ sequence_array.map do |node|
155
+ structure_hash[node]
156
+ end
157
+
158
+ end
159
+
160
+ def render_sir_trevor_block(object, image_type = 'large', options = {})
161
+ view_name = "lady_josephine/blocks/#{object['type'].to_s.downcase}_block"
162
+ LadyJosephine::ApplicationController.new.render_to_string(
163
+ :partial => view_name,
164
+ :locals => {
165
+ :block => object['data'],
166
+ :options => options
167
+ }
168
+ )
169
+ end
170
+
171
+ end
172
+ end
@@ -0,0 +1,29 @@
1
+ module LadyJosephine
2
+
3
+ module Concerns
4
+ module Model
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ include Pingable
9
+ include ServerUuid
10
+ include SirTrevorImages
11
+
12
+ LadyJosephine::Whitelist.instance.whitelist(self)
13
+
14
+ def content_data_hash
15
+ if self.content_data.present?
16
+ JSON.parse(self.content_data)
17
+ else
18
+ {"server_uuid" => nil}
19
+ end
20
+ end
21
+
22
+ def content_data_hash=(hash)
23
+ self.content_data = hash.to_json
24
+ end
25
+ end
26
+ end
27
+ end
28
+
29
+ end
@@ -0,0 +1,28 @@
1
+ module LadyJosephine
2
+ module Concerns
3
+ module Pingable
4
+ extend ActiveSupport::Concern
5
+
6
+ PING_TIMESPAN = 30.seconds
7
+
8
+ included do
9
+ belongs_to :ping_user, class_name: 'User'
10
+
11
+ def ping(user, force_update = false)
12
+ if lady_josephine_ping_user.nil? ||
13
+ lady_josephine_ping_user == user ||
14
+ (lady_josephine_ping_date && lady_josephine_ping_date < Time.current - PING_TIMESPAN) ||
15
+ force_update
16
+ self.lady_josephine_ping_date = Time.current
17
+ self.lady_josephine_ping_user = user
18
+ true
19
+ else
20
+ false
21
+ end
22
+ end
23
+
24
+ end
25
+
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,24 @@
1
+ module LadyJosephine
2
+ module Concerns
3
+ module ServerUuid
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ before_save :update_server_uuid
8
+
9
+ def update_server_uuid
10
+ if self.lady_josephine_server_uuid.blank? && (client_uuid = self.content_data_hash["uuid"]).present?
11
+ self.lady_josephine_server_version = self.content_data_hash["version"]
12
+ self.lady_josephine_server_uuid = client_uuid
13
+ self.content_data_hash = content_data_hash.merge({"server_uuid" => client_uuid, "server_version" => lady_josephine_server_version})
14
+ elsif (client_version = self.content_data_hash["version"]).present?
15
+ self.lady_josephine_server_version = client_version
16
+ self.content_data_hash = content_data_hash.merge({"server_version" => client_version})
17
+ end
18
+ end
19
+
20
+ end
21
+
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,38 @@
1
+ module LadyJosephine
2
+ module Concerns
3
+ module SirTrevorImages
4
+ extend ActiveSupport::Concern
5
+
6
+ included do |column|
7
+
8
+ def images
9
+ files = []
10
+ image_blocks.each do |block|
11
+ files << block["data"]["file"]
12
+ files << block["data"]["file"]["large"]
13
+ files << block["data"]["file"]["medium"]
14
+ files << block["data"]["file"]["small"]
15
+ end
16
+ files.map { |f| f["url"] }
17
+ end
18
+
19
+ private
20
+
21
+ def image_blocks
22
+ self.sir_trevor_unwrap_column["data"].select do |block|
23
+ block['type'] == 'extended_image'
24
+ end
25
+ end
26
+
27
+ end
28
+
29
+ class_methods do
30
+
31
+ def sir_trevor_unwrap_column
32
+ JSON.parse(self.content_data || "{}")
33
+ end
34
+
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,41 @@
1
+ require 'carrierwave'
2
+ require 'carrierwave/orm/activerecord'
3
+
4
+ module LadyJosephine
5
+ class Image < ActiveRecord::Base
6
+
7
+ mount_uploader :file, LadyJosephine::ImageUploader
8
+
9
+ before_save :update_file_metadata
10
+
11
+ def self.from_params(params)
12
+ uploadable_type = params["model-name"]
13
+ uploadable_type = allowed_class_name uploadable_type
14
+ uploadable_uuid = params["article-uuid"]
15
+ uploadable_attribute = params["column-name"]
16
+ uploadable_id = uploadable_type.constantize.find_by(lady_josephine_server_uuid: uploadable_uuid).try :id
17
+ block_uuid = params["block-uuid"]
18
+ file = params[:attachment][:file]
19
+
20
+ new(
21
+ block_uuid: block_uuid,
22
+ uploadable_type: uploadable_type,
23
+ uploadable_uuid: uploadable_uuid,
24
+ uploadable_id: uploadable_id,
25
+ uploadable_attribute: uploadable_attribute,
26
+ file: file
27
+ )
28
+ end
29
+
30
+ def self.allowed_class_name(uploadable_type)
31
+ uploadable_type.classify if LadyJosephine::Whitelist.instance.is_whitelisted?(uploadable_type)
32
+ end
33
+
34
+ def update_file_metadata
35
+ if file.present? && file?
36
+ self.file_metadata = file.metadata.to_json
37
+ end
38
+ end
39
+
40
+ end
41
+ end