storytime 1.2.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (359) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +10 -0
  3. data/.rspec +1 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/Gemfile +17 -0
  7. data/Gemfile.lock +448 -0
  8. data/Guardfile +24 -0
  9. data/MIT-LICENSE +1 -1
  10. data/README.md +160 -0
  11. data/app/assets/{javascripts/storytime/subscriptions.js → images/storytime/.keep} +0 -0
  12. data/app/assets/images/storytime/storytime-logo-nav-light.png +0 -0
  13. data/app/assets/images/storytime/storytime-logo-nav.png +0 -0
  14. data/app/assets/images/storytime/storytime-logo.png +0 -0
  15. data/app/assets/javascripts/storytime/application.js +11 -3
  16. data/app/assets/javascripts/storytime/base.js.coffee +44 -6
  17. data/app/assets/javascripts/storytime/blog_posts.js.coffee +16 -0
  18. data/app/assets/javascripts/storytime/blogs.js.coffee +18 -0
  19. data/app/assets/javascripts/storytime/character_counter.js.coffee +26 -0
  20. data/app/assets/javascripts/storytime/contenteditable.js.coffee +15 -0
  21. data/app/assets/javascripts/storytime/custom_posts.js.coffee +16 -0
  22. data/app/assets/javascripts/storytime/editor.js.coffee +50 -134
  23. data/app/assets/javascripts/storytime/media.js.coffee +91 -22
  24. data/app/assets/javascripts/storytime/pages.js.coffee +16 -0
  25. data/app/assets/javascripts/storytime/posts.js.coffee +28 -1
  26. data/app/assets/javascripts/storytime/sites.js.coffee +1 -16
  27. data/app/assets/javascripts/storytime/snippets.js.coffee +6 -3
  28. data/app/assets/javascripts/storytime/tags.js.coffee +17 -0
  29. data/app/assets/javascripts/storytime/users.js.coffee +10 -0
  30. data/app/assets/javascripts/storytime/wysiwyg.js.coffee +183 -0
  31. data/app/assets/stylesheets/storytime/_buttons.scss +70 -0
  32. data/app/assets/stylesheets/storytime/_dropdowns.scss +5 -0
  33. data/app/assets/stylesheets/storytime/_forms.scss +3 -0
  34. data/app/assets/stylesheets/storytime/_list-group.scss +13 -0
  35. data/app/assets/stylesheets/storytime/_pagination.scss +14 -0
  36. data/app/assets/stylesheets/storytime/_panels.scss +8 -0
  37. data/app/assets/stylesheets/storytime/_tabs.scss +38 -0
  38. data/app/assets/stylesheets/storytime/_type.scss +13 -0
  39. data/app/assets/stylesheets/storytime/_wells.scss +14 -0
  40. data/app/assets/stylesheets/storytime/admin.scss +42 -0
  41. data/app/assets/stylesheets/storytime/application.scss +75 -0
  42. data/app/assets/stylesheets/storytime/{comments.css.scss → comments.scss} +0 -0
  43. data/app/assets/stylesheets/storytime/icons.scss +79 -0
  44. data/app/assets/stylesheets/storytime/layout.scss +21 -0
  45. data/app/assets/stylesheets/storytime/media.scss +65 -0
  46. data/app/assets/stylesheets/storytime/modals.scss +46 -0
  47. data/app/assets/stylesheets/storytime/navigation.scss +137 -0
  48. data/app/assets/stylesheets/storytime/posts.scss +76 -0
  49. data/app/assets/stylesheets/storytime/scroll-panels.scss +19 -0
  50. data/app/assets/stylesheets/storytime/snippets.scss +11 -0
  51. data/app/assets/stylesheets/storytime/{sites.css.scss → subscriptions.scss} +0 -0
  52. data/app/assets/stylesheets/storytime/versions.scss +21 -0
  53. data/app/controllers/storytime/application_controller.rb +36 -16
  54. data/app/controllers/storytime/blog_homepage_controller.rb +10 -0
  55. data/app/controllers/storytime/blogs_controller.rb +56 -0
  56. data/app/controllers/storytime/comments_controller.rb +5 -1
  57. data/app/controllers/storytime/dashboard/autosaves_controller.rb +7 -3
  58. data/app/controllers/storytime/dashboard/blog_posts_controller.rb +60 -0
  59. data/app/controllers/storytime/dashboard/blogs_controller.rb +66 -0
  60. data/app/controllers/storytime/dashboard/custom_posts_controller.rb +51 -0
  61. data/app/controllers/storytime/dashboard/media_controller.rb +9 -7
  62. data/app/controllers/storytime/dashboard/memberships_controller.rb +49 -0
  63. data/app/controllers/storytime/dashboard/pages_controller.rb +24 -0
  64. data/app/controllers/storytime/dashboard/posts_controller.rb +29 -38
  65. data/app/controllers/storytime/dashboard/roles_controller.rb +16 -2
  66. data/app/controllers/storytime/dashboard/sites_controller.rb +25 -11
  67. data/app/controllers/storytime/dashboard/snippets_controller.rb +19 -14
  68. data/app/controllers/storytime/dashboard/subscriptions_controller.rb +9 -5
  69. data/app/controllers/storytime/dashboard/users_controller.rb +24 -22
  70. data/app/controllers/storytime/dashboard_controller.rb +9 -3
  71. data/app/controllers/storytime/homepage_controller.rb +10 -0
  72. data/app/controllers/storytime/pages_controller.rb +30 -13
  73. data/app/controllers/storytime/posts_controller.rb +22 -53
  74. data/app/controllers/storytime/subscriptions_controller.rb +5 -4
  75. data/app/helpers/storytime/application_helper.rb +28 -7
  76. data/app/helpers/storytime/dashboard/sites_helper.rb +2 -5
  77. data/app/helpers/storytime/subscriptions_helper.rb +0 -7
  78. data/app/inputs/date_time_picker_input.rb +1 -1
  79. data/app/mailers/storytime/subscription_mailer.rb +1 -3
  80. data/app/models/concerns/storytime/post_comments.rb +17 -0
  81. data/app/models/concerns/storytime/post_excerpt.rb +14 -0
  82. data/app/models/concerns/storytime/post_featured_images.rb +8 -0
  83. data/app/models/concerns/storytime/post_partial_inheritance.rb +29 -0
  84. data/app/models/concerns/storytime/post_tags.rb +41 -0
  85. data/app/models/concerns/storytime/scoped_to_site.rb +11 -0
  86. data/app/models/storytime/action.rb +1 -0
  87. data/app/models/storytime/autosave.rb +7 -1
  88. data/app/models/storytime/blog.rb +16 -0
  89. data/app/models/storytime/blog_post.rb +12 -1
  90. data/app/models/storytime/comment.rb +4 -1
  91. data/app/models/storytime/media.rb +2 -0
  92. data/app/models/storytime/membership.rb +17 -0
  93. data/app/models/storytime/page.rb +0 -5
  94. data/app/models/storytime/permission.rb +26 -20
  95. data/app/models/storytime/post.rb +29 -82
  96. data/app/models/storytime/role.rb +12 -0
  97. data/app/models/storytime/site.rb +42 -12
  98. data/app/models/storytime/snippet.rb +3 -0
  99. data/app/models/storytime/subscription.rb +2 -1
  100. data/app/models/storytime/tag.rb +5 -1
  101. data/app/models/storytime/tagging.rb +1 -0
  102. data/app/models/storytime/version.rb +1 -0
  103. data/app/policies/admin_policy.rb +30 -0
  104. data/app/policies/storytime/comment_policy.rb +5 -1
  105. data/app/policies/storytime/membership_policy.rb +32 -0
  106. data/app/policies/storytime/post_policy.rb +6 -4
  107. data/app/policies/storytime/site_policy.rb +7 -2
  108. data/app/policies/storytime/snippet_policy.rb +3 -2
  109. data/app/policies/storytime/subscription_policy.rb +3 -2
  110. data/app/policies/user_policy.rb +2 -5
  111. data/app/views/kaminari/_first_page.html.erb +13 -0
  112. data/app/views/kaminari/_gap.html.erb +8 -0
  113. data/app/views/kaminari/_last_page.html.erb +13 -0
  114. data/app/views/kaminari/_next_page.html.erb +13 -0
  115. data/app/views/kaminari/_page.html.erb +12 -0
  116. data/app/views/kaminari/_paginator.html.erb +24 -0
  117. data/app/views/kaminari/_prev_page.html.erb +13 -0
  118. data/app/views/layouts/storytime/application.html.erb +1 -1
  119. data/app/views/layouts/storytime/dashboard.html.erb +22 -6
  120. data/app/views/storytime/application/storytime/_disqus_comment_counts.html.erb +14 -0
  121. data/app/views/storytime/application/storytime/_header.html.erb +3 -4
  122. data/app/views/storytime/application/storytime/_navigation.html.erb +14 -1
  123. data/app/views/storytime/blogs/_tags.html.erb +3 -0
  124. data/app/views/storytime/{posts/index.atom.builder → blogs/show.atom.builder} +1 -1
  125. data/app/views/storytime/{posts/index.html.erb → blogs/show.html.erb} +1 -1
  126. data/app/views/storytime/comments/_discourse.html.erb +18 -0
  127. data/app/views/storytime/comments/_disqus.html.erb +2 -2
  128. data/app/views/storytime/comments/_form.html.erb +2 -2
  129. data/app/views/storytime/dashboard/_navigation.html.erb +109 -41
  130. data/app/views/storytime/dashboard/_settings_tabs.html.erb +32 -0
  131. data/app/views/storytime/dashboard/autosaves/_autosave_info.html.erb +7 -4
  132. data/app/views/storytime/dashboard/blog_posts/_form.html.erb +157 -0
  133. data/app/views/storytime/dashboard/blog_posts/edit.html.erb +55 -0
  134. data/app/views/storytime/dashboard/blog_posts/new.html.erb +31 -0
  135. data/app/views/storytime/dashboard/blogs/_blog.html.erb +3 -0
  136. data/app/views/storytime/dashboard/blogs/_form.html.erb +25 -0
  137. data/app/views/storytime/dashboard/blogs/edit.json.jbuilder +1 -0
  138. data/app/views/storytime/dashboard/blogs/index.json.jbuilder +1 -0
  139. data/app/views/storytime/dashboard/blogs/new.json.jbuilder +1 -0
  140. data/app/views/storytime/dashboard/media/_form.html.erb +3 -3
  141. data/app/views/storytime/dashboard/media/{_gallery.html → _gallery.html.erb} +7 -4
  142. data/app/views/storytime/dashboard/media/_media.html.erb +6 -13
  143. data/app/views/storytime/dashboard/media/_modal.html.erb +3 -3
  144. data/app/views/storytime/dashboard/media/index.html.erb +15 -5
  145. data/app/views/storytime/dashboard/memberships/_form.html.erb +12 -0
  146. data/app/views/storytime/dashboard/memberships/_index.html.erb +39 -0
  147. data/app/views/storytime/dashboard/memberships/_membership.html.erb +12 -0
  148. data/app/views/storytime/dashboard/memberships/index.json.jbuilder +2 -0
  149. data/app/views/storytime/dashboard/memberships/save.json.jbuilder +1 -0
  150. data/app/views/storytime/dashboard/pages/_form.html.erb +88 -0
  151. data/app/views/storytime/dashboard/pages/_index_title.html.erb +1 -0
  152. data/app/views/storytime/dashboard/pages/_new_button.html.erb +1 -0
  153. data/app/views/storytime/dashboard/pages/edit.html.erb +49 -0
  154. data/app/views/storytime/dashboard/pages/new.html.erb +28 -0
  155. data/app/views/storytime/dashboard/posts/_form.html.erb +128 -122
  156. data/app/views/storytime/dashboard/posts/_image_toolbar.html.erb +32 -0
  157. data/app/views/storytime/dashboard/posts/_index_title.html.erb +1 -0
  158. data/app/views/storytime/dashboard/posts/_list.html.erb +23 -24
  159. data/app/views/storytime/dashboard/posts/_new_button.html.erb +10 -0
  160. data/app/views/storytime/dashboard/posts/edit.html.erb +56 -13
  161. data/app/views/storytime/dashboard/posts/index.html.erb +56 -7
  162. data/app/views/storytime/dashboard/posts/new.html.erb +29 -8
  163. data/app/views/storytime/dashboard/roles/_form.html.erb +41 -0
  164. data/app/views/storytime/dashboard/roles/edit.json.jbuilder +1 -0
  165. data/app/views/storytime/dashboard/sites/_form.html.erb +31 -15
  166. data/app/views/storytime/dashboard/sites/new.html.erb +21 -8
  167. data/app/views/storytime/dashboard/sites/site.json.jbuilder +2 -0
  168. data/app/views/storytime/dashboard/snippets/_form.html.erb +26 -12
  169. data/app/views/storytime/dashboard/snippets/_index.html.erb +17 -0
  170. data/app/views/storytime/dashboard/snippets/_snippet.html.erb +12 -0
  171. data/app/views/storytime/dashboard/snippets/edit.json.jbuilder +1 -0
  172. data/app/views/storytime/dashboard/snippets/index.json.jbuilder +4 -0
  173. data/app/views/storytime/dashboard/snippets/new.json.jbuilder +1 -0
  174. data/app/views/storytime/dashboard/subscriptions/_form.html.erb +19 -0
  175. data/app/views/storytime/dashboard/subscriptions/_index.html.erb +19 -0
  176. data/app/views/storytime/dashboard/subscriptions/_subscription.html.erb +9 -10
  177. data/app/views/storytime/dashboard/subscriptions/form.json.jbuilder +1 -0
  178. data/app/views/storytime/dashboard/subscriptions/index.json.jbuilder +1 -0
  179. data/app/views/storytime/dashboard/users/_edit.html.erb +26 -0
  180. data/app/views/storytime/dashboard/users/_new.html.erb +25 -0
  181. data/app/views/storytime/dashboard/users/edit.json.jbuilder +2 -0
  182. data/app/views/storytime/dashboard/users/new.json.jbuilder +2 -0
  183. data/app/views/storytime/dashboard/versions/_version.html.erb +14 -0
  184. data/app/views/storytime/dashboard/versions/_versions_info.html.erb +1 -16
  185. data/app/views/storytime/pages/show.html.erb +1 -1
  186. data/app/views/storytime/posts/_post.html.erb +8 -0
  187. data/app/views/storytime/posts/_tags.html.erb +1 -1
  188. data/app/views/storytime/posts/show.html.erb +1 -1
  189. data/app/views/storytime/sites/_google_analytics_code.html.erb +2 -2
  190. data/app/views/storytime/snippets/_snippet.html.erb +9 -0
  191. data/app/views/storytime/subscription_mailer/new_post_email.html.erb +2 -2
  192. data/app/views/storytime/subscription_mailer/new_post_email.text.erb +2 -2
  193. data/app/views/storytime/subscriptions/_form.html.erb +0 -1
  194. data/app/views/storytime/subscriptions/_modal.html.erb +18 -10
  195. data/bin/rails +12 -0
  196. data/bin/storytime +4 -0
  197. data/circle.yml +3 -0
  198. data/config/initializers/storytime_admin.rb +3 -0
  199. data/config/initializers/url_for_patch.rb +2 -37
  200. data/config/locales/en.yml +33 -13
  201. data/config/routes.rb +47 -19
  202. data/db/migrate/20150128185746_seed_new_actions_and_permissions.rb +9 -0
  203. data/db/migrate/20150206201847_add_site_id_to_storytime_post.rb +7 -0
  204. data/db/migrate/20150206201919_add_site_id_to_storytime_snippet.rb +7 -0
  205. data/db/migrate/20150206201931_add_site_id_to_storytime_tag.rb +7 -0
  206. data/db/migrate/20150206205256_add_notification_fields_to_storytime_post.rb +6 -0
  207. data/db/migrate/20150216211257_add_subdomain_to_storytime_sites.rb +5 -0
  208. data/db/migrate/20150216225045_add_site_to_storytime_media.rb +6 -0
  209. data/db/migrate/20150219210528_remove_root_page_content_from_storytime_sites.rb +12 -0
  210. data/db/migrate/20150220184902_add_blog_id_to_posts.rb +6 -0
  211. data/db/migrate/20150224192138_add_homepage_path_to_storytime_sites.rb +5 -0
  212. data/db/migrate/20150224193151_add_subscription_email_from_to_storytime_sites.rb +5 -0
  213. data/db/migrate/20150224193551_add_layout_to_storytime_sites.rb +5 -0
  214. data/db/migrate/20150224194559_add_disqus_forum_shortname_to_storytime_sites.rb +5 -0
  215. data/db/migrate/20150224212453_remove_homepage_path_from_storytime_sites.rb +5 -0
  216. data/db/migrate/20150225143516_add_site_id_to_storytime_autosaves.rb +6 -0
  217. data/db/migrate/20150225143826_add_site_id_to_storytime_comments.rb +6 -0
  218. data/db/migrate/20150225145119_add_site_id_to_storytime_versions.rb +6 -0
  219. data/db/migrate/20150225145316_add_site_id_to_storytime_taggings.rb +6 -0
  220. data/db/migrate/20150225145608_update_storytime_site_id_columns.rb +11 -0
  221. data/db/migrate/20150225164232_add_site_id_to_storytime_permissions.rb +6 -0
  222. data/db/migrate/20150225212917_create_storytime_memberships.rb +11 -0
  223. data/db/migrate/20150225213535_create_memberships_for_storytime_users.rb +8 -0
  224. data/db/migrate/20150226201739_add_custom_domain_to_storytime_sites.rb +5 -0
  225. data/db/migrate/20150302171500_add_site_id_to_storytime_media.rb +8 -0
  226. data/db/migrate/20150302171722_set_site_layout.rb +8 -0
  227. data/db/migrate/20150302185138_remove_storytime_role_id_from_users.rb +5 -0
  228. data/db/migrate/20150302192525_transfer_posts_to_blogs.rb +8 -0
  229. data/db/migrate/20150302192759_seed_permissions.rb +9 -0
  230. data/db/migrate/20150331162329_add_discourse_name_to_storytime_sites.rb +5 -0
  231. data/db/migrate/20150402161427_remove_subdomain_from_storytime_site.rb +5 -0
  232. data/lib/generators/storytime/install_generator.rb +17 -0
  233. data/lib/generators/storytime/views_generator.rb +21 -9
  234. data/lib/generators/templates/storytime.rb +70 -27
  235. data/lib/storytime/cli/install.rb +274 -0
  236. data/lib/storytime/cli.rb +28 -0
  237. data/lib/storytime/concerns/current_site.rb +10 -0
  238. data/lib/storytime/concerns/has_versions.rb +22 -3
  239. data/lib/storytime/concerns/storytime_user.rb +31 -7
  240. data/lib/storytime/constraints/blog_constraint.rb +11 -0
  241. data/lib/storytime/constraints/blog_homepage_constraint.rb +11 -0
  242. data/lib/storytime/constraints/page_constraint.rb +13 -0
  243. data/lib/storytime/constraints/page_homepage_constraint.rb +11 -0
  244. data/lib/storytime/engine.rb +43 -14
  245. data/lib/storytime/generators/initializer.rb +45 -0
  246. data/lib/storytime/migrators/v1.rb +122 -0
  247. data/lib/storytime/post_notifier.rb +19 -0
  248. data/lib/storytime/post_url_handler.rb +47 -0
  249. data/lib/storytime/storytime_helpers.rb +12 -0
  250. data/lib/storytime/version.rb +1 -1
  251. data/lib/storytime.rb +57 -56
  252. data/screenshots/admin.png +0 -0
  253. data/screenshots/media.png +0 -0
  254. data/screenshots/page-list.png +0 -0
  255. data/screenshots/post-editor.png +0 -0
  256. data/screenshots/site-settings.png +0 -0
  257. data/screenshots/text-snippets.png +0 -0
  258. data/screenshots/user-management.png +0 -0
  259. data/spec/controllers/dashboard_controller_spec.rb +3 -1
  260. data/{app/assets/stylesheets/storytime/subscriptions.css.scss → spec/dummy/app/assets/images/.keep} +0 -0
  261. data/spec/dummy/app/assets/javascripts/application.js +3 -0
  262. data/spec/dummy/app/controllers/application_controller.rb +5 -1
  263. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  264. data/spec/dummy/app/controllers/storytime_admin/widgets_controller.rb +5 -0
  265. data/spec/dummy/app/mailers/.keep +0 -0
  266. data/spec/dummy/app/models/.keep +0 -0
  267. data/spec/dummy/app/models/concerns/.keep +0 -0
  268. data/spec/dummy/app/models/user.rb +5 -1
  269. data/spec/dummy/app/models/video_post.rb +2 -0
  270. data/spec/dummy/app/models/widget.rb +3 -0
  271. data/spec/dummy/app/views/layouts/application.html.erb +1 -1
  272. data/spec/dummy/app/views/storytime/dashboard/posts/_video_post_fields.html.erb +1 -0
  273. data/spec/dummy/app/views/widgets/storytime/dashboard/admin/_headers.html.erb +1 -0
  274. data/spec/dummy/app/views/widgets/storytime/dashboard/admin/_row.html.erb +1 -0
  275. data/spec/dummy/config/database.yml +9 -5
  276. data/spec/dummy/config/environments/test.rb +1 -0
  277. data/spec/dummy/config/initializers/devise.rb +1 -1
  278. data/spec/dummy/config/initializers/session_store.rb +1 -1
  279. data/spec/dummy/config/initializers/storytime.rb +7 -14
  280. data/spec/dummy/db/development.sqlite3 +0 -0
  281. data/spec/dummy/db/migrate/20150127172846_create_widgets.rb +9 -0
  282. data/spec/dummy/db/migrate/20150206203824_add_video_url_to_storytime_posts.rb +5 -0
  283. data/spec/dummy/db/schema.rb +76 -21
  284. data/spec/dummy/db/test.sqlite3 +0 -0
  285. data/spec/dummy/lib/assets/.keep +0 -0
  286. data/spec/dummy/log/.keep +0 -0
  287. data/spec/factories/comment_factories.rb +1 -0
  288. data/spec/factories/membership_factories.rb +7 -0
  289. data/spec/factories/site_factories.rb +3 -2
  290. data/spec/factories/user_factories.rb +3 -3
  291. data/spec/factories/widget_factories.rb +5 -0
  292. data/spec/features/blogs_spec.rb +28 -0
  293. data/spec/features/comments_spec.rb +8 -9
  294. data/spec/features/dashboard/media_spec.rb +14 -30
  295. data/spec/features/dashboard/memberships_spec.rb +58 -0
  296. data/spec/features/dashboard/pages_spec.rb +67 -44
  297. data/spec/features/dashboard/posts_spec.rb +84 -62
  298. data/spec/features/dashboard/sites_spec.rb +28 -23
  299. data/spec/features/dashboard/snippets_spec.rb +44 -44
  300. data/spec/features/dashboard/subscription_spec.rb +36 -28
  301. data/spec/features/dashboard/users_spec.rb +48 -29
  302. data/spec/features/pages_spec.rb +2 -2
  303. data/spec/features/posts_spec.rb +2 -20
  304. data/spec/features/subscription_spec.rb +4 -4
  305. data/spec/models/post_spec.rb +26 -17
  306. data/spec/policies/comment_policy_spec.rb +22 -6
  307. data/spec/policies/post_policy_spec.rb +21 -3
  308. data/spec/requests/routings_spec.rb +27 -17
  309. data/spec/spec_helper.rb +12 -1
  310. data/spec/support/database_cleaner.rb +5 -5
  311. data/spec/support/domains.rb +18 -0
  312. data/spec/support/feature_macros.rb +18 -9
  313. data/storytime.gemspec +59 -0
  314. data/vendor/assets/javascripts/.DS_Store +0 -0
  315. data/vendor/assets/javascripts/codemirror/modes/css.js +717 -0
  316. data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +120 -0
  317. data/vendor/assets/javascripts/codemirror/modes/javascript.js +686 -0
  318. data/vendor/assets/javascripts/codemirror/modes/liquid.js +40 -0
  319. data/vendor/assets/javascripts/codemirror/modes/overlay.js +85 -0
  320. data/vendor/assets/javascripts/codemirror/{xml.js → modes/xml.js} +2 -2
  321. data/vendor/assets/javascripts/medium-editor.min.js +2450 -0
  322. data/vendor/assets/javascripts/phantom_js_bind_polyfill.js +24 -0
  323. data/vendor/assets/javascripts/tidy.js +30 -0
  324. data/vendor/assets/stylesheets/.DS_Store +0 -0
  325. data/vendor/assets/stylesheets/chosen-bootstrap-3.css +148 -0
  326. data/vendor/assets/stylesheets/{chosen.css.scss → chosen.scss} +1 -1
  327. data/vendor/assets/stylesheets/disable-transitions-for-test-env.css +7 -0
  328. data/vendor/assets/stylesheets/medium-editor-default.min.css +1 -0
  329. data/vendor/assets/stylesheets/medium-editor.min.css +1 -0
  330. metadata +297 -47
  331. data/app/assets/stylesheets/storytime/admin.css.scss +0 -121
  332. data/app/assets/stylesheets/storytime/application.css.scss +0 -22
  333. data/app/assets/stylesheets/storytime/layout.css.scss +0 -17
  334. data/app/assets/stylesheets/storytime/media.css.scss +0 -68
  335. data/app/assets/stylesheets/storytime/pagination.css.scss +0 -4
  336. data/app/assets/stylesheets/storytime/posts.css.scss +0 -30
  337. data/app/assets/stylesheets/storytime/versions.css.scss +0 -21
  338. data/app/helpers/storytime/dashboard/posts_helper.rb +0 -21
  339. data/app/views/storytime/blog_posts/_blog_post.html.erb +0 -8
  340. data/app/views/storytime/dashboard/posts/_basic_new_post_button.html.erb +0 -3
  341. data/app/views/storytime/dashboard/posts/_new_post_dropdown_button.html.erb +0 -10
  342. data/app/views/storytime/dashboard/sites/edit.html.erb +0 -25
  343. data/app/views/storytime/dashboard/snippets/_list.html.erb +0 -21
  344. data/app/views/storytime/dashboard/snippets/edit.html.erb +0 -13
  345. data/app/views/storytime/dashboard/snippets/index.html.erb +0 -13
  346. data/app/views/storytime/dashboard/snippets/new.html.erb +0 -12
  347. data/app/views/storytime/dashboard/subscriptions/edit.html.erb +0 -10
  348. data/app/views/storytime/dashboard/subscriptions/index.html.erb +0 -19
  349. data/app/views/storytime/dashboard/subscriptions/new.html.erb +0 -9
  350. data/app/views/storytime/dashboard/users/_user.html.erb +0 -11
  351. data/app/views/storytime/dashboard/users/edit.html.erb +0 -10
  352. data/app/views/storytime/dashboard/users/index.html.erb +0 -22
  353. data/app/views/storytime/dashboard/users/new.html.erb +0 -11
  354. data/spec/lib/storytime_spec.rb +0 -23
  355. data/vendor/assets/javascripts/codemirror/codemirror.js +0 -7831
  356. data/vendor/assets/javascripts/summernote.js +0 -5338
  357. data/vendor/assets/stylesheets/codemirror/codemirror.css +0 -309
  358. data/vendor/assets/stylesheets/codemirror/monokai.css +0 -31
  359. data/vendor/assets/stylesheets/summernote.css +0 -1
