storytime 1.2.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +10 -0
- data/.rspec +1 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +448 -0
- data/Guardfile +24 -0
- data/MIT-LICENSE +1 -1
- data/README.md +160 -0
- data/app/assets/{javascripts/storytime/subscriptions.js → images/storytime/.keep} +0 -0
- data/app/assets/images/storytime/storytime-logo-nav-light.png +0 -0
- data/app/assets/images/storytime/storytime-logo-nav.png +0 -0
- data/app/assets/images/storytime/storytime-logo.png +0 -0
- data/app/assets/javascripts/storytime/application.js +11 -3
- data/app/assets/javascripts/storytime/base.js.coffee +44 -6
- data/app/assets/javascripts/storytime/blog_posts.js.coffee +16 -0
- data/app/assets/javascripts/storytime/blogs.js.coffee +18 -0
- data/app/assets/javascripts/storytime/character_counter.js.coffee +26 -0
- data/app/assets/javascripts/storytime/contenteditable.js.coffee +15 -0
- data/app/assets/javascripts/storytime/custom_posts.js.coffee +16 -0
- data/app/assets/javascripts/storytime/editor.js.coffee +50 -134
- data/app/assets/javascripts/storytime/media.js.coffee +91 -22
- data/app/assets/javascripts/storytime/pages.js.coffee +16 -0
- data/app/assets/javascripts/storytime/posts.js.coffee +28 -1
- data/app/assets/javascripts/storytime/sites.js.coffee +1 -16
- data/app/assets/javascripts/storytime/snippets.js.coffee +6 -3
- data/app/assets/javascripts/storytime/tags.js.coffee +17 -0
- data/app/assets/javascripts/storytime/users.js.coffee +10 -0
- data/app/assets/javascripts/storytime/wysiwyg.js.coffee +183 -0
- data/app/assets/stylesheets/storytime/_buttons.scss +70 -0
- data/app/assets/stylesheets/storytime/_dropdowns.scss +5 -0
- data/app/assets/stylesheets/storytime/_forms.scss +3 -0
- data/app/assets/stylesheets/storytime/_list-group.scss +13 -0
- data/app/assets/stylesheets/storytime/_pagination.scss +14 -0
- data/app/assets/stylesheets/storytime/_panels.scss +8 -0
- data/app/assets/stylesheets/storytime/_tabs.scss +38 -0
- data/app/assets/stylesheets/storytime/_type.scss +13 -0
- data/app/assets/stylesheets/storytime/_wells.scss +14 -0
- data/app/assets/stylesheets/storytime/admin.scss +42 -0
- data/app/assets/stylesheets/storytime/application.scss +75 -0
- data/app/assets/stylesheets/storytime/{comments.css.scss → comments.scss} +0 -0
- data/app/assets/stylesheets/storytime/icons.scss +79 -0
- data/app/assets/stylesheets/storytime/layout.scss +21 -0
- data/app/assets/stylesheets/storytime/media.scss +65 -0
- data/app/assets/stylesheets/storytime/modals.scss +46 -0
- data/app/assets/stylesheets/storytime/navigation.scss +137 -0
- data/app/assets/stylesheets/storytime/posts.scss +76 -0
- data/app/assets/stylesheets/storytime/scroll-panels.scss +19 -0
- data/app/assets/stylesheets/storytime/snippets.scss +11 -0
- data/app/assets/stylesheets/storytime/{sites.css.scss → subscriptions.scss} +0 -0
- data/app/assets/stylesheets/storytime/versions.scss +21 -0
- data/app/controllers/storytime/application_controller.rb +36 -16
- data/app/controllers/storytime/blog_homepage_controller.rb +10 -0
- data/app/controllers/storytime/blogs_controller.rb +56 -0
- data/app/controllers/storytime/comments_controller.rb +5 -1
- data/app/controllers/storytime/dashboard/autosaves_controller.rb +7 -3
- data/app/controllers/storytime/dashboard/blog_posts_controller.rb +60 -0
- data/app/controllers/storytime/dashboard/blogs_controller.rb +66 -0
- data/app/controllers/storytime/dashboard/custom_posts_controller.rb +51 -0
- data/app/controllers/storytime/dashboard/media_controller.rb +9 -7
- data/app/controllers/storytime/dashboard/memberships_controller.rb +49 -0
- data/app/controllers/storytime/dashboard/pages_controller.rb +24 -0
- data/app/controllers/storytime/dashboard/posts_controller.rb +29 -38
- data/app/controllers/storytime/dashboard/roles_controller.rb +16 -2
- data/app/controllers/storytime/dashboard/sites_controller.rb +25 -11
- data/app/controllers/storytime/dashboard/snippets_controller.rb +19 -14
- data/app/controllers/storytime/dashboard/subscriptions_controller.rb +9 -5
- data/app/controllers/storytime/dashboard/users_controller.rb +24 -22
- data/app/controllers/storytime/dashboard_controller.rb +9 -3
- data/app/controllers/storytime/homepage_controller.rb +10 -0
- data/app/controllers/storytime/pages_controller.rb +30 -13
- data/app/controllers/storytime/posts_controller.rb +22 -53
- data/app/controllers/storytime/subscriptions_controller.rb +5 -4
- data/app/helpers/storytime/application_helper.rb +28 -7
- data/app/helpers/storytime/dashboard/sites_helper.rb +2 -5
- data/app/helpers/storytime/subscriptions_helper.rb +0 -7
- data/app/inputs/date_time_picker_input.rb +1 -1
- data/app/mailers/storytime/subscription_mailer.rb +1 -3
- data/app/models/concerns/storytime/post_comments.rb +17 -0
- data/app/models/concerns/storytime/post_excerpt.rb +14 -0
- data/app/models/concerns/storytime/post_featured_images.rb +8 -0
- data/app/models/concerns/storytime/post_partial_inheritance.rb +29 -0
- data/app/models/concerns/storytime/post_tags.rb +41 -0
- data/app/models/concerns/storytime/scoped_to_site.rb +11 -0
- data/app/models/storytime/action.rb +1 -0
- data/app/models/storytime/autosave.rb +7 -1
- data/app/models/storytime/blog.rb +16 -0
- data/app/models/storytime/blog_post.rb +12 -1
- data/app/models/storytime/comment.rb +4 -1
- data/app/models/storytime/media.rb +2 -0
- data/app/models/storytime/membership.rb +17 -0
- data/app/models/storytime/page.rb +0 -5
- data/app/models/storytime/permission.rb +26 -20
- data/app/models/storytime/post.rb +29 -82
- data/app/models/storytime/role.rb +12 -0
- data/app/models/storytime/site.rb +42 -12
- data/app/models/storytime/snippet.rb +3 -0
- data/app/models/storytime/subscription.rb +2 -1
- data/app/models/storytime/tag.rb +5 -1
- data/app/models/storytime/tagging.rb +1 -0
- data/app/models/storytime/version.rb +1 -0
- data/app/policies/admin_policy.rb +30 -0
- data/app/policies/storytime/comment_policy.rb +5 -1
- data/app/policies/storytime/membership_policy.rb +32 -0
- data/app/policies/storytime/post_policy.rb +6 -4
- data/app/policies/storytime/site_policy.rb +7 -2
- data/app/policies/storytime/snippet_policy.rb +3 -2
- data/app/policies/storytime/subscription_policy.rb +3 -2
- data/app/policies/user_policy.rb +2 -5
- data/app/views/kaminari/_first_page.html.erb +13 -0
- data/app/views/kaminari/_gap.html.erb +8 -0
- data/app/views/kaminari/_last_page.html.erb +13 -0
- data/app/views/kaminari/_next_page.html.erb +13 -0
- data/app/views/kaminari/_page.html.erb +12 -0
- data/app/views/kaminari/_paginator.html.erb +24 -0
- data/app/views/kaminari/_prev_page.html.erb +13 -0
- data/app/views/layouts/storytime/application.html.erb +1 -1
- data/app/views/layouts/storytime/dashboard.html.erb +22 -6
- data/app/views/storytime/application/storytime/_disqus_comment_counts.html.erb +14 -0
- data/app/views/storytime/application/storytime/_header.html.erb +3 -4
- data/app/views/storytime/application/storytime/_navigation.html.erb +14 -1
- data/app/views/storytime/blogs/_tags.html.erb +3 -0
- data/app/views/storytime/{posts/index.atom.builder → blogs/show.atom.builder} +1 -1
- data/app/views/storytime/{posts/index.html.erb → blogs/show.html.erb} +1 -1
- data/app/views/storytime/comments/_discourse.html.erb +18 -0
- data/app/views/storytime/comments/_disqus.html.erb +2 -2
- data/app/views/storytime/comments/_form.html.erb +2 -2
- data/app/views/storytime/dashboard/_navigation.html.erb +109 -41
- data/app/views/storytime/dashboard/_settings_tabs.html.erb +32 -0
- data/app/views/storytime/dashboard/autosaves/_autosave_info.html.erb +7 -4
- data/app/views/storytime/dashboard/blog_posts/_form.html.erb +157 -0
- data/app/views/storytime/dashboard/blog_posts/edit.html.erb +55 -0
- data/app/views/storytime/dashboard/blog_posts/new.html.erb +31 -0
- data/app/views/storytime/dashboard/blogs/_blog.html.erb +3 -0
- data/app/views/storytime/dashboard/blogs/_form.html.erb +25 -0
- data/app/views/storytime/dashboard/blogs/edit.json.jbuilder +1 -0
- data/app/views/storytime/dashboard/blogs/index.json.jbuilder +1 -0
- data/app/views/storytime/dashboard/blogs/new.json.jbuilder +1 -0
- data/app/views/storytime/dashboard/media/_form.html.erb +3 -3
- data/app/views/storytime/dashboard/media/{_gallery.html → _gallery.html.erb} +7 -4
- data/app/views/storytime/dashboard/media/_media.html.erb +6 -13
- data/app/views/storytime/dashboard/media/_modal.html.erb +3 -3
- data/app/views/storytime/dashboard/media/index.html.erb +15 -5
- data/app/views/storytime/dashboard/memberships/_form.html.erb +12 -0
- data/app/views/storytime/dashboard/memberships/_index.html.erb +39 -0
- data/app/views/storytime/dashboard/memberships/_membership.html.erb +12 -0
- data/app/views/storytime/dashboard/memberships/index.json.jbuilder +2 -0
- data/app/views/storytime/dashboard/memberships/save.json.jbuilder +1 -0
- data/app/views/storytime/dashboard/pages/_form.html.erb +88 -0
- data/app/views/storytime/dashboard/pages/_index_title.html.erb +1 -0
- data/app/views/storytime/dashboard/pages/_new_button.html.erb +1 -0
- data/app/views/storytime/dashboard/pages/edit.html.erb +49 -0
- data/app/views/storytime/dashboard/pages/new.html.erb +28 -0
- data/app/views/storytime/dashboard/posts/_form.html.erb +128 -122
- data/app/views/storytime/dashboard/posts/_image_toolbar.html.erb +32 -0
- data/app/views/storytime/dashboard/posts/_index_title.html.erb +1 -0
- data/app/views/storytime/dashboard/posts/_list.html.erb +23 -24
- data/app/views/storytime/dashboard/posts/_new_button.html.erb +10 -0
- data/app/views/storytime/dashboard/posts/edit.html.erb +56 -13
- data/app/views/storytime/dashboard/posts/index.html.erb +56 -7
- data/app/views/storytime/dashboard/posts/new.html.erb +29 -8
- data/app/views/storytime/dashboard/roles/_form.html.erb +41 -0
- data/app/views/storytime/dashboard/roles/edit.json.jbuilder +1 -0
- data/app/views/storytime/dashboard/sites/_form.html.erb +31 -15
- data/app/views/storytime/dashboard/sites/new.html.erb +21 -8
- data/app/views/storytime/dashboard/sites/site.json.jbuilder +2 -0
- data/app/views/storytime/dashboard/snippets/_form.html.erb +26 -12
- data/app/views/storytime/dashboard/snippets/_index.html.erb +17 -0
- data/app/views/storytime/dashboard/snippets/_snippet.html.erb +12 -0
- data/app/views/storytime/dashboard/snippets/edit.json.jbuilder +1 -0
- data/app/views/storytime/dashboard/snippets/index.json.jbuilder +4 -0
- data/app/views/storytime/dashboard/snippets/new.json.jbuilder +1 -0
- data/app/views/storytime/dashboard/subscriptions/_form.html.erb +19 -0
- data/app/views/storytime/dashboard/subscriptions/_index.html.erb +19 -0
- data/app/views/storytime/dashboard/subscriptions/_subscription.html.erb +9 -10
- data/app/views/storytime/dashboard/subscriptions/form.json.jbuilder +1 -0
- data/app/views/storytime/dashboard/subscriptions/index.json.jbuilder +1 -0
- data/app/views/storytime/dashboard/users/_edit.html.erb +26 -0
- data/app/views/storytime/dashboard/users/_new.html.erb +25 -0
- data/app/views/storytime/dashboard/users/edit.json.jbuilder +2 -0
- data/app/views/storytime/dashboard/users/new.json.jbuilder +2 -0
- data/app/views/storytime/dashboard/versions/_version.html.erb +14 -0
- data/app/views/storytime/dashboard/versions/_versions_info.html.erb +1 -16
- data/app/views/storytime/pages/show.html.erb +1 -1
- data/app/views/storytime/posts/_post.html.erb +8 -0
- data/app/views/storytime/posts/_tags.html.erb +1 -1
- data/app/views/storytime/posts/show.html.erb +1 -1
- data/app/views/storytime/sites/_google_analytics_code.html.erb +2 -2
- data/app/views/storytime/snippets/_snippet.html.erb +9 -0
- data/app/views/storytime/subscription_mailer/new_post_email.html.erb +2 -2
- data/app/views/storytime/subscription_mailer/new_post_email.text.erb +2 -2
- data/app/views/storytime/subscriptions/_form.html.erb +0 -1
- data/app/views/storytime/subscriptions/_modal.html.erb +18 -10
- data/bin/rails +12 -0
- data/bin/storytime +4 -0
- data/circle.yml +3 -0
- data/config/initializers/storytime_admin.rb +3 -0
- data/config/initializers/url_for_patch.rb +2 -37
- data/config/locales/en.yml +33 -13
- data/config/routes.rb +47 -19
- data/db/migrate/20150128185746_seed_new_actions_and_permissions.rb +9 -0
- data/db/migrate/20150206201847_add_site_id_to_storytime_post.rb +7 -0
- data/db/migrate/20150206201919_add_site_id_to_storytime_snippet.rb +7 -0
- data/db/migrate/20150206201931_add_site_id_to_storytime_tag.rb +7 -0
- data/db/migrate/20150206205256_add_notification_fields_to_storytime_post.rb +6 -0
- data/db/migrate/20150216211257_add_subdomain_to_storytime_sites.rb +5 -0
- data/db/migrate/20150216225045_add_site_to_storytime_media.rb +6 -0
- data/db/migrate/20150219210528_remove_root_page_content_from_storytime_sites.rb +12 -0
- data/db/migrate/20150220184902_add_blog_id_to_posts.rb +6 -0
- data/db/migrate/20150224192138_add_homepage_path_to_storytime_sites.rb +5 -0
- data/db/migrate/20150224193151_add_subscription_email_from_to_storytime_sites.rb +5 -0
- data/db/migrate/20150224193551_add_layout_to_storytime_sites.rb +5 -0
- data/db/migrate/20150224194559_add_disqus_forum_shortname_to_storytime_sites.rb +5 -0
- data/db/migrate/20150224212453_remove_homepage_path_from_storytime_sites.rb +5 -0
- data/db/migrate/20150225143516_add_site_id_to_storytime_autosaves.rb +6 -0
- data/db/migrate/20150225143826_add_site_id_to_storytime_comments.rb +6 -0
- data/db/migrate/20150225145119_add_site_id_to_storytime_versions.rb +6 -0
- data/db/migrate/20150225145316_add_site_id_to_storytime_taggings.rb +6 -0
- data/db/migrate/20150225145608_update_storytime_site_id_columns.rb +11 -0
- data/db/migrate/20150225164232_add_site_id_to_storytime_permissions.rb +6 -0
- data/db/migrate/20150225212917_create_storytime_memberships.rb +11 -0
- data/db/migrate/20150225213535_create_memberships_for_storytime_users.rb +8 -0
- data/db/migrate/20150226201739_add_custom_domain_to_storytime_sites.rb +5 -0
- data/db/migrate/20150302171500_add_site_id_to_storytime_media.rb +8 -0
- data/db/migrate/20150302171722_set_site_layout.rb +8 -0
- data/db/migrate/20150302185138_remove_storytime_role_id_from_users.rb +5 -0
- data/db/migrate/20150302192525_transfer_posts_to_blogs.rb +8 -0
- data/db/migrate/20150302192759_seed_permissions.rb +9 -0
- data/db/migrate/20150331162329_add_discourse_name_to_storytime_sites.rb +5 -0
- data/db/migrate/20150402161427_remove_subdomain_from_storytime_site.rb +5 -0
- data/lib/generators/storytime/install_generator.rb +17 -0
- data/lib/generators/storytime/views_generator.rb +21 -9
- data/lib/generators/templates/storytime.rb +70 -27
- data/lib/storytime/cli/install.rb +274 -0
- data/lib/storytime/cli.rb +28 -0
- data/lib/storytime/concerns/current_site.rb +10 -0
- data/lib/storytime/concerns/has_versions.rb +22 -3
- data/lib/storytime/concerns/storytime_user.rb +31 -7
- data/lib/storytime/constraints/blog_constraint.rb +11 -0
- data/lib/storytime/constraints/blog_homepage_constraint.rb +11 -0
- data/lib/storytime/constraints/page_constraint.rb +13 -0
- data/lib/storytime/constraints/page_homepage_constraint.rb +11 -0
- data/lib/storytime/engine.rb +43 -14
- data/lib/storytime/generators/initializer.rb +45 -0
- data/lib/storytime/migrators/v1.rb +122 -0
- data/lib/storytime/post_notifier.rb +19 -0
- data/lib/storytime/post_url_handler.rb +47 -0
- data/lib/storytime/storytime_helpers.rb +12 -0
- data/lib/storytime/version.rb +1 -1
- data/lib/storytime.rb +57 -56
- data/screenshots/admin.png +0 -0
- data/screenshots/media.png +0 -0
- data/screenshots/page-list.png +0 -0
- data/screenshots/post-editor.png +0 -0
- data/screenshots/site-settings.png +0 -0
- data/screenshots/text-snippets.png +0 -0
- data/screenshots/user-management.png +0 -0
- data/spec/controllers/dashboard_controller_spec.rb +3 -1
- data/{app/assets/stylesheets/storytime/subscriptions.css.scss → spec/dummy/app/assets/images/.keep} +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +3 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -1
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/controllers/storytime_admin/widgets_controller.rb +5 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/models/user.rb +5 -1
- data/spec/dummy/app/models/video_post.rb +2 -0
- data/spec/dummy/app/models/widget.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +1 -1
- data/spec/dummy/app/views/storytime/dashboard/posts/_video_post_fields.html.erb +1 -0
- data/spec/dummy/app/views/widgets/storytime/dashboard/admin/_headers.html.erb +1 -0
- data/spec/dummy/app/views/widgets/storytime/dashboard/admin/_row.html.erb +1 -0
- data/spec/dummy/config/database.yml +9 -5
- data/spec/dummy/config/environments/test.rb +1 -0
- data/spec/dummy/config/initializers/devise.rb +1 -1
- data/spec/dummy/config/initializers/session_store.rb +1 -1
- data/spec/dummy/config/initializers/storytime.rb +7 -14
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20150127172846_create_widgets.rb +9 -0
- data/spec/dummy/db/migrate/20150206203824_add_video_url_to_storytime_posts.rb +5 -0
- data/spec/dummy/db/schema.rb +76 -21
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/factories/comment_factories.rb +1 -0
- data/spec/factories/membership_factories.rb +7 -0
- data/spec/factories/site_factories.rb +3 -2
- data/spec/factories/user_factories.rb +3 -3
- data/spec/factories/widget_factories.rb +5 -0
- data/spec/features/blogs_spec.rb +28 -0
- data/spec/features/comments_spec.rb +8 -9
- data/spec/features/dashboard/media_spec.rb +14 -30
- data/spec/features/dashboard/memberships_spec.rb +58 -0
- data/spec/features/dashboard/pages_spec.rb +67 -44
- data/spec/features/dashboard/posts_spec.rb +84 -62
- data/spec/features/dashboard/sites_spec.rb +28 -23
- data/spec/features/dashboard/snippets_spec.rb +44 -44
- data/spec/features/dashboard/subscription_spec.rb +36 -28
- data/spec/features/dashboard/users_spec.rb +48 -29
- data/spec/features/pages_spec.rb +2 -2
- data/spec/features/posts_spec.rb +2 -20
- data/spec/features/subscription_spec.rb +4 -4
- data/spec/models/post_spec.rb +26 -17
- data/spec/policies/comment_policy_spec.rb +22 -6
- data/spec/policies/post_policy_spec.rb +21 -3
- data/spec/requests/routings_spec.rb +27 -17
- data/spec/spec_helper.rb +12 -1
- data/spec/support/database_cleaner.rb +5 -5
- data/spec/support/domains.rb +18 -0
- data/spec/support/feature_macros.rb +18 -9
- data/storytime.gemspec +59 -0
- data/vendor/assets/javascripts/.DS_Store +0 -0
- data/vendor/assets/javascripts/codemirror/modes/css.js +717 -0
- data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +120 -0
- data/vendor/assets/javascripts/codemirror/modes/javascript.js +686 -0
- data/vendor/assets/javascripts/codemirror/modes/liquid.js +40 -0
- data/vendor/assets/javascripts/codemirror/modes/overlay.js +85 -0
- data/vendor/assets/javascripts/codemirror/{xml.js → modes/xml.js} +2 -2
- data/vendor/assets/javascripts/medium-editor.min.js +2450 -0
- data/vendor/assets/javascripts/phantom_js_bind_polyfill.js +24 -0
- data/vendor/assets/javascripts/tidy.js +30 -0
- data/vendor/assets/stylesheets/.DS_Store +0 -0
- data/vendor/assets/stylesheets/chosen-bootstrap-3.css +148 -0
- data/vendor/assets/stylesheets/{chosen.css.scss → chosen.scss} +1 -1
- data/vendor/assets/stylesheets/disable-transitions-for-test-env.css +7 -0
- data/vendor/assets/stylesheets/medium-editor-default.min.css +1 -0
- data/vendor/assets/stylesheets/medium-editor.min.css +1 -0
- metadata +297 -47
- data/app/assets/stylesheets/storytime/admin.css.scss +0 -121
- data/app/assets/stylesheets/storytime/application.css.scss +0 -22
- data/app/assets/stylesheets/storytime/layout.css.scss +0 -17
- data/app/assets/stylesheets/storytime/media.css.scss +0 -68
- data/app/assets/stylesheets/storytime/pagination.css.scss +0 -4
- data/app/assets/stylesheets/storytime/posts.css.scss +0 -30
- data/app/assets/stylesheets/storytime/versions.css.scss +0 -21
- data/app/helpers/storytime/dashboard/posts_helper.rb +0 -21
- data/app/views/storytime/blog_posts/_blog_post.html.erb +0 -8
- data/app/views/storytime/dashboard/posts/_basic_new_post_button.html.erb +0 -3
- data/app/views/storytime/dashboard/posts/_new_post_dropdown_button.html.erb +0 -10
- data/app/views/storytime/dashboard/sites/edit.html.erb +0 -25
- data/app/views/storytime/dashboard/snippets/_list.html.erb +0 -21
- data/app/views/storytime/dashboard/snippets/edit.html.erb +0 -13
- data/app/views/storytime/dashboard/snippets/index.html.erb +0 -13
- data/app/views/storytime/dashboard/snippets/new.html.erb +0 -12
- data/app/views/storytime/dashboard/subscriptions/edit.html.erb +0 -10
- data/app/views/storytime/dashboard/subscriptions/index.html.erb +0 -19
- data/app/views/storytime/dashboard/subscriptions/new.html.erb +0 -9
- data/app/views/storytime/dashboard/users/_user.html.erb +0 -11
- data/app/views/storytime/dashboard/users/edit.html.erb +0 -10
- data/app/views/storytime/dashboard/users/index.html.erb +0 -22
- data/app/views/storytime/dashboard/users/new.html.erb +0 -11
- data/spec/lib/storytime_spec.rb +0 -23
- data/vendor/assets/javascripts/codemirror/codemirror.js +0 -7831
- data/vendor/assets/javascripts/summernote.js +0 -5338
- data/vendor/assets/stylesheets/codemirror/codemirror.css +0 -309
- data/vendor/assets/stylesheets/codemirror/monokai.css +0 -31
- data/vendor/assets/stylesheets/summernote.css +0 -1
@@ -5,76 +5,99 @@ describe "In the dashboard, Pages" do
|
|
5
5
|
login_admin
|
6
6
|
end
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
8
|
+
describe "index" do
|
9
|
+
before do
|
10
|
+
3.times{ FactoryGirl.create(:page, site: current_site) }
|
11
|
+
3.times{ FactoryGirl.create(:page, published_at: nil, site: current_site) }
|
12
|
+
end
|
13
|
+
|
14
|
+
let!(:other_site_page){ FactoryGirl.create(:page) }
|
15
|
+
|
16
|
+
it "lists draft pages" do
|
17
|
+
visit dashboard_pages_path
|
18
|
+
|
19
|
+
current_site.pages.each do |p|
|
20
|
+
expect(page).to have_link_to_post(p) if p.published_at.nil?
|
21
|
+
expect(page).not_to have_link_to_post(p) if p.published_at.present?
|
22
|
+
expect(page).not_to have_content(p.content)
|
23
|
+
end
|
24
|
+
|
25
|
+
expect(page).not_to have_link_to_post(other_site_page)
|
16
26
|
end
|
17
27
|
|
18
|
-
|
28
|
+
it "lists published pages" do
|
29
|
+
visit dashboard_pages_path(published: true)
|
30
|
+
|
31
|
+
# need the type designation so Blogs, which are Page subclasses, don't show up in the query
|
32
|
+
current_site.pages.where(type: "Storytime::Page").each do |p|
|
33
|
+
expect(page).not_to have_link_to_post(p) if p.published_at.nil?
|
34
|
+
expect(page).to have_link_to_post(p) if p.published_at.present?
|
35
|
+
expect(page).not_to have_content(p.content)
|
36
|
+
end
|
37
|
+
|
38
|
+
expect(page).not_to have_link_to_post(other_site_page)
|
39
|
+
end
|
19
40
|
end
|
20
41
|
|
21
|
-
it "creates a page" do
|
22
|
-
Storytime::Page.count
|
23
|
-
|
42
|
+
it "creates a page", js: true do
|
43
|
+
page_count = Storytime::Page.count
|
44
|
+
|
45
|
+
visit new_dashboard_page_path
|
24
46
|
|
25
|
-
|
26
|
-
|
27
|
-
fill_in "post_draft_content", with: "It was a dark and stormy night..."
|
28
|
-
find("#featured_media_id").set media.id
|
47
|
+
find('#post-title-input').set("The Page")
|
48
|
+
find('#medium-editor-post').set("The content of my page")
|
29
49
|
|
50
|
+
click_link "Save / Publish"
|
30
51
|
click_button "Save Draft"
|
31
52
|
|
32
|
-
page.
|
33
|
-
Storytime::Page.count.
|
53
|
+
expect(page).to have_content(I18n.t('flash.posts.create.success'))
|
54
|
+
expect(Storytime::Page.count).to eq(page_count + 1)
|
34
55
|
|
35
56
|
pg = Storytime::Page.last
|
36
|
-
pg.title.
|
37
|
-
pg.draft_content.
|
38
|
-
pg.user.
|
39
|
-
pg.
|
40
|
-
pg.type.
|
41
|
-
pg.
|
57
|
+
expect(pg.title).to eq("The Page")
|
58
|
+
expect(pg.draft_content).to eq("<p>The content of my page</p>")
|
59
|
+
expect(pg.user).to eq(current_user)
|
60
|
+
expect(pg.site).to eq(current_site)
|
61
|
+
expect(pg.type).to eq("Storytime::Page")
|
62
|
+
expect(pg.slug).to eq("The Page".parameterize)
|
63
|
+
expect(pg).to_not be_published
|
42
64
|
end
|
43
65
|
|
44
|
-
it "updates a page" do
|
45
|
-
pg = FactoryGirl.create(:page, published_at: nil)
|
66
|
+
it "updates a page", js: true do
|
67
|
+
pg = FactoryGirl.create(:page, site: current_site, published_at: nil)
|
46
68
|
original_creator = pg.user
|
47
|
-
Storytime::Page.count
|
69
|
+
page_count = Storytime::Page.count
|
70
|
+
|
71
|
+
visit edit_dashboard_page_path(pg)
|
72
|
+
find('#post-title-input').set("The Story")
|
73
|
+
find('#medium-editor-post').set("It was a dark and stormy night...")
|
48
74
|
|
49
|
-
|
50
|
-
fill_in "post_title", with: "The Story"
|
51
|
-
fill_in "post_draft_content", with: "It was a dark and stormy night..."
|
75
|
+
click_link "advanced-settings-panel-toggle"
|
52
76
|
click_button "Save Draft"
|
53
77
|
|
54
|
-
page.
|
55
|
-
Storytime::Page.count.
|
78
|
+
expect(page).to have_content(I18n.t('flash.posts.update.success'))
|
79
|
+
expect(Storytime::Page.count).to eq(page_count)
|
56
80
|
|
57
81
|
pg = Storytime::Page.last
|
58
|
-
pg.title.
|
59
|
-
pg.draft_content.
|
60
|
-
pg.user.
|
61
|
-
pg.
|
62
|
-
pg.
|
82
|
+
expect(pg.title).to eq("The Story")
|
83
|
+
expect(pg.draft_content).to eq("<p>It was a dark and stormy night...</p>")
|
84
|
+
expect(pg.user).to eq(original_creator)
|
85
|
+
expect(pg.type).to eq("Storytime::Page")
|
86
|
+
expect(pg).to_not be_published
|
63
87
|
end
|
64
88
|
|
65
89
|
it "deletes a page", js: true do
|
66
|
-
|
67
|
-
|
90
|
+
storytime_page = FactoryGirl.create(:page, site: current_site)
|
91
|
+
page_count = Storytime::Page.count
|
68
92
|
|
69
|
-
storytime_page
|
70
|
-
visit url_for([:edit, :dashboard, storytime_page, type: Storytime::Page.type_name, only_path: true])
|
93
|
+
visit edit_dashboard_page_path(storytime_page)
|
71
94
|
|
95
|
+
click_button "post-utilities"
|
72
96
|
click_link "Delete"
|
73
97
|
|
74
|
-
expect { storytime_page.reload }.to raise_error
|
75
|
-
|
76
98
|
expect(page).to_not have_content(storytime_page.title)
|
77
|
-
expect
|
99
|
+
expect { storytime_page.reload }.to raise_error
|
100
|
+
expect(Storytime::Page.count).to eq(page_count - 1)
|
78
101
|
end
|
79
102
|
|
80
103
|
end
|
@@ -1,121 +1,143 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "In the dashboard, Posts" do
|
4
|
-
before
|
4
|
+
before do
|
5
|
+
login_admin
|
6
|
+
end
|
5
7
|
|
6
|
-
it "lists posts" do
|
7
|
-
|
8
|
+
it "lists draft posts" do
|
9
|
+
blog = @current_site.blogs.first
|
10
|
+
3.times{ FactoryGirl.create(:post, blog: blog, site: @current_site, published_at: nil) }
|
11
|
+
3.times{ FactoryGirl.create(:post, blog: blog, site: @current_site, published_at: 2.hours.ago) }
|
8
12
|
FactoryGirl.create(:post)
|
9
13
|
static_page = FactoryGirl.create(:page)
|
10
|
-
|
14
|
+
|
15
|
+
visit url_for([storytime, :dashboard, blog, :blog_page_post_index, only_path: true])
|
11
16
|
|
12
|
-
within "#
|
13
|
-
|
14
|
-
expect(page).to have_content(p.title)
|
17
|
+
within "#main" do
|
18
|
+
blog.posts.each do |p|
|
19
|
+
expect(page).to have_content(p.title) if p.published_at.nil?
|
20
|
+
expect(page).not_to have_content(p.title) if p.published_at.present?
|
15
21
|
end
|
16
22
|
|
17
23
|
expect(page).not_to have_content(static_page.title)
|
18
24
|
end
|
19
25
|
end
|
20
26
|
|
21
|
-
it "creates a post" do
|
22
|
-
Storytime::BlogPost.count
|
27
|
+
it "creates a post", js: true do
|
28
|
+
post_count = Storytime::BlogPost.count
|
23
29
|
media = FactoryGirl.create(:media)
|
30
|
+
Rails.logger.warn "==> STARTING CREATE POST"
|
31
|
+
visit url_for([:new, :dashboard, @current_site.blogs.first, :blog_post, only_path: true])
|
24
32
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
33
|
+
find('#post-title-input').set("The Story")
|
34
|
+
find('#medium-editor-post').set("It was a dark and stormy night...")
|
35
|
+
|
36
|
+
click_link "Save / Publish"
|
37
|
+
|
38
|
+
fill_in "blog_post_excerpt", with: "It was a dark and stormy night..."
|
39
|
+
find("#featured_media_id", visible: false).set media.id
|
40
|
+
|
41
|
+
click_button "save-draft-submit"
|
31
42
|
|
32
|
-
page.
|
33
|
-
Storytime::BlogPost.count.
|
43
|
+
expect(page).to have_content(I18n.t('flash.posts.create.success'))
|
44
|
+
expect(Storytime::BlogPost.count).to eq(post_count + 1)
|
34
45
|
|
35
46
|
post = Storytime::BlogPost.last
|
36
|
-
post.title.
|
37
|
-
post.draft_content.
|
38
|
-
post.user.
|
39
|
-
post.
|
40
|
-
post.
|
41
|
-
post.
|
47
|
+
expect(post.title).to eq("The Story")
|
48
|
+
expect(post.draft_content).to eq("<p>It was a dark and stormy night...</p>")
|
49
|
+
expect(post.user).to eq(current_user)
|
50
|
+
expect(post.type).to eq("Storytime::BlogPost")
|
51
|
+
expect(post.featured_media).to eq(media)
|
52
|
+
expect(post).to_not be_published
|
42
53
|
end
|
43
54
|
|
44
55
|
it "saves a post when previewing a new post", js: true do
|
45
|
-
Storytime::BlogPost.count
|
56
|
+
post_count = Storytime::BlogPost.count
|
46
57
|
|
47
|
-
visit url_for([:new, :dashboard, :
|
48
|
-
fill_in "post_title", with: "Snow Crash"
|
49
|
-
fill_in "post_excerpt", with: "The Deliverator belongs to an elite order, a hallowed sub-category."
|
58
|
+
visit url_for([:new, :dashboard, @current_site.blogs.first, :blog_post, only_path: true])
|
50
59
|
|
51
|
-
|
52
|
-
find(
|
60
|
+
find('#post-title-input').set("Snow Crash")
|
61
|
+
find('#medium-editor-post').set("It was a dark and stormy night...")
|
62
|
+
find('#blog_post_excerpt', visible: false).set("It was a dark and stormy night...")
|
63
|
+
|
53
64
|
click_button "Preview"
|
54
65
|
|
55
|
-
page.
|
56
|
-
Storytime::BlogPost.count.
|
66
|
+
expect(page).to have_content(I18n.t('flash.posts.create.success'))
|
67
|
+
expect(Storytime::BlogPost.count).to eq(post_count + 1)
|
57
68
|
|
58
69
|
post = Storytime::BlogPost.last
|
59
|
-
post.title.
|
60
|
-
post.draft_content.
|
61
|
-
post.user.
|
62
|
-
post.
|
63
|
-
post.
|
70
|
+
expect(post.title).to eq("Snow Crash")
|
71
|
+
expect(post.draft_content).to eq("<p>It was a dark and stormy night...</p>")
|
72
|
+
expect(post.user).to eq(current_user)
|
73
|
+
expect(post.type).to eq("Storytime::BlogPost")
|
74
|
+
expect(post).to_not be_published
|
64
75
|
end
|
65
76
|
|
66
77
|
it "autosaves a post when editing", js: true do
|
67
|
-
|
78
|
+
blog = @current_site.blogs.first
|
79
|
+
post = FactoryGirl.create(:post, blog: blog, site: @current_site, published_at: nil,
|
80
|
+
title: "A Scandal in Bohemia",
|
68
81
|
draft_content: "To Sherlock Holmes she was always the woman.")
|
82
|
+
|
69
83
|
original_creator = post.user
|
70
|
-
Storytime::BlogPost.count
|
84
|
+
post_count = Storytime::BlogPost.count
|
71
85
|
|
72
|
-
post.autosave.
|
86
|
+
expect(post.autosave).to be_nil
|
73
87
|
|
74
88
|
visit url_for([:edit, :dashboard, post, only_path: true])
|
75
89
|
|
76
|
-
|
90
|
+
find('#medium-editor-post').set("Some content to autosave")
|
91
|
+
|
92
|
+
page.execute_script "Storytime.instance.editor.editor.autosavePostForm()"
|
93
|
+
|
94
|
+
expect(page).to have_content("Draft saved at")
|
77
95
|
|
78
96
|
visit url_for([:edit, :dashboard, post, only_path: true])
|
79
97
|
|
80
|
-
page.
|
98
|
+
expect(page).to have_content("View the autosave")
|
81
99
|
|
82
100
|
post.reload
|
83
101
|
expect(post.autosave).not_to be_nil
|
84
|
-
expect(post.autosave.content).to eq("
|
102
|
+
expect(post.autosave.content).to eq("<p>Some content to autosave</p>")
|
103
|
+
expect(Storytime::BlogPost.count).to eq(post_count)
|
85
104
|
end
|
86
105
|
|
87
|
-
it "updates a post" do
|
88
|
-
|
106
|
+
it "updates a post", js: true do
|
107
|
+
blog = @current_site.blogs.first
|
108
|
+
post = FactoryGirl.create(:post, blog: blog, site: @current_site, published_at: nil)
|
89
109
|
original_creator = post.user
|
90
|
-
Storytime::BlogPost.count
|
110
|
+
post_count = Storytime::BlogPost.count
|
111
|
+
# page.driver.debug
|
91
112
|
|
92
113
|
visit url_for([:edit, :dashboard, post, only_path: true])
|
93
|
-
|
94
|
-
|
114
|
+
find('#post-title-input').set("The Story")
|
115
|
+
find('#medium-editor-post').set("It was a dark and stormy night...")
|
116
|
+
click_link "advanced-settings-panel-toggle"
|
95
117
|
click_button "Save Draft"
|
96
|
-
|
97
|
-
page.should have_content(I18n.t('flash.posts.update.success'))
|
98
|
-
Storytime::BlogPost.count.should == 1
|
99
118
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
post
|
104
|
-
post.
|
119
|
+
expect(page).to have_content(I18n.t('flash.posts.update.success'))
|
120
|
+
expect(Storytime::BlogPost.count).to eq(post_count)
|
121
|
+
|
122
|
+
post = post.reload
|
123
|
+
post.draft_content = nil # clear the cached copy of draft_content so it reloads
|
124
|
+
expect(post.title).to eq("The Story")
|
125
|
+
expect(post.draft_content).to eq("<p>It was a dark and stormy night...</p>")
|
126
|
+
expect(post.user).to eq(original_creator)
|
127
|
+
expect(post).to_not be_published
|
105
128
|
end
|
106
129
|
|
107
130
|
it "deletes a post", js: true do
|
108
|
-
|
131
|
+
blog = @current_site.blogs.first
|
132
|
+
3.times{ FactoryGirl.create(:post, blog: blog, site: @current_site) }
|
109
133
|
expect(Storytime::BlogPost.count).to eq(3)
|
110
134
|
|
111
135
|
post = Storytime::BlogPost.first
|
112
136
|
visit url_for([:edit, :dashboard, post, only_path: true])
|
113
137
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
expect(page).to_not have_content(post.title)
|
119
|
-
expect(Storytime::Post.count).to eq(2)
|
138
|
+
expect{
|
139
|
+
click_button "post-utilities"
|
140
|
+
click_link "Delete"
|
141
|
+
}.to change(Storytime::BlogPost, :count).by(-1)
|
120
142
|
end
|
121
143
|
end
|
@@ -3,41 +3,46 @@ require 'spec_helper'
|
|
3
3
|
describe "In the dashboard, Sites" do
|
4
4
|
|
5
5
|
it "creates a site" do
|
6
|
-
login FactoryGirl.create(:
|
7
|
-
Storytime::Site.count.
|
8
|
-
|
6
|
+
login FactoryGirl.create(:user), true
|
7
|
+
expect(Storytime::Site.count).to eq(0)
|
8
|
+
|
9
9
|
visit new_dashboard_site_path
|
10
|
+
|
10
11
|
fill_in "site_title", with: "The Site"
|
11
|
-
|
12
|
+
fill_in "site_custom_domain", with: "example.lvh.me"
|
13
|
+
fill_in "site_subscription_email_from", with: "test@example.com"
|
14
|
+
|
15
|
+
click_button "Save"
|
16
|
+
|
17
|
+
# since creating a site redirects you to a new domain, you are not logged in
|
18
|
+
fill_in "user_email", with: current_user.email
|
19
|
+
fill_in "user_password", with: current_user.password
|
20
|
+
click_on "Log in"
|
12
21
|
|
13
|
-
page.
|
14
|
-
Storytime::Site.count.
|
22
|
+
expect(page).to have_content("Pages")
|
23
|
+
expect(Storytime::Site.count).to eq(1)
|
15
24
|
|
16
|
-
|
17
|
-
|
25
|
+
site = Storytime::Site.last
|
26
|
+
expect(site.title).to eq("The Site")
|
27
|
+
expect(site.custom_domain).to eq("example.lvh.me")
|
28
|
+
expect(site.subscription_email_from).to eq("test@example.com")
|
18
29
|
end
|
19
30
|
|
20
31
|
context "as a logged in user" do
|
21
32
|
before{ login_admin }
|
22
33
|
|
23
|
-
it "updates a site" do
|
24
|
-
Storytime::Site.
|
34
|
+
it "updates a site", js: true do
|
35
|
+
site = Storytime::Site.last
|
25
36
|
|
26
|
-
visit
|
37
|
+
visit storytime.dashboard_path
|
38
|
+
click_link "utility-menu-toggle"
|
39
|
+
click_link "site-settings-link"
|
27
40
|
fill_in "site_title", with: "The Site's New Name"
|
28
|
-
click_button "
|
41
|
+
click_button "Save"
|
29
42
|
|
30
|
-
page.
|
31
|
-
|
32
|
-
|
33
|
-
s = Storytime::Site.last
|
34
|
-
s.title.should == "The Site's New Name"
|
35
|
-
end
|
36
|
-
|
37
|
-
it "new redirects to edit if a site already exists" do
|
38
|
-
visit new_dashboard_site_path
|
39
|
-
page.should have_content("Site Settings")
|
40
|
-
page.should have_content("Permissions")
|
43
|
+
expect(page).to have_content("Your changes were saved successfully")
|
44
|
+
site.reload
|
45
|
+
expect(site.title).to eq "The Site's New Name"
|
41
46
|
end
|
42
47
|
end
|
43
48
|
end
|
@@ -5,63 +5,63 @@ describe "In the dashboard, Snippets" do
|
|
5
5
|
login_admin
|
6
6
|
end
|
7
7
|
|
8
|
-
it "lists snippets" do
|
9
|
-
3.times{ FactoryGirl.create(:snippet) }
|
10
|
-
visit
|
8
|
+
it "lists snippets", js: true do
|
9
|
+
3.times{ FactoryGirl.create(:snippet, site: @current_site) }
|
10
|
+
visit storytime.dashboard_url
|
11
|
+
find("#snippets-link").trigger('click')
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
within "#storytime-modal" do
|
14
|
+
Storytime::Snippet.all.each do |s|
|
15
|
+
expect(page).to have_link(s.name, href: url_for([:edit, :dashboard, s, only_path: true]))
|
16
|
+
expect(page).to_not have_content(s.content)
|
17
|
+
end
|
15
18
|
end
|
16
19
|
end
|
17
20
|
|
18
|
-
it "creates a snippet" do
|
19
|
-
|
21
|
+
it "creates a snippet", js: true do
|
22
|
+
visit storytime.dashboard_url
|
23
|
+
find("#snippets-link").trigger('click')
|
24
|
+
click_link "new-snippet-link"
|
20
25
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
expect(page).to have_content(I18n.t('flash.snippets.create.success'))
|
28
|
-
expect(Storytime::Snippet.count).to eq(1)
|
26
|
+
within "#storytime-modal" do
|
27
|
+
fill_in "snippet_name", with: "jumbotron-text"
|
28
|
+
find("#medium-editor-snippet").set("Hooray Writing!")
|
29
|
+
click_button "Save"
|
30
|
+
end
|
29
31
|
|
30
|
-
|
31
|
-
|
32
|
-
|
32
|
+
within "#storytime-modal" do
|
33
|
+
expect(page).to have_content "jumbotron-text"
|
34
|
+
end
|
33
35
|
end
|
34
36
|
|
35
|
-
it "updates a snippet" do
|
36
|
-
snippet = FactoryGirl.create(:snippet)
|
37
|
-
expect(Storytime::Snippet.count).to eq(1)
|
38
|
-
|
39
|
-
visit url_for([:edit, :dashboard, snippet])
|
40
|
-
fill_in "snippet_name", with: "new-name"
|
41
|
-
fill_in "snippet_content", with: "It was a dark and stormy night..."
|
42
|
-
click_button "Update Snippet"
|
43
|
-
|
44
|
-
expect(page).to have_content(I18n.t('flash.snippets.update.success'))
|
45
|
-
expect(Storytime::Snippet.count).to eq(1)
|
37
|
+
it "updates a snippet", js: true do
|
38
|
+
snippet = FactoryGirl.create(:snippet, site: @current_site, content: "Test")
|
46
39
|
|
47
|
-
|
48
|
-
|
49
|
-
expect(snippet.content).to eq("It was a dark and stormy night...")
|
50
|
-
end
|
40
|
+
visit storytime.dashboard_url
|
41
|
+
find("#snippets-link").trigger('click')
|
51
42
|
|
52
|
-
|
53
|
-
3.times{|i| FactoryGirl.create(:snippet) }
|
54
|
-
expect(Storytime::Snippet.count).to eq(3)
|
43
|
+
click_link "edit-snippet-#{snippet.id}"
|
55
44
|
|
56
|
-
|
57
|
-
|
45
|
+
fill_in "snippet_name", with: "new-name"
|
46
|
+
find("#medium-editor-snippet").set("It was a dark and stormy night...")
|
47
|
+
click_button "Save"
|
48
|
+
|
49
|
+
within "#storytime-modal" do
|
50
|
+
expect(page).to have_content "new-name"
|
51
|
+
end
|
52
|
+
end
|
58
53
|
|
59
|
-
|
54
|
+
it "deletes a snippet", js: true do
|
55
|
+
snippet = FactoryGirl.create :snippet, site: @current_site
|
60
56
|
|
61
|
-
|
57
|
+
visit storytime.dashboard_url
|
58
|
+
find("#snippets-link").trigger('click')
|
62
59
|
|
63
|
-
|
64
|
-
|
60
|
+
find("#snippet_#{snippet.id}").hover()
|
61
|
+
click_link "delete_snippet_#{snippet.id}"
|
62
|
+
|
63
|
+
within "#storytime-modal" do
|
64
|
+
expect(page).to_not have_content snippet.name
|
65
|
+
end
|
65
66
|
end
|
66
|
-
|
67
67
|
end
|
@@ -5,48 +5,56 @@ describe "In the dashboard, Subscriptions" do
|
|
5
5
|
login_admin
|
6
6
|
end
|
7
7
|
|
8
|
-
it "lists subscriptions" do
|
9
|
-
3.times{ FactoryGirl.create(:subscription) }
|
10
|
-
visit
|
8
|
+
it "lists subscriptions", js: true do
|
9
|
+
3.times{ FactoryGirl.create(:subscription, site: @current_site) }
|
10
|
+
visit storytime.dashboard_path
|
11
|
+
click_link "utility-menu-toggle"
|
12
|
+
click_link "subscriptions-link"
|
13
|
+
# wait_for_ajax
|
11
14
|
|
12
15
|
Storytime::Subscription.all.each do |s|
|
13
|
-
expect(page).to
|
16
|
+
expect(page).to have_content s.email
|
14
17
|
end
|
15
18
|
end
|
16
19
|
|
17
|
-
it "creates a subscription" do
|
18
|
-
|
20
|
+
it "creates a subscription", js: true do
|
21
|
+
visit storytime.dashboard_path
|
22
|
+
click_link "utility-menu-toggle"
|
23
|
+
click_link "subscriptions-link"
|
24
|
+
# wait_for_ajax
|
25
|
+
click_link "new-subscription-link"
|
26
|
+
# wait_for_ajax
|
19
27
|
|
20
|
-
visit url_for([:new, :dashboard, :subscription, only_path: true])
|
21
28
|
fill_in "subscription_email", with: "some_random_email@example.com"
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
subscription = Storytime::Subscription.last
|
29
|
-
|
30
|
-
expect(subscription.email).to eq("some_random_email@example.com")
|
31
|
-
expect(subscription.token).to_not eq(nil)
|
29
|
+
click_button "Save"
|
30
|
+
|
31
|
+
within "#storytime-modal" do
|
32
|
+
expect(page).to have_content "some_random_email@example.com"
|
33
|
+
end
|
32
34
|
end
|
33
35
|
|
34
|
-
it "updates a subscription" do
|
35
|
-
subscription = FactoryGirl.create(:subscription)
|
36
|
+
it "updates a subscription", js: true do
|
37
|
+
subscription = FactoryGirl.create(:subscription, site: @current_site)
|
36
38
|
|
37
39
|
expect(Storytime::Subscription.count).to eq(1)
|
38
40
|
expect(subscription.subscribed?).to eq(true)
|
39
41
|
|
40
|
-
visit
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
visit storytime.dashboard_path
|
43
|
+
click_link "utility-menu-toggle"
|
44
|
+
click_link "subscriptions-link"
|
45
|
+
|
46
|
+
within "#storytime-modal" do
|
47
|
+
click_link "edit-subscription-#{subscription.id}"
|
48
|
+
end
|
46
49
|
|
47
|
-
|
50
|
+
within "#storytime-modal" do
|
51
|
+
fill_in "subscription_email", with: "johndoe@example.com"
|
52
|
+
uncheck "subscription_subscribed"
|
53
|
+
click_button "Save"
|
54
|
+
end
|
48
55
|
|
49
|
-
|
50
|
-
|
56
|
+
within "#storytime-modal" do
|
57
|
+
expect(page).to have_content "johndoe@example.com"
|
58
|
+
end
|
51
59
|
end
|
52
60
|
end
|