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
@@ -1,45 +1,74 @@
1
- require 'pundit'
1
+ require 'active_record'
2
2
  require 'bootstrap-sass'
3
+ require 'carrierwave'
4
+ require 'fog/aws/storage'
5
+ require 'font-awesome-sass'
6
+ require 'friendly_id'
7
+ require 'jbuilder'
3
8
  require 'jquery-rails'
4
9
  require 'jquery-ui-rails'
5
- require 'jbuilder'
6
10
  require 'kaminari'
7
- require 'simple_form'
8
- require 'friendly_id'
9
- require 'fog/aws/storage'
10
- require 'carrierwave'
11
+ require 'leather'
11
12
  require 'nokogiri'
12
- require 'font-awesome-sass'
13
+ require 'pundit'
14
+ require 'simple_form'
15
+ require 'codemirror-rails'
16
+ require 'storytime_admin'
13
17
 
14
18
  require 'storytime/concerns/has_versions'
15
19
  require 'storytime/concerns/storytime_user'
16
20
  require 'storytime/concerns/controller_content_for'
21
+ require 'storytime/concerns/current_site'
22
+ require 'storytime/constraints/blog_homepage_constraint'
23
+ require 'storytime/constraints/page_homepage_constraint'
24
+ require 'storytime/constraints/blog_constraint'
25
+ require 'storytime/constraints/page_constraint'
17
26
  require 'storytime/controller_helpers'
18
-
27
+ require 'storytime/post_url_handler'
19
28
  require 'storytime/importers/importer'
20
29
  require 'storytime/importers/wordpress'
30
+ require 'storytime/migrators/v1'
21
31
 
22
32
  module Storytime
23
33
  class Engine < ::Rails::Engine
24
34
  isolate_namespace Storytime
25
35
 
36
+ initializer "storytime.view_helpers" do
37
+ ActiveSupport.on_load(:action_view) do
38
+ include Storytime::ApplicationHelper
39
+ include Storytime::StorytimeHelpers
40
+ end
41
+ end
42
+
26
43
  initializer "storytime.controller_helpers" do
27
44
  ActiveSupport.on_load(:action_controller) do
28
45
  include Storytime::ControllerHelpers
29
-
46
+ include Storytime::Concerns::CurrentSite
47
+ helper_method :current_storytime_site
48
+
30
49
  helper Storytime::SubscriptionsHelper
31
50
  end
32
51
  end
33
52
 
34
- # putting this here rather than config/initializers so that Storytime is configured before getting here
53
+ # Register all decorators from app/decorators/
54
+ initializer "storytime.decorators" do
55
+ config.to_prepare do
56
+ Dir.glob(Rails.root + "app/decorators/**/*_decorator*.rb").each do |c|
57
+ require_dependency(c)
58
+ end
59
+ end
60
+ end
61
+
62
+ # putting this here rather than config/initializers so that Storytime is configured before getting there
35
63
  initializer "storytime.configure_carrierwave" do
36
64
  CarrierWave.configure do |config|
37
65
  if Storytime.media_storage == :s3
38
66
  config.storage = :fog
39
67
  config.fog_credentials = {
40
68
  :provider => 'AWS',
41
- :aws_access_key_id => ENV['STORYTIME_AWS_ACCESS_KEY_ID'],
42
- :aws_secret_access_key => ENV['STORYTIME_AWS_SECRET_KEY']
69
+ :region => Storytime.aws_region,
70
+ :aws_access_key_id => Storytime.aws_access_key_id,
71
+ :aws_secret_access_key => Storytime.aws_secret_key
43
72
  }
44
73
  config.fog_directory = Storytime.s3_bucket
45
74
  config.fog_public = true
@@ -47,14 +76,14 @@ module Storytime
47
76
  else
48
77
  config.storage = :file
49
78
  end
50
-
79
+
51
80
  config.enable_processing = !Rails.env.test?
52
81
  end
53
82
  end
54
83
 
55
84
  initializer "storytime.register_default_post_types" do
56
85
  Storytime.configure do |config|