@@ -19,6 +19,7 @@ Rails.application.configure do
19
19
  config.assets.debug = true
20
20
 
21
21
  config.assets.precompile << %r(storytime/bootstrap/glyphicons-halflings-regular\.(?:eot|svg|ttf|woff)$)
22
+ config.assets.precompile << %w(phantom_js_bind_polyfill.js disable-transitions-for-test-env.css)
22
23
 
23
24
  # Show full error reports and disable caching.
24
25
  config.consider_all_requests_local = true
@@ -4,7 +4,7 @@ Devise.setup do |config|
4
4
  # The secret key used by Devise. Devise uses this key to generate
5
5
  # random tokens. Changing this key will render invalid all existing
6
6
  # confirmation, reset password and unlock tokens in the database.
7
- # config.secret_key = '6ddb7b0fdefdf873e82d00d546b308945e95fc6384d00983b9d2ef9d90b9af4bdaa8f2cf815df7c2d469021f5c7b1e9202f3cee7856e1299550296bd858f1cbd'
7
+ config.secret_key = Rails.application.secrets.secret_key_base
8
8
 
9
9
  # ==> Mailer Configuration
10
10
  # Configure the e-mail address which will be shown in Devise::Mailer,
@@ -1,3 +1,3 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- Rails.application.config.session_store :cookie_store, key: '_dummy_session'
3
+ Rails.application.config.session_store :cookie_store, key: '_dummy_session', domain: :all
@@ -1,9 +1,4 @@
1
1
  Storytime.configure do |config|
