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,16 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format. Inflections
|
4
|
+
# are locale specific, and you may define rules for as many different
|
5
|
+
# locales as you wish. All of these examples are active by default:
|
6
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
7
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
8
|
+
# inflect.singular /^(ox)en/i, '\1'
|
9
|
+
# inflect.irregular 'person', 'people'
|
10
|
+
# inflect.uncountable %w( fish sheep )
|
11
|
+
# end
|
12
|
+
|
13
|
+
# These inflection rules are supported but not enabled by default:
|
14
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
15
|
+
# inflect.acronym 'RESTful'
|
16
|
+
# end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'paper_trail'
|
2
|
+
require 'paper_trail/frameworks/active_record/models/paper_trail/version'
|
3
|
+
|
4
|
+
module PaperTrail
|
5
|
+
class Version < ActiveRecord::Base
|
6
|
+
scope :by_date, ->{ order(created_at: :desc) }
|
7
|
+
|
8
|
+
def version_user
|
9
|
+
@version_user ||= User.find_by(id: whodunnit)
|
10
|
+
end
|
11
|
+
|
12
|
+
def pretty_changes
|
13
|
+
_pretty_changes = []
|
14
|
+
|
15
|
+
changeset.each do |attribute, changes|
|
16
|
+
if attribute != "updated_at" || attribute != "created_at" || attribute == "id"
|
17
|
+
buffer = ""
|
18
|
+
buffer += attribute
|
19
|
+
buffer += " changed from "
|
20
|
+
buffer += changes[0].present? ? "\"#{changes[0]}\"" : "(blank)"
|
21
|
+
buffer += " to "
|
22
|
+
buffer += changes[1].present? ? "\"#{changes[1]}\"" : "(blank)"
|
23
|
+
_pretty_changes << buffer
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
_pretty_changes.join(", ")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.expand_path "../../../app/helpers/virgo/video_helper", __FILE__
|
2
|
+
require 'shortcode'
|
3
|
+
|
4
|
+
template_root = File.expand_path "../../../app/views/virgo/shortcode_templates", __FILE__
|
5
|
+
|
6
|
+
Shortcode.setup do |config|
|
7
|
+
config.template_parser = :haml
|
8
|
+
config.helpers = [Virgo::VideoHelper]
|
9
|
+
config.block_tags = [:pullquote, :blockquote, :h1, :h2, :h3, :h4]
|
10
|
+
config.self_closing_tags = [:image, :video, :tweet, :slideshow]
|
11
|
+
config.template_paths.prepend(template_root)
|
12
|
+
end
|
@@ -0,0 +1,170 @@
|
|
1
|
+
require 'simple_form'
|
2
|
+
|
3
|
+
# Use this setup block to configure all options available in SimpleForm.
|
4
|
+
SimpleForm.setup do |config|
|
5
|
+
# Wrappers are used by the form builder to generate a
|
6
|
+
# complete input. You can remove any component from the
|
7
|
+
# wrapper, change the order or even add your own to the
|
8
|
+
# stack. The options given below are used to wrap the
|
9
|
+
# whole input.
|
10
|
+
config.wrappers :default, class: :input,
|
11
|
+
hint_class: :field_with_hint, error_class: :field_with_errors do |b|
|
12
|
+
## Extensions enabled by default
|
13
|
+
# Any of these extensions can be disabled for a
|
14
|
+
# given input by passing: `f.input EXTENSION_NAME => false`.
|
15
|
+
# You can make any of these extensions optional by
|
16
|
+
# renaming `b.use` to `b.optional`.
|
17
|
+
|
18
|
+
# Determines whether to use HTML5 (:email, :url, ...)
|
19
|
+
# and required attributes
|
20
|
+
b.use :html5
|
21
|
+
|
22
|
+
# Calculates placeholders automatically from I18n
|
23
|
+
# You can also pass a string as f.input placeholder: "Placeholder"
|
24
|
+
b.use :placeholder
|
25
|
+
|
26
|
+
## Optional extensions
|
27
|
+
# They are disabled unless you pass `f.input EXTENSION_NAME => true`
|
28
|
+
# to the input. If so, they will retrieve the values from the model
|
29
|
+
# if any exists. If you want to enable any of those
|
30
|
+
# extensions by default, you can change `b.optional` to `b.use`.
|
31
|
+
|
32
|
+
# Calculates maxlength from length validations for string inputs
|
33
|
+
b.optional :maxlength
|
34
|
+
|
35
|
+
# Calculates pattern from format validations for string inputs
|
36
|
+
b.optional :pattern
|
37
|
+
|
38
|
+
# Calculates min and max from length validations for numeric inputs
|
39
|
+
b.optional :min_max
|
40
|
+
|
41
|
+
# Calculates readonly automatically from readonly attributes
|
42
|
+
b.optional :readonly
|
43
|
+
|
44
|
+
## Inputs
|
45
|
+
b.use :label_input
|
46
|
+
b.use :hint, wrap_with: { tag: :span, class: :hint }
|
47
|
+
b.use :error, wrap_with: { tag: :span, class: :error }
|
48
|
+
|
49
|
+
## full_messages_for
|
50
|
+
# If you want to display the full error message for the attribute, you can
|
51
|
+
# use the component :full_error, like:
|
52
|
+
#
|
53
|
+
# b.use :full_error, wrap_with: { tag: :span, class: :error }
|
54
|
+
end
|
55
|
+
|
56
|
+
# The default wrapper to be used by the FormBuilder.
|
57
|
+
config.default_wrapper = :default
|
58
|
+
|
59
|
+
# Define the way to render check boxes / radio buttons with labels.
|
60
|
+
# Defaults to :nested for bootstrap config.
|
61
|
+
# inline: input + label
|
62
|
+
# nested: label > input
|
63
|
+
config.boolean_style = :nested
|
64
|
+
|
65
|
+
# Default class for buttons
|
66
|
+
config.button_class = 'btn'
|
67
|
+
|
68
|
+
# Method used to tidy up errors. Specify any Rails Array method.
|
69
|
+
# :first lists the first message for each field.
|
70
|
+
# Use :to_sentence to list all errors for each field.
|
71
|
+
# config.error_method = :first
|
72
|
+
|
73
|
+
# Default tag used for error notification helper.
|
74
|
+
config.error_notification_tag = :div
|
75
|
+
|
76
|
+
# CSS class to add for error notification helper.
|
77
|
+
config.error_notification_class = 'error_notification'
|
78
|
+
|
79
|
+
# ID to add for error notification helper.
|
80
|
+
# config.error_notification_id = nil
|
81
|
+
|
82
|
+
# Series of attempts to detect a default label method for collection.
|
83
|
+
# config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
|
84
|
+
|
85
|
+
# Series of attempts to detect a default value method for collection.
|
86
|
+
# config.collection_value_methods = [ :id, :to_s ]
|
87
|
+
|
88
|
+
# You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
|
89
|
+
# config.collection_wrapper_tag = nil
|
90
|
+
|
91
|
+
# You can define the class to use on all collection wrappers. Defaulting to none.
|
92
|
+
# config.collection_wrapper_class = nil
|
93
|
+
|
94
|
+
# You can wrap each item in a collection of radio/check boxes with a tag,
|
95
|
+
# defaulting to :span. Please note that when using :boolean_style = :nested,
|
96
|
+
# SimpleForm will force this option to be a label.
|
97
|
+
# config.item_wrapper_tag = :span
|
98
|
+
|
99
|
+
# You can define a class to use in all item wrappers. Defaulting to none.
|
100
|
+
# config.item_wrapper_class = nil
|
101
|
+
|
102
|
+
# How the label text should be generated altogether with the required text.
|
103
|
+
config.label_text = lambda { |label, required, explicit_label|
|
104
|
+
"#{label} #{required}"
|
105
|
+
}
|
106
|
+
|
107
|
+
# You can define the class to use on all labels. Default is nil.
|
108
|
+
# config.label_class = nil
|
109
|
+
|
110
|
+
# You can define the default class to be used on forms. Can be overriden
|
111
|
+
# with `html: { :class }`. Defaulting to none.
|
112
|
+
# config.default_form_class = nil
|
113
|
+
|
114
|
+
# You can define which elements should obtain additional classes
|
115
|
+
# config.generate_additional_classes_for = [:wrapper, :label, :input]
|
116
|
+
|
117
|
+
# Whether attributes are required by default (or not). Default is true.
|
118
|
+
# config.required_by_default = true
|
119
|
+
|
120
|
+
# Tell browsers whether to use the native HTML5 validations (novalidate form option).
|
121
|
+
# These validations are enabled in SimpleForm's internal config but disabled by default
|
122
|
+
# in this configuration, which is recommended due to some quirks from different browsers.
|
123
|
+
# To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
|
124
|
+
# change this configuration to true.
|
125
|
+
config.browser_validations = false
|
126
|
+
|
127
|
+
# Collection of methods to detect if a file type was given.
|
128
|
+
# config.file_methods = [ :mounted_as, :file?, :public_filename ]
|
129
|
+
|
130
|
+
# Custom mappings for input types. This should be a hash containing a regexp
|
131
|
+
# to match as key, and the input type that will be used when the field name
|
132
|
+
# matches the regexp as value.
|
133
|
+
# config.input_mappings = { /count/ => :integer }
|
134
|
+
|
135
|
+
# Custom wrappers for input types. This should be a hash containing an input
|
136
|
+
# type as key and the wrapper that will be used for all inputs with specified type.
|
137
|
+
# config.wrapper_mappings = { string: :prepend }
|
138
|
+
|
139
|
+
# Namespaces where SimpleForm should look for custom input classes that
|
140
|
+
# override default inputs.
|
141
|
+
# config.custom_inputs_namespaces << "CustomInputs"
|
142
|
+
|
143
|
+
# Default priority for time_zone inputs.
|
144
|
+
# config.time_zone_priority = nil
|
145
|
+
|
146
|
+
# Default priority for country inputs.
|
147
|
+
# config.country_priority = nil
|
148
|
+
|
149
|
+
# When false, do not use translations for labels.
|
150
|
+
# config.translate_labels = true
|
151
|
+
|
152
|
+
# Automatically discover new inputs in Rails' autoload path.
|
153
|
+
# config.inputs_discovery = true
|
154
|
+
|
155
|
+
# Cache SimpleForm inputs discovery
|
156
|
+
# config.cache_discovery = !Rails.env.development?
|
157
|
+
|
158
|
+
# Default class for inputs
|
159
|
+
# config.input_class = nil
|
160
|
+
|
161
|
+
# Define the default class of the input wrapper of the boolean input.
|
162
|
+
config.boolean_label_class = 'checkbox'
|
163
|
+
|
164
|
+
# Defines if the default input wrapper class should be included in radio
|
165
|
+
# collection wrappers.
|
166
|
+
# config.include_default_input_wrapper_class = true
|
167
|
+
|
168
|
+
# Defines which i18n scope will be used in Simple Form.
|
169
|
+
# config.i18n_scope = 'simple_form'
|
170
|
+
end
|
@@ -0,0 +1,136 @@
|
|
1
|
+
# Use this setup block to configure all options available in SimpleForm.
|
2
|
+
SimpleForm.setup do |config|
|
3
|
+
config.error_notification_class = 'alert alert-danger'
|
4
|
+
config.button_class = 'btn btn-default'
|
5
|
+
config.boolean_label_class = nil
|
6
|
+
|
7
|
+
config.wrappers :vertical_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
8
|
+
b.use :html5
|
9
|
+
b.use :placeholder
|
10
|
+
b.optional :maxlength
|
11
|
+
b.optional :pattern
|
12
|
+
b.optional :min_max
|
13
|
+
b.optional :readonly
|
14
|
+
b.use :label, class: 'control-label'
|
15
|
+
|
16
|
+
b.use :input, class: 'form-control'
|
17
|
+
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
18
|
+
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
19
|
+
end
|
20
|
+
|
21
|
+
config.wrappers :vertical_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
22
|
+
b.use :html5
|
23
|
+
b.use :placeholder
|
24
|
+
b.optional :maxlength
|
25
|
+
b.optional :readonly
|
26
|
+
b.use :label, class: 'control-label'
|
27
|
+
|
28
|
+
b.use :input
|
29
|
+
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
30
|
+
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
31
|
+
end
|
32
|
+
|
33
|
+
config.wrappers :vertical_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
34
|
+
b.use :html5
|
35
|
+
b.optional :readonly
|
36
|
+
|
37
|
+
b.wrapper tag: 'div', class: 'checkbox' do |ba|
|
38
|
+
ba.use :label_input
|
39
|
+
end
|
40
|
+
|
41
|
+
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
42
|
+
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
43
|
+
end
|
44
|
+
|
45
|
+
config.wrappers :vertical_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
46
|
+
b.use :html5
|
47
|
+
b.optional :readonly
|
48
|
+
b.use :label, class: 'control-label'
|
49
|
+
b.use :input
|
50
|
+
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
51
|
+
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
52
|
+
end
|
53
|
+
|
54
|
+
config.wrappers :horizontal_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
55
|
+
b.use :html5
|
56
|
+
b.use :placeholder
|
57
|
+
b.optional :maxlength
|
58
|
+
b.optional :pattern
|
59
|
+
b.optional :min_max
|
60
|
+
b.optional :readonly
|
61
|
+
b.use :label, class: 'col-sm-3 control-label'
|
62
|
+
|
63
|
+
b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
|
64
|
+
ba.use :input, class: 'form-control'
|
65
|
+
ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
66
|
+
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
config.wrappers :horizontal_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
71
|
+
b.use :html5
|
72
|
+
b.use :placeholder
|
73
|
+
b.optional :maxlength
|
74
|
+
b.optional :readonly
|
75
|
+
b.use :label, class: 'col-sm-3 control-label'
|
76
|
+
|
77
|
+
b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
|
78
|
+
ba.use :input
|
79
|
+
ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
80
|
+
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
config.wrappers :horizontal_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
85
|
+
b.use :html5
|
86
|
+
b.optional :readonly
|
87
|
+
|
88
|
+
b.wrapper tag: 'div', class: 'col-sm-offset-3 col-sm-9' do |wr|
|
89
|
+
wr.wrapper tag: 'div', class: 'checkbox' do |ba|
|
90
|
+
ba.use :label_input, class: 'col-sm-9'
|
91
|
+
end
|
92
|
+
|
93
|
+
wr.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
94
|
+
wr.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
config.wrappers :horizontal_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
99
|
+
b.use :html5
|
100
|
+
b.optional :readonly
|
101
|
+
|
102
|
+
b.use :label, class: 'col-sm-3 control-label'
|
103
|
+
|
104
|
+
b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
|
105
|
+
ba.use :input
|
106
|
+
ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
107
|
+
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
config.wrappers :inline_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
112
|
+
b.use :html5
|
113
|
+
b.use :placeholder
|
114
|
+
b.optional :maxlength
|
115
|
+
b.optional :pattern
|
116
|
+
b.optional :min_max
|
117
|
+
b.optional :readonly
|
118
|
+
b.use :label, class: 'sr-only'
|
119
|
+
|
120
|
+
b.use :input, class: 'form-control'
|
121
|
+
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
122
|
+
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
123
|
+
end
|
124
|
+
|
125
|
+
# Wrappers for forms and inputs using the Bootstrap toolkit.
|
126
|
+
# Check the Bootstrap docs (http://getbootstrap.com)
|
127
|
+
# to learn about the different styles for forms and inputs,
|
128
|
+
# buttons and other elements.
|
129
|
+
config.default_wrapper = :vertical_form
|
130
|
+
config.wrapper_mappings = {
|
131
|
+
check_boxes: :vertical_radio_and_checkboxes,
|
132
|
+
radio_buttons: :vertical_radio_and_checkboxes,
|
133
|
+
file: :vertical_file_input,
|
134
|
+
boolean: :vertical_boolean,
|
135
|
+
}
|
136
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Time::DATE_FORMATS[:us_regular] = "%B %d at %I:%M %p"
|
2
|
+
Time::DATE_FORMATS[:time_only] = "%I:%M %p"
|
3
|
+
Time::DATE_FORMATS[:date_only_ordinal] = lambda { |date| date.strftime("%B #{ActiveSupport::Inflector.ordinalize(date.day)}, %Y") }
|
4
|
+
Time::DATE_FORMATS[:short_ordinal] = lambda { |date| date.strftime("%B #{ActiveSupport::Inflector.ordinalize(date.day)} at %I:%M %p") }
|
5
|
+
Time::DATE_FORMATS[:long_ordinal] = lambda { |date| date.strftime("%B #{ActiveSupport::Inflector.ordinalize(date.day)}, %Y at %I:%M %p") }
|
6
|
+
Time::DATE_FORMATS[:month_abbrev] = lambda { |date| date.strftime("%b") }
|
7
|
+
Time::DATE_FORMATS[:month_abbrev_with_year] = lambda { |date| date.strftime("%b %Y") }
|
8
|
+
Time::DATE_FORMATS[:slashes] = Date::DATE_FORMATS[:slashes] = '%m/%d/%Y'
|
9
|
+
Time::DATE_FORMATS[:short_slashes] = Date::DATE_FORMATS[:short_slashes] = '%m/%d/%y'
|
10
|
+
Time::DATE_FORMATS[:slashes_with_time] = '%m/%d/%Y at %I:%M %p'
|
11
|
+
Time::DATE_FORMATS[:wday_and_date] = lambda { |date|
|
12
|
+
if date.year == Time.now.year
|
13
|
+
date.strftime('%a, %b %d')
|
14
|
+
else
|
15
|
+
date.strftime('%a, %b %d, %Y')
|
16
|
+
end
|
17
|
+
}
|
18
|
+
Date::DATE_FORMATS[:short_ordinal] = lambda { |date| date.strftime("%B #{ActiveSupport::Inflector.ordinalize(date.day)}, %Y") }
|
19
|
+
Date::DATE_FORMATS[:long_ordinal] = lambda { |date| date.strftime("%B #{ActiveSupport::Inflector.ordinalize(date.day)}, %Y") }
|
20
|
+
Time::DATE_FORMATS[:month_name_and_year] = Date::DATE_FORMATS[:month_name_and_year] = lambda { |date| date.strftime("%B %Y") }
|
21
|
+
Time::DATE_FORMATS[:cal_ics] = Date::DATE_FORMATS[:cal_ics] = lambda { |date| date.strftime("%Y%m%dT%H%M%S") }
|
22
|
+
Date::DATE_FORMATS[:month_and_year] = lambda { |date| date.strftime("%B %Y") }
|
23
|
+
Date::DATE_FORMATS[:expanded_english] = "%A, %B %e, %Y"
|