57
- config.post_types += ["Storytime::BlogPost", "Storytime::Page"]
86
+ config.post_types += ["Storytime::BlogPost", "Storytime::Page", "Storytime::Blog"]
58
87
  end
59
88
  end
60
89
  end
@@ -0,0 +1,45 @@
1
+ require 'thor/group'
2
+
3
+ module Storytime
4
+ module Generators
5
+ class Initializer < Thor::Group
6
+ include Thor::Actions
7
+
8
+ argument :settings, :type => :hash
9
+
10
+ class_option :force, :type => :boolean, :default => false
11
+
12
+ source_root File.expand_path('../../../generators/templates', __FILE__)
13
+
14
+ def set_local_assigns
15
+ @user_class = settings[:user_class]
16
+ @dashboard_namespace_path = settings[:dashboard_namespace_path]
17
+ @post_types = settings[:post_types]
18
+ @post_title_character_limit = settings[:post_title_character_limit]
19
+ @post_excerpt_character_limit = settings[:post_excerpt_character_limit]
20
+ @whitelisted_html_tags = settings[:whitelisted_html_tags]
21
+ @email_regexp = settings[:email_regexp]
22
+ @search_adapter = settings[:search_adapter]
23
+ @enable_file_upload = settings[:enable_file_upload]
24
+ @aws_region = settings[:aws_region]
25
+ @aws_access_key_id = settings[:aws_access_key_id]
26
+ @aws_secret_key = settings[:aws_secret_key]
27
+ @s3_bucket = settings[:s3_bucket]
28
+ @prod_media_storage = settings[:prod_media_storage]
29
+ @dev_media_storage = settings[:dev_media_storage]
30
+
31
+ @enable_user_class = settings[:enable_user_class]
32
+ @enable_dashboard_namespace_path = settings[:enable_dashboard_namespace_path]
33
+ @enable_post_types = settings[:enable_post_types]
34
+ @enable_post_title_character_limit = settings[:enable_post_title_character_limit]
35
+ @enable_post_excerpt_character_limit = settings[:enable_post_excerpt_character_limit]
36
+ @enable_email_regexp = settings[:enable_email_regexp]
37
+ @enable_search_adapter = settings[:enable_search_adapter]
38
+ end
39
+
40
+ def copy_initializer
41
+ template "storytime.rb", "config/initializers/storytime.rb"
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,122 @@
1
+ module Storytime
2
+ module Migrators
3
+ module V1
4
+ def self.create_user_memberships
5
+ Storytime.user_class.find_each do |user|
6
+ Storytime::Site.find_each do |site|
7
+ if user.storytime_role_id.present?
8
+ Storytime::Membership.create(site_id: site.id, user_id: user.id, storytime_role_id: user.storytime_role_id)
9
+ # set as site creator if site.user_id is blank and role is admin
10
+ if site.user_id.blank? && user.storytime_role_id == Storytime::Role.find_by(name: "admin").id
11
+ site.update_column "user_id", user.id
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+
18
+ def self.set_site_layout
19
+ Storytime::Site.find_each do |site|
20
+ site.update_column "layout", Storytime.layout
21
+ end
22
+ end
23
+
24
+ def self.add_site_id_to_media
25
+ Storytime::Media.find_each do |media|
26
+ if media.site_id.blank?
27
+ media.update_column("site_id", Storytime::Site.first.id)
28
+ end
29
+ end
30
+ end
31
+
32
+ def self.add_site_id_to_autosaves
33
+ Storytime::Autosave.find_each do |autosave|
34
+ if autosave.site_id.blank?
35
+ autosave.update_column("site_id", autosave.autosavable.site_id)
36
+ end
37
+ end
38
+ end
39
+
40
+ def self.add_site_id_to_comments
41
+ Storytime::Comment.find_each do |comment|
42
+ if comment.site_id.blank?
43
+ comment.update_column("site_id", comment.post.site_id)
44
+ end
45
+ end
46
+ end
47
+
48
+ def self.add_site_id_to_versions
49
+ Storytime::Version.find_each do |version|
50
+ if version.site_id.blank?
51
+ version.update_column("site_id", version.versionable.site_id)
52
+ end
53
+ end
54
+ end
55
+
56
+ def self.add_site_id_to_taggings
57
+ Storytime::Tagging.find_each do |tagging|
58
+ if tagging.site_id.blank?
59
+ tagging.update_column("site_id", tagging.post.site_id)
60
+ end
61
+ end
62
+ end
63
+
64
+ def self.add_site_id_to_posts
65
+ site = Storytime::Site.first
66
+ Storytime::Post.all.each do |post|
67
+ if post.site_id.blank?
68
+ post.update_attributes(site_id: site.id)
69
+ end
70
+ end
71
+ end
72
+
73
+ def self.add_site_id_to_snippets
74
+ site = Storytime::Site.first
75
+ Storytime::Snippet.all.each do |snippet|
76
+ if snippet.site_id.blank?
77
+ snippet.update_attributes(site_id: site.id)
78
+ end
79
+ end
80
+ end
81
+
82
+ def self.add_site_id_to_tags
83
+ site = Storytime::Site.first
84
+ Storytime::Tag.all.each do |tag|
85
+ if tag.site_id.blank?
86
+ tag.update_attributes(site_id: site.id)
87
+ end
88
+ end
89
+ end
90
+
91
+ def self.create_default_blog_for_sites
92
+ Storytime::Site.find_each do |site|
93
+ blog = site.blogs.new
94
+ blog.published_at = Time.now
95
+ blog.title = "Blog"
96
+ blog.draft_content = "Test"
97
+ blog.slug = "blog"
98
+ blog.user = Storytime.user_class.first
99
+ blog.save
100
+ if site.root_page_content == 0
101
+ site.homepage = blog
102
+ site.save
103
+ end
104
+ end
105
+ end
106
+
107
+ def self.transfer_posts_to_blogs
108
+ Storytime::BlogPost.reset_column_information
109
+
110
+ Storytime::Site.find_each do |site|
111
+ default_blog = site.blogs.first
112
+
113
+ Storytime::BlogPost.all.find_each do |post|
114
+ post.blog = default_blog
115
+ post.save
116
+ end
117
+ end
118
+ end
119
+
120
+ end
121
+ end
122
+ end
@@ -0,0 +1,19 @@
1
+ module Storytime
2
+ class PostNotifier
3
+ def self.send_notifications_for(post_id)
4
+ post = Storytime::Post.find_by(id: post_id)
5
+
6
+ return if post.nil?
7
+
8
+ unless post.notifications_sent_at
9
+ post.update_attributes(notifications_sent_at: Time.now)
10
+
11
+ post.site.active_email_subscriptions.each do |subscription|
12
+ mail = Storytime::SubscriptionMailer.new_post_email(post, subscription)
13
+
14
+ Rails::VERSION::MINOR < 2 ? mail.deliver : mail.deliver_now
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,47 @@
1
+ module Storytime
2
+ module PostUrlHandler
3
+
4
+ def self.handle_url(options)
5
+ return unless options[:controller] == "storytime/posts" && options[:action] == "show"
6
+
7
+ key = [:id, :component_1, :component_2, :component_3].detect{|key| options[key].is_a?(Storytime::Post) }
8
+ post = options[key]
9
+
10
+ if post.is_a?(Storytime::Page)
11
+ options[:component_1] = nil
12
+ options[:id] = post
13
+ else
14
+ case post.site.post_slug_style
15
+ when "default"
16
+ options[:component_1] = "posts"
17
+ options[:id] = post
18
+ when "day_and_name"
19
+ date = post.created_at.to_date
20
+ options[:component_1] = date.strftime("%Y") # 4 digit year
21
+ options[:component_2] = date.strftime("%m") # 2 digit month
22
+ options[:component_3] = date.strftime("%d") # 2 digit day
23
+ options[:id] = post
24
+ when "month_and_name"
25
+ date = post.created_at.to_date
26
+ options[:component_1] = date.strftime("%Y") # 4 digit year
27
+ options[:component_2] = date.strftime("%m") # 2 digit month
28
+ options[:id] = post
29
+ when "post_id"
30
+ options[:component_1] = "posts"
31
+ options[:id] = post.id
32
+ end
33
+ end
34
+
35
+ end
36
+
37
+ def self.site(options)
38
+ if Storytime::Site.current_id.present?
39
+ Storytime::Site.find(Storytime::Site.current_id)
40
+ elsif options[:host]
41
+ Storytime::Site.find_by!(custom_domain: options[:host])
42
+ end
43
+ end
44
+
45
+
46
+ end
47
+ end
@@ -0,0 +1,12 @@
1
+ module Storytime
2
+ module StorytimeHelpers
3
+ def storytime_snippet(name)
4
+ snippet = Storytime::Snippet.find_by(name: name)
5
+ if snippet.nil?
6
+ ""
7
+ else
8
+ render partial: "storytime/snippets/snippet", locals: {snippet: snippet}
9
+ end
10
+ end
11
+ end
12
+ end
@@ -1,3 +1,3 @@
1
1
  module Storytime