2
- # Name of the layout to be used. e.g. the 'application'
3
- # layout uses /app/views/layout/application, in your
4
- # host app, as the layout.
5
- # config.layout = 'application'
6
-
7
2
  # Name of the model you're using for Storytime users.
8
3
  config.user_class = 'User'
9
4
 
@@ -11,14 +6,10 @@ Storytime.configure do |config|
11
6
  # Storytime's mount point within the host app.
12
7
  # config.dashboard_namespace_path = "/storytime"
13
8
 
14
- # Path of Storytime's home page, relative to
15
- # Storytime's mount point within the host app.
16
- # config.home_page_path = "/"
17
-
18
9
  # Add custom post types to use within Storytime.
19
10
  # Make sure that the custom post types inherit the
20
11
  # from the Storytime::Post class.
21
- # config.post_types += ['CustomPostType']
12
+ config.post_types += ['VideoPost']
22
13
 
23
14
  # Character limit for Storytime::Post.title <= 255
24
15
  # config.post_title_character_limit = 255
@@ -26,14 +17,16 @@ Storytime.configure do |config|
26
17
  # Character limit for Storytime::Post.excerpt
27
18
  # config.post_excerpt_character_limit = 500
28
19
 
29
- # Array of tags to allow from the Summernote WYSIWYG Editor.
30
- # An empty array or nil setting will allow all tags.
31
- # config.whitelisted_html_tags = %w(p blockquote pre h1 h2 h3 h4 h5 h6 span ul li ol table tbody td br a img iframe hr)
32
-
33
20
  # Enable Disqus comments using your forum's shortname,
