virgo 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +37 -0
- data/app/assets/javascripts/tinymce/manifest.coffee +1 -0
- data/app/assets/javascripts/tinymce/plugins/image_manager/plugin.coffee +234 -0
- data/app/assets/javascripts/virgo/admin/page_modules/edit_form.coffee +4 -0
- data/app/assets/javascripts/virgo/admin/page_modules/edit_subject_form.coffee +29 -0
- data/app/assets/javascripts/virgo/admin/posts/edit_locking.coffee +35 -0
- data/app/assets/javascripts/virgo/admin/posts/form.coffee +183 -0
- data/app/assets/javascripts/virgo/admin/slides/form.coffee +27 -0
- data/app/assets/javascripts/virgo/admin/slideshows/form.coffee +26 -0
- data/app/assets/javascripts/virgo/admin_only.coffee +1 -0
- data/app/assets/javascripts/virgo/application.coffee +51 -0
- data/app/assets/javascripts/virgo/common.coffee +83 -0
- data/app/assets/javascripts/virgo/common/character_counter.coffee +27 -0
- data/app/assets/javascripts/virgo/components/header.coffee +47 -0
- data/app/assets/javascripts/virgo/components/media_modal.coffee +151 -0
- data/app/assets/javascripts/virgo/components/share_bar.coffee +53 -0
- data/app/assets/javascripts/virgo/components/slideshow.coffee +35 -0
- data/app/assets/javascripts/virgo/lib/jquery-ui-multiselect.js +342 -0
- data/app/assets/javascripts/virgo/lib/jquery.browser.js +184 -0
- data/app/assets/javascripts/virgo/lib/jquery.cookie.js +114 -0
- data/app/assets/javascripts/virgo/lib/jquery.pjax.js +932 -0
- data/app/assets/javascripts/virgo/lib/jquery_ext.coffee +0 -0
- data/app/assets/javascripts/virgo/lib/manifest.coffee +5 -0
- data/app/assets/javascripts/virgo/lib/ouibounce.js +194 -0
- data/app/assets/javascripts/virgo/page_modules.coffee +175 -0
- data/app/assets/javascripts/virgo/posts/show.coffee +32 -0
- data/app/assets/stylesheets/tinymce/skin.sass +2 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/content.min.sass +82 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/fonts/tinymce-small.eot +0 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/fonts/tinymce-small.svg +62 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/fonts/tinymce-small.ttf +0 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/fonts/tinymce-small.woff +0 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/fonts/tinymce.eot +0 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/fonts/tinymce.svg +63 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/fonts/tinymce.ttf +0 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/fonts/tinymce.woff +0 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/img/anchor.gif +0 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/img/loader.gif +0 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/img/object.gif +0 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/img/trans.gif +0 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/skin.min.sass +1703 -0
- data/app/assets/stylesheets/virgo/_common.sass +65 -0
- data/app/assets/stylesheets/virgo/admin.sass +301 -0
- data/app/assets/stylesheets/virgo/admin/columns.sass +3 -0
- data/app/assets/stylesheets/virgo/admin/images.sass +14 -0
- data/app/assets/stylesheets/virgo/admin/media_modal.sass +72 -0
- data/app/assets/stylesheets/virgo/admin/post.sass +102 -0
- data/app/assets/stylesheets/virgo/admin/slideshow.sass +35 -0
- data/app/assets/stylesheets/virgo/admin/users.sass +2 -0
- data/app/assets/stylesheets/virgo/admin_only.sass +1 -0
- data/app/assets/stylesheets/virgo/application.sass +605 -0
- data/app/assets/stylesheets/virgo/columns.sass +51 -0
- data/app/assets/stylesheets/virgo/install.sass +15 -0
- data/app/assets/stylesheets/virgo/lib/bootstrap/bootstrap-imports.sass +9 -0
- data/app/assets/stylesheets/virgo/lib/bootstrap/bootstrap-overrides.sass +51 -0
- data/app/assets/stylesheets/virgo/lib/bootstrap/bootstrap-variables.sass +27 -0
- data/app/assets/stylesheets/virgo/lib/jquery-ui-multiselect.css +30 -0
- data/app/assets/stylesheets/virgo/lib/manifest.sass +3 -0
- data/app/assets/stylesheets/virgo/lib/ouibounce.css +222 -0
- data/app/assets/stylesheets/virgo/lib/select2-imports.sass +8 -0
- data/app/assets/stylesheets/virgo/page_modules.sass +54 -0
- data/app/assets/stylesheets/virgo/pages/authors.sass +30 -0
- data/app/assets/stylesheets/virgo/posts.sass +782 -0
- data/app/assets/stylesheets/virgo/search.sass +36 -0
- data/app/assets/stylesheets/virgo/ui.sass +434 -0
- data/app/assets/stylesheets/virgo/users.sass +9 -0
- data/app/controllers/virgo/admin/base_controller.rb +22 -0
- data/app/controllers/virgo/admin/categories_controller.rb +90 -0
- data/app/controllers/virgo/admin/columns_controller.rb +65 -0
- data/app/controllers/virgo/admin/images_controller.rb +89 -0
- data/app/controllers/virgo/admin/media_modal_controller.rb +101 -0
- data/app/controllers/virgo/admin/newsletters_controller.rb +37 -0
- data/app/controllers/virgo/admin/page_modules_controller.rb +62 -0
- data/app/controllers/virgo/admin/pages_controller.rb +6 -0
- data/app/controllers/virgo/admin/posts_controller.rb +173 -0
- data/app/controllers/virgo/admin/sites_controller.rb +31 -0
- data/app/controllers/virgo/admin/slides_controller.rb +71 -0
- data/app/controllers/virgo/admin/slideshows_controller.rb +66 -0
- data/app/controllers/virgo/admin/tags_controller.rb +98 -0
- data/app/controllers/virgo/admin/users/sessions_controller.rb +21 -0
- data/app/controllers/virgo/admin/users_controller.rb +84 -0
- data/app/controllers/virgo/application_controller.rb +151 -0
- data/app/controllers/virgo/categories_controller.rb +20 -0
- data/app/controllers/virgo/columns_controller.rb +24 -0
- data/app/controllers/virgo/images_controller.rb +9 -0
- data/app/controllers/virgo/install_controller.rb +46 -0
- data/app/controllers/virgo/page_modules_controller.rb +23 -0
- data/app/controllers/virgo/pages_controller.rb +29 -0
- data/app/controllers/virgo/posts_controller.rb +101 -0
- data/app/controllers/virgo/search_controller.rb +35 -0
- data/app/controllers/virgo/subscribers_controller.rb +54 -0
- data/app/controllers/virgo/tags_controller.rb +15 -0
- data/app/controllers/virgo/users/confirmations_controller.rb +18 -0
- data/app/controllers/virgo/users/passwords_controller.rb +31 -0
- data/app/controllers/virgo/users/registrations_controller.rb +41 -0
- data/app/controllers/virgo/users/sessions_controller.rb +32 -0
- data/app/controllers/virgo/users_controller.rb +15 -0
- data/app/helpers/virgo/admin/post_helper.rb +54 -0
- data/app/helpers/virgo/admin_helper.rb +15 -0
- data/app/helpers/virgo/application_helper.rb +124 -0
- data/app/helpers/virgo/hooks_helper.rb +30 -0
- data/app/helpers/virgo/page_modules_helper.rb +4 -0
- data/app/helpers/virgo/post_helper.rb +159 -0
- data/app/helpers/virgo/render_helper.rb +33 -0
- data/app/helpers/virgo/search_helper.rb +49 -0
- data/app/helpers/virgo/shortcode_helper.rb +7 -0
- data/app/helpers/virgo/text_helper.rb +12 -0
- data/app/helpers/virgo/video_helper.rb +34 -0
- data/app/models/concerns/virgo/common/slug_history.rb +36 -0
- data/app/models/concerns/virgo/common/uuid.rb +22 -0
- data/app/models/concerns/virgo/post/recommendations.rb +15 -0
- data/app/models/concerns/virgo/post/search.rb +100 -0
- data/app/models/concerns/virgo/user/search.rb +39 -0
- data/app/models/virgo/ability.rb +59 -0
- data/app/models/virgo/category.rb +44 -0
- data/app/models/virgo/column.rb +25 -0
- data/app/models/virgo/form_model.rb +19 -0
- data/app/models/virgo/image.rb +63 -0
- data/app/models/virgo/page_module.rb +42 -0
- data/app/models/virgo/page_module_post.rb +8 -0
- data/app/models/virgo/post.rb +391 -0
- data/app/models/virgo/post_category.rb +8 -0
- data/app/models/virgo/post_search.rb +7 -0
- data/app/models/virgo/post_tag.rb +10 -0
- data/app/models/virgo/site.rb +36 -0
- data/app/models/virgo/slide.rb +23 -0
- data/app/models/virgo/slideshow.rb +37 -0
- data/app/models/virgo/slug_history.rb +5 -0
- data/app/models/virgo/subscriber.rb +5 -0
- data/app/models/virgo/tag.rb +34 -0
- data/app/models/virgo/user.rb +145 -0
- data/app/uploaders/virgo/application_uploader.rb +11 -0
- data/app/uploaders/virgo/avatar_uploader.rb +21 -0
- data/app/uploaders/virgo/featured_image_uploader.rb +28 -0
- data/app/uploaders/virgo/image_uploader.rb +40 -0
- data/app/uploaders/virgo/slide_uploader.rb +19 -0
- data/app/views/layouts/virgo/admin.haml +16 -0
- data/app/views/layouts/virgo/admin/site_settings.haml +14 -0
- data/app/views/layouts/virgo/application.haml +63 -0
- data/app/views/layouts/virgo/errors.haml +42 -0
- data/app/views/layouts/virgo/main.haml +5 -0
- data/app/views/layouts/virgo/posts.haml +10 -0
- data/app/views/virgo/admin/categories/_form.haml +19 -0
- data/app/views/virgo/admin/categories/edit.haml +7 -0
- data/app/views/virgo/admin/categories/index.haml +38 -0
- data/app/views/virgo/admin/categories/modal_form.haml +11 -0
- data/app/views/virgo/admin/categories/new.haml +7 -0
- data/app/views/virgo/admin/categories/success_modal.haml +14 -0
- data/app/views/virgo/admin/columns/_form.haml +30 -0
- data/app/views/virgo/admin/columns/edit.haml +1 -0
- data/app/views/virgo/admin/columns/index.haml +30 -0
- data/app/views/virgo/admin/columns/new.haml +1 -0
- data/app/views/virgo/admin/images/_form.haml +46 -0
- data/app/views/virgo/admin/images/edit.haml +1 -0
- data/app/views/virgo/admin/images/index.haml +32 -0
- data/app/views/virgo/admin/images/new.haml +1 -0
- data/app/views/virgo/admin/media_modal/_image_settings.haml +17 -0
- data/app/views/virgo/admin/media_modal/_library_panel.haml +26 -0
- data/app/views/virgo/admin/media_modal/_upload_panel.haml +21 -0
- data/app/views/virgo/admin/media_modal/_upload_success.haml +7 -0
- data/app/views/virgo/admin/media_modal/index.haml +19 -0
- data/app/views/virgo/admin/newsletters/changelog.haml +25 -0
- data/app/views/virgo/admin/newsletters/edit.haml +6 -0
- data/app/views/virgo/admin/page_modules/edit.haml +33 -0
- data/app/views/virgo/admin/page_modules/edit_subject.haml +43 -0
- data/app/views/virgo/admin/pages/help.haml +114 -0
- data/app/views/virgo/admin/posts/_author_dropdown.haml +1 -0
- data/app/views/virgo/admin/posts/_categories_form.haml +7 -0
- data/app/views/virgo/admin/posts/_category.haml +22 -0
- data/app/views/virgo/admin/posts/_form.haml +201 -0
- data/app/views/virgo/admin/posts/_revisions.haml +40 -0
- data/app/views/virgo/admin/posts/edit.haml +9 -0
- data/app/views/virgo/admin/posts/index.haml +59 -0
- data/app/views/virgo/admin/posts/new.haml +1 -0
- data/app/views/virgo/admin/posts/revision_detail.haml +28 -0
- data/app/views/virgo/admin/posts/revisions.haml +3 -0
- data/app/views/virgo/admin/sites/edit.haml +12 -0
- data/app/views/virgo/admin/slides/_form.haml +41 -0
- data/app/views/virgo/admin/slides/edit.haml +1 -0
- data/app/views/virgo/admin/slides/new.haml +1 -0
- data/app/views/virgo/admin/slideshows/_form.haml +49 -0
- data/app/views/virgo/admin/slideshows/edit.haml +1 -0
- data/app/views/virgo/admin/slideshows/index.haml +43 -0
- data/app/views/virgo/admin/slideshows/new.haml +1 -0
- data/app/views/virgo/admin/tags/_form.haml +16 -0
- data/app/views/virgo/admin/tags/edit.haml +7 -0
- data/app/views/virgo/admin/tags/index.haml +33 -0
- data/app/views/virgo/admin/tags/modal_form.haml +12 -0
- data/app/views/virgo/admin/tags/new.haml +7 -0
- data/app/views/virgo/admin/tags/success_modal.haml +14 -0
- data/app/views/virgo/admin/users/_form.haml +62 -0
- data/app/views/virgo/admin/users/edit.haml +1 -0
- data/app/views/virgo/admin/users/index.haml +34 -0
- data/app/views/virgo/admin/users/new.haml +1 -0
- data/app/views/virgo/application/sitemap.xml.builder +0 -0
- data/app/views/virgo/authors/_profile_long.haml +13 -0
- data/app/views/virgo/authors/_profile_short.haml +10 -0
- data/app/views/virgo/categories/show.haml +24 -0
- data/app/views/virgo/columns/index.haml +19 -0
- data/app/views/virgo/columns/show.haml +18 -0
- data/app/views/virgo/common/_admin_navbar.haml +100 -0
- data/app/views/virgo/common/_alerts.haml +40 -0
- data/app/views/virgo/common/_analytics.html.erb +1 -0
- data/app/views/virgo/common/_base_errors.haml +8 -0
- data/app/views/virgo/common/_category_heading.haml +26 -0
- data/app/views/virgo/common/_disqus.html.erb +24 -0
- data/app/views/virgo/common/_disqus_comment_count.html.erb +12 -0
- data/app/views/virgo/common/_fb_api.html.erb +30 -0
- data/app/views/virgo/common/_fonts.html.erb +1 -0
- data/app/views/virgo/common/_footer.haml +13 -0
- data/app/views/virgo/common/_footer_javascript.html.erb +0 -0
- data/app/views/virgo/common/_header_analytics.html.erb +9 -0
- data/app/views/virgo/common/_list_signup.haml +20 -0
- data/app/views/virgo/common/_ouibounce_modal.haml +26 -0
- data/app/views/virgo/common/_public_nav.haml +58 -0
- data/app/views/virgo/common/_search_form.haml +8 -0
- data/app/views/virgo/common/_share_bar.haml +45 -0
- data/app/views/virgo/common/_user_vars.haml +2 -0
- data/app/views/virgo/errors/404.haml +10 -0
- data/app/views/virgo/errors/500.haml +10 -0
- data/app/views/virgo/images/_shortcode.haml +4 -0
- data/app/views/virgo/install/index.haml +58 -0
- data/app/views/virgo/install/success.haml +12 -0
- data/app/views/virgo/page_modules/_latest_posts.haml +29 -0
- data/app/views/virgo/page_modules/_popular_posts.haml +51 -0
- data/app/views/virgo/pages/authors.haml +8 -0
- data/app/views/virgo/pages/home.haml +0 -0
- data/app/views/virgo/pages/show.haml +6 -0
- data/app/views/virgo/posts/_author_info.haml +16 -0
- data/app/views/virgo/posts/_post_full.haml +63 -0
- data/app/views/virgo/posts/_post_short.haml +30 -0
- data/app/views/virgo/posts/_post_thumb_box.haml +13 -0
- data/app/views/virgo/posts/_recommendations.haml +12 -0
- data/app/views/virgo/posts/_sidebar_thumb.haml +4 -0
- data/app/views/virgo/posts/index.haml +22 -0
- data/app/views/virgo/posts/latest.haml +16 -0
- data/app/views/virgo/posts/more.haml +10 -0
- data/app/views/virgo/posts/rss.xml.builder +17 -0
- data/app/views/virgo/posts/show.haml +17 -0
- data/app/views/virgo/search/_form.haml +5 -0
- data/app/views/virgo/search/_item.haml +22 -0
- data/app/views/virgo/search/index.haml +11 -0
- data/app/views/virgo/search/new.haml +4 -0
- data/app/views/virgo/shortcode_templates/blockquote.haml +9 -0
- data/app/views/virgo/shortcode_templates/h1.haml +1 -0
- data/app/views/virgo/shortcode_templates/h2.haml +1 -0
- data/app/views/virgo/shortcode_templates/h3.haml +1 -0
- data/app/views/virgo/shortcode_templates/h4.haml +1 -0
- data/app/views/virgo/shortcode_templates/image.haml +17 -0
- data/app/views/virgo/shortcode_templates/pullquote.haml +3 -0
- data/app/views/virgo/shortcode_templates/slideshow.haml +35 -0
- data/app/views/virgo/shortcode_templates/tweet.haml +3 -0
- data/app/views/virgo/shortcode_templates/video.haml +8 -0
- data/app/views/virgo/subscribers/_success_modal.haml +13 -0
- data/app/views/virgo/subscribers/modal.haml +15 -0
- data/app/views/virgo/tags/show.haml +16 -0
- data/app/views/virgo/users/confirmations/new.html.haml +10 -0
- data/app/views/virgo/users/devise_mailer/confirmation_instructions.html.erb +7 -0
- data/app/views/virgo/users/devise_mailer/reset_password_instructions.html.haml +6 -0
- data/app/views/virgo/users/devise_mailer/unlock_instructions.html.haml +5 -0
- data/app/views/virgo/users/passwords/edit.html.haml +14 -0
- data/app/views/virgo/users/passwords/new.html.haml +14 -0
- data/app/views/virgo/users/registrations/edit.html.haml +30 -0
- data/app/views/virgo/users/registrations/new.html.haml +13 -0
- data/app/views/virgo/users/sessions/new.html.haml +12 -0
- data/app/views/virgo/users/shared/_links.haml +26 -0
- data/app/views/virgo/users/show.haml +11 -0
- data/app/views/virgo/users/unlocks/new.html.haml +9 -0
- data/config/initializers/action_mailer.rb +7 -0
- data/config/initializers/active_record.rb +72 -0
- data/config/initializers/active_record_symbolize.rb +18 -0
- data/config/initializers/assets.rb +17 -0
- data/config/initializers/backtrace_silencers.rb +7 -0
- data/config/initializers/carrierwave.rb +36 -0
- data/config/initializers/cookies_serializer.rb +3 -0
- data/config/initializers/devise.rb +257 -0
- data/config/initializers/filter_parameter_logging.rb +4 -0
- data/config/initializers/hash.rb +5 -0
- data/config/initializers/inflections.rb +16 -0
- data/config/initializers/mime_types.rb +4 -0
- data/config/initializers/nil_class.rb +13 -0
- data/config/initializers/non_digest_assets.rb +3 -0
- data/config/initializers/paper_trail.rb +30 -0
- data/config/initializers/schema_plus.rb +5 -0
- data/config/initializers/session_store.rb +3 -0
- data/config/initializers/shortcode.rb +12 -0
- data/config/initializers/simple_form.rb +170 -0
- data/config/initializers/simple_form_bootstrap.rb +136 -0
- data/config/initializers/string.rb +5 -0
- data/config/initializers/time_formatting.rb +23 -0
- data/config/initializers/wrap_parameters.rb +14 -0
- data/config/locales/devise.en.yml +60 -0
- data/config/routes.rb +96 -0
- data/config/schedule.rb +3 -0
- data/db/migrate/20150729174510_create_virgo_schema.rb +225 -0
- data/lib/generators/virgo/install/install_generator.rb +16 -0
- data/lib/generators/virgo/views/views_generator.rb +22 -0
- data/lib/tasks/virgo_tasks.rake +7 -0
- data/lib/virgo.rb +4 -0
- data/lib/virgo/development_mail_interceptor.rb +6 -0
- data/lib/virgo/email_validator.rb +6 -0
- data/lib/virgo/engine.rb +73 -0
- data/lib/virgo/reduce_validator.rb +6 -0
- data/lib/virgo/upload_helpers.rb +89 -0
- data/lib/virgo/version.rb +3 -0
- data/lib/virgo/view_help.rb +3 -0
- metadata +1051 -0
@@ -0,0 +1,27 @@
|
|
1
|
+
class AdminSlideForm
|
2
|
+
constructor: ->
|
3
|
+
new window.MediaModal(
|
4
|
+
image_selected_callback: @on_image_selected,
|
5
|
+
image_uploaded_callback: @on_image_uploaded
|
6
|
+
)
|
7
|
+
|
8
|
+
@bind_events()
|
9
|
+
|
10
|
+
bind_events: ->
|
11
|
+
$('.js-change-image-link, .js-add-image-link').click (e) =>
|
12
|
+
e.preventDefault()
|
13
|
+
$(document).trigger("showMediaModal")
|
14
|
+
|
15
|
+
on_image_selected: (data) =>
|
16
|
+
$(".js-image-id").val(data.id)
|
17
|
+
$(".js-image-thumb").attr("src", data.image_url).removeClass("hidden")
|
18
|
+
$(".slide-thumb").removeClass("empty")
|
19
|
+
$("#media-modal .close").click()
|
20
|
+
|
21
|
+
on_image_uploaded: (image, image_html) =>
|
22
|
+
$(".js-image-id").val(image.id)
|
23
|
+
$(".js-image-thumb").attr("src", image.image_url).removeClass("hidden")
|
24
|
+
$(".slide-thumb").removeClass("empty")
|
25
|
+
|
26
|
+
|
27
|
+
window.AdminSlideForm = AdminSlideForm
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class AdminSlideshowForm
|
2
|
+
constructor: ->
|
3
|
+
@slides_list = $(".js-admin-slides-list")
|
4
|
+
@slides_list.sortable(
|
5
|
+
update: @submit_slide_positions
|
6
|
+
)
|
7
|
+
|
8
|
+
submit_slide_positions: (event, ui) =>
|
9
|
+
data = []
|
10
|
+
counter = 0
|
11
|
+
|
12
|
+
@slides_list.find("li.slide").each ->
|
13
|
+
data.push({
|
14
|
+
id: $(this).attr('data-id'),
|
15
|
+
position: counter
|
16
|
+
})
|
17
|
+
counter += 1
|
18
|
+
|
19
|
+
$.ajax
|
20
|
+
type: 'POST'
|
21
|
+
url: '/admin/admin/slides/positions'
|
22
|
+
data: {slides: data}
|
23
|
+
success: (response) =>
|
24
|
+
ui.item.find('.thumbnail').effect('highlight', {}, 1000)
|
25
|
+
|
26
|
+
window.AdminSlideshowForm = AdminSlideshowForm
|
@@ -0,0 +1 @@
|
|
1
|
+
#= require ./lib/jquery-ui-multiselect
|
@@ -0,0 +1,51 @@
|
|
1
|
+
#= require jquery
|
2
|
+
#= require jquery_ujs
|
3
|
+
#= require jquery-ui/effect
|
4
|
+
#= require jquery-ui/effect-highlight
|
5
|
+
#= require jquery-ui/datepicker
|
6
|
+
#= require jquery-ui/autocomplete
|
7
|
+
#= require jquery-ui/sortable
|
8
|
+
#= require jquery-ui/draggable
|
9
|
+
#= require jquery-fileupload/basic
|
10
|
+
#= require ./common
|
11
|
+
#= require bootstrap
|
12
|
+
#= require select2
|
13
|
+
#= require moment
|
14
|
+
#= require local_time
|
15
|
+
#= require bootstrap-datetimepicker
|
16
|
+
#= require ./lib/manifest
|
17
|
+
#= require ../tinymce/manifest
|
18
|
+
#= require_tree ./common
|
19
|
+
#= require_tree ./components
|
20
|
+
#= require_tree ./admin
|
21
|
+
#= require_tree ./posts
|
22
|
+
#= require ./page_modules
|
23
|
+
#= require_self
|
24
|
+
|
25
|
+
$ ->
|
26
|
+
$('.select2-anchor').select2()
|
27
|
+
$("[data-toggle='tooltip']").tooltip()
|
28
|
+
|
29
|
+
EllipseFix.run()
|
30
|
+
ImageWrapper.run()
|
31
|
+
ResponsiveEmbed.run()
|
32
|
+
|
33
|
+
$('#menu-toggle').click (e) ->
|
34
|
+
e.preventDefault()
|
35
|
+
$('#wrapper').toggleClass('toggled')
|
36
|
+
|
37
|
+
$('a.cancel-events').click (e) -> e.preventDefault()
|
38
|
+
|
39
|
+
$('body').addClass("browser-#{$.browser.name}")
|
40
|
+
|
41
|
+
|
42
|
+
# uncomment to force modal to continue to appear (after first dismissal) in dev/staging environments
|
43
|
+
# if window.app_env == "staging" or window.app_env == "development"
|
44
|
+
# $.cookie("viewedOuibounceModal", false)
|
45
|
+
|
46
|
+
# initialize ouibounce modal
|
47
|
+
ouibounce($('#ouibounce-modal')[0], {cookieExpire: 7})
|
48
|
+
|
49
|
+
$('#ouibounce-modal .js-close-modal, #ouibounce-modal .underlay').click (e) ->
|
50
|
+
e.preventDefault()
|
51
|
+
$('#ouibounce-modal').fadeOut(200)
|
@@ -0,0 +1,83 @@
|
|
1
|
+
class EllipseFix
|
2
|
+
@run: ->
|
3
|
+
$("span.ellipse").each ->
|
4
|
+
$ellipse = $(this)
|
5
|
+
$parent = $(this).parent()
|
6
|
+
$parent.addClass("ellipse-wrap")
|
7
|
+
|
8
|
+
$lastP = null
|
9
|
+
|
10
|
+
$(this).parents(".post-body").first().find("p:not(.ellipse-wrap)").each ->
|
11
|
+
if $(this).html() != ""
|
12
|
+
$lastP = $(this)
|
13
|
+
|
14
|
+
if $lastP
|
15
|
+
$lastP.append($ellipse)
|
16
|
+
# $parent.remove()
|
17
|
+
|
18
|
+
window.EllipseFix = EllipseFix
|
19
|
+
|
20
|
+
class ImageWrapper
|
21
|
+
@run: ->
|
22
|
+
$(".post .post-img").each ->
|
23
|
+
$img = $(this)
|
24
|
+
$wrapper = $("<div class='image-wrap'></div>")
|
25
|
+
$img.wrap($wrapper)
|
26
|
+
$wrapper = $img.parents('.image-wrap').first()
|
27
|
+
|
28
|
+
# move the image's style attribute to the wrapper
|
29
|
+
if $img.attr("style") and $img.attr("style") != ""
|
30
|
+
$wrapper.attr("style", $img.attr("style"))
|
31
|
+
$img.removeAttr("style")
|
32
|
+
|
33
|
+
if $img.attr("data-credit") and $img.attr("data-credit") != '' and $img.attr("data-credit") != 'null'
|
34
|
+
$credit = $("<div class='image-credit'></div>")
|
35
|
+
$credit.html(decodeURIComponent($img.attr("data-credit")))
|
36
|
+
$wrapper.append($credit)
|
37
|
+
|
38
|
+
if $img.attr("data-caption") and $img.attr("data-caption") != '' and $img.attr("data-caption") != 'null'
|
39
|
+
$caption = $("<div class='image-caption'></div>")
|
40
|
+
$caption.html(decodeURIComponent($img.attr("data-caption")))
|
41
|
+
$wrapper.append($caption)
|
42
|
+
|
43
|
+
|
44
|
+
window.ImageWrapper = ImageWrapper
|
45
|
+
|
46
|
+
class ResponsiveEmbed
|
47
|
+
@run: ->
|
48
|
+
@convert_videos_to_responsive()
|
49
|
+
|
50
|
+
@convert_videos_to_responsive: =>
|
51
|
+
self = this
|
52
|
+
|
53
|
+
$('.responsive-video-wrap').each ->
|
54
|
+
$this = $(this)
|
55
|
+
$embed = $this.children().first()
|
56
|
+
|
57
|
+
if self.is_recognized_video_embed_url($embed.attr('src'))
|
58
|
+
$wrapper = $("<div class='embed-responsive embed-responsive-16by9 video-embed-wrap'></div>")
|
59
|
+
$embed.removeAttr("width").removeAttr("height").addClass("embed-responsive-item video-embed")
|
60
|
+
$embed.wrap($wrapper)
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
@is_recognized_video_embed_url: (url) =>
|
65
|
+
provider = url.match(/https?:\/\/(:?www.)?(\w*)/)[2]
|
66
|
+
|
67
|
+
if provider == 'youtube' or provider == 'vimeo' or provider == 'player' or provider == 'youtu.be'
|
68
|
+
return true
|
69
|
+
|
70
|
+
false
|
71
|
+
|
72
|
+
window.ResponsiveEmbed = ResponsiveEmbed
|
73
|
+
|
74
|
+
$.fn.outerHTML = (s) ->
|
75
|
+
if s then this.before(s).remove() else jQuery("<p>").append(this.eq(0).clone()).html();
|
76
|
+
|
77
|
+
window.invertObject = (obj) ->
|
78
|
+
new_obj = {}
|
79
|
+
|
80
|
+
for k,v of obj
|
81
|
+
new_obj[v] = k
|
82
|
+
|
83
|
+
new_obj
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class CharacterCounter
|
2
|
+
constructor: (@el) ->
|
3
|
+
@inject_counter()
|
4
|
+
@bind_events()
|
5
|
+
@adjust_count()
|
6
|
+
|
7
|
+
bind_events: =>
|
8
|
+
@el.keyup @adjust_count
|
9
|
+
|
10
|
+
adjust_count: =>
|
11
|
+
count = @el.val().length
|
12
|
+
title = if count == 1 then 'character' else 'characters'
|
13
|
+
@counter_el.html("#{count} #{title}")
|
14
|
+
|
15
|
+
inject_counter: =>
|
16
|
+
group = @el.parents(".form-group")
|
17
|
+
@counter_wrap = $("
|
18
|
+
<div class='character-count-wrap'>
|
19
|
+
<span class='count'></span>
|
20
|
+
</div>
|
21
|
+
")
|
22
|
+
group.prepend(@counter_wrap)
|
23
|
+
@counter_el = @counter_wrap.find('.count')
|
24
|
+
|
25
|
+
$ ->
|
26
|
+
$("[data-toggle='character-counter']").each -> new CharacterCounter($(this))
|
27
|
+
|
@@ -0,0 +1,47 @@
|
|
1
|
+
class Header
|
2
|
+
constructor: ->
|
3
|
+
$(document).on 'hidden', '#signup-modal', ->
|
4
|
+
$(this).remove()
|
5
|
+
|
6
|
+
$('.js-expand-search-form').on 'click', (e) ->
|
7
|
+
e.preventDefault()
|
8
|
+
$('.js-search-form').addClass('expanded').find('#post_search_term').focus()
|
9
|
+
$('.js-collapse-search-form').on 'click', ->
|
10
|
+
$('.js-search-form').removeClass('expanded')
|
11
|
+
$('.close-sticky-signup').on 'click', ->
|
12
|
+
$('.sticky-signup-form, .navbar-spacer.large').slideUp(200)
|
13
|
+
localStorage.setItem("emailPromptHidden", "true") if window.localStorage?
|
14
|
+
|
15
|
+
$('.js-signup-link').click (e) ->
|
16
|
+
e.preventDefault()
|
17
|
+
$.get "/subscribers/modal", (response) ->
|
18
|
+
# remove existing
|
19
|
+
$('#signup-modal').modal('hide') if $('#signup-modal').length
|
20
|
+
|
21
|
+
$modal = $(response.html)
|
22
|
+
|
23
|
+
$modal.modal()
|
24
|
+
|
25
|
+
$(document).on 'submit', '.js-list-signup-form', (e) ->
|
26
|
+
e.preventDefault()
|
27
|
+
|
28
|
+
$form = $(e.currentTarget)
|
29
|
+
|
30
|
+
$form.find(".js-submit-btn").button("loading")
|
31
|
+
|
32
|
+
$.ajax
|
33
|
+
type: 'POST'
|
34
|
+
url: $form.attr('action')
|
35
|
+
data: $form.serialize()
|
36
|
+
success: (response) =>
|
37
|
+
$("#signup-modal .modal-dialog").replaceWith($(response.html).find(".modal-dialog"))
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
unless (window.localStorage? && window.localStorage.getItem("emailPromptHidden") == "true")
|
42
|
+
$(".sticky-signup-form, .navbar-spacer.large").removeClass('hidden')
|
43
|
+
|
44
|
+
$ ->
|
45
|
+
unless window.header_initialized
|
46
|
+
new Header
|
47
|
+
window.header_initialized = true
|
@@ -0,0 +1,151 @@
|
|
1
|
+
class MediaModal
|
2
|
+
constructor: (opts) ->
|
3
|
+
@mode = 'normal'
|
4
|
+
|
5
|
+
@image_selected_callback = opts.image_selected_callback
|
6
|
+
@image_uploaded_callback = opts.image_uploaded_callback
|
7
|
+
|
8
|
+
@bind_events()
|
9
|
+
|
10
|
+
bind_events: =>
|
11
|
+
$(document).bind("showMediaModal", @show_media_modal)
|
12
|
+
|
13
|
+
$('body').on 'change', '.image-radio', @image_radio_click
|
14
|
+
$('body').on 'submit', '.js-image-upload-panel', @submit_upload
|
15
|
+
$('body').on 'change', '#image-upload-file-field', @file_selected
|
16
|
+
$('body').on 'click', '.js-insert-selection', @on_image_selected
|
17
|
+
$('body').on 'click', '#browse-files-btn', @browse_files_clicked
|
18
|
+
|
19
|
+
$('body').on 'click', '.js-paginate-link', (e) =>
|
20
|
+
e.preventDefault()
|
21
|
+
@paginate()
|
22
|
+
|
23
|
+
$('body').on 'click', '.media-modal-nav li a', (e) =>
|
24
|
+
e.preventDefault()
|
25
|
+
$link = $(e.currentTarget)
|
26
|
+
$('.media-modal-nav li.active').removeClass('active')
|
27
|
+
$link.parents('li').first().addClass('active')
|
28
|
+
@show_loading()
|
29
|
+
$.get $link.attr('href'), (response) =>
|
30
|
+
$("#media-modal-content-area").html(response.html)
|
31
|
+
@init_fileupload()
|
32
|
+
@hide_loading()
|
33
|
+
|
34
|
+
show_media_modal: (e) =>
|
35
|
+
e.preventDefault() if e?
|
36
|
+
|
37
|
+
if e && e.data && e.data.mode?
|
38
|
+
@mode = e.data.mode
|
39
|
+
|
40
|
+
$.get '/admin/media_modal', (response) =>
|
41
|
+
if $('#media-modal').length
|
42
|
+
$('#media-modal').modal('hide').data('bs.modal', null).remove()
|
43
|
+
|
44
|
+
$modal = $(response.html)
|
45
|
+
$('body').prepend($modal)
|
46
|
+
$modal.modal()
|
47
|
+
@modal_launch_events()
|
48
|
+
|
49
|
+
show_loading: =>
|
50
|
+
$('#media-modal-content-area').css({opacity: 0.65})
|
51
|
+
|
52
|
+
hide_loading: =>
|
53
|
+
$('#media-modal-content-area').css({opacity: 1})
|
54
|
+
|
55
|
+
modal_launch_events: =>
|
56
|
+
$('.media-thumbnails').scroll @on_thumbnails_scroll
|
57
|
+
|
58
|
+
image_radio_click: =>
|
59
|
+
$('#insert-selection').removeClass('hidden')
|
60
|
+
|
61
|
+
on_thumbnails_scroll: (e) =>
|
62
|
+
if @scroll_distance_from_bottom() < @paginationThreshold
|
63
|
+
@paginate()
|
64
|
+
|
65
|
+
|
66
|
+
paginate: (e) =>
|
67
|
+
if $(".paginator").attr('data-last-page') != 'true' && !@paginating
|
68
|
+
uri = $(".paginator").attr("data-uri")
|
69
|
+
@paginating = true
|
70
|
+
@show_loading()
|
71
|
+
|
72
|
+
$.get uri, (response) =>
|
73
|
+
$('.media-thumbnails-inner').append($(response.html).find('.media-thumbnails-inner').html())
|
74
|
+
$(".paginator").replaceWith($(response.html).find(".paginator"))
|
75
|
+
@paginating = false
|
76
|
+
@hide_loading()
|
77
|
+
|
78
|
+
|
79
|
+
update_upload_progress_indicator: (e, data) =>
|
80
|
+
percent_loaded = parseInt(data.loaded / data.total * 100, 10)
|
81
|
+
$(".upload-progress").show()
|
82
|
+
$(".upload-progress .progress-bar").css("width", "#{percent_loaded}%")
|
83
|
+
$(".upload-progress .progress-amount").html("#{percent_loaded}%")
|
84
|
+
|
85
|
+
if percent_loaded == 100
|
86
|
+
$(".progress-text").html("Processing uploaded image. Please be patient...")
|
87
|
+
|
88
|
+
submit_upload: (e) =>
|
89
|
+
e.preventDefault()
|
90
|
+
|
91
|
+
$form = $("form.js-image-upload-panel")
|
92
|
+
|
93
|
+
unless @files
|
94
|
+
alert("You must select a file")
|
95
|
+
return false
|
96
|
+
|
97
|
+
if $("#image_name").val() == ""
|
98
|
+
alert("You must enter a name for this image")
|
99
|
+
return false
|
100
|
+
|
101
|
+
if @upload_data
|
102
|
+
@upload_data.submit()
|
103
|
+
|
104
|
+
$('#upload-button').button('loading')
|
105
|
+
|
106
|
+
|
107
|
+
init_fileupload: =>
|
108
|
+
$form = $("form.js-image-upload-panel")
|
109
|
+
|
110
|
+
@files = false
|
111
|
+
|
112
|
+
if $form.length
|
113
|
+
unless $form.data('blueimpFileupload')
|
114
|
+
$form.fileupload(
|
115
|
+
progressall: @update_upload_progress_indicator
|
116
|
+
dataType: 'json'
|
117
|
+
add: (e, data) =>
|
118
|
+
@files = true
|
119
|
+
@upload_data = data
|
120
|
+
$('#browse-files-btn').html('File Added').css('opacity', '0.7')
|
121
|
+
done: (e, data) =>
|
122
|
+
response = data.result
|
123
|
+
$('#upload-button').button('reset')
|
124
|
+
$("#media-modal-content-area").html(response.html)
|
125
|
+
if response.status == 'upload_success'
|
126
|
+
@image_uploaded_callback(response.image, response.image_html)
|
127
|
+
)
|
128
|
+
|
129
|
+
on_image_selected: (e) =>
|
130
|
+
e.preventDefault()
|
131
|
+
|
132
|
+
$(".js-insert-selection").button("loading")
|
133
|
+
|
134
|
+
$selection = $(".image-radio:checked")
|
135
|
+
|
136
|
+
data = $.parseJSON($selection.attr('data-image'))
|
137
|
+
|
138
|
+
data.selected_el = $(e.currentTarget)
|
139
|
+
|
140
|
+
@image_selected_callback(data)
|
141
|
+
|
142
|
+
file_selected: (e) =>
|
143
|
+
@files = e.target.files
|
144
|
+
|
145
|
+
scroll_distance_from_bottom: =>
|
146
|
+
distance = $('.media-thumbnails-inner').height() - ($('.media-thumbnails').height() + $('.media-thumbnails').scrollTop())
|
147
|
+
|
148
|
+
browse_files_clicked: (e) =>
|
149
|
+
e.preventDefault()
|
150
|
+
|
151
|
+
window.MediaModal = MediaModal
|
@@ -0,0 +1,53 @@
|
|
1
|
+
class ShareBar
|
2
|
+
constructor: ->
|
3
|
+
$('body').on 'click', '.js-fb-share', @present_fb_share
|
4
|
+
$('body').on 'click', '.js-fb-like', @show_fb_like_widget
|
5
|
+
@load_fb_share_count()
|
6
|
+
@load_tweet_count()
|
7
|
+
|
8
|
+
if window.fb_api_disabled
|
9
|
+
$('.js-fb-share, .js-fb-like').hide()
|
10
|
+
|
11
|
+
|
12
|
+
load_fb_share_count: =>
|
13
|
+
info_url = "#{window.location.protocol}//api.facebook.com/method/links.getStats?urls=#{encodeURIComponent(window.page_url)}&format=json&callback=?"
|
14
|
+
|
15
|
+
$.getJSON info_url, (response) =>
|
16
|
+
if response and response[0] and response[0].share_count
|
17
|
+
share_count = response[0].share_count
|
18
|
+
|
19
|
+
if share_count
|
20
|
+
$share_count_tpl = $("<span class='fb-share-count count'>(#{share_count})</span>")
|
21
|
+
$(".js-fb-share").each ->
|
22
|
+
$share_count = $share_count_tpl.clone()
|
23
|
+
$(this).append($share_count)
|
24
|
+
|
25
|
+
load_tweet_count: =>
|
26
|
+
info_url = "#{window.location.protocol}//urls.api.twitter.com/1/urls/count.json?url=#{encodeURIComponent(window.page_url)}&callback=?"
|
27
|
+
|
28
|
+
$.getJSON info_url, (response) =>
|
29
|
+
if response and response.count
|
30
|
+
$tweet_count_tpl = $("<span class='tweet-count count'>(#{response.count})</span>")
|
31
|
+
$(".js-tweet-button").each ->
|
32
|
+
$tweet_count = $tweet_count_tpl.clone()
|
33
|
+
$(this).append($tweet_count)
|
34
|
+
|
35
|
+
present_fb_share: (e) =>
|
36
|
+
e.preventDefault()
|
37
|
+
|
38
|
+
$link = $(e.currentTarget)
|
39
|
+
|
40
|
+
FB.ui({
|
41
|
+
method: 'share',
|
42
|
+
href: $link.attr("data-share-uri")
|
43
|
+
})
|
44
|
+
|
45
|
+
show_fb_like_widget: (e) =>
|
46
|
+
e.preventDefault()
|
47
|
+
$el = $(e.currentTarget)
|
48
|
+
$wrap = $el.parents(".share-links-wrap").first()
|
49
|
+
|
50
|
+
$wrap.find(".like-widget-wrap").toggleClass("hidden", 0)
|
51
|
+
|
52
|
+
|
53
|
+
$ -> new ShareBar if $('.share-links').length
|