2
- VERSION = "1.2.0"
2
+ VERSION = "2.0.0"
3
3
  end
data/lib/storytime.rb CHANGED
@@ -1,10 +1,14 @@
1
- require "storytime/engine"
2
- require "storytime/mysql_search_adapter"
3
- require "storytime/mysql_fulltext_search_adapter"
4
- require "storytime/postgres_search_adapter"
5
- require "storytime/sqlite3_search_adapter"
1
+ require 'rails'
2
+ require 'storytime/engine'
6
3
 
7
4
  module Storytime
5
+ autoload :MysqlSearchAdapter, 'storytime/mysql_search_adapter'
6
+ autoload :MysqlFulltextSearchAdapter, 'storytime/mysql_fulltext_search_adapter'
7
+ autoload :PostgresSearchAdapter, 'storytime/postgres_search_adapter'
8
+ autoload :Sqlite3SearchAdapter, 'storytime/sqlite3_search_adapter'
9
+ autoload :StorytimeHelpers, 'storytime/storytime_helpers'
10
+ autoload :PostNotifier, 'storytime/post_notifier'
11
+
8
12
  # Model to use for Storytime users.
9
13
  mattr_accessor :user_class
10
14
  @@user_class = 'User'
@@ -12,21 +16,12 @@ module Storytime
12
16
  # Path of Storytime's dashboard, relative to