34
21
  # the unique identifier for your website as registered on Disqus.
35
22
  # config.disqus_forum_shortname = ""
36
23
 
24
+ # Enable Discourse comments using your discourse server,
25
+ # Your discourse server must be configured for embedded comments.
26
+ # e.g. config.discourse_name = "http://forum.example.com/"
27
+ # NOTE: include the '/' suffix at the end of the url
28
+ # config.discourse_name = ""
29
+
37
30
  # Search adapter to use for searching through Storytime Posts or
38
31
  # Post subclasses. Options for the search adapter include:
39
32
  # Storytime::PostgresSearchAdapter, Storytime::MysqlSearchAdapter,
Binary file
@@ -0,0 +1,9 @@
1
+ class CreateWidgets < ActiveRecord::Migration
2
+ def change
3
+ create_table :widgets do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ class AddVideoUrlToStorytimePosts < ActiveRecord::Migration
2
+ def change
3
+ add_column :storytime_posts, :video_url, :string
4
+ end
5
+ end
@@ -11,8 +11,12 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20150129215308) do
15
- create_table "friendly_id_slugs", force: true do |t|
14
+ ActiveRecord::Schema.define(version: 20150402161427) do
15
+
16
+ # These are extensions that must be enabled in order to support this database
17
+ enable_extension "plpgsql"
18
+
19
+ create_table "friendly_id_slugs", force: :cascade do |t|
16
20
  t.string "slug", null: false
