proclaim 0.5.6 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/Rakefile +5 -38
- data/app/assets/config/proclaim_manifest.js +2 -0
- data/app/assets/images/{ajax_loader.gif → proclaim/ajax_loader.gif} +0 -0
- data/app/assets/javascripts/proclaim.js +7 -7
- data/app/assets/javascripts/proclaim/{comments_handler.js.coffee → comments_handler.coffee} +16 -10
- data/app/assets/javascripts/proclaim/editor.coffee +55 -0
- data/app/assets/stylesheets/{proclaim.css.scss → proclaim.scss} +7 -8
- data/app/assets/stylesheets/proclaim/{comments.css.scss → comments.scss} +0 -0
- data/app/assets/stylesheets/proclaim/{posts.css.scss → posts.scss} +60 -25
- data/app/assets/stylesheets/proclaim/{subscriptions.css.scss → subscriptions.scss} +0 -0
- data/app/controllers/proclaim/application_controller.rb +60 -56
- data/app/controllers/proclaim/comments_controller.rb +13 -42
- data/app/controllers/proclaim/posts_controller.rb +25 -57
- data/app/controllers/proclaim/subscriptions_controller.rb +3 -3
- data/app/jobs/proclaim/application_job.rb +4 -0
- data/app/mailers/proclaim/application_mailer.rb +5 -0
- data/app/mailers/proclaim/subscription_mailer.rb +19 -17
- data/app/models/proclaim/application_record.rb +5 -0
- data/app/models/proclaim/comment.rb +6 -1
- data/app/models/proclaim/post.rb +20 -28
- data/app/models/proclaim/subscription.rb +33 -11
- data/app/views/layouts/proclaim/subscription_mailer.html.erb +15 -36
- data/app/views/proclaim/comments/_comment.html.erb +7 -7
- data/app/views/proclaim/comments/_form.html.erb +7 -5
- data/app/views/proclaim/posts/_form.html.erb +34 -21
- data/app/views/proclaim/posts/show.html.erb +16 -3
- data/app/views/proclaim/subscription_mailer/welcome_email.html.erb +2 -6
- data/config/initializers/friendly_id.rb +20 -1
- data/config/routes.rb +1 -5
- data/db/migrate/20141108222616_create_proclaim_posts.rb +8 -1
- data/db/migrate/20141114235359_create_proclaim_comments.rb +1 -1
- data/db/migrate/20141115022230_create_proclaim_comment_hierarchies.rb +1 -1
- data/db/migrate/20141210234057_create_proclaim_subscriptions.rb +5 -4
- data/db/migrate/20150213015321_create_friendly_id_slugs.rb +1 -1
- data/lib/generators/proclaim/install_generator.rb +1 -1
- data/lib/generators/proclaim/templates/initialize_proclaim.rb +31 -29
- data/lib/generators/proclaim/views_generator.rb +1 -1
- data/lib/proclaim.rb +15 -15
- data/lib/proclaim/engine.rb +21 -19
- data/lib/proclaim/version.rb +1 -1
- data/vendor/assets/fonts/KaTeX_AMS-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_AMS-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Fraktur-Bold.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Fraktur-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Bold.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Bold.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Bold.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Main-BoldItalic.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Italic.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Italic.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Italic.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Math-Italic.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Math-Italic.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Math-Italic.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Bold.woff +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Italic.woff +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Script-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Script-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Script-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Size1-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Size1-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Size2-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Size2-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Size3-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Size3-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Size4-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Size4-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Typewriter-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- data/vendor/assets/javascripts/contrib/auto-render.js +339 -0
- data/vendor/assets/javascripts/contrib/auto-render.min.js +1 -0
- data/vendor/assets/javascripts/contrib/auto-render.mjs +215 -0
- data/vendor/assets/javascripts/contrib/copy-tex.css +14 -0
- data/vendor/assets/javascripts/contrib/copy-tex.js +213 -0
- data/vendor/assets/javascripts/contrib/copy-tex.min.css +1 -0
- data/vendor/assets/javascripts/contrib/copy-tex.min.js +1 -0
- data/vendor/assets/javascripts/contrib/copy-tex.mjs +85 -0
- data/vendor/assets/javascripts/contrib/mathtex-script-type.js +137 -0
- data/vendor/assets/javascripts/contrib/mathtex-script-type.min.js +1 -0
- data/vendor/assets/javascripts/contrib/mathtex-script-type.mjs +24 -0
- data/vendor/assets/javascripts/contrib/mhchem.js +3241 -0
- data/vendor/assets/javascripts/contrib/mhchem.min.js +1 -0
- data/vendor/assets/javascripts/contrib/mhchem.mjs +3109 -0
- data/vendor/assets/javascripts/katex.js +16517 -0
- data/vendor/assets/javascripts/katex.min.js +1 -0
- data/vendor/assets/javascripts/katex.mjs +16122 -0
- data/vendor/assets/javascripts/quill.core.js +8522 -0
- data/vendor/assets/javascripts/quill.js +11489 -0
- data/vendor/assets/javascripts/quill.min.js +8 -0
- data/vendor/assets/javascripts/quill.min.js.map +1 -0
- data/vendor/assets/stylesheets/katex.css +1011 -0
- data/vendor/assets/stylesheets/katex.min.css +1 -0
- data/vendor/assets/stylesheets/quill.bubble.css +952 -0
- data/vendor/assets/stylesheets/quill.core.css +397 -0
- data/vendor/assets/stylesheets/quill.snow.css +945 -0
- metadata +169 -278
- data/CHANGELOG +0 -77
- data/Gemfile +0 -14
- data/VERSION +0 -1
- data/app/assets/javascripts/proclaim/editor.js.coffee +0 -52
- data/app/assets/javascripts/proclaim/images.js.coffee +0 -3
- data/app/assets/javascripts/proclaim/subscriptions.js.coffee +0 -3
- data/app/assets/stylesheets/proclaim/images.scss +0 -3
- data/app/controllers/proclaim/images_controller.rb +0 -67
- data/app/helpers/proclaim/comments_helper.rb +0 -4
- data/app/helpers/proclaim/images_helper.rb +0 -4
- data/app/helpers/proclaim/subscriptions_helper.rb +0 -4
- data/app/models/proclaim/image.rb +0 -19
- data/app/policies/proclaim/image_policy.rb +0 -29
- data/app/uploaders/proclaim/image_uploader.rb +0 -82
- data/db/migrate/20141222224905_create_proclaim_images.rb +0 -12
- data/db/migrate/20150123115226_add_name_to_subscriptions.rb +0 -7
- data/db/migrate/20150213015850_add_slug_to_posts.rb +0 -20
- data/proclaim.gemspec +0 -51
- data/test/controllers/proclaim/comments_controller_test.rb +0 -228
- data/test/controllers/proclaim/images_controller_test.rb +0 -166
- data/test/controllers/proclaim/posts_controller_test.rb +0 -465
- data/test/controllers/proclaim/subscriptions_controller_test.rb +0 -154
- data/test/dummy/README.rdoc +0 -28
- data/test/dummy/Rakefile +0 -6
- data/test/dummy/app/assets/javascripts/application.js +0 -14
- data/test/dummy/app/assets/stylesheets/application.css +0 -16
- data/test/dummy/app/controllers/application_controller.rb +0 -15
- data/test/dummy/app/helpers/application_helper.rb +0 -28
- data/test/dummy/app/models/user.rb +0 -7
- data/test/dummy/app/views/layouts/application.html.erb +0 -16
- data/test/dummy/bin/bundle +0 -3
- data/test/dummy/bin/rails +0 -4
- data/test/dummy/bin/rake +0 -4
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -24
- data/test/dummy/config/boot.rb +0 -5
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -45
- data/test/dummy/config/environments/production.rb +0 -80
- data/test/dummy/config/environments/test.rb +0 -49
- data/test/dummy/config/initializers/assets.rb +0 -8
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/cookies_serializer.rb +0 -3
- data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/test/dummy/config/initializers/inflections.rb +0 -16
- data/test/dummy/config/initializers/mime_types.rb +0 -4
- data/test/dummy/config/initializers/session_store.rb +0 -3
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -23
- data/test/dummy/config/routes.rb +0 -5
- data/test/dummy/config/secrets.yml +0 -22
- data/test/dummy/db/migrate/20141117214323_create_users.rb +0 -10
- data/test/dummy/db/schema.rb +0 -91
- data/test/dummy/public/404.html +0 -67
- data/test/dummy/public/422.html +0 -67
- data/test/dummy/public/500.html +0 -66
- data/test/dummy/public/favicon.ico +0 -0
- data/test/factories/proclaim/comment.rb +0 -11
- data/test/factories/proclaim/image.rb +0 -6
- data/test/factories/proclaim/post.rb +0 -14
- data/test/factories/proclaim/subscription.rb +0 -14
- data/test/factories/user.rb +0 -6
- data/test/helpers/proclaim/comments_helper_test.rb +0 -6
- data/test/helpers/proclaim/posts_helper_test.rb +0 -6
- data/test/helpers/proclaim/subscriptions_helper_test.rb +0 -6
- data/test/integration/with_javascript/comment_test.rb +0 -391
- data/test/integration/with_javascript/post_form_test.rb +0 -225
- data/test/integration/with_javascript/post_show_test.rb +0 -47
- data/test/integration/with_javascript/post_subscription_test.rb +0 -302
- data/test/integration/without_javascript/blog_subscription_test.rb +0 -114
- data/test/integration/without_javascript/manage_subscriptions_test.rb +0 -37
- data/test/integration/without_javascript/post_test.rb +0 -234
- data/test/integration/without_javascript/subscription_email_test.rb +0 -95
- data/test/integration/without_javascript/unsubscribe_test.rb +0 -32
- data/test/mailers/previews/proclaim/subscription_mailer_preview.rb +0 -22
- data/test/mailers/proclaim/subscription_mailer_test.rb +0 -91
- data/test/models/proclaim/comment_test.rb +0 -41
- data/test/models/proclaim/image_test.rb +0 -70
- data/test/models/proclaim/post_test.rb +0 -193
- data/test/models/proclaim/subscription_test.rb +0 -77
- data/test/policies/application_policy_test.rb +0 -87
- data/test/policies/proclaim/comment_policy_test.rb +0 -71
- data/test/policies/proclaim/image_policy_test.rb +0 -83
- data/test/policies/proclaim/post_policy_test.rb +0 -98
- data/test/policies/proclaim/subscription_policy_test.rb +0 -103
- data/test/proclaim_test.rb +0 -7
- data/test/support/images/test.jpg +0 -0
- data/test/support/pages/posts/edit_page.rb +0 -5
- data/test/support/pages/posts/show_page.rb +0 -47
- data/test/support/wait_for_ajax.rb +0 -11
- data/test/test_helper.rb +0 -71
- data/test/unit/proclaim/new_comment_callback_test.rb +0 -62
- data/test/unit/proclaim/new_subscription_callback_test.rb +0 -62
- data/test/unit/proclaim/post_published_callback_test.rb +0 -74
- 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 +0 -197
- data/vendor/assets/javascripts/addons/medium-editor-insert-images.js +0 -572
- data/vendor/assets/javascripts/addons/medium-editor-insert-maps.js +0 -50
- data/vendor/assets/javascripts/addons/medium-editor-insert-plugin.js +0 -496
- data/vendor/assets/javascripts/addons/medium-editor-insert-tables.js +0 -132
- data/vendor/assets/javascripts/medium-editor-insert-plugin.all.js +0 -1415
- data/vendor/assets/stylesheets/medium-editor-insert-plugin-frontend.css.scss +0 -55
- data/vendor/assets/stylesheets/medium-editor-insert-plugin.css.scss +0 -277
data/test/proclaim_test.rb
DELETED
|
Binary file
|
|
@@ -1,47 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
# Configure Rails Environment
|
|
2
|
-
ENV["RAILS_ENV"] = "test"
|
|
3
|
-
|
|
4
|
-
require "codeclimate-test-reporter"
|
|
5
|
-
CodeClimate::TestReporter.start
|
|
6
|
-
|
|
7
|
-
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
|
8
|
-
require "rails/test_help"
|
|
9
|
-
require 'selenium-webdriver'
|
|
10
|
-
require "factory_girl_rails"
|
|
11
|
-
require "faker"
|
|
12
|
-
require "mocha/mini_test"
|
|
13
|
-
require 'capybara/rails'
|
|
14
|
-
require 'database_cleaner'
|
|
15
|
-
require 'test_after_commit'
|
|
16
|
-
require 'coffee_script'
|
|
17
|
-
require 'sass'
|
|
18
|
-
|
|
19
|
-
Rails.backtrace_cleaner.remove_silencers!
|
|
20
|
-
Capybara.default_wait_time = 5 # 5 seconds instead of 2, since we use fades.
|
|
21
|
-
|
|
22
|
-
# Load support files
|
|
23
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
|
24
|
-
|
|
25
|
-
class ActionDispatch::IntegrationTest
|
|
26
|
-
# Make the Capybara DSL available in all integration tests
|
|
27
|
-
include Capybara::DSL
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
if ENV['TRAVIS']
|
|
31
|
-
capabilities = Selenium::WebDriver::Remote::Capabilities.send ENV["BROWSER"]
|
|
32
|
-
capabilities.version = ENV["VERSION"]
|
|
33
|
-
capabilities.platform = ENV["PLATFORM"]
|
|
34
|
-
|
|
35
|
-
capabilities['tunnel-identifier'] = ENV['TRAVIS_JOB_NUMBER']
|
|
36
|
-
capabilities['name'] = "Travis ##{ENV['TRAVIS_JOB_NUMBER']}"
|
|
37
|
-
capabilities['deviceName'] = ENV['DEVICE_NAME']
|
|
38
|
-
capabilities['deviceOrientation'] = ENV['DEVICE_ORIENTATION']
|
|
39
|
-
|
|
40
|
-
Capybara.register_driver :selenium do |app|
|
|
41
|
-
Capybara::Selenium::Driver.new(app,
|
|
42
|
-
browser: :remote,
|
|
43
|
-
url: "http://#{ENV['SAUCE_USERNAME']}:#{ENV['SAUCE_ACCESS_KEY']}@ondemand.saucelabs.com/wd/hub",
|
|
44
|
-
desired_capabilities: capabilities)
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def sign_in(user)
|
|
49
|
-
ApplicationController.any_instance.stubs(:current_user).returns(user)
|
|
50
|
-
ApplicationController.any_instance.stubs(:authenticate_user).returns(true)
|
|
51
|
-
|
|
52
|
-
if @controller
|
|
53
|
-
@controller.stubs(:current_user).returns(user)
|
|
54
|
-
@controller.stubs(:authenticate_user).returns(true)
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def wait_until
|
|
59
|
-
require "timeout"
|
|
60
|
-
begin
|
|
61
|
-
Timeout.timeout(Capybara.default_wait_time) do
|
|
62
|
-
sleep(0.1) until value = yield
|
|
63
|
-
value
|
|
64
|
-
end
|
|
65
|
-
rescue
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
def test_image_file_path
|
|
70
|
-
File.join(Rails.root, '../', 'support', 'images', 'test.jpg')
|
|
71
|
-
end
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
# == Schema Information
|
|
2
|
-
#
|
|
3
|
-
# Table name: proclaim_comments
|
|
4
|
-
#
|
|
5
|
-
# id :integer not null, primary key
|
|
6
|
-
# post_id :integer
|
|
7
|
-
# parent_id :integer
|
|
8
|
-
# author :string
|
|
9
|
-
# body :text
|
|
10
|
-
# created_at :datetime not null
|
|
11
|
-
# updated_at :datetime not null
|
|
12
|
-
#
|
|
13
|
-
|
|
14
|
-
require 'test_helper'
|
|
15
|
-
|
|
16
|
-
module Proclaim
|
|
17
|
-
class NewCommentCallbackTest < ActiveSupport::TestCase
|
|
18
|
-
setup do
|
|
19
|
-
@callback_called = false
|
|
20
|
-
|
|
21
|
-
Proclaim.after_new_comment do
|
|
22
|
-
@callback_called = true
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
teardown do
|
|
27
|
-
Proclaim.reset_new_comment_callbacks
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
test "ensure callback supports blocks and procs" do
|
|
31
|
-
assert_nothing_raised do
|
|
32
|
-
Proclaim.after_new_comment lambda {|comment| puts "test Proc"}
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
assert_nothing_raised do
|
|
36
|
-
Proclaim.after_new_comment do
|
|
37
|
-
puts "test block"
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
assert_raise RuntimeError do
|
|
42
|
-
Proclaim.after_new_comment :foo
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
test "ensure callback is called when created" do
|
|
47
|
-
comment = FactoryGirl.build(:comment)
|
|
48
|
-
refute @callback_called
|
|
49
|
-
|
|
50
|
-
comment.save
|
|
51
|
-
assert @callback_called
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
test "ensure callback is not called when updated" do
|
|
55
|
-
comment = FactoryGirl.create(:comment)
|
|
56
|
-
@callback_called = false
|
|
57
|
-
|
|
58
|
-
comment.save
|
|
59
|
-
refute @callback_called
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
end
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
# == Schema Information
|
|
2
|
-
#
|
|
3
|
-
# Table name: proclaim_comments
|
|
4
|
-
#
|
|
5
|
-
# id :integer not null, primary key
|
|
6
|
-
# post_id :integer
|
|
7
|
-
# parent_id :integer
|
|
8
|
-
# author :string
|
|
9
|
-
# body :text
|
|
10
|
-
# created_at :datetime not null
|
|
11
|
-
# updated_at :datetime not null
|
|
12
|
-
#
|
|
13
|
-
|
|
14
|
-
require 'test_helper'
|
|
15
|
-
|
|
16
|
-
module Proclaim
|
|
17
|
-
class NewSubscriptionCallbackTest < ActiveSupport::TestCase
|
|
18
|
-
setup do
|
|
19
|
-
@callback_called = false
|
|
20
|
-
|
|
21
|
-
Proclaim.after_new_subscription do
|
|
22
|
-
@callback_called = true
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
teardown do
|
|
27
|
-
Proclaim.reset_new_subscription_callbacks
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
test "ensure callback supports blocks and procs" do
|
|
31
|
-
assert_nothing_raised do
|
|
32
|
-
Proclaim.after_new_subscription lambda {|subscription| puts "test Proc"}
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
assert_nothing_raised do
|
|
36
|
-
Proclaim.after_new_subscription do
|
|
37
|
-
puts "test block"
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
assert_raise RuntimeError do
|
|
42
|
-
Proclaim.after_new_subscription :foo
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
test "ensure callback is called when created" do
|
|
47
|
-
subscription = FactoryGirl.build(:subscription)
|
|
48
|
-
refute @callback_called
|
|
49
|
-
|
|
50
|
-
subscription.save
|
|
51
|
-
assert @callback_called
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
test "ensure callback is not called when updated" do
|
|
55
|
-
subscription = FactoryGirl.create(:subscription)
|
|
56
|
-
@callback_called = false
|
|
57
|
-
|
|
58
|
-
subscription.save
|
|
59
|
-
refute @callback_called
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
end
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# == Schema Information
|
|
2
|
-
#
|
|
3
|
-
# Table name: proclaim_comments
|
|
4
|
-
#
|
|
5
|
-
# id :integer not null, primary key
|
|
6
|
-
# post_id :integer
|
|
7
|
-
# parent_id :integer
|
|
8
|
-
# author :string
|
|
9
|
-
# body :text
|
|
10
|
-
# created_at :datetime not null
|
|
11
|
-
# updated_at :datetime not null
|
|
12
|
-
#
|
|
13
|
-
|
|
14
|
-
require 'test_helper'
|
|
15
|
-
|
|
16
|
-
module Proclaim
|
|
17
|
-
class PostPublishedCallbackTest < ActiveSupport::TestCase
|
|
18
|
-
setup do
|
|
19
|
-
@callback_called = false
|
|
20
|
-
|
|
21
|
-
Proclaim.after_post_published do
|
|
22
|
-
@callback_called = true
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
teardown do
|
|
27
|
-
Proclaim.reset_post_published_callbacks
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
test "ensure callback supports blocks and procs" do
|
|
31
|
-
assert_nothing_raised do
|
|
32
|
-
Proclaim.after_post_published lambda {|post| puts "test Proc"}
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
assert_nothing_raised do
|
|
36
|
-
Proclaim.after_post_published do
|
|
37
|
-
puts "test block"
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
assert_raise RuntimeError do
|
|
42
|
-
Proclaim.after_post_published :foo
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
test "ensure callback is called when published" do
|
|
47
|
-
post = FactoryGirl.build(:post)
|
|
48
|
-
refute @callback_called
|
|
49
|
-
|
|
50
|
-
post.publish
|
|
51
|
-
refute @callback_called # Not saved yet, so callbacks shouldn't happen
|
|
52
|
-
|
|
53
|
-
post.save
|
|
54
|
-
assert @callback_called
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
test "ensure callback is not called when created" do
|
|
58
|
-
post = FactoryGirl.build(:post)
|
|
59
|
-
refute @callback_called
|
|
60
|
-
|
|
61
|
-
post.save
|
|
62
|
-
refute @callback_called,
|
|
63
|
-
"Callback shouldn't be called unless the post is published!"
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
test "ensure callback is not called when updated" do
|
|
67
|
-
post = FactoryGirl.create(:post)
|
|
68
|
-
@callback_called = false
|
|
69
|
-
|
|
70
|
-
post.save
|
|
71
|
-
refute @callback_called
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
end
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,197 +0,0 @@
|
|
|
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));
|