13
17
  # Storytime's mount point within the host app.
14
18
  mattr_accessor :dashboard_namespace_path
15
- @@dashboard_namespace_path = "/storytime"
16
-
17
- # Path of Storytime's home page, relative to
18
- # Storytime's mount point within the host app.
19
- mattr_accessor :home_page_path
20
- @@home_page_path = "/"
19
+ @@dashboard_namespace_path = '/storytime'
21
20
 
22
21
  # Path used to sign users in.
23
22
  mattr_accessor :login_path
24
23
  @@login_path = '/users/sign_in'
25
24
 
26
- # Path used to log users out.
27
- mattr_accessor :logout_path
28
- @@logout_path = '/users/sign_out'
29
-
30
25
  # Method used for Storytime user logout path.
31
26
  mattr_accessor :logout_method
32
27
  @@logout_method = :delete
@@ -35,39 +30,74 @@ module Storytime
35
30
  mattr_accessor :enable_file_upload
36
31
  @@enable_file_upload = true
37
32
 
38
- # Character limit for Storytime::Post.title <= 255
33
+ # Character limit for Storytime::Post.title <= 100
39
34
  mattr_accessor :post_title_character_limit
40
- @@post_title_character_limit = 255
35
+ @@post_title_character_limit = 100
41
36
 
42
37
  # Character limit for Storytime::Post.excerpt
43
38
  mattr_accessor :post_excerpt_character_limit
44
39
  @@post_excerpt_character_limit = 500
45
40
 