17
21
  t.integer "sluggable_id", null: false
18
22
  t.string "sluggable_type", limit: 50
@@ -25,54 +29,76 @@ ActiveRecord::Schema.define(version: 20150129215308) do
25
29
  add_index "friendly_id_slugs", ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id"
26
30
  add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type"
27
31
 
28
- create_table "storytime_actions", force: true do |t|
32
+ create_table "storytime_actions", force: :cascade do |t|
29
33
  t.string "name"
30
34
  t.string "guid"
31
35
  t.datetime "created_at"
32
36
  t.datetime "updated_at"
33
37
  end
34
38
 
35
- create_table "storytime_autosaves", force: true do |t|
39
+ add_index "storytime_actions", ["guid"], name: "index_storytime_actions_on_guid"
40
+
41
+ create_table "storytime_autosaves", force: :cascade do |t|
36
42
  t.text "content"
37
43
  t.integer "autosavable_id"
38
44
  t.string "autosavable_type"
39
45
  t.datetime "created_at"
40
46
  t.datetime "updated_at"
47
+ t.integer "site_id"
41
48
  end
42
49
 
43
50
  add_index "storytime_autosaves", ["autosavable_type", "autosavable_id"], name: "autosavable_index"
51
+ add_index "storytime_autosaves", ["site_id"], name: "index_storytime_autosaves_on_site_id"
44
52
 
