proclaim 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG +6 -0
- data/Gemfile +14 -0
- data/LICENSE +674 -0
- data/README.md +137 -0
- data/Rakefile +65 -0
- data/VERSION +1 -0
- data/app/assets/images/ajax_loader.gif +0 -0
- data/app/assets/javascripts/proclaim.js +18 -0
- data/app/assets/javascripts/proclaim/comments_handler.js.coffee +192 -0
- data/app/assets/javascripts/proclaim/editor.js.coffee +50 -0
- data/app/assets/javascripts/proclaim/images.js.coffee +3 -0
- data/app/assets/javascripts/proclaim/subscriptions.js.coffee +3 -0
- data/app/assets/stylesheets/proclaim.css.scss +28 -0
- data/app/assets/stylesheets/proclaim/comments.css.scss +14 -0
- data/app/assets/stylesheets/proclaim/images.scss +3 -0
- data/app/assets/stylesheets/proclaim/posts.css.scss +77 -0
- data/app/assets/stylesheets/proclaim/subscriptions.css.scss +3 -0
- data/app/controllers/proclaim/application_controller.rb +44 -0
- data/app/controllers/proclaim/comments_controller.rb +128 -0
- data/app/controllers/proclaim/images_controller.rb +108 -0
- data/app/controllers/proclaim/posts_controller.rb +131 -0
- data/app/controllers/proclaim/subscriptions_controller.rb +67 -0
- data/app/helpers/proclaim/application_helper.rb +34 -0
- data/app/helpers/proclaim/comments_helper.rb +4 -0
- data/app/helpers/proclaim/images_helper.rb +4 -0
- data/app/helpers/proclaim/posts_helper.rb +4 -0
- data/app/helpers/proclaim/subscriptions_helper.rb +4 -0
- data/app/mailers/proclaim/subscription_mailer.rb +43 -0
- data/app/models/proclaim/comment.rb +35 -0
- data/app/models/proclaim/image.rb +19 -0
- data/app/models/proclaim/post.rb +133 -0
- data/app/models/proclaim/subscription.rb +63 -0
- data/app/policies/application_policy.rb +53 -0
- data/app/policies/proclaim/comment_policy.rb +27 -0
- data/app/policies/proclaim/image_policy.rb +29 -0
- data/app/policies/proclaim/post_policy.rb +38 -0
- data/app/policies/proclaim/subscription_policy.rb +32 -0
- data/app/uploaders/proclaim/image_uploader.rb +82 -0
- data/app/views/layouts/proclaim/subscription_mailer.html.erb +133 -0
- data/app/views/proclaim/comments/_comment.html.erb +33 -0
- data/app/views/proclaim/comments/_form.html.erb +51 -0
- data/app/views/proclaim/posts/_form.html.erb +67 -0
- data/app/views/proclaim/posts/edit.html.erb +3 -0
- data/app/views/proclaim/posts/index.html.erb +30 -0
- data/app/views/proclaim/posts/new.html.erb +3 -0
- data/app/views/proclaim/posts/show.html.erb +46 -0
- data/app/views/proclaim/subscription_mailer/new_comment_notification_email.html.erb +11 -0
- data/app/views/proclaim/subscription_mailer/new_post_notification_email.html.erb +15 -0
- data/app/views/proclaim/subscription_mailer/welcome_email.html.erb +25 -0
- data/app/views/proclaim/subscriptions/_form.html.erb +32 -0
- data/app/views/proclaim/subscriptions/new.html.erb +8 -0
- data/app/views/proclaim/subscriptions/subscribed.html.erb +7 -0
- data/app/views/proclaim/subscriptions/unsubscribe.html.erb +7 -0
- data/app/views/proclaim/subscriptions/unsubscribed.html.erb +3 -0
- data/config/routes.rb +18 -0
- data/db/migrate/20141108222616_create_proclaim_posts.rb +15 -0
- data/db/migrate/20141114235359_create_proclaim_comments.rb +15 -0
- data/db/migrate/20141115022230_create_proclaim_comment_hierarchies.rb +26 -0
- data/db/migrate/20141210234057_create_proclaim_subscriptions.rb +17 -0
- data/db/migrate/20141222224905_create_proclaim_images.rb +12 -0
- data/lib/generators/proclaim/install_generator.rb +23 -0
- data/lib/generators/proclaim/templates/README +27 -0
- data/lib/generators/proclaim/templates/initialize_proclaim.rb +22 -0
- data/lib/generators/proclaim/views_generator.rb +24 -0
- data/lib/proclaim.rb +22 -0
- data/lib/proclaim/engine.rb +39 -0
- data/lib/proclaim/version.rb +3 -0
- data/lib/tasks/proclaim_tasks.rake +4 -0
- data/proclaim.gemspec +46 -0
- data/test/controllers/proclaim/comments_controller_test.rb +228 -0
- data/test/controllers/proclaim/images_controller_test.rb +123 -0
- data/test/controllers/proclaim/posts_controller_test.rb +303 -0
- data/test/controllers/proclaim/subscriptions_controller_test.rb +93 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +14 -0
- data/test/dummy/app/assets/stylesheets/application.css +16 -0
- data/test/dummy/app/controllers/application_controller.rb +15 -0
- data/test/dummy/app/helpers/application_helper.rb +28 -0
- data/test/dummy/app/models/user.rb +7 -0
- data/test/dummy/app/views/layouts/application.html.erb +16 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +24 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +45 -0
- data/test/dummy/config/environments/production.rb +80 -0
- data/test/dummy/config/environments/test.rb +49 -0
- data/test/dummy/config/initializers/assets.rb +8 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +5 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/db/migrate/20141117214323_create_users.rb +10 -0
- data/test/dummy/db/schema.rb +75 -0
- data/test/dummy/log/development.log +131 -0
- data/test/dummy/log/test.log +25961 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/tmp/cache/assets/test/sass/0b69f7cc441d56def3a51688e6a7a8474dc476d1/proclaim.css.scssc +0 -0
- data/test/dummy/tmp/cache/assets/test/sass/12a97df611d5fb0e395afda829edf8b9372acde7/comments.css.scssc +0 -0
- data/test/dummy/tmp/cache/assets/test/sass/12a97df611d5fb0e395afda829edf8b9372acde7/images.scssc +0 -0
- data/test/dummy/tmp/cache/assets/test/sass/12a97df611d5fb0e395afda829edf8b9372acde7/posts.css.scssc +0 -0
- data/test/dummy/tmp/cache/assets/test/sass/12a97df611d5fb0e395afda829edf8b9372acde7/subscriptions.css.scssc +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/04adcece63bc645379e6de797e7998f8 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/06620fc450f0a9b4a482a7bc08387711 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/076dd0d567a92c34163b3b98af1d48ba +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/09fc2eadf6d6062b2cc135a44e4e73db +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/09fe8c62e8ae706e01058b4b4d056c8e +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/142fd040033525acb73ad2ccf1406aea +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/1762aeeaf38da3b8d989a5b66b088004 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/194ac1a695334e303516614579b3926d +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/197ea008934db3e7ea8045302d206b92 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/19eba2635fec0895379c3e38f81ada84 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/1c2ebe72fcd7ff1379a561552ca30f85 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/1f42c80faacb651f670ec2b0998e49dc +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/2243230e778a749ecbf0415a52e75be0 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/23ad87e715c70312aa61dde4fbb4bfe1 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/245b8735db4ea90bcaa91c011a1f447e +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/26a42dac0cec64483f4126d2de4b0c9e +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/30151c8f6d93717f06fa12774612ddf4 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/3c623d200214a5334aaf170537db087f +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/3ec36650a50759fd4b75794cb253936f +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/40431cdcc10c75ba1f275ecfe42623d3 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/4226218a4b06608115b21063353370ea +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/437901953eb8707af6c27ca59cf65d91 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/461885b8ad31ef6a94c9a4f2e332b7eb +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/4792f46317cda92ccd5b278ec61f9ac5 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/4dcb3434b91b1c62f897a1741c6d398b +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/5101cda93cf70f0fc0837713be587780 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/52d8c61de0703e0d7cf97d0f7b0cca7a +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/57f3d19a9bd484ac68c46f962a8684b2 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/587e7c1332c8d8b69746dd85164e2cef +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/5934d5d0d1ac6657842708e85c73cf51 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/5af081799d7da2f04ead6a516c6015ad +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/69ee5af8d9a655898a67bc538ca1c7e7 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/6d1c56259648b0383bc438c875a448c3 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/6e7de35055967df848aa490830043e51 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/70bc59560ee544af7bb2f727247db307 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/728cb566999910549092ff0a98e2853b +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/72b5f0d35e9d69b744a156edad98f983 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/72ffa34d552e3fd02f28a6f845a5ac5b +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/7369d324e84bc872c42b3e717ff4ad6c +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/749a8b0e45b11df748a256dd04ceb1f7 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/77fb9f62552d9b786f9407ef11cc9a09 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/797823842565e01fc989ad8df0bd4254 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/7c139afa2296ac17483520109aecd449 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/7fb99e2b35af65c4f58bfb92dd4185b4 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/819de31c63b704f9ddf4865587a91d41 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/8604b464bf846e5223da37ef2f29b524 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/88fc815613b473e98e9307b1d423918d +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/8bc4341aa4060b8646e8134722cf3b11 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/8cf8fd5ff8eae12211a88f971af30236 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/8da3b4a9f17aafff49eb263bdb758f44 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/9168e513bae02f041dbb806d6dbe94ac +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/920c1322be1212a54b7c4f2751d5e7bf +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/92205679a36afd387a2ba5c585a5a62c +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/940566ebcae2d4e5c56a881ab66f2cf0 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/976967e07e2944a7ecc7403667f1f96b +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/99bdde70cefa71745279232be575f14e +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/9a8e402a7e32063e46647403b43553a5 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/9b09ad72f8cc33503878b01c713d92d0 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/a20dbdfebf37fe50e832a6273c972553 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/a3c6189fad6cb9ae955f6d5a43a61d51 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/abb54e11ff057a3e22a5a97d27cc4fa3 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/ad18e3875541d4298b1df133d494b93f +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/b9b7c575c22943d49734d52381c5ee16 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/ba269a52f100d3d6cffda81e82e1ed49 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/bc7a0846b4881b0832d41de2b1724dba +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/bcb2df87f9611d3cc3ef8a5575e54fb8 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/bcf33791d3286af3ba2cdf6a6756c89e +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/be32d0a530ce861537d6abfa41333df9 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/c8270a6f07dccc5f00e6b2b43f10efd2 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/cd82cd410a50bffcfb6e21e3c49a85c9 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/ce4ccaa06bdee6426486224bc7e54187 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d0bdb8592e4eed80aa2341e37f20dbc9 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d4b784b16fa1b1dfcca6590689a8c157 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d968bd38a69bbf5c0065e2df3d30cfd3 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/daa4d4b8a5ce46d6c4ecf031e0c61cfe +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/dc2effd195334219a7e4acfdc7ec7974 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/de36ab6c3b1a9b62a586d98373dd569c +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/e3aec457d5c753090d6521f2bb2d91b6 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/e8d6158b1fed2f574242b55856a3953d +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/ea82f6aececcf81eef3e2e15a9225e66 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/ed9f5c17f71ec75de10b1bb029ebd7a2 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f2984adaeaa5322e3a040705c6d40622 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f62fd0cf9f5e7e077ec9c4daeccb06ae +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f78ea69bdbba5738c052e9eb04e6c208 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f864e553f706456dbdf168319970ec2e +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/fb0f641bfcbb0101c040da9ff736447b +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/fe426a44cf23cf82032091cbffff898c +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/ff732ea47a86c449582b2a81ef2930da +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/ffc4980851addaacf12abeebfa63e07f +0 -0
- data/test/dummy/tmp/generators/config/initializers/proclaim.rb +22 -0
- data/test/factories/proclaim/comment.rb +11 -0
- data/test/factories/proclaim/image.rb +6 -0
- data/test/factories/proclaim/post.rb +14 -0
- data/test/factories/proclaim/subscription.rb +13 -0
- data/test/factories/user.rb +6 -0
- data/test/helpers/proclaim/comments_helper_test.rb +6 -0
- data/test/helpers/proclaim/posts_helper_test.rb +6 -0
- data/test/helpers/proclaim/subscriptions_helper_test.rb +6 -0
- data/test/integration/with_javascript/comment_test.rb +353 -0
- data/test/integration/with_javascript/post_form_test.rb +179 -0
- data/test/integration/with_javascript/post_subscription_test.rb +273 -0
- data/test/integration/without_javascript/blog_subscription_test.rb +87 -0
- data/test/integration/without_javascript/post_test.rb +140 -0
- data/test/integration/without_javascript/subscription_email_test.rb +95 -0
- data/test/integration/without_javascript/unsubscribe_test.rb +32 -0
- data/test/mailers/previews/proclaim/subscription_mailer_preview.rb +22 -0
- data/test/mailers/proclaim/subscription_mailer_test.rb +87 -0
- data/test/models/proclaim/comment_test.rb +41 -0
- data/test/models/proclaim/image_test.rb +70 -0
- data/test/models/proclaim/post_test.rb +127 -0
- data/test/models/proclaim/subscription_test.rb +66 -0
- data/test/policies/proclaim/comment_policy_test.rb +71 -0
- data/test/policies/proclaim/post_policy_test.rb +87 -0
- data/test/policies/proclaim/subscription_policy_test.rb +91 -0
- data/test/proclaim_test.rb +7 -0
- data/test/support/images/test.jpg +0 -0
- data/test/support/pages/posts/edit_page.rb +5 -0
- data/test/support/pages/posts/show_page.rb +47 -0
- data/test/support/wait_for_ajax.rb +11 -0
- data/test/test_helper.rb +56 -0
- data/vendor/assets/images/link.png +0 -0
- data/vendor/assets/images/remove.png +0 -0
- data/vendor/assets/images/resize-bigger.png +0 -0
- data/vendor/assets/images/resize-smaller.png +0 -0
- data/vendor/assets/images/unlink.png +0 -0
- data/vendor/assets/javascripts/addons/medium-editor-insert-embeds.js +197 -0
- data/vendor/assets/javascripts/addons/medium-editor-insert-embeds.min.js +10 -0
- data/vendor/assets/javascripts/addons/medium-editor-insert-images.js +572 -0
- data/vendor/assets/javascripts/addons/medium-editor-insert-images.min.js +10 -0
- data/vendor/assets/javascripts/addons/medium-editor-insert-maps.js +50 -0
- data/vendor/assets/javascripts/addons/medium-editor-insert-maps.min.js +10 -0
- data/vendor/assets/javascripts/addons/medium-editor-insert-plugin.js +496 -0
- data/vendor/assets/javascripts/addons/medium-editor-insert-plugin.min.js +10 -0
- data/vendor/assets/javascripts/addons/medium-editor-insert-tables.js +132 -0
- data/vendor/assets/javascripts/addons/medium-editor-insert-tables.min.js +10 -0
- data/vendor/assets/javascripts/medium-editor-insert-plugin.all.js +1415 -0
- data/vendor/assets/javascripts/medium-editor-insert-plugin.all.min.js +10 -0
- data/vendor/assets/stylesheets/medium-editor-insert-plugin-frontend.css +55 -0
- data/vendor/assets/stylesheets/medium-editor-insert-plugin-frontend.min.css +10 -0
- data/vendor/assets/stylesheets/medium-editor-insert-plugin.css +277 -0
- data/vendor/assets/stylesheets/medium-editor-insert-plugin.min.css +10 -0
- metadata +791 -0
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class SubscriptionPolicyTest < ActiveSupport::TestCase
|
4
|
+
test "subscription scope" do
|
5
|
+
user = FactoryGirl.create(:user)
|
6
|
+
subscription1 = FactoryGirl.create(:subscription)
|
7
|
+
subscription2 = FactoryGirl.create(:subscription)
|
8
|
+
|
9
|
+
# Verify that a user can view both subscriptions
|
10
|
+
subscriptions = Pundit.policy_scope(user, Proclaim::Subscription)
|
11
|
+
assert_includes subscriptions, subscription1
|
12
|
+
assert_includes subscriptions, subscription2
|
13
|
+
|
14
|
+
# Verify that without a user, no subscription can be seen
|
15
|
+
subscriptions = Pundit.policy_scope(nil, Proclaim::Subscription)
|
16
|
+
assert_nil subscriptions
|
17
|
+
end
|
18
|
+
|
19
|
+
test "subscription creation" do
|
20
|
+
user = FactoryGirl.create(:user)
|
21
|
+
|
22
|
+
# Verify that a user can create a subscription to the blog
|
23
|
+
subscription = FactoryGirl.build(:subscription)
|
24
|
+
policy = Proclaim::SubscriptionPolicy.new(user, subscription)
|
25
|
+
assert policy.create?, "A user should be able to create subscriptions to the blog"
|
26
|
+
|
27
|
+
# Verify that a user can create a subscription to an unpublished post
|
28
|
+
subscription = FactoryGirl.build(:post_subscription)
|
29
|
+
policy = Proclaim::SubscriptionPolicy.new(user, subscription)
|
30
|
+
assert policy.create?, "A user should be able to create subscriptions to unpublished posts"
|
31
|
+
|
32
|
+
# Verify that a user can create a subscription to a published post
|
33
|
+
subscription = FactoryGirl.build(:published_post_subscription)
|
34
|
+
policy = Proclaim::SubscriptionPolicy.new(user, subscription)
|
35
|
+
assert policy.create?, "A user should be able to create subscriptions to published posts"
|
36
|
+
|
37
|
+
# Verify that a guest can create a subscription to the blog
|
38
|
+
subscription = FactoryGirl.build(:subscription)
|
39
|
+
policy = Proclaim::SubscriptionPolicy.new(nil, subscription)
|
40
|
+
assert policy.create?, "A guest should be able to create subscriptions to the blog"
|
41
|
+
|
42
|
+
# Verify that a guest cannot create a subscription to an unpublished post
|
43
|
+
subscription = FactoryGirl.build(:post_subscription)
|
44
|
+
policy = Proclaim::SubscriptionPolicy.new(nil, subscription)
|
45
|
+
refute policy.create?, "A guest should not be able to create subscriptions to unpublished posts"
|
46
|
+
|
47
|
+
# Verify that a guest can create a subscription to a published post
|
48
|
+
subscription = FactoryGirl.build(:published_post_subscription)
|
49
|
+
policy = Proclaim::SubscriptionPolicy.new(nil, subscription)
|
50
|
+
assert policy.create?, "A guest should be able to create subscriptions to published posts"
|
51
|
+
end
|
52
|
+
|
53
|
+
test "subscription update" do
|
54
|
+
user = FactoryGirl.create(:user)
|
55
|
+
subscription = FactoryGirl.create(:subscription)
|
56
|
+
|
57
|
+
# Verify that a even a user can't update a subscription (for now)
|
58
|
+
policy = Proclaim::SubscriptionPolicy.new(user, subscription)
|
59
|
+
refute policy.update?, "A user should not be able to update subscriptions!"
|
60
|
+
|
61
|
+
# Verify that a guest cannot update a subscription
|
62
|
+
policy = Proclaim::SubscriptionPolicy.new(nil, subscription)
|
63
|
+
refute policy.update?, "A guest should not be able to update subscription!"
|
64
|
+
end
|
65
|
+
|
66
|
+
test "subscription unsubscribe" do
|
67
|
+
user = FactoryGirl.create(:user)
|
68
|
+
subscription = FactoryGirl.create(:subscription)
|
69
|
+
|
70
|
+
# Verify that a user can unsubscribe
|
71
|
+
policy = Proclaim::SubscriptionPolicy.new(user, subscription)
|
72
|
+
assert policy.unsubscribe?, "A user should be able to unsubscribe!"
|
73
|
+
|
74
|
+
# Verify that a guest can also unsubscribe
|
75
|
+
policy = Proclaim::SubscriptionPolicy.new(nil, subscription)
|
76
|
+
assert policy.unsubscribe?, "A guest should be able to unsubscribe!"
|
77
|
+
end
|
78
|
+
|
79
|
+
test "subscription destroy" do
|
80
|
+
user = FactoryGirl.create(:user)
|
81
|
+
subscription = FactoryGirl.create(:subscription)
|
82
|
+
|
83
|
+
# Verify that a user can destroy a subscription
|
84
|
+
policy = Proclaim::SubscriptionPolicy.new(user, subscription)
|
85
|
+
assert policy.destroy?, "A user should be able to destroy subscriptions!"
|
86
|
+
|
87
|
+
# Verify that a guest can also destroy a subscription
|
88
|
+
policy = Proclaim::SubscriptionPolicy.new(nil, subscription)
|
89
|
+
assert policy.destroy?, "A guest should be able to destroy subscriptions!"
|
90
|
+
end
|
91
|
+
end
|
Binary file
|
@@ -0,0 +1,47 @@
|
|
1
|
+
class ShowPage
|
2
|
+
include Capybara::DSL
|
3
|
+
|
4
|
+
def comment_reply_link(comment)
|
5
|
+
find("#comment_#{comment.id} .reply")
|
6
|
+
end
|
7
|
+
|
8
|
+
def comment_edit_link(comment)
|
9
|
+
find("#comment_#{comment.id} .edit")
|
10
|
+
end
|
11
|
+
|
12
|
+
def comment_delete_link(comment)
|
13
|
+
find("#comment_#{comment.id} .delete")
|
14
|
+
end
|
15
|
+
|
16
|
+
def edit_comment_submit_button(comment)
|
17
|
+
find("#edit_comment_#{comment.id} input[type=submit]")
|
18
|
+
end
|
19
|
+
|
20
|
+
def new_comment_submit_button(comment = nil)
|
21
|
+
if comment
|
22
|
+
find("#reply_to_#{comment.id}_new_comment input[type=submit]")
|
23
|
+
else
|
24
|
+
find('#new_comment input[type=submit]')
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def edit_comment_cancel_button(comment)
|
29
|
+
find("#edit_comment_#{comment.id} button.cancel_comment")
|
30
|
+
end
|
31
|
+
|
32
|
+
def new_comment_cancel_button(comment = nil)
|
33
|
+
if comment
|
34
|
+
find("#reply_to_#{comment.id}_new_comment button.cancel_comment")
|
35
|
+
else
|
36
|
+
find('#new_comment button.cancel_comment')
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def antispam_solution(comment = nil)
|
41
|
+
if comment
|
42
|
+
find("input#reply_to_#{comment.id}_antispam_solution", visible: false).value
|
43
|
+
else
|
44
|
+
find('input#antispam_solution', visible: false).value
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# Configure Rails Environment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
|
4
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
5
|
+
require "rails/test_help"
|
6
|
+
require "factory_girl_rails"
|
7
|
+
require "faker"
|
8
|
+
require "mocha/mini_test"
|
9
|
+
require 'capybara/rails'
|
10
|
+
require 'database_cleaner'
|
11
|
+
require 'test_after_commit'
|
12
|
+
require 'coffee_script'
|
13
|
+
require 'sass'
|
14
|
+
#Capybara.app = Proclaim::Engine
|
15
|
+
|
16
|
+
Rails.backtrace_cleaner.remove_silencers!
|
17
|
+
|
18
|
+
# Load support files
|
19
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
20
|
+
|
21
|
+
#FactoryGirl.definition_file_paths << "test/dummy/test/factories"
|
22
|
+
#FactoryGirl.reload
|
23
|
+
|
24
|
+
#class ActionController::TestCase
|
25
|
+
# include Proclaim::Engine.routes.url_helpers
|
26
|
+
#end
|
27
|
+
|
28
|
+
class ActionDispatch::IntegrationTest
|
29
|
+
# Make the Capybara DSL available in all integration tests
|
30
|
+
include Capybara::DSL
|
31
|
+
end
|
32
|
+
|
33
|
+
def sign_in(user)
|
34
|
+
ApplicationController.any_instance.stubs(:current_user).returns(user)
|
35
|
+
ApplicationController.any_instance.stubs(:authenticate_user).returns(true)
|
36
|
+
|
37
|
+
if @controller
|
38
|
+
@controller.stubs(:current_user).returns(user)
|
39
|
+
@controller.stubs(:authenticate_user).returns(true)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def wait_until
|
44
|
+
require "timeout"
|
45
|
+
begin
|
46
|
+
Timeout.timeout(Capybara.default_wait_time) do
|
47
|
+
sleep(0.1) until value = yield
|
48
|
+
value
|
49
|
+
end
|
50
|
+
rescue
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_image_file_path
|
55
|
+
File.join(Rails.root, '../', 'support', 'images', 'test.jpg')
|
56
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,197 @@
|
|
1
|
+
/*!
|
2
|
+
* medium-editor-insert-plugin v0.3.2 - jQuery insert plugin for MediumEditor
|
3
|
+
*
|
4
|
+
* https://github.com/orthes/medium-editor-insert-plugin
|
5
|
+
*
|
6
|
+
* Copyright (c) 2014 Pavel Linkesch (http://linkesch.sk)
|
7
|
+
* Released under the MIT license
|
8
|
+
*/
|
9
|
+
|
10
|
+
(function ($) {
|
11
|
+
|
12
|
+
$.fn.mediumInsert.registerAddon('embeds', {
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Embed default options
|
16
|
+
*/
|
17
|
+
|
18
|
+
defaults: {
|
19
|
+
urlPlaceholder: 'Paste or type a link'
|
20
|
+
//,oembedProxy: 'http://medium.iframe.ly/api/oembed?iframe=1'
|
21
|
+
},
|
22
|
+
|
23
|
+
/**
|
24
|
+
* Embeds initial function
|
25
|
+
* @return {void}
|
26
|
+
*/
|
27
|
+
init : function (options) {
|
28
|
+
this.options = $.extend(this.defaults, options);
|
29
|
+
this.$el = $.fn.mediumInsert.insert.$el;
|
30
|
+
this.setEmbedButtonEvents();
|
31
|
+
this.preparePreviousEmbeds();
|
32
|
+
},
|
33
|
+
|
34
|
+
insertButton : function (buttonLabels) {
|
35
|
+
var label = 'Embed';
|
36
|
+
if (buttonLabels === 'fontawesome' || typeof buttonLabels === 'object' && !!(buttonLabels.fontawesome)) {
|
37
|
+
label = '<i class="fa fa-code"></i>';
|
38
|
+
}
|
39
|
+
|
40
|
+
if (typeof buttonLabels === 'object' && buttonLabels.embed) {
|
41
|
+
label = buttonLabels.embed;
|
42
|
+
}
|
43
|
+
|
44
|
+
return '<button data-addon="embeds" data-action="add" class="medium-editor-action mediumInsert-action">' + label + '</button>';
|
45
|
+
},
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Add embed to $placeholder
|
49
|
+
* @param {element} $placeholder $placeholder to add embed to
|
50
|
+
* @return {void}
|
51
|
+
*/
|
52
|
+
add : function ($placeholder) {
|
53
|
+
$.fn.mediumInsert.insert.deselect();
|
54
|
+
|
55
|
+
|
56
|
+
var formHtml = '<div class="medium-editor-toolbar medium-editor-toolbar-active medium-editor-toolbar-form-anchor mediumInsert-embedsWire" style="display: block;"><input type="text" value="" placeholder="' + this.options.urlPlaceholder + '" class="mediumInsert-embedsText medium-editor-toolbar-anchor-input"></div>';
|
57
|
+
$(formHtml).appendTo($placeholder.prev());
|
58
|
+
setTimeout(function () {
|
59
|
+
$placeholder.prev().find('input').focus();
|
60
|
+
}, 50);
|
61
|
+
|
62
|
+
$.fn.mediumInsert.insert.deselect();
|
63
|
+
|
64
|
+
this.currentPlaceholder = $placeholder;
|
65
|
+
$(".mediumInsert-embedsText").focus();
|
66
|
+
},
|
67
|
+
|
68
|
+
/**
|
69
|
+
* Make existing embeds interactive
|
70
|
+
*
|
71
|
+
* @return {void}
|
72
|
+
*/
|
73
|
+
|
74
|
+
preparePreviousEmbeds: function () {
|
75
|
+
this.$el.find('.mediumInsert-embeds').each(function() {
|
76
|
+
var $parent = $(this).parent();
|
77
|
+
if (!$parent.hasClass('mediumInsert-placeholder')) {
|
78
|
+
$parent.html('<div class="mediumInsert-placeholder" draggable="true">' + $parent.html() + '</div>');
|
79
|
+
}
|
80
|
+
});
|
81
|
+
},
|
82
|
+
|
83
|
+
setEmbedButtonEvents : function () {
|
84
|
+
var that = this;
|
85
|
+
$(document).on('keypress', 'input.mediumInsert-embedsText', function (e) {
|
86
|
+
if ((e.which && e.which === 13) || (e.keyCode && e.keyCode === 13)) {
|
87
|
+
that.setEnterActionEvents();
|
88
|
+
that.removeToolbar();
|
89
|
+
}
|
90
|
+
});
|
91
|
+
|
92
|
+
this.$el
|
93
|
+
.on('blur', '.mediumInsert-embedsText', function () {
|
94
|
+
that.removeToolbar();
|
95
|
+
})
|
96
|
+
// Fix #72
|
97
|
+
// Workaround for CTRL+V not working in FF, when cleanPastedHTML and forcePlainText options on editor are set to true,
|
98
|
+
// because editor steals the event and doesn't pass it to the plugin
|
99
|
+
// https://github.com/orthes/medium-editor-insert-plugin/issues/72
|
100
|
+
.on('paste', '.mediumInsert-embedsText', function (e) {
|
101
|
+
if ($.fn.mediumInsert.insert.isFirefox && e.originalEvent.clipboardData) {
|
102
|
+
$(this).val(e.originalEvent.clipboardData.getData('text/plain'));
|
103
|
+
}
|
104
|
+
});
|
105
|
+
|
106
|
+
},
|
107
|
+
setEnterActionEvents : function () {
|
108
|
+
var that = this;
|
109
|
+
if ($.fn.mediumInsert.settings.enabled === false) {
|
110
|
+
return false;
|
111
|
+
}
|
112
|
+
|
113
|
+
var url = $("input.mediumInsert-embedsText").val();
|
114
|
+
if (!url) {
|
115
|
+
return false;
|
116
|
+
}
|
117
|
+
|
118
|
+
function processEmbedTag(embed_tag) {
|
119
|
+
if (!embed_tag) {
|
120
|
+
alert('Incorrect URL format specified');
|
121
|
+
return false;
|
122
|
+
} else {
|
123
|
+
var returnedTag = embed_tag;
|
124
|
+
var tagId = new Date().getTime();
|
125
|
+
embed_tag = $('<div class="mediumInsert-embeds" id="' + tagId + '"></div>').append(embed_tag);
|
126
|
+
that.currentPlaceholder.append(embed_tag);
|
127
|
+
that.currentPlaceholder.closest('[data-medium-element]').trigger('keyup').trigger('input');
|
128
|
+
|
129
|
+
if(returnedTag.indexOf("facebook") !== -1) {
|
130
|
+
if (typeof(FB) !== 'undefined') {
|
131
|
+
setTimeout(function() { FB.XFBML.parse();}, 2000);
|
132
|
+
}
|
133
|
+
}
|
134
|
+
}
|
135
|
+
}
|
136
|
+
|
137
|
+
if (this.options.oembedProxy) {
|
138
|
+
that.getOEmbedHTML(url, function(error, oebmed) {
|
139
|
+
|
140
|
+
var html = !error && oebmed && oebmed.html;
|
141
|
+
|
142
|
+
if (oebmed && !oebmed.html && oebmed.type === 'photo' && oebmed.url) {
|
143
|
+
html = '<img src="' + oebmed.url + '" />';
|
144
|
+
}
|
145
|
+
|
146
|
+
processEmbedTag(html);
|
147
|
+
});
|
148
|
+
} else {
|
149
|
+
var embed_tag = that.convertUrlToEmbedTag(url);
|
150
|
+
return processEmbedTag(embed_tag);
|
151
|
+
}
|
152
|
+
|
153
|
+
},
|
154
|
+
|
155
|
+
removeToolbar : function () {
|
156
|
+
$(".mediumInsert-embedsWire").remove();
|
157
|
+
},
|
158
|
+
|
159
|
+
getOEmbedHTML: function(url, cb) {
|
160
|
+
$.ajax({
|
161
|
+
url: this.options.oembedProxy,
|
162
|
+
dataType: "json",
|
163
|
+
data: {
|
164
|
+
url: url
|
165
|
+
},
|
166
|
+
success: function(data, textStatus, jqXHR) {
|
167
|
+
cb(null, data, jqXHR);
|
168
|
+
},
|
169
|
+
error: function(jqXHR, textStatus, errorThrown) {
|
170
|
+
var responseJSON = (function() {
|
171
|
+
try {
|
172
|
+
return JSON.parse(jqXHR.responseText);
|
173
|
+
} catch(e) {}
|
174
|
+
}());
|
175
|
+
|
176
|
+
cb((responseJSON && responseJSON.error) || jqXHR.status || errorThrown.message, responseJSON, jqXHR);
|
177
|
+
}
|
178
|
+
});
|
179
|
+
},
|
180
|
+
|
181
|
+
convertUrlToEmbedTag : function (url) {
|
182
|
+
// We didn't get something we expect so let's get out of here.
|
183
|
+
if (!(new RegExp(['youtube', 'yout.be', 'vimeo', 'facebook', 'instagram'].join("|")).test(url))) return false;
|
184
|
+
|
185
|
+
var embed_tag = url.replace(/\n?/g, '').replace(/^((http(s)?:\/\/)?(www\.)?(youtube\.com|youtu\.be)\/(watch\?v=|v\/)?)([a-zA-Z0-9\-_]+)(.*)?$/, '<div class="video"><iframe width="420" height="315" src="//www.youtube.com/embed/$7" frameborder="0" allowfullscreen></iframe></div>')
|
186
|
+
.replace(/^http:\/\/vimeo\.com(\/.+)?\/([0-9]+)$/, '<iframe src="//player.vimeo.com/video/$2" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>')
|
187
|
+
//.replace(/^https:\/\/twitter\.com\/(\w+)\/status\/(\d+)\/?$/, '<blockquote class="twitter-tweet" align="center" lang="en"><a href="https://twitter.com/$1/statuses/$2"></a></blockquote><script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>')
|
188
|
+
.replace(/^https:\/\/www\.facebook\.com\/(video.php|photo.php)\?v=(\d+).+$/, '<div class="fb-post" data-href="https://www.facebook.com/photo.php?v=$2"><div class="fb-xfbml-parse-ignore"><a href="https://www.facebook.com/photo.php?v=$2">Post</a></div></div>')
|
189
|
+
.replace(/^http:\/\/instagram\.com\/p\/(.+)\/?$/, '<span class="instagram"><iframe src="//instagram.com/p/$1/embed/" width="612" height="710" frameborder="0" scrolling="no" allowtransparency="true"></iframe></span>');
|
190
|
+
|
191
|
+
|
192
|
+
return (/<("[^"]*"|'[^']*'|[^'">])*>/).test(embed_tag) ? embed_tag : false;
|
193
|
+
}
|
194
|
+
|
195
|
+
});
|
196
|
+
|
197
|
+
}(jQuery));
|
@@ -0,0 +1,10 @@
|
|
1
|
+
/*!
|
2
|
+
* medium-editor-insert-plugin v0.3.2 - jQuery insert plugin for MediumEditor
|
3
|
+
*
|
4
|
+
* https://github.com/orthes/medium-editor-insert-plugin
|
5
|
+
*
|
6
|
+
* Copyright (c) 2014 Pavel Linkesch (http://linkesch.sk)
|
7
|
+
* Released under the MIT license
|
8
|
+
*/
|
9
|
+
|
10
|
+
!function(a){a.fn.mediumInsert.registerAddon("embeds",{defaults:{urlPlaceholder:"Paste or type a link"},init:function(b){this.options=a.extend(this.defaults,b),this.$el=a.fn.mediumInsert.insert.$el,this.setEmbedButtonEvents(),this.preparePreviousEmbeds()},insertButton:function(a){var b="Embed";return("fontawesome"===a||"object"==typeof a&&a.fontawesome)&&(b='<i class="fa fa-code"></i>'),"object"==typeof a&&a.embed&&(b=a.embed),'<button data-addon="embeds" data-action="add" class="medium-editor-action mediumInsert-action">'+b+"</button>"},add:function(b){a.fn.mediumInsert.insert.deselect();var c='<div class="medium-editor-toolbar medium-editor-toolbar-active medium-editor-toolbar-form-anchor mediumInsert-embedsWire" style="display: block;"><input type="text" value="" placeholder="'+this.options.urlPlaceholder+'" class="mediumInsert-embedsText medium-editor-toolbar-anchor-input"></div>';a(c).appendTo(b.prev()),setTimeout(function(){b.prev().find("input").focus()},50),a.fn.mediumInsert.insert.deselect(),this.currentPlaceholder=b,a(".mediumInsert-embedsText").focus()},preparePreviousEmbeds:function(){this.$el.find(".mediumInsert-embeds").each(function(){var b=a(this).parent();b.hasClass("mediumInsert-placeholder")||b.html('<div class="mediumInsert-placeholder" draggable="true">'+b.html()+"</div>")})},setEmbedButtonEvents:function(){var b=this;a(document).on("keypress","input.mediumInsert-embedsText",function(a){(a.which&&13===a.which||a.keyCode&&13===a.keyCode)&&(b.setEnterActionEvents(),b.removeToolbar())}),this.$el.on("blur",".mediumInsert-embedsText",function(){b.removeToolbar()}).on("paste",".mediumInsert-embedsText",function(b){a.fn.mediumInsert.insert.isFirefox&&b.originalEvent.clipboardData&&a(this).val(b.originalEvent.clipboardData.getData("text/plain"))})},setEnterActionEvents:function(){function b(b){if(!b)return alert("Incorrect URL format specified"),!1;var d=b,e=(new Date).getTime();b=a('<div class="mediumInsert-embeds" id="'+e+'"></div>').append(b),c.currentPlaceholder.append(b),c.currentPlaceholder.closest("[data-medium-element]").trigger("keyup").trigger("input"),-1!==d.indexOf("facebook")&&"undefined"!=typeof FB&&setTimeout(function(){FB.XFBML.parse()},2e3)}var c=this;if(a.fn.mediumInsert.settings.enabled===!1)return!1;var d=a("input.mediumInsert-embedsText").val();if(!d)return!1;if(!this.options.oembedProxy){var e=c.convertUrlToEmbedTag(d);return b(e)}c.getOEmbedHTML(d,function(a,c){var d=!a&&c&&c.html;c&&!c.html&&"photo"===c.type&&c.url&&(d='<img src="'+c.url+'" />'),b(d)})},removeToolbar:function(){a(".mediumInsert-embedsWire").remove()},getOEmbedHTML:function(b,c){a.ajax({url:this.options.oembedProxy,dataType:"json",data:{url:b},success:function(a,b,d){c(null,a,d)},error:function(a,b,d){var e=function(){try{return JSON.parse(a.responseText)}catch(b){}}();c(e&&e.error||a.status||d.message,e,a)}})},convertUrlToEmbedTag:function(a){if(!new RegExp(["youtube","yout.be","vimeo","facebook","instagram"].join("|")).test(a))return!1;var b=a.replace(/\n?/g,"").replace(/^((http(s)?:\/\/)?(www\.)?(youtube\.com|youtu\.be)\/(watch\?v=|v\/)?)([a-zA-Z0-9\-_]+)(.*)?$/,'<div class="video"><iframe width="420" height="315" src="//www.youtube.com/embed/$7" frameborder="0" allowfullscreen></iframe></div>').replace(/^http:\/\/vimeo\.com(\/.+)?\/([0-9]+)$/,'<iframe src="//player.vimeo.com/video/$2" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>').replace(/^https:\/\/www\.facebook\.com\/(video.php|photo.php)\?v=(\d+).+$/,'<div class="fb-post" data-href="https://www.facebook.com/photo.php?v=$2"><div class="fb-xfbml-parse-ignore"><a href="https://www.facebook.com/photo.php?v=$2">Post</a></div></div>').replace(/^http:\/\/instagram\.com\/p\/(.+)\/?$/,'<span class="instagram"><iframe src="//instagram.com/p/$1/embed/" width="612" height="710" frameborder="0" scrolling="no" allowtransparency="true"></iframe></span>');return/<("[^"]*"|'[^']*'|[^'">])*>/.test(b)?b:!1}})}(jQuery);
|