46
- # Array of tags to allow from the Summernote WYSIWYG
47
- # Editor when editing Posts and custom post types.
48
- # An empty array, "", or nil setting will permit all tags.
49
- mattr_accessor :whitelisted_post_html_tags
50
- @@whitelisted_post_html_tags = []
41
+ # Hook for handling post content sanitization.
42
+ # Accepts either a Lambda or Proc which can be used to
43
+ # handle how post content is sanitized (i.e. which tags,
44
+ # HTML attributes to allow/disallow.
45
+ mattr_accessor :post_sanitizer
46
+ @@post_sanitizer = Proc.new do |draft_content|
47
+ white_list_sanitizer = if Rails::VERSION::MINOR <= 1
48
+ HTML::WhiteListSanitizer.new
49
+ else
50
+ Rails::Html::WhiteListSanitizer.new
51
+ end
52
+
53
+ attributes = %w(
54
+ id class href style src title width height alt value
55
+ target rel align disabled
56
+ )
57
+
58
+ white_list_sanitizer.sanitize(draft_content, attributes: attributes)
59
+ end
51
60
 
52
61
  # Enable Disqus comments using your forum's shortname,
53
62
  # the unique identifier for your website as registered on Disqus.
54
63
  mattr_accessor :disqus_forum_shortname
55
64
  @@disqus_forum_shortname = ""
56
65
 
66
+ # Enable Discourse comments using your discourse server,
67
+ # Your discourse server must be configured for embedded comments.
68
+ # NOTE: include the '/' suffix at the end of the url
69
+ # e.g. config.discourse_name = "http://forum.example.com"
70
+ mattr_accessor :discourse_name
71
+ @@discourse_name = ""
72
+
57
73
  # Email regex used to validate email format validity for subscriptions.
58
74
  mattr_accessor :email_regexp
59
75
  @@email_regexp = /\A[^@\s]+@([^@\s]+\.)+[^@\s]+\z/
60
76
 
61
- # Email address of the sender of subscription emails.
62
- mattr_accessor :subscription_email_from
63
- @@subscription_email_from = "no-reply@example.com"
77
+ # Hook for handling notification delivery when publishing content.
78
+ # Accepts either a Lambda or Proc which can be setup to schedule
79
+ # a ActiveJob (Rails 4.2+).
80
+ mattr_accessor :on_publish_with_notifications
81
+ @@on_publish_with_notifications = nil
64
82
 
65
83
  # Search adapter to use for searching through Storytime Posts or
66
84
  # Post subclasses. Options for the search adapter include:
67
85
  # Storytime::PostgresSearchAdapter, Storytime::MysqlSearchAdapter,
68
86
  # Storytime::MysqlFulltextSearchAdapter, Storytime::Sqlite3SearchAdapter
69
87
  mattr_accessor :search_adapter
70
- @@search_adapter = ''
88
+ @@search_adapter = nil
89
+
90
+ # AWS Region to use for file uploads.
91
+ mattr_accessor :aws_region
92
+ @@aws_region = ENV['STORYTIME_AWS_REGION']
93
+
94
+ # AWS Access Key ID to use for file uploads.
95
+ mattr_accessor :aws_access_key_id
96
+ @@aws_access_key_id = ENV['STORYTIME_AWS_ACCESS_KEY_ID']
97
+
98
+ # AWS Secret Key to use for file uploads.
99
+ mattr_accessor :aws_secret_key
100
+ @@aws_secret_key = ENV['STORYTIME_AWS_SECRET_KEY']
71
101
 
72
102
  class << self
73
103
  attr_accessor :layout, :media_storage, :s3_bucket, :post_types
@@ -93,34 +123,5 @@ module Storytime
93
123
  def user_class_symbol
94
124
  @@user_class.underscore.to_sym
95
125
  end
96
-
97
- def snippet(name)
98
- snippet = Storytime::Snippet.find_by(name: name)
99
- snippet.nil? ? "" : snippet.content.html_safe
100
- end
101
-
102
- def home_page_route_options
103
- site = Storytime::Site.first if ActiveRecord::Base.connection.table_exists? 'storytime_sites'
104
-
105
- if site
106
- if site.root_page_content == "page"
107
- { to: "pages#show", as: :storytime_root_post }
108
- else
109
- { to: "posts#index", as: :storytime_root_post }
110
- end
111
- else
112
- { to: "application#setup", as: :storytime_root }
113
- end
114
- end
115
-
116
- def post_index_path_options
117
- site = Storytime::Site.first if ActiveRecord::Base.connection.table_exists? 'storytime_sites'
118
-
119
- if site && site.root_page_content == "posts"
120
- { path: Storytime.home_page_path }
121
- else
122
- {}
123
- end
124
- end
125
126
  end