45
- create_table "storytime_comments", force: true do |t|
53
+ create_table "storytime_comments", force: :cascade do |t|
46
54
  t.text "content"
47
55
  t.integer "user_id"
48
56
  t.integer "post_id"
49
57
  t.datetime "created_at"
50
58
  t.datetime "updated_at"
59
+ t.integer "site_id"
51
60
  end
52
61
 
53
62
  add_index "storytime_comments", ["post_id"], name: "index_storytime_comments_on_post_id"
63
+ add_index "storytime_comments", ["site_id"], name: "index_storytime_comments_on_site_id"
54
64
  add_index "storytime_comments", ["user_id"], name: "index_storytime_comments_on_user_id"
55
65
 
56
- create_table "storytime_media", force: true do |t|
66
+ create_table "storytime_media", force: :cascade do |t|
57
67
  t.string "file"
58
68
  t.integer "user_id"
59
69
  t.datetime "created_at"
60
70
  t.datetime "updated_at"
71
+ t.integer "site_id"
61
72
  end
62
73
 
74
+ add_index "storytime_media", ["site_id"], name: "index_storytime_media_on_site_id"
63
75
  add_index "storytime_media", ["user_id"], name: "index_storytime_media_on_user_id"
64
76
 
65
- create_table "storytime_permissions", force: true do |t|
77
+ create_table "storytime_memberships", force: :cascade do |t|
78
+ t.integer "user_id"
79
+ t.integer "storytime_role_id"
80
+ t.integer "site_id"
81
+ t.datetime "created_at"
82
+ t.datetime "updated_at"
83
+ end
84
+
85
+ add_index "storytime_memberships", ["site_id"], name: "index_storytime_memberships_on_site_id"
86
+ add_index "storytime_memberships", ["storytime_role_id"], name: "index_storytime_memberships_on_storytime_role_id"
87
+ add_index "storytime_memberships", ["user_id"], name: "index_storytime_memberships_on_user_id"
88
+
89
+ create_table "storytime_permissions", force: :cascade do |t|
66
90
  t.integer "role_id"
67
91
  t.integer "action_id"
68
92
  t.datetime "created_at"
69
93
  t.datetime "updated_at"
94
+ t.integer "site_id"
70
95
  end
71
96
 
72
97
  add_index "storytime_permissions", ["action_id"], name: "index_storytime_permissions_on_action_id"
73
98
  add_index "storytime_permissions", ["role_id"], name: "index_storytime_permissions_on_role_id"
99
+ add_index "storytime_permissions", ["site_id"], name: "index_storytime_permissions_on_site_id"
74
100
 
75
- create_table "storytime_posts", force: true do |t|
101
+ create_table "storytime_posts", force: :cascade do |t|
76
102
  t.integer "user_id"
77
103
  t.string "type"
78
104
  t.string "title"
@@ -81,40 +107,58 @@ ActiveRecord::Schema.define(version: 20150129215308) do
81
107
  t.text "excerpt"
82
108
  t.datetime "published_at"
83
109
  t.integer "featured_media_id"
84
- t.boolean "featured", default: false
110
+ t.boolean "featured", default: false
85
111
  t.datetime "created_at"
86
112
  t.datetime "updated_at"
113
+ t.string "video_url"
87
114
  t.integer "secondary_media_id"
115
+ t.integer "site_id"
116
+ t.boolean "notifications_enabled", default: false
117
+ t.datetime "notifications_sent_at"
118
+ t.integer "blog_id"
88
119
  end
89
120
 
121
+ add_index "storytime_posts", ["blog_id"], name: "index_storytime_posts_on_blog_id"
122
+ add_index "storytime_posts", ["slug"], name: "index_storytime_posts_on_slug"
90
123
  add_index "storytime_posts", ["user_id"], name: "index_storytime_posts_on_user_id"
91
124
 
92
- create_table "storytime_roles", force: true do |t|
125
+ create_table "storytime_roles", force: :cascade do |t|
93
126
  t.string "name"
94
127
  t.datetime "created_at"
95
128
  t.datetime "updated_at"
96
129
  end
97
130
 
98
- create_table "storytime_sites", force: true do |t|
131
+ add_index "storytime_roles", ["name"], name: "index_storytime_roles_on_name"
132
+
133
+ create_table "storytime_sites", force: :cascade do |t|
99
134
  t.string "title"
100
- t.integer "post_slug_style", default: 0
135
+ t.integer "post_slug_style", default: 0
101
136
  t.string "ga_tracking_id"
102
- t.integer "root_page_content", default: 0
103
137
  t.integer "root_post_id"
104
138
  t.datetime "created_at"
105
139
  t.datetime "updated_at"
140
+ t.string "subscription_email_from"
141
+ t.string "layout"
142
+ t.string "disqus_forum_shortname"
143
+ t.integer "user_id"
144
+ t.string "custom_domain"
145
+ t.string "discourse_name"
106
146
  end
107
147
 
108
148
  add_index "storytime_sites", ["root_post_id"], name: "index_storytime_sites_on_root_post_id"
149
+ add_index "storytime_sites", ["user_id"], name: "index_storytime_sites_on_user_id"
109
150
 
110
- create_table "storytime_snippets", force: true do |t|
151
+ create_table "storytime_snippets", force: :cascade do |t|
111
152
  t.string "name"
112
153
  t.text "content"
113
154
  t.datetime "created_at"
114
155
  t.datetime "updated_at"
156
+ t.integer "site_id"
115
157
  end
116
158
 
117
- create_table "storytime_subscriptions", force: true do |t|
159
+ add_index "storytime_snippets", ["name"], name: "index_storytime_snippets_on_name"
160
+
161
+ create_table "storytime_subscriptions", force: :cascade do |t|
118
162
  t.string "email"
119
163
  t.boolean "subscribed", default: true
120
164
  t.string "token"
@@ -123,35 +167,42 @@ ActiveRecord::Schema.define(version: 20150129215308) do
123
167
  t.integer "site_id"
124
168
  end
125
169
 
126
- create_table "storytime_taggings", force: true do |t|
170
+ add_index "storytime_subscriptions", ["token"], name: "index_storytime_subscriptions_on_token"
171
+
172
+ create_table "storytime_taggings", force: :cascade do |t|
127
173
  t.integer "tag_id"
128
174
  t.integer "post_id"
129
175
  t.datetime "created_at"
130
176
  t.datetime "updated_at"
177
+ t.integer "site_id"
131
178
  end
132
179
 
133
180
  add_index "storytime_taggings", ["post_id"], name: "index_storytime_taggings_on_post_id"
181
+ add_index "storytime_taggings", ["site_id"], name: "index_storytime_taggings_on_site_id"
134
182
  add_index "storytime_taggings", ["tag_id"], name: "index_storytime_taggings_on_tag_id"
135
183
 
136
- create_table "storytime_tags", force: true do |t|
184
+ create_table "storytime_tags", force: :cascade do |t|
137
185
  t.string "name"
138
186
  t.datetime "created_at"
139
187
  t.datetime "updated_at"
188
+ t.integer "site_id"
140
189
  end
141
190
 
142
- create_table "storytime_versions", force: true do |t|
191
+ create_table "storytime_versions", force: :cascade do |t|
143
192
  t.text "content"
144
193
  t.integer "user_id"
145
194
  t.integer "versionable_id"
146
195
  t.string "versionable_type"
147
196
  t.datetime "created_at"
148
197
  t.datetime "updated_at"
198
+ t.integer "site_id"
149
199
  end
150
200
 
201
+ add_index "storytime_versions", ["site_id"], name: "index_storytime_versions_on_site_id"
151
202
  add_index "storytime_versions", ["user_id"], name: "index_storytime_versions_on_user_id"
152
203
  add_index "storytime_versions", ["versionable_type", "versionable_id"], name: "versionable_index"
153
204
 
154
- create_table "users", force: true do |t|
205
+ create_table "users", force: :cascade do |t|
155
206
  t.string "email", default: "", null: false
156
207
  t.string "encrypted_password", default: "", null: false
157
208
  t.string "reset_password_token"
@@ -164,12 +215,16 @@ ActiveRecord::Schema.define(version: 20150129215308) do
164
215
  t.string "last_sign_in_ip"
165
216
  t.datetime "created_at"
166
217
  t.datetime "updated_at"
167
- t.integer "storytime_role_id"
168
218
  t.string "storytime_name"
169
219
  end
170
220
 
171
221
  add_index "users", ["email"], name: "index_users_on_email", unique: true
172
222
  add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
173
- add_index "users", ["storytime_role_id"], name: "index_users_on_storytime_role_id"
223
+
224
+ create_table "widgets", force: :cascade do |t|
225
+ t.string "name"
226
+ t.datetime "created_at"
227
+ t.datetime "updated_at"
228
+ end
174
229
 
175
230
  end
Binary file
File without changes
File without changes
@@ -3,5 +3,6 @@ FactoryGirl.define do
3
3
  user
4
4
  post
5
5
  sequence(:content) { |i| "Comment ##{i}" }
6
+ site
6
7
  end
7
8
  end
@@ -0,0 +1,7 @@
1
+ FactoryGirl.define do
2
+ factory :membership, class: Storytime::Membership do
3
+ association :user, factory: :user
4
+ association :site, factory: :site
5
+ storytime_role { Storytime::Role.find_by(name: "writer") }
6
+ end
7
+ end
@@ -1,7 +1,8 @@
1
1
  FactoryGirl.define do
2
2
  factory :site, class: Storytime::Site do
3
3
  sequence(:title) {|i| "Site Title #{i}"}
4
+ subscription_email_from "notifications@site.com"
5
+ sequence(:custom_domain){|i| "site-#{i}.lvh.me" }
4
6
  post_slug_style 0
5
- root_page_content 0
6
7
  end
7
- end
8
+ end
@@ -5,15 +5,15 @@ FactoryGirl.define do
5
5
  sequence(:storytime_name) { |i| "user name #{i}" }
6
6
 
7
7
  factory :writer do
8
- before(:create){|user| user.storytime_role = Storytime::Role.find_by(name: "writer") }
8
+ after(:create){|user| user.storytime_memberships.create(site: @current_site, storytime_role: Storytime::Role.find_by(name: "writer")) }
9
9
  end
10
10
 
11
11
  factory :editor do
12
- before(:create){|user| user.storytime_role = Storytime::Role.find_by(name: "editor") }
12
+ after(:create){|user| user.storytime_memberships.create(site: @current_site, storytime_role: Storytime::Role.find_by(name: "editor")) }
13
13
  end
14
14
 
15
15
  factory :admin do
16
- before(:create){|user| user.storytime_role = Storytime::Role.find_by(name: "admin") }
16
+ after(:create){|user| user.storytime_memberships.create(site: @current_site, storytime_role: Storytime::Role.find_by(name: "admin")) }
17
17
  end
18
18
  end
19
19
  end
@@ -0,0 +1,5 @@
1
+ FactoryGirl.define do
2
+ factory :widget do
3
+ name "Widget Name"
4
+ end
5
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Blogs" do
4
+ before do
5
+ setup_site(FactoryGirl.create(:admin))
6
+ end
7
+
8
+ it "lists posts belonging to that blog" do
9
+ 3.times{ FactoryGirl.create(:post, blog: @current_site.blogs.first, site: @current_site) }
10
+ other_blog_post = FactoryGirl.create(:post, site: @current_site)
11
+ static_page = FactoryGirl.create(:page, site: @current_site)
12
+ visit url_for([@current_site.blogs.first, only_path: true])
13
+
14
+ within ".post-list" do
15
+ @current_site.blogs.first.posts.each do |p|
16
+ page.should have_content(p.title)
17
+ page.should have_content(p.excerpt)
18
+ page.should_not have_content(p.content)
19
+ end
20
+
21
+ expect(page).not_to have_content(static_page.title)
22
+ expect(page).not_to have_content(static_page.excerpt)
23
+
24
+ expect(page).not_to have_content(other_blog_post.title)
25
+ expect(page).not_to have_content(other_blog_post.excerpt)
26
+ end
27
+ end
28
+ end
@@ -2,14 +2,14 @@ require 'spec_helper'
2
2
 
3
3
  describe "Comments" do
4
4
  before do
5
- setup_site
5
+ # setup_site
6
6
  login
7
7
  end
8
8
 
9
9
  it "lists comments on a post" do
10
- post = FactoryGirl.create(:post)
11
- 3.times{ FactoryGirl.create(:comment, post: post) }
12
- other_post_comment = FactoryGirl.create(:comment)
10
+ post = FactoryGirl.create(:post, site: @current_site, blog: @current_site.blogs.first)
11
+ 3.times{ FactoryGirl.create(:comment, post: post, site: @current_site) }
12
+ other_post_comment = FactoryGirl.create(:comment, site: @current_site)
13
13
 
14
14
  visit url_for([post, only_path: true])
15
15
 
@@ -22,7 +22,7 @@ describe "Comments" do
22
22
  end
23
23
 
24
24
  it "creates a comment" do