126
- end
127
+ end
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -18,10 +18,12 @@ describe Storytime::DashboardController do
18
18
  controller.view_paths.unshift(ActionView::FixtureResolver.new("widgets/index.html.erb" => ""))
19
19
  FactoryGirl.create(:site)
20
20
  sign_in FactoryGirl.create(:writer)
21
- expect{ get :index }.to raise_error(Pundit::AuthorizationNotPerformedError)
21
+ get :index
22
+ expect(flash[:error]).to eq("You are not authorized to perform this action.")
22
23
  end
23
24
 
24
25
  it "redirects to site setup if none exists" do
26
+ allow(Storytime::Site).to receive(:count).and_return(0)
25
27
  sign_in FactoryGirl.create(:writer)
26
28
  get :index
27
29
  response.should redirect_to(new_dashboard_site_path)
@@ -10,4 +10,7 @@
10
10
  // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
11
  // about supported directives.
12
12
  //
13
+ //= require_self
14
+ //= require jquery
15
+ //= require jquery_ujs
13
16
  //= require_tree .
@@ -3,4 +3,8 @@ class ApplicationController < ActionController::Base
3
3
  # For APIs, you may want to use :null_session instead.
4
4
  protect_from_forgery with: :exception
5
5
 
6
- end
6
+ def storytime_post_param_additions
7
+ attrs = [:video_url]
8
+ attrs
9
+ end
10
+ end
File without changes
@@ -0,0 +1,5 @@
1
+ module StorytimeAdmin
2
+ class WidgetsController < StorytimeAdmin::ApplicationController
3
+ set_tab :admin, :widgets
4
+ end
5
+ end
File without changes
File without changes
File without changes
@@ -5,4 +5,8 @@ class User < ActiveRecord::Base
5
5
  :recoverable, :rememberable, :trackable, :validatable
6
6
 
7
7
  storytime_user
8
- end
8
+
9
+ def admin?
10
+ Pundit.policy(self, :admin).manage?
11
+ end
12
+ end
@@ -0,0 +1,2 @@
1
+ class VideoPost < Storytime::BlogPost
2
+ end
@@ -0,0 +1,3 @@
1
+ class Widget < ActiveRecord::Base
2
+ validates_presence_of :name
3
+ end
@@ -7,7 +7,7 @@
7
7
  <%= csrf_meta_tags %>
8
8
  </head>
9
9
  <body>
10
-
10
+
11
11
  <%= yield %>
12
12
 
13
13
  </body>
@@ -0,0 +1 @@
1
+ <%= f.input :video_url %>
@@ -0,0 +1 @@
1
+ <td><%= item.name %></td>
@@ -5,21 +5,25 @@
5
5
  # gem 'sqlite3'
6
6
  #
7
7
  default: &default
8
- adapter: sqlite3
8
+ adapter: postgresql
9
+ encoding: unicode
10
+ host: localhost
9
11
  pool: 5
10
- timeout: 5000
12
+ username: <%= ENV['USER'] %>
13
+ password:
14
+
11
15
 
12
16
  development:
13
17
  <<: *default
14
- database: db/development.sqlite3
18
+ database: storytime_dummy_development
15
19
 
16
20
  # Warning: The database defined as "test" will be erased and
17
21
  # re-generated from your development database when you run "rake".
18
22
  # Do not set this db to the same as development or production.
19
23
  test:
20
24
  <<: *default
21
- database: db/test.sqlite3
25
+ database: storytime_dummy_test
22
26
 
23
27
  production:
24
28
  <<: *default
25
- database: db/production.sqlite3
29
+ database: storytime_dummy_production