25
- post = FactoryGirl.create(:post)
25
+ post = FactoryGirl.create(:post, site: @current_site, blog: @current_site.blogs.first)
26
26
  comment_count = post.comments.count
27
27
 
28
28
  visit url_for([post, only_path: true])
@@ -38,14 +38,13 @@ describe "Comments" do
38
38
  end
39
39
 
40
40
  it "deletes a comment", js: true do
41
- post = FactoryGirl.create(:post)
42
- other_persons_comment = FactoryGirl.create(:comment, post: post)
43
- comment_to_delete = FactoryGirl.create(:comment, post: post, user: current_user)
41
+ post = FactoryGirl.create(:post, site: @current_site, blog: @current_site.blogs.first)
42
+ other_persons_comment = FactoryGirl.create(:comment, post: post, site: @current_site)
43
+ comment_to_delete = FactoryGirl.create(:comment, post: post, user: current_user, site: @current_site)
44
44
 
45
45
  visit url_for([post, only_path: true])
46
46
 
47
47
  expect(page).to have_content(other_persons_comment.content)
48
- expect(page).to_not have_link("delete_comment_#{other_persons_comment.id}")
49
48
 
50
49
  expect(page).to have_content(comment_to_delete.content)
51
50
  click_link "delete_comment_#{comment_to_delete.id}"
@@ -3,30 +3,19 @@ require 'spec_helper'
3
3
  describe "In the dashboard, Media" do
4
4
  include Storytime::Dashboard::MediaHelper
5
5
 
6
- # needed because our wysiwyg text area is hidden
7
- def wait_until
8
- require "timeout"
9
- Timeout.timeout(Capybara.default_wait_time + 5) do
10
- sleep(0.1) until value = yield
11
- value
12
- end
13
- end
14
-
15
- before{ login }
6
+ before{ login_admin }
16
7
 
17
8
  it "creates media", js: true do
18
9
  visit dashboard_media_index_path
19
10
 
20
11
  attach_file('media_file', "./spec/support/images/success-kid.jpg")
21
-
22
- page.should have_selector("#media_gallery img")
23
- media = Storytime::Media.last
24
- page.should have_image(media.file_url(:thumb))
12
+
13
+ expect(find("#media_gallery").find("img")['src']).to have_content('success-kid.jpg')
25
14
  end
26
15
 
27
16
  it "shows a gallery of the user's images" do
28
- m1 = FactoryGirl.create(:media)
29
- m2 = FactoryGirl.create(:media)
17
+ m1 = FactoryGirl.create(:media, site: @current_site)
18
+ m2 = FactoryGirl.create(:media, site: @current_site)
30
19
 
31
20
  visit dashboard_media_index_path
32
21
 
@@ -35,7 +24,7 @@ describe "In the dashboard, Media" do
35
24
  end
36
25
 
37
26
  it "deletes an image", js: true do
38
- image = FactoryGirl.create(:media)
27
+ image = FactoryGirl.create(:media, site: @current_site)
39
28
 
40
29
  visit dashboard_media_index_path
41
30
  page.should have_image(image.file_url(:thumb))
@@ -43,25 +32,20 @@ describe "In the dashboard, Media" do
43
32
  click_link "delete_media_#{image.id}"
44
33
 
45
34
  page.should_not have_image(image)
46
-
47
- expect{ image.reload }.to raise_error
48
35
  end
49
36
 
50
37
  it "inserts media into post", js: true do
51
- media = FactoryGirl.create(:media)
52
-
53
- visit url_for([:new, :dashboard, :post, type: Storytime::BlogPost.type_name, only_path: true])
54
-
55
- page.should have_selector("button[data-event='showImageDialog']")
56
- find("button[data-event='showImageDialog']").click
38
+ media = FactoryGirl.create(:media, site: @current_site)
57
39
 
58
- page.should have_selector(".note-image-dialog")
59
- find(".insert-image-button").click
40
+ visit url_for([:new, :dashboard, @current_site.blogs.first, :blog_post, only_path: true])
60
41
 
61
- page.should_not have_selector(".note-image-dialog")
42
+ find(".insert-media-button").click
43
+
44
+ within "#media_#{media.id}" do
45
+ find(".insert-image-button").click
46
+ end
62
47
 
63
- summernote_html = page.evaluate_script("$('.note-editable').html()")
64
- summernote_html.should =~ /#{media.file_url}/
48
+ expect(page).to have_image(media.file_url)
65
49
  end
66
50
 
67
51
  end
@@ -0,0 +1,58 @@
1
+ require 'spec_helper'
2
+
3
+ describe "In the dashboard, Users" do
4
+ context "as Admin" do
5
+ before{ login_admin }
6
+
7
+ it "provides links to all the sites where the user has a membership", js: true do
8
+ other_site = FactoryGirl.create(:site)
9
+ membership = FactoryGirl.create(:membership, user: @current_user, site: other_site)
10
+
11
+ visit storytime.dashboard_path
12
+
13
+ click_link @current_site.title
14
+
15
+ expect(page).to have_link(@current_site.title, href: "")
16
+ expect(page).to have_link(other_site.title, href: storytime.dashboard_url(host: other_site.custom_domain, port: Capybara.current_session.server.port))
17
+ end
18
+
19
+ it "lists users for a site", js: true do
20
+ FactoryGirl.create_list(:user, 3)
21
+
22
+ Storytime.user_class.all.each do |user|
23
+ user.storytime_memberships.create(site: @current_site, storytime_role: Storytime::Role.find_by(name: "writer"))
24
+ end
25
+
26
+ visit storytime.dashboard_path
27
+ click_link "utility-menu-toggle"
28
+ click_link "users-link"
29
+
30
+ Storytime.user_class.all.each do |u|
31
+ expect(page).to have_content u.storytime_name
32
+ end
33
+ end
34
+
35
+ it "deletes a user from the site", js: true do
36
+ user = FactoryGirl.create(:user)
37
+ membership = user.storytime_memberships.create(site: @current_site, storytime_role: Storytime::Role.find_by(name: "writer"))
38
+
39
+ user_count = Storytime.user_class.count
40
+ membership_count = Storytime::Membership.count
41
+
42
+ visit storytime.dashboard_path
43
+ click_link "utility-menu-toggle"
44
+ click_link "users-link"
45
+
46
+ expect(page).to have_content(user.storytime_name)
47
+
48
+ find("#membership_#{membership.id}").hover
49
+ click_link("delete_membership_#{membership.id}")
50
+
51
+ expect(page).to_not have_content(user.storytime_name)
52
+
53
+ expect(Storytime.user_class.count).to eq(user_count)
54
+ expect(Storytime::Membership.count).to eq(membership_count-1)
55
+ end
56
+
57
+ end
58
+ end