effective_bootstrap 0.7.3
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/README.md +644 -0
- data/app/assets/images/icons/activity.svg +13 -0
- data/app/assets/images/icons/airplay.svg +14 -0
- data/app/assets/images/icons/alert-circle.svg +15 -0
- data/app/assets/images/icons/alert-octagon.svg +15 -0
- data/app/assets/images/icons/alert-triangle.svg +15 -0
- data/app/assets/images/icons/align-center.svg +16 -0
- data/app/assets/images/icons/align-justify.svg +16 -0
- data/app/assets/images/icons/align-left.svg +16 -0
- data/app/assets/images/icons/align-right.svg +16 -0
- data/app/assets/images/icons/anchor.svg +15 -0
- data/app/assets/images/icons/aperture.svg +19 -0
- data/app/assets/images/icons/arrow-down-circle.svg +15 -0
- data/app/assets/images/icons/arrow-down-left.svg +14 -0
- data/app/assets/images/icons/arrow-down-right.svg +14 -0
- data/app/assets/images/icons/arrow-down.svg +14 -0
- data/app/assets/images/icons/arrow-left-circle.svg +15 -0
- data/app/assets/images/icons/arrow-left.svg +14 -0
- data/app/assets/images/icons/arrow-right-circle.svg +15 -0
- data/app/assets/images/icons/arrow-right.svg +14 -0
- data/app/assets/images/icons/arrow-up-circle.svg +15 -0
- data/app/assets/images/icons/arrow-up-left.svg +14 -0
- data/app/assets/images/icons/arrow-up-right.svg +14 -0
- data/app/assets/images/icons/arrow-up.svg +14 -0
- data/app/assets/images/icons/at-sign.svg +14 -0
- data/app/assets/images/icons/award.svg +14 -0
- data/app/assets/images/icons/bar-chart-2.svg +15 -0
- data/app/assets/images/icons/bar-chart.svg +15 -0
- data/app/assets/images/icons/battery-charging.svg +15 -0
- data/app/assets/images/icons/battery.svg +14 -0
- data/app/assets/images/icons/bell-off.svg +14 -0
- data/app/assets/images/icons/bell.svg +13 -0
- data/app/assets/images/icons/bluetooth.svg +13 -0
- data/app/assets/images/icons/bold.svg +14 -0
- data/app/assets/images/icons/book-open.svg +14 -0
- data/app/assets/images/icons/book.svg +14 -0
- data/app/assets/images/icons/bookmark.svg +13 -0
- data/app/assets/images/icons/box.svg +15 -0
- data/app/assets/images/icons/briefcase.svg +14 -0
- data/app/assets/images/icons/calendar.svg +16 -0
- data/app/assets/images/icons/camera-off.svg +14 -0
- data/app/assets/images/icons/camera.svg +14 -0
- data/app/assets/images/icons/cast.svg +14 -0
- data/app/assets/images/icons/check-circle.svg +14 -0
- data/app/assets/images/icons/check-square.svg +14 -0
- data/app/assets/images/icons/check.svg +13 -0
- data/app/assets/images/icons/chevron-down.svg +13 -0
- data/app/assets/images/icons/chevron-left.svg +13 -0
- data/app/assets/images/icons/chevron-right.svg +13 -0
- data/app/assets/images/icons/chevron-up.svg +13 -0
- data/app/assets/images/icons/chevrons-down.svg +14 -0
- data/app/assets/images/icons/chevrons-left.svg +14 -0
- data/app/assets/images/icons/chevrons-right.svg +14 -0
- data/app/assets/images/icons/chevrons-up.svg +14 -0
- data/app/assets/images/icons/chrome.svg +17 -0
- data/app/assets/images/icons/circle.svg +13 -0
- data/app/assets/images/icons/clipboard.svg +14 -0
- data/app/assets/images/icons/clock.svg +14 -0
- data/app/assets/images/icons/cloud-drizzle.svg +19 -0
- data/app/assets/images/icons/cloud-lightning.svg +14 -0
- data/app/assets/images/icons/cloud-off.svg +14 -0
- data/app/assets/images/icons/cloud-rain.svg +16 -0
- data/app/assets/images/icons/cloud-snow.svg +19 -0
- data/app/assets/images/icons/cloud.svg +13 -0
- data/app/assets/images/icons/code.svg +14 -0
- data/app/assets/images/icons/codepen.svg +17 -0
- data/app/assets/images/icons/command.svg +13 -0
- data/app/assets/images/icons/compass.svg +14 -0
- data/app/assets/images/icons/copy.svg +14 -0
- data/app/assets/images/icons/corner-down-left.svg +14 -0
- data/app/assets/images/icons/corner-down-right.svg +14 -0
- data/app/assets/images/icons/corner-left-down.svg +14 -0
- data/app/assets/images/icons/corner-left-up.svg +14 -0
- data/app/assets/images/icons/corner-right-down.svg +14 -0
- data/app/assets/images/icons/corner-right-up.svg +14 -0
- data/app/assets/images/icons/corner-up-left.svg +14 -0
- data/app/assets/images/icons/corner-up-right.svg +14 -0
- data/app/assets/images/icons/cpu.svg +22 -0
- data/app/assets/images/icons/credit-card.svg +14 -0
- data/app/assets/images/icons/crop.svg +14 -0
- data/app/assets/images/icons/crosshair.svg +17 -0
- data/app/assets/images/icons/database.svg +15 -0
- data/app/assets/images/icons/delete.svg +15 -0
- data/app/assets/images/icons/disc.svg +14 -0
- data/app/assets/images/icons/dollar-sign.svg +14 -0
- data/app/assets/images/icons/download-cloud.svg +15 -0
- data/app/assets/images/icons/download.svg +15 -0
- data/app/assets/images/icons/droplet.svg +13 -0
- data/app/assets/images/icons/edit-2.svg +13 -0
- data/app/assets/images/icons/edit-3.svg +14 -0
- data/app/assets/images/icons/edit.svg +14 -0
- data/app/assets/images/icons/external-link.svg +15 -0
- data/app/assets/images/icons/eye-off.svg +14 -0
- data/app/assets/images/icons/eye.svg +14 -0
- data/app/assets/images/icons/facebook-white.svg +7 -0
- data/app/assets/images/icons/facebook.svg +13 -0
- data/app/assets/images/icons/fast-forward.svg +14 -0
- data/app/assets/images/icons/feather.svg +15 -0
- data/app/assets/images/icons/file-minus.svg +15 -0
- data/app/assets/images/icons/file-plus.svg +16 -0
- data/app/assets/images/icons/file-text.svg +17 -0
- data/app/assets/images/icons/file.svg +14 -0
- data/app/assets/images/icons/film.svg +20 -0
- data/app/assets/images/icons/filter.svg +13 -0
- data/app/assets/images/icons/flag.svg +14 -0
- data/app/assets/images/icons/folder-minus.svg +14 -0
- data/app/assets/images/icons/folder-plus.svg +15 -0
- data/app/assets/images/icons/folder.svg +13 -0
- data/app/assets/images/icons/git-branch.svg +16 -0
- data/app/assets/images/icons/git-commit.svg +15 -0
- data/app/assets/images/icons/git-merge.svg +15 -0
- data/app/assets/images/icons/git-pull-request.svg +16 -0
- data/app/assets/images/icons/github.svg +13 -0
- data/app/assets/images/icons/gitlab.svg +13 -0
- data/app/assets/images/icons/globe.svg +15 -0
- data/app/assets/images/icons/google.svg +2 -0
- data/app/assets/images/icons/grid.svg +16 -0
- data/app/assets/images/icons/hard-drive.svg +16 -0
- data/app/assets/images/icons/hash.svg +16 -0
- data/app/assets/images/icons/headphones.svg +14 -0
- data/app/assets/images/icons/heart.svg +13 -0
- data/app/assets/images/icons/help-circle.svg +15 -0
- data/app/assets/images/icons/home.svg +14 -0
- data/app/assets/images/icons/image.svg +15 -0
- data/app/assets/images/icons/inbox.svg +14 -0
- data/app/assets/images/icons/info.svg +15 -0
- data/app/assets/images/icons/instagram.svg +15 -0
- data/app/assets/images/icons/italic.svg +15 -0
- data/app/assets/images/icons/layers.svg +15 -0
- data/app/assets/images/icons/layout.svg +15 -0
- data/app/assets/images/icons/life-buoy.svg +19 -0
- data/app/assets/images/icons/link-2.svg +14 -0
- data/app/assets/images/icons/link.svg +14 -0
- data/app/assets/images/icons/linkedin.svg +15 -0
- data/app/assets/images/icons/list.svg +18 -0
- data/app/assets/images/icons/loader.svg +20 -0
- data/app/assets/images/icons/lock.svg +14 -0
- data/app/assets/images/icons/log-in.svg +15 -0
- data/app/assets/images/icons/log-out.svg +15 -0
- data/app/assets/images/icons/mail.svg +14 -0
- data/app/assets/images/icons/map-pin.svg +14 -0
- data/app/assets/images/icons/map.svg +15 -0
- data/app/assets/images/icons/maximize-2.svg +16 -0
- data/app/assets/images/icons/maximize.svg +13 -0
- data/app/assets/images/icons/menu.svg +15 -0
- data/app/assets/images/icons/message-circle.svg +13 -0
- data/app/assets/images/icons/message-square.svg +13 -0
- data/app/assets/images/icons/mic-off.svg +17 -0
- data/app/assets/images/icons/mic.svg +16 -0
- data/app/assets/images/icons/minimize-2.svg +16 -0
- data/app/assets/images/icons/minimize.svg +13 -0
- data/app/assets/images/icons/minus-circle.svg +14 -0
- data/app/assets/images/icons/minus-square.svg +14 -0
- data/app/assets/images/icons/minus.svg +13 -0
- data/app/assets/images/icons/monitor.svg +15 -0
- data/app/assets/images/icons/moon.svg +13 -0
- data/app/assets/images/icons/more-horizontal.svg +15 -0
- data/app/assets/images/icons/more-vertical.svg +15 -0
- data/app/assets/images/icons/move.svg +18 -0
- data/app/assets/images/icons/music.svg +14 -0
- data/app/assets/images/icons/navigation-2.svg +13 -0
- data/app/assets/images/icons/navigation.svg +13 -0
- data/app/assets/images/icons/octagon.svg +13 -0
- data/app/assets/images/icons/package.svg +16 -0
- data/app/assets/images/icons/paperclip.svg +13 -0
- data/app/assets/images/icons/pause-circle.svg +15 -0
- data/app/assets/images/icons/pause.svg +14 -0
- data/app/assets/images/icons/percent.svg +15 -0
- data/app/assets/images/icons/phone-call.svg +13 -0
- data/app/assets/images/icons/phone-forwarded.svg +15 -0
- data/app/assets/images/icons/phone-incoming.svg +15 -0
- data/app/assets/images/icons/phone-missed.svg +15 -0
- data/app/assets/images/icons/phone-off.svg +14 -0
- data/app/assets/images/icons/phone-outgoing.svg +15 -0
- data/app/assets/images/icons/phone.svg +13 -0
- data/app/assets/images/icons/pie-chart.svg +14 -0
- data/app/assets/images/icons/play-circle.svg +14 -0
- data/app/assets/images/icons/play.svg +13 -0
- data/app/assets/images/icons/plus-circle.svg +15 -0
- data/app/assets/images/icons/plus-square.svg +15 -0
- data/app/assets/images/icons/plus.svg +14 -0
- data/app/assets/images/icons/pocket.svg +14 -0
- data/app/assets/images/icons/power.svg +14 -0
- data/app/assets/images/icons/printer.svg +15 -0
- data/app/assets/images/icons/radio.svg +14 -0
- data/app/assets/images/icons/refresh-ccw.svg +15 -0
- data/app/assets/images/icons/refresh-cw.svg +15 -0
- data/app/assets/images/icons/repeat.svg +16 -0
- data/app/assets/images/icons/rewind.svg +14 -0
- data/app/assets/images/icons/rotate-ccw.svg +14 -0
- data/app/assets/images/icons/rotate-cw.svg +14 -0
- data/app/assets/images/icons/rss.svg +15 -0
- data/app/assets/images/icons/save.svg +15 -0
- data/app/assets/images/icons/scissors.svg +17 -0
- data/app/assets/images/icons/search.svg +14 -0
- data/app/assets/images/icons/send.svg +14 -0
- data/app/assets/images/icons/server.svg +16 -0
- data/app/assets/images/icons/settings.svg +14 -0
- data/app/assets/images/icons/share-2.svg +17 -0
- data/app/assets/images/icons/share.svg +15 -0
- data/app/assets/images/icons/shield-off.svg +15 -0
- data/app/assets/images/icons/shield.svg +13 -0
- data/app/assets/images/icons/shopping-bag.svg +15 -0
- data/app/assets/images/icons/shopping-cart.svg +15 -0
- data/app/assets/images/icons/shuffle.svg +17 -0
- data/app/assets/images/icons/sidebar.svg +14 -0
- data/app/assets/images/icons/skip-back.svg +14 -0
- data/app/assets/images/icons/skip-forward.svg +14 -0
- data/app/assets/images/icons/slack.svg +17 -0
- data/app/assets/images/icons/slash.svg +14 -0
- data/app/assets/images/icons/sliders.svg +21 -0
- data/app/assets/images/icons/smartphone.svg +14 -0
- data/app/assets/images/icons/speaker.svg +15 -0
- data/app/assets/images/icons/spinner.svg +1 -0
- data/app/assets/images/icons/square.svg +13 -0
- data/app/assets/images/icons/star.svg +13 -0
- data/app/assets/images/icons/stop-circle.svg +14 -0
- data/app/assets/images/icons/sun.svg +21 -0
- data/app/assets/images/icons/sunrise.svg +20 -0
- data/app/assets/images/icons/sunset.svg +20 -0
- data/app/assets/images/icons/tablet.svg +22 -0
- data/app/assets/images/icons/tag.svg +14 -0
- data/app/assets/images/icons/target.svg +15 -0
- data/app/assets/images/icons/terminal.svg +14 -0
- data/app/assets/images/icons/thermometer.svg +13 -0
- data/app/assets/images/icons/thumbs-down.svg +13 -0
- data/app/assets/images/icons/thumbs-up.svg +13 -0
- data/app/assets/images/icons/toggle-left.svg +14 -0
- data/app/assets/images/icons/toggle-right.svg +14 -0
- data/app/assets/images/icons/trash-2.svg +16 -0
- data/app/assets/images/icons/trash.svg +14 -0
- data/app/assets/images/icons/trending-down.svg +14 -0
- data/app/assets/images/icons/trending-up.svg +14 -0
- data/app/assets/images/icons/triangle.svg +13 -0
- data/app/assets/images/icons/truck.svg +16 -0
- data/app/assets/images/icons/tv.svg +14 -0
- data/app/assets/images/icons/twitter.svg +13 -0
- data/app/assets/images/icons/type.svg +15 -0
- data/app/assets/images/icons/umbrella.svg +13 -0
- data/app/assets/images/icons/underline.svg +14 -0
- data/app/assets/images/icons/unlock.svg +14 -0
- data/app/assets/images/icons/upload-cloud.svg +16 -0
- data/app/assets/images/icons/upload.svg +15 -0
- data/app/assets/images/icons/user-check.svg +15 -0
- data/app/assets/images/icons/user-minus.svg +15 -0
- data/app/assets/images/icons/user-plus.svg +16 -0
- data/app/assets/images/icons/user-x.svg +16 -0
- data/app/assets/images/icons/user.svg +14 -0
- data/app/assets/images/icons/users.svg +16 -0
- data/app/assets/images/icons/video-off.svg +14 -0
- data/app/assets/images/icons/video.svg +14 -0
- data/app/assets/images/icons/voicemail.svg +15 -0
- data/app/assets/images/icons/volume-1.svg +14 -0
- data/app/assets/images/icons/volume-2.svg +14 -0
- data/app/assets/images/icons/volume-x.svg +15 -0
- data/app/assets/images/icons/volume.svg +13 -0
- data/app/assets/images/icons/watch.svg +15 -0
- data/app/assets/images/icons/wifi-off.svg +19 -0
- data/app/assets/images/icons/wifi.svg +16 -0
- data/app/assets/images/icons/wind.svg +13 -0
- data/app/assets/images/icons/x-circle.svg +15 -0
- data/app/assets/images/icons/x-square.svg +15 -0
- data/app/assets/images/icons/x.svg +14 -0
- data/app/assets/images/icons/zap-off.svg +16 -0
- data/app/assets/images/icons/zap.svg +13 -0
- data/app/assets/images/icons/zoom-in.svg +16 -0
- data/app/assets/images/icons/zoom-out.svg +15 -0
- data/app/assets/javascripts/effective_bootstrap.js +25 -0
- data/app/assets/javascripts/effective_bootstrap/base.js.coffee +22 -0
- data/app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb +23 -0
- data/app/assets/javascripts/effective_bootstrap/form.js.coffee +182 -0
- data/app/assets/javascripts/effective_bootstrap/logic.js.coffee +64 -0
- data/app/assets/javascripts/effective_bootstrap/other.js.coffee +4 -0
- data/app/assets/javascripts/effective_bootstrap/tabs.js +14 -0
- data/app/assets/javascripts/effective_checks/initialize.js.coffee +7 -0
- data/app/assets/javascripts/effective_checks/input.js +1 -0
- data/app/assets/javascripts/effective_ck_editor/initialize.js.coffee +72 -0
- data/app/assets/javascripts/effective_ck_editor/input.js +1 -0
- data/app/assets/javascripts/effective_clear/initialize.js.coffee +3 -0
- data/app/assets/javascripts/effective_clear/input.js +1 -0
- data/app/assets/javascripts/effective_date/initialize.js.coffee +7 -0
- data/app/assets/javascripts/effective_date/input.js +5 -0
- data/app/assets/javascripts/effective_datetime/bootstrap-datetimepicker.js +2636 -0
- data/app/assets/javascripts/effective_datetime/initialize.js.coffee +7 -0
- data/app/assets/javascripts/effective_datetime/input.js +5 -0
- data/app/assets/javascripts/effective_datetime/overrides.js.coffee +45 -0
- data/app/assets/javascripts/effective_datetime/turbolinks.js.coffee +5 -0
- data/app/assets/javascripts/effective_editor/image-drop-and-paste.js +3 -0
- data/app/assets/javascripts/effective_editor/image-resize.js +2 -0
- data/app/assets/javascripts/effective_editor/initialize.js.coffee +138 -0
- data/app/assets/javascripts/effective_editor/input.js +4 -0
- data/app/assets/javascripts/effective_editor/quill.js +11496 -0
- data/app/assets/javascripts/effective_file/initialize.js.coffee +19 -0
- data/app/assets/javascripts/effective_file/input.js +1 -0
- data/app/assets/javascripts/effective_integer/initialize.js.coffee +6 -0
- data/app/assets/javascripts/effective_integer/input.js +1 -0
- data/app/assets/javascripts/effective_number_text/initialize.js.coffee +6 -0
- data/app/assets/javascripts/effective_number_text/input.js +1 -0
- data/app/assets/javascripts/effective_percent/initialize.js.coffee +39 -0
- data/app/assets/javascripts/effective_percent/input.js +1 -0
- data/app/assets/javascripts/effective_phone/initialize.js.coffee +4 -0
- data/app/assets/javascripts/effective_phone/input.js +2 -0
- data/app/assets/javascripts/effective_phone/jquery.maskedInput.js +182 -0
- data/app/assets/javascripts/effective_price/initialize.js.coffee +43 -0
- data/app/assets/javascripts/effective_price/input.js +1 -0
- data/app/assets/javascripts/effective_radio/initialize.js.coffee +36 -0
- data/app/assets/javascripts/effective_radio/input.js +1 -0
- data/app/assets/javascripts/effective_select/initialize.js.coffee +56 -0
- data/app/assets/javascripts/effective_select/input.js +3 -0
- data/app/assets/javascripts/effective_select/overrides.js.coffee +60 -0
- data/app/assets/javascripts/effective_select/select2.js +5747 -0
- data/app/assets/javascripts/effective_select_or_text/initialize.js +30 -0
- data/app/assets/javascripts/effective_select_or_text/input.js +1 -0
- data/app/assets/javascripts/effective_time/initialize.js.coffee +7 -0
- data/app/assets/javascripts/effective_time/input.js +5 -0
- data/app/assets/javascripts/effective_time_zone_select/initialize.js.coffee +13 -0
- data/app/assets/javascripts/effective_time_zone_select/input.js +1 -0
- data/app/assets/javascripts/moment/locale/af.js +72 -0
- data/app/assets/javascripts/moment/locale/ar-dz.js +58 -0
- data/app/assets/javascripts/moment/locale/ar-kw.js +58 -0
- data/app/assets/javascripts/moment/locale/ar-ly.js +121 -0
- data/app/assets/javascripts/moment/locale/ar-ma.js +58 -0
- data/app/assets/javascripts/moment/locale/ar-sa.js +103 -0
- data/app/assets/javascripts/moment/locale/ar-tn.js +58 -0
- data/app/assets/javascripts/moment/locale/ar.js +134 -0
- data/app/assets/javascripts/moment/locale/az.js +104 -0
- data/app/assets/javascripts/moment/locale/be.js +131 -0
- data/app/assets/javascripts/moment/locale/bg.js +89 -0
- data/app/assets/javascripts/moment/locale/bm.js +57 -0
- data/app/assets/javascripts/moment/locale/bn.js +118 -0
- data/app/assets/javascripts/moment/locale/bo.js +118 -0
- data/app/assets/javascripts/moment/locale/br.js +107 -0
- data/app/assets/javascripts/moment/locale/bs.js +150 -0
- data/app/assets/javascripts/moment/locale/ca.js +87 -0
- data/app/assets/javascripts/moment/locale/cs.js +171 -0
- data/app/assets/javascripts/moment/locale/cv.js +62 -0
- data/app/assets/javascripts/moment/locale/cy.js +79 -0
- data/app/assets/javascripts/moment/locale/da.js +59 -0
- data/app/assets/javascripts/moment/locale/de-at.js +75 -0
- data/app/assets/javascripts/moment/locale/de-ch.js +75 -0
- data/app/assets/javascripts/moment/locale/de.js +75 -0
- data/app/assets/javascripts/moment/locale/dv.js +98 -0
- data/app/assets/javascripts/moment/locale/el.js +99 -0
- data/app/assets/javascripts/moment/locale/en-SG.js +66 -0
- data/app/assets/javascripts/moment/locale/en-au.js +66 -0
- data/app/assets/javascripts/moment/locale/en-ca.js +62 -0
- data/app/assets/javascripts/moment/locale/en-gb.js +66 -0
- data/app/assets/javascripts/moment/locale/en-ie.js +66 -0
- data/app/assets/javascripts/moment/locale/en-il.js +61 -0
- data/app/assets/javascripts/moment/locale/en-nz.js +66 -0
- data/app/assets/javascripts/moment/locale/eo.js +70 -0
- data/app/assets/javascripts/moment/locale/es-do.js +91 -0
- data/app/assets/javascripts/moment/locale/es-us.js +91 -0
- data/app/assets/javascripts/moment/locale/es.js +91 -0
- data/app/assets/javascripts/moment/locale/et.js +79 -0
- data/app/assets/javascripts/moment/locale/eu.js +65 -0
- data/app/assets/javascripts/moment/locale/fa.js +105 -0
- data/app/assets/javascripts/moment/locale/fi.js +108 -0
- data/app/assets/javascripts/moment/locale/fo.js +59 -0
- data/app/assets/javascripts/moment/locale/fr-ca.js +73 -0
- data/app/assets/javascripts/moment/locale/fr-ch.js +77 -0
- data/app/assets/javascripts/moment/locale/fr.js +82 -0
- data/app/assets/javascripts/moment/locale/fy.js +74 -0
- data/app/assets/javascripts/moment/locale/ga.js +76 -0
- data/app/assets/javascripts/moment/locale/gd.js +75 -0
- data/app/assets/javascripts/moment/locale/gl.js +76 -0
- data/app/assets/javascripts/moment/locale/gom-latn.js +122 -0
- data/app/assets/javascripts/moment/locale/gu.js +123 -0
- data/app/assets/javascripts/moment/locale/he.js +96 -0
- data/app/assets/javascripts/moment/locale/hi.js +123 -0
- data/app/assets/javascripts/moment/locale/hr.js +153 -0
- data/app/assets/javascripts/moment/locale/hu.js +109 -0
- data/app/assets/javascripts/moment/locale/hy-am.js +94 -0
- data/app/assets/javascripts/moment/locale/id.js +81 -0
- data/app/assets/javascripts/moment/locale/is.js +131 -0
- data/app/assets/javascripts/moment/locale/it-ch.js +68 -0
- data/app/assets/javascripts/moment/locale/it.js +68 -0
- data/app/assets/javascripts/moment/locale/ja.js +91 -0
- data/app/assets/javascripts/moment/locale/jv.js +81 -0
- data/app/assets/javascripts/moment/locale/ka.js +88 -0
- data/app/assets/javascripts/moment/locale/kk.js +86 -0
- data/app/assets/javascripts/moment/locale/km.js +109 -0
- data/app/assets/javascripts/moment/locale/kn.js +125 -0
- data/app/assets/javascripts/moment/locale/ko.js +80 -0
- data/app/assets/javascripts/moment/locale/ku.js +118 -0
- data/app/assets/javascripts/moment/locale/ky.js +86 -0
- data/app/assets/javascripts/moment/locale/lb.js +135 -0
- data/app/assets/javascripts/moment/locale/lo.js +69 -0
- data/app/assets/javascripts/moment/locale/lt.js +117 -0
- data/app/assets/javascripts/moment/locale/lv.js +96 -0
- data/app/assets/javascripts/moment/locale/me.js +111 -0
- data/app/assets/javascripts/moment/locale/mi.js +63 -0
- data/app/assets/javascripts/moment/locale/mk.js +89 -0
- data/app/assets/javascripts/moment/locale/ml.js +80 -0
- data/app/assets/javascripts/moment/locale/mn.js +103 -0
- data/app/assets/javascripts/moment/locale/mr.js +159 -0
- data/app/assets/javascripts/moment/locale/ms-my.js +81 -0
- data/app/assets/javascripts/moment/locale/ms.js +81 -0
- data/app/assets/javascripts/moment/locale/mt.js +59 -0
- data/app/assets/javascripts/moment/locale/my.js +92 -0
- data/app/assets/javascripts/moment/locale/nb.js +61 -0
- data/app/assets/javascripts/moment/locale/ne.js +122 -0
- data/app/assets/javascripts/moment/locale/nl-be.js +86 -0
- data/app/assets/javascripts/moment/locale/nl.js +86 -0
- data/app/assets/javascripts/moment/locale/nn.js +59 -0
- data/app/assets/javascripts/moment/locale/pa-in.js +123 -0
- data/app/assets/javascripts/moment/locale/pl.js +125 -0
- data/app/assets/javascripts/moment/locale/pt-br.js +60 -0
- data/app/assets/javascripts/moment/locale/pt.js +64 -0
- data/app/assets/javascripts/moment/locale/ro.js +74 -0
- data/app/assets/javascripts/moment/locale/ru.js +181 -0
- data/app/assets/javascripts/moment/locale/sd.js +97 -0
- data/app/assets/javascripts/moment/locale/se.js +59 -0
- data/app/assets/javascripts/moment/locale/si.js +70 -0
- data/app/assets/javascripts/moment/locale/sk.js +155 -0
- data/app/assets/javascripts/moment/locale/sl.js +172 -0
- data/app/assets/javascripts/moment/locale/sq.js +67 -0
- data/app/assets/javascripts/moment/locale/sr-cyrl.js +110 -0
- data/app/assets/javascripts/moment/locale/sr.js +110 -0
- data/app/assets/javascripts/moment/locale/ss.js +87 -0
- data/app/assets/javascripts/moment/locale/sv.js +68 -0
- data/app/assets/javascripts/moment/locale/sw.js +58 -0
- data/app/assets/javascripts/moment/locale/ta.js +128 -0
- data/app/assets/javascripts/moment/locale/te.js +88 -0
- data/app/assets/javascripts/moment/locale/tet.js +66 -0
- data/app/assets/javascripts/moment/locale/tg.js +115 -0
- data/app/assets/javascripts/moment/locale/th.js +66 -0
- data/app/assets/javascripts/moment/locale/tl-ph.js +61 -0
- data/app/assets/javascripts/moment/locale/tlh.js +121 -0
- data/app/assets/javascripts/moment/locale/tr.js +93 -0
- data/app/assets/javascripts/moment/locale/tzl.js +90 -0
- data/app/assets/javascripts/moment/locale/tzm-latn.js +57 -0
- data/app/assets/javascripts/moment/locale/tzm.js +57 -0
- data/app/assets/javascripts/moment/locale/ug-cn.js +118 -0
- data/app/assets/javascripts/moment/locale/uk.js +153 -0
- data/app/assets/javascripts/moment/locale/ur.js +97 -0
- data/app/assets/javascripts/moment/locale/uz-latn.js +57 -0
- data/app/assets/javascripts/moment/locale/uz.js +57 -0
- data/app/assets/javascripts/moment/locale/vi.js +78 -0
- data/app/assets/javascripts/moment/locale/x-pseudo.js +67 -0
- data/app/assets/javascripts/moment/locale/yo.js +59 -0
- data/app/assets/javascripts/moment/locale/zh-cn.js +109 -0
- data/app/assets/javascripts/moment/locale/zh-hk.js +102 -0
- data/app/assets/javascripts/moment/locale/zh-tw.js +102 -0
- data/app/assets/javascripts/moment/moment.js +4603 -0
- data/app/assets/stylesheets/effective_bootstrap.scss +12 -0
- data/app/assets/stylesheets/effective_bootstrap/base.scss +4 -0
- data/app/assets/stylesheets/effective_bootstrap/forms.scss +65 -0
- data/app/assets/stylesheets/effective_bootstrap/icons.scss +67 -0
- data/app/assets/stylesheets/effective_bootstrap/overrides.scss +14 -0
- data/app/assets/stylesheets/effective_checks/input.scss +8 -0
- data/app/assets/stylesheets/effective_date/input.scss +1 -0
- data/app/assets/stylesheets/effective_datetime/bootstrap-datetimepicker.scss +374 -0
- data/app/assets/stylesheets/effective_datetime/input.scss +2 -0
- data/app/assets/stylesheets/effective_datetime/overrides.scss +31 -0
- data/app/assets/stylesheets/effective_editor/input.scss +2 -0
- data/app/assets/stylesheets/effective_editor/overrides.scss +25 -0
- data/app/assets/stylesheets/effective_editor/quill.scss +948 -0
- data/app/assets/stylesheets/effective_file/input.scss +46 -0
- data/app/assets/stylesheets/effective_radio/input.scss +29 -0
- data/app/assets/stylesheets/effective_select/bootstrap-theme.css +564 -0
- data/app/assets/stylesheets/effective_select/input.scss +3 -0
- data/app/assets/stylesheets/effective_select/overrides.scss +115 -0
- data/app/assets/stylesheets/effective_select/select2.css +484 -0
- data/app/assets/stylesheets/effective_select_or_text/input.scss +6 -0
- data/app/assets/stylesheets/effective_time/input.scss +1 -0
- data/app/helpers/effective_bootstrap_helper.rb +371 -0
- data/app/helpers/effective_editor_helper.rb +29 -0
- data/app/helpers/effective_form_builder_helper.rb +74 -0
- data/app/helpers/effective_icons_helper.rb +51 -0
- data/app/models/effective/access_denied.rb +17 -0
- data/app/models/effective/form_builder.rb +199 -0
- data/app/models/effective/form_input.rb +434 -0
- data/app/models/effective/form_inputs/check_box.rb +70 -0
- data/app/models/effective/form_inputs/checks.rb +99 -0
- data/app/models/effective/form_inputs/ck_editor.rb +48 -0
- data/app/models/effective/form_inputs/clear.rb +22 -0
- data/app/models/effective/form_inputs/collection_input.rb +168 -0
- data/app/models/effective/form_inputs/date_field.rb +34 -0
- data/app/models/effective/form_inputs/datetime_field.rb +83 -0
- data/app/models/effective/form_inputs/delete.rb +26 -0
- data/app/models/effective/form_inputs/editor.rb +88 -0
- data/app/models/effective/form_inputs/email_cc_field.rb +19 -0
- data/app/models/effective/form_inputs/email_field.rb +20 -0
- data/app/models/effective/form_inputs/error_field.rb +47 -0
- data/app/models/effective/form_inputs/file_field.rb +135 -0
- data/app/models/effective/form_inputs/float_field.rb +20 -0
- data/app/models/effective/form_inputs/form_group.rb +15 -0
- data/app/models/effective/form_inputs/integer_field.rb +18 -0
- data/app/models/effective/form_inputs/number_field.rb +10 -0
- data/app/models/effective/form_inputs/number_text_field.rb +15 -0
- data/app/models/effective/form_inputs/password_field.rb +24 -0
- data/app/models/effective/form_inputs/percent_field.rb +38 -0
- data/app/models/effective/form_inputs/phone_field.rb +39 -0
- data/app/models/effective/form_inputs/price_field.rb +32 -0
- data/app/models/effective/form_inputs/radios.rb +175 -0
- data/app/models/effective/form_inputs/remote_link_to.rb +30 -0
- data/app/models/effective/form_inputs/reset.rb +22 -0
- data/app/models/effective/form_inputs/save.rb +22 -0
- data/app/models/effective/form_inputs/search_field.rb +15 -0
- data/app/models/effective/form_inputs/select.rb +176 -0
- data/app/models/effective/form_inputs/select_or_text.rb +70 -0
- data/app/models/effective/form_inputs/static_field.rb +41 -0
- data/app/models/effective/form_inputs/submit.rb +109 -0
- data/app/models/effective/form_inputs/text_area.rb +11 -0
- data/app/models/effective/form_inputs/text_field.rb +6 -0
- data/app/models/effective/form_inputs/time_field.rb +34 -0
- data/app/models/effective/form_inputs/time_zone_select.rb +15 -0
- data/app/models/effective/form_inputs/url_field.rb +20 -0
- data/app/models/effective/form_logic.rb +45 -0
- data/app/models/effective/form_logics/hide_if.rb +39 -0
- data/app/models/effective/form_logics/show_if.rb +39 -0
- data/app/models/effective/form_logics/show_if_any.rb +42 -0
- data/app/views/effective/style_guide/__fields.html.haml +43 -0
- data/app/views/effective/style_guide/__inline_fields.html.haml +4 -0
- data/app/views/effective/style_guide/_effective_form_with.html.haml +26 -0
- data/app/views/effective/style_guide/_feather_icons.html.haml +9 -0
- data/config/effective_bootstrap.rb +27 -0
- data/lib/effective_bootstrap.rb +33 -0
- data/lib/effective_bootstrap/engine.rb +15 -0
- data/lib/effective_bootstrap/version.rb +3 -0
- data/lib/generators/effective_bootstrap/install_generator.rb +14 -0
- metadata +650 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: edbd3d46e3b489964e42de81d6e1e80ee8cd069e3eb023691b3f4bd72c269232
|
4
|
+
data.tar.gz: 49aff1866905080fbd03ec98b882928d0082d9f03b63c453e35993d24687d493
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8a2d898a6a45553bfac7ce5743aa0d0f98de8d0833e680f3665f845c30d8d2b452bd92351b3eab7ee534a0040a2ec291103a47253821f2a58bbbb4fa98a1dd4b
|
7
|
+
data.tar.gz: c0a16990a52e9b46f0b636765c13711b10b4c3ae14e9af4d28cd7869ee163887553969262b868a2d0a0e9621bc7a6dd509b060f55277b42bfc0544c7c6a8ce5d
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2019 Code and Effect Inc.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,644 @@
|
|
1
|
+
# Effective Bootstrap
|
2
|
+
|
3
|
+
Everything your Ruby on Rails 5.1+ application needs to get working with [Twitter Bootstrap 4](https://getbootstrap.com/).
|
4
|
+
|
5
|
+
- Bootstrap4 component view helpers.
|
6
|
+
- SVG icons based on [Inline SVG](https://github.com/jamesmartin/inline_svg), with [Feather Icons](https://feathericons.com) and [FontAwesome](https://fontawesome.com) svg icons to replace the old glyphicons.
|
7
|
+
- An html-exact form builder that builds on top of Rails' new `form_with` with numerous custom form inputs.
|
8
|
+
|
9
|
+
## Getting Started
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'effective_bootstrap'
|
13
|
+
```
|
14
|
+
|
15
|
+
Run the bundle command to install it:
|
16
|
+
|
17
|
+
```console
|
18
|
+
bundle install
|
19
|
+
```
|
20
|
+
|
21
|
+
Install the configuration file:
|
22
|
+
|
23
|
+
```console
|
24
|
+
rails generate effective_bootstrap:install
|
25
|
+
```
|
26
|
+
|
27
|
+
The generator will install an initializer which describes all configuration options.
|
28
|
+
|
29
|
+
Add the following to your `application.js`:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
//= require jquery3
|
33
|
+
//= require popper
|
34
|
+
//= require bootstrap
|
35
|
+
//= require effective_bootstrap
|
36
|
+
|
37
|
+
# The date picker form inputs use momentjs locales. To add a locale:
|
38
|
+
//= require moment/locale/es
|
39
|
+
//= require moment/locale/nl
|
40
|
+
```
|
41
|
+
|
42
|
+
And to your `application.scss`:
|
43
|
+
|
44
|
+
```sass
|
45
|
+
@import 'bootstrap';
|
46
|
+
@import 'effective_bootstrap';
|
47
|
+
```
|
48
|
+
|
49
|
+
## View Helpers
|
50
|
+
|
51
|
+
All these examples are in [haml](https://github.com/haml/haml).
|
52
|
+
|
53
|
+
### Collapse
|
54
|
+
|
55
|
+
https://getbootstrap.com/docs/4.0/components/collapse/
|
56
|
+
|
57
|
+
```haml
|
58
|
+
= collapse('Click to collapse/expand') do
|
59
|
+
%p You have revealed me!
|
60
|
+
```
|
61
|
+
|
62
|
+
### Dropdown
|
63
|
+
|
64
|
+
https://getbootstrap.com/docs/4.0/components/dropdowns/
|
65
|
+
|
66
|
+
```haml
|
67
|
+
= dropdown do
|
68
|
+
= dropdown_link_to 'Something', root_path
|
69
|
+
= dropdown_divider
|
70
|
+
= dropdown_link_to 'Another', root_path
|
71
|
+
```
|
72
|
+
|
73
|
+
Options include: `dropdown(variation: :dropup|:dropleft|:dropright, split: true|false, right: true|false, btn: 'btn-secondary')`
|
74
|
+
|
75
|
+
### ListGroup
|
76
|
+
|
77
|
+
https://getbootstrap.com/docs/4.0/components/list-group/
|
78
|
+
|
79
|
+
```haml
|
80
|
+
= list_group do
|
81
|
+
= list_group_link_to 'Something', root_path
|
82
|
+
```
|
83
|
+
|
84
|
+
`list_group_link_to` will automatically insert the the `.active` class based on the request path.
|
85
|
+
|
86
|
+
### Navbar
|
87
|
+
|
88
|
+
https://getbootstrap.com/docs/4.0/components/navbar/
|
89
|
+
|
90
|
+
```haml
|
91
|
+
%nav.navbar.navbar-expand-lg.navbar-light.bg-light
|
92
|
+
%a.navbar-brand{href: '/'} Home
|
93
|
+
|
94
|
+
%button.navbar-toggler{type: 'button', data: {toggle: 'collapse', target: '#navContent', 'aria-controls': 'navContent', 'aria-label': 'Toggle navigation'}}
|
95
|
+
%span.navbar-toggler-icon
|
96
|
+
|
97
|
+
#navContent.collapse.navbar-collapse
|
98
|
+
%ul.navbar-nav.mr-auto
|
99
|
+
= nav_link_to 'About', '/about'
|
100
|
+
= nav_link_to 'Contact', '/conact'
|
101
|
+
|
102
|
+
%ul.navbar-nav
|
103
|
+
- if current_user.present?
|
104
|
+
= nav_dropdown('Account', right: true) do
|
105
|
+
= nav_link_to 'Settings', user_settings_path
|
106
|
+
|
107
|
+
- if can?(:access, :admin)
|
108
|
+
= nav_divider
|
109
|
+
= nav_link_to 'Site Admin', '/admin'
|
110
|
+
|
111
|
+
= nav_divider
|
112
|
+
= nav_link_to 'Sign Out', destroy_user_session_path, method: :delete
|
113
|
+
- else
|
114
|
+
= nav_link_to 'Sign In', new_user_session_path
|
115
|
+
```
|
116
|
+
|
117
|
+
`nav_link_to` will automatically insert the `.active` class based on the request path.
|
118
|
+
|
119
|
+
### Pagination
|
120
|
+
|
121
|
+
https://getbootstrap.com/docs/4.0/components/pagination/
|
122
|
+
|
123
|
+
Builds a pagination based on the given collection, current url and params[:page].
|
124
|
+
|
125
|
+
The collection must be an ActiveRecord relation.
|
126
|
+
|
127
|
+
```haml
|
128
|
+
= paginate(@posts, per_page: 10)
|
129
|
+
```
|
130
|
+
|
131
|
+
Add this to your model:
|
132
|
+
|
133
|
+
```ruby
|
134
|
+
scope :paginate, -> (page: nil, per_page:) {
|
135
|
+
page = (page || 1).to_i
|
136
|
+
offset = [(page - 1), 0].max * per_page
|
137
|
+
|
138
|
+
limit(per_page).offset(offset)
|
139
|
+
}
|
140
|
+
```
|
141
|
+
|
142
|
+
Add this to your controller:
|
143
|
+
|
144
|
+
```ruby
|
145
|
+
def index
|
146
|
+
@posts = Post.all.paginate(page: params[:page], per_page: 10)
|
147
|
+
end
|
148
|
+
```
|
149
|
+
|
150
|
+
Add this to your view:
|
151
|
+
|
152
|
+
```haml
|
153
|
+
%nav= paginate(@posts, per_page: 10)
|
154
|
+
```
|
155
|
+
|
156
|
+
or
|
157
|
+
|
158
|
+
```haml
|
159
|
+
%nav.d-flex.justify-content-center= paginate(@posts, per_page: 10)
|
160
|
+
```
|
161
|
+
|
162
|
+
### Tabs
|
163
|
+
|
164
|
+
https://getbootstrap.com/docs/4.0/components/navs/#tabs
|
165
|
+
|
166
|
+
```haml
|
167
|
+
= tabs do
|
168
|
+
= tab 'Demographics' do
|
169
|
+
%p Demographics tab
|
170
|
+
|
171
|
+
= tab 'Orders' do
|
172
|
+
%p Orders tab
|
173
|
+
|
174
|
+
- if resource.logs.present?
|
175
|
+
= tab 'Logs' do
|
176
|
+
%p Logs tab
|
177
|
+
```
|
178
|
+
|
179
|
+
## Icon Helpers
|
180
|
+
|
181
|
+
Unfortunately, Bootstrap 4 dropped support for glyphicons, so we use a combination of [Inline SVG](https://github.com/jamesmartin/inline_svg), with [Feather Icons](https://feathericons.com) and [FontAwesome](https://fontawesome.com) .svg images (no webfonts) to get back this functionality, even better than it was before.
|
182
|
+
|
183
|
+
```haml
|
184
|
+
= icon('ok') # <svg class='eb-icon eb-icon-ok' ...>
|
185
|
+
```
|
186
|
+
|
187
|
+
```haml
|
188
|
+
= icon_to('ok', root_path) # <a href='/'><svg class='eb-icon eb-icon-ok' ...></a>
|
189
|
+
```
|
190
|
+
|
191
|
+
A full list of icons can be found here: [All effective_bootstrap icons](https://github.com/code-and-effect/effective_bootstrap/tree/master/app/assets/images/icons)
|
192
|
+
|
193
|
+
To overwrite or add an icon, just drop the `.svg` file into your application's `app/assets/images/icons/` directory.
|
194
|
+
|
195
|
+
There are also a few helpers for commonly used icons, they all take the form of `x_icon_to(new_thing_path)`:
|
196
|
+
|
197
|
+
- `new_icon_to`
|
198
|
+
- `show_icon_to`
|
199
|
+
- `edit_icon_to`
|
200
|
+
- `destroy_icon_to`
|
201
|
+
- `settings_icon_to`
|
202
|
+
- `ok_icon_to`
|
203
|
+
- `approve_icon_to`
|
204
|
+
- `remove_icon_to`
|
205
|
+
|
206
|
+
## Form Builder
|
207
|
+
|
208
|
+
Rails 5.1 has introduced a new `form_with` syntax, and soft-deprecated `form_tag` and `form_for`.
|
209
|
+
|
210
|
+
This gem includes a [Bootstrap4 Forms](https://getbootstrap.com/docs/4.0/components/forms/) html-exact form builder built on top of `form_with`.
|
211
|
+
|
212
|
+
The goal of this form builder is to output beautiful forms while matching the rails form syntax -- you should be able to change an existing `form_with` form to `effective_form_with` with no other changes.
|
213
|
+
|
214
|
+
Of course, just the regular form inputs are boring, and this gem extends numerous jQuery/Javascript libraries to level up some inputs.
|
215
|
+
|
216
|
+
This is an opinionated Bootstrap4 form builder.
|
217
|
+
|
218
|
+
## effective_form_with
|
219
|
+
|
220
|
+
Matches the Rails `form_with` tag syntax, with all its `:model`, `:scope`, `:url`, `:method`, etc.
|
221
|
+
|
222
|
+
As well, you can specify `layout: :vertical`, `layout: :horizontal`, or `layout: :inline` as per the different Bootstrap form layouts.
|
223
|
+
|
224
|
+
```haml
|
225
|
+
= effective_form_with(model: @user, layout: :horizontal) do |f|
|
226
|
+
= f.text_field :name
|
227
|
+
= f.submit
|
228
|
+
```
|
229
|
+
|
230
|
+
The default is `layout: :vertical`.
|
231
|
+
|
232
|
+
All standard form fields have been implemented as per [Rails 5.1 FormHelper](http://api.rubyonrails.org/v5.1/classes/ActionView/Helpers/FormHelper.html)
|
233
|
+
|
234
|
+
When working as a `remote: true` form, you can also pass `flash_success: true|false` and `flash_error: true|false` to control the flash behaviour. By default, the errors will be displayed, and the success will be hidden.
|
235
|
+
|
236
|
+
### Options
|
237
|
+
|
238
|
+
There are three sets of options hashes that you can pass into any form input:
|
239
|
+
|
240
|
+
- `wrapper: { class: 'something' }` are applied to the wrapping div tag.
|
241
|
+
- `input_html: { class: 'something' }` are applied to the input, select or textarea tag itself.
|
242
|
+
- `input_js: { key: value }` are passed to any custom form input will be used to initialize the Javascript library. For example:
|
243
|
+
|
244
|
+
```ruby
|
245
|
+
= effective_form_with(model: @user) do |f|
|
246
|
+
= f.date_field :updated_at, input_js: { useCurrent: 'day', showTodayButton: true }
|
247
|
+
```
|
248
|
+
|
249
|
+
will result in the following call to the Javascript library:
|
250
|
+
|
251
|
+
```javascript
|
252
|
+
$('input').datetimepicker(useCurrent: 'day', showTodayButton: true);
|
253
|
+
```
|
254
|
+
Any options passed in this way will be used to initialize the underlying javascript libraries.
|
255
|
+
|
256
|
+
## Basic form inputs
|
257
|
+
|
258
|
+
The following form inputs are supported, but don't have any kind of custom JavaScript
|
259
|
+
|
260
|
+
```haml
|
261
|
+
= f.check_box
|
262
|
+
= f.email_field
|
263
|
+
= f.error_field
|
264
|
+
= f.number_field
|
265
|
+
= f.password_field
|
266
|
+
= f.static_field
|
267
|
+
= f.text_area
|
268
|
+
= f.text_field
|
269
|
+
= f.url_field
|
270
|
+
```
|
271
|
+
|
272
|
+
## Custom date_field, datetime_field, time_field
|
273
|
+
|
274
|
+
These custom form inputs are all based on the following awesome project:
|
275
|
+
|
276
|
+
Bootstrap 3 Datepicker (https://github.com/Eonasdan/bootstrap-datetimepicker)
|
277
|
+
|
278
|
+
```haml
|
279
|
+
= f.date_field :updated_at
|
280
|
+
= f.datetime_field :updated_at
|
281
|
+
= f.time_field :updated_at
|
282
|
+
```
|
283
|
+
|
284
|
+
### Options
|
285
|
+
|
286
|
+
The default options used to initialize this form input are as follows:
|
287
|
+
|
288
|
+
```ruby
|
289
|
+
am_pm: true, input_js: { showTodayButton: false, showClear: false, useCurrent: 'hour' }
|
290
|
+
```
|
291
|
+
|
292
|
+
For a full list of options, please refer to:
|
293
|
+
|
294
|
+
http://eonasdan.github.io/bootstrap-datetimepicker/Options/
|
295
|
+
|
296
|
+
### Set Date
|
297
|
+
|
298
|
+
Use the following JavaScript to set the date:
|
299
|
+
|
300
|
+
```javascript
|
301
|
+
$('#start_at').data('DateTimePicker').date('2016-05-08')
|
302
|
+
```
|
303
|
+
|
304
|
+
### Disabled Dates
|
305
|
+
|
306
|
+
Provide a String, Date, or Range to set the disabled dates.
|
307
|
+
|
308
|
+
```ruby
|
309
|
+
input_js: { disabledDates: '2020-01-01' }
|
310
|
+
input_js: { disabledDates: Time.zone.now }
|
311
|
+
input_js: { disabledDates: Time.zone.now.beginning_of_month..Time.zone.now.end_of_month }
|
312
|
+
input_js: { disabledDates: [Time.zone.now, Time.zone.now + 1.day] }
|
313
|
+
```
|
314
|
+
|
315
|
+
### Linked Dates
|
316
|
+
|
317
|
+
By default, when two matching date inputs named `start_*` and `end_*` are present on the same form, they will become linked.
|
318
|
+
|
319
|
+
The end date selector will have its date <= start_date disabled.
|
320
|
+
|
321
|
+
To disable this behaviour, call with `date_linked: false`.
|
322
|
+
|
323
|
+
```ruby
|
324
|
+
= f.input :end_at, date_linked: false
|
325
|
+
```
|
326
|
+
|
327
|
+
### Events
|
328
|
+
|
329
|
+
The date picker library doesn't trigger a regular `change`. Instead you must watch for the `dp.change` event.
|
330
|
+
|
331
|
+
More info is available here:
|
332
|
+
|
333
|
+
http://eonasdan.github.io/bootstrap-datetimepicker/Events/
|
334
|
+
|
335
|
+
## Custom percent_field
|
336
|
+
|
337
|
+
This custom form input uses no 3rd party jQuery plugins.
|
338
|
+
|
339
|
+
It displays a percentage formatted value `100` or `12.500` but posts the "percentage as integer" value of `100000` or `12500` to the server.
|
340
|
+
|
341
|
+
It's like the price field, but 3 digits instead of 2.
|
342
|
+
|
343
|
+
```haml
|
344
|
+
= f.percent_field :percent
|
345
|
+
```
|
346
|
+
|
347
|
+
## Custom price_field
|
348
|
+
|
349
|
+
This custom form input uses no 3rd party jQuery plugins.
|
350
|
+
|
351
|
+
It displays a currency formatted value `100.00` but posts the "price as integer" value of `10000` to the server.
|
352
|
+
|
353
|
+
Think about this value as "the number of cents".
|
354
|
+
|
355
|
+
```haml
|
356
|
+
= f.price_field :price
|
357
|
+
```
|
358
|
+
|
359
|
+
This gem also includes a rails view helper `price_to_currency` that takes a value like `10000` and displays it as `$100.00`
|
360
|
+
|
361
|
+
## Custom select
|
362
|
+
|
363
|
+
This custom form input is based on the following awesome project:
|
364
|
+
|
365
|
+
Select2 (https://select2.github.io/)
|
366
|
+
|
367
|
+
### Usage
|
368
|
+
|
369
|
+
As a Rails Form Helper input:
|
370
|
+
|
371
|
+
```ruby
|
372
|
+
= f.select :category, 10.times.map { |x| "Category #{x}"}
|
373
|
+
= f.select :categories, 10.times.map { |x| "Category #{x}"}, multiple: true
|
374
|
+
= f.select :categories, 10.times.map { |x| "Category #{x}"}, tags: true
|
375
|
+
= f.select :categories, {'Active': [['Post A', 1], ['Post B', 2]], 'Past': [['Post C', 3], ['Post D', 4]]}, grouped: true
|
376
|
+
```
|
377
|
+
|
378
|
+
### Modes
|
379
|
+
|
380
|
+
The standard mode is a replacement for the default single select box.
|
381
|
+
|
382
|
+
Passing `multiple: true` will allow multiple selections to be made.
|
383
|
+
|
384
|
+
Passing `freeform: true` will allow a single selection and new ones to be created.
|
385
|
+
|
386
|
+
Passing `multiple: true, tags: true` will allow multiple selections to be made, and new value options to be created. This will allow you to both select existing tags and create new tags in the same form control.
|
387
|
+
|
388
|
+
Passing `grouped: true` will enable optgroup support. When in this mode, the collection should be a Hash of ActiveRecord Relations or Array of Arrays
|
389
|
+
|
390
|
+
```ruby
|
391
|
+
{'Active' => Post.active, 'Past' => Post.past}
|
392
|
+
{'Active' => [['Post A', 1], ['Post B', 2]], 'Past' => [['Post C', 3], ['Post D', 4]]}
|
393
|
+
```
|
394
|
+
|
395
|
+
Passing `polymorphic: true` will enable polymorphic support. In this mode, an additional 2 hidden input fields are created alongside the select field.
|
396
|
+
|
397
|
+
So calling
|
398
|
+
|
399
|
+
```ruby
|
400
|
+
= f.input :primary_contact, User.all.to_a + Member.all.to_a, polymorphic: true
|
401
|
+
```
|
402
|
+
|
403
|
+
will internally translate the collection into:
|
404
|
+
|
405
|
+
```ruby
|
406
|
+
[['User 1', 'User_1'], ['User 2', 'User_2'], ['Member 100', 'Member_100']]
|
407
|
+
```
|
408
|
+
|
409
|
+
and instead of posting to the server with the parameter `:primary_contact`, it will instead post `{primary_contact_id: 2, primary_contact_type: 'User'}`.
|
410
|
+
|
411
|
+
Using both `polymorphic: true` and `grouped: true` is recommended. In this case the expected collection is as follows:
|
412
|
+
|
413
|
+
```ruby
|
414
|
+
= f.input :primary_contact, {'Users': User.all, 'Members': Member.all}, polymorphic: true, grouped: true
|
415
|
+
```
|
416
|
+
|
417
|
+
### Options
|
418
|
+
|
419
|
+
The default options used to initialize this form input are as follows:
|
420
|
+
|
421
|
+
```ruby
|
422
|
+
{
|
423
|
+
:theme => 'bootstrap',
|
424
|
+
:minimumResultsForSearch => 6,
|
425
|
+
:tokenSeparators => [',', ' '],
|
426
|
+
:width => 'style',
|
427
|
+
:placeholder => 'Please choose',
|
428
|
+
:allowClear => !(options[:multiple]) # Only display the Clear 'x' on a single selection box
|
429
|
+
}
|
430
|
+
```
|
431
|
+
|
432
|
+
### Interesting Available Options
|
433
|
+
|
434
|
+
To limit the number of items that can be selected in a multiple select box:
|
435
|
+
|
436
|
+
```ruby
|
437
|
+
maximumSelectionLength: 2
|
438
|
+
```
|
439
|
+
|
440
|
+
To hide the search box entirely:
|
441
|
+
|
442
|
+
```ruby
|
443
|
+
minimumResultsForSearch: 'Infinity'
|
444
|
+
```
|
445
|
+
|
446
|
+
For a full list of options, please refer to: https://select2.github.io/options.html
|
447
|
+
|
448
|
+
|
449
|
+
The following `input_js: options` are not part of the standard select2 API, and are custom `effective_select` functionality only:
|
450
|
+
|
451
|
+
To add a css class to the select2 container or dropdown:
|
452
|
+
|
453
|
+
```ruby
|
454
|
+
containerClass: 'custom-container-class'
|
455
|
+
dropdownClass: 'custom-dropdown-class'
|
456
|
+
```
|
457
|
+
|
458
|
+
to display rich html for the option value:
|
459
|
+
|
460
|
+
```ruby
|
461
|
+
f.select :user, user_tag_collection(User.all), template: :html
|
462
|
+
|
463
|
+
def user_tag_collection(users)
|
464
|
+
users.map do |user|
|
465
|
+
[
|
466
|
+
user.to_s,
|
467
|
+
user.to_param,
|
468
|
+
{ 'data-html': content_tag(:span, user.to_s, class: 'user-choice') }
|
469
|
+
]
|
470
|
+
end
|
471
|
+
end
|
472
|
+
```
|
473
|
+
|
474
|
+
### Additional
|
475
|
+
|
476
|
+
Call with `single_selected: true` to ensure only the first selected option tag will be `<option selected="selected">`.
|
477
|
+
|
478
|
+
This can be useful when displaying multiple options with an identical value.
|
479
|
+
|
480
|
+
### Clear value
|
481
|
+
|
482
|
+
It's a bit tricky to clear the selected value
|
483
|
+
|
484
|
+
```coffeescript
|
485
|
+
$('select').val('').trigger('change.select2')
|
486
|
+
```
|
487
|
+
|
488
|
+
### Working with dynamic options
|
489
|
+
|
490
|
+
The following information applies to `effective_select` only, and is not part of the standard select2 API.
|
491
|
+
|
492
|
+
To totally hide (instead of just grey out) any disabled options from the select2 dropdown, initialize the input with:
|
493
|
+
|
494
|
+
```ruby
|
495
|
+
= f.input :category, User.all, hide_disabled: true
|
496
|
+
```
|
497
|
+
|
498
|
+
If you want to dynamically add/remove options from the select field after page load, you must use the `select2:reinitialize` event:
|
499
|
+
|
500
|
+
```coffeescript
|
501
|
+
# When something on my page changes
|
502
|
+
$(document).on 'change', '.something', (event) ->
|
503
|
+
$select = $(event.target).closest('form').find('select.i-want-to-change') # Find the select2 input to be updated
|
504
|
+
|
505
|
+
# Go through its options, and modify some of them.
|
506
|
+
# Using the above 'hide_disabled true' functionality, the following code hides the options from being displayed,
|
507
|
+
# but you could actually remove the options, add new ones, or update the values/texts. whatever.
|
508
|
+
$select.find('option').each (index, option) ->
|
509
|
+
$(option).prop('disabled', true) if index > 10
|
510
|
+
|
511
|
+
# Whenever the underlying options change, you need to manually trigger the following event:
|
512
|
+
$select.select2().trigger('select2:reinitialize')
|
513
|
+
```
|
514
|
+
|
515
|
+
### AJAX Support
|
516
|
+
|
517
|
+
Provide the `ajax_url: ` method to use AJAX remote data source.
|
518
|
+
|
519
|
+
In your form:
|
520
|
+
|
521
|
+
```ruby
|
522
|
+
= f.select :user_id, User.all, ajax_url: users_select2_ajax_index_path
|
523
|
+
```
|
524
|
+
|
525
|
+
In your `routes.rb`:
|
526
|
+
|
527
|
+
```ruby
|
528
|
+
resources :select2_ajax, only: [] do
|
529
|
+
get :users, on: :collection
|
530
|
+
end
|
531
|
+
```
|
532
|
+
|
533
|
+
In your controller:
|
534
|
+
|
535
|
+
```ruby
|
536
|
+
class Select2AjaxController < ApplicationController
|
537
|
+
def users
|
538
|
+
# Collection
|
539
|
+
collection = User.all
|
540
|
+
|
541
|
+
# Search
|
542
|
+
if (term = params[:term]).present?
|
543
|
+
collection = collection.where('name ILIKE ?', "%#{term}%").or(collection.where('id::TEXT LIKE ?', "%#{term}%"))
|
544
|
+
end
|
545
|
+
|
546
|
+
# Paginate
|
547
|
+
per_page = 20
|
548
|
+
page = (params[:page] || 1).to_i
|
549
|
+
last = (collection.reselect(:id).count.to_f / per_page).ceil
|
550
|
+
more = page < last
|
551
|
+
|
552
|
+
offset = [(page - 1), 0].max * per_page
|
553
|
+
collection = collection.limit(per_page).offset(offset)
|
554
|
+
|
555
|
+
# Results
|
556
|
+
results = collection.map { |user| { id: user.to_param, text: user.to_s } }
|
557
|
+
|
558
|
+
respond_to do |format|
|
559
|
+
format.js do
|
560
|
+
render json: { results: results, pagination: { more: more } }
|
561
|
+
end
|
562
|
+
end
|
563
|
+
end
|
564
|
+
|
565
|
+
end
|
566
|
+
```
|
567
|
+
|
568
|
+
## Custom select_or_text_field
|
569
|
+
|
570
|
+
This custom form input is unique. It takes in two different field names, one of them a select, the other a text field.
|
571
|
+
|
572
|
+
It enforces an `XOR` between the two fields.
|
573
|
+
|
574
|
+
It's intended for selecting a `belongs_to` or using a freeform text field pattern.
|
575
|
+
|
576
|
+
This custom form input uses no 3rd party jQuery plugins.
|
577
|
+
|
578
|
+
```haml
|
579
|
+
= f.select_or_text_field :post_id, :post_text, Post.all
|
580
|
+
= f.select_or_text_field :post_id, :post_text, Post.all, hint: 'Both select and text field will see this hint'
|
581
|
+
= f.select_or_text_field :post_id, :post_text, Post.all, select: { hint: 'select only options' }, text: { hint: 'text field only options'}
|
582
|
+
```
|
583
|
+
|
584
|
+
The `f.object` should have two separate attributes, `post_id` and `post_text`.
|
585
|
+
|
586
|
+
The javascript form input will enforce XOR, but you can also apply your own validation to also have the same effect as `required: true`
|
587
|
+
|
588
|
+
```
|
589
|
+
class PostSummary < ApplicationRecord
|
590
|
+
validate do
|
591
|
+
unless (post_id.present? ^ post_text.present?) # xor
|
592
|
+
self.errors.add(:post_id, 'please choose either post or post text')
|
593
|
+
self.errors.add(:post_text, 'please choose either post or post text')
|
594
|
+
end
|
595
|
+
end
|
596
|
+
end
|
597
|
+
```
|
598
|
+
|
599
|
+
## Custom submit and save
|
600
|
+
|
601
|
+
The `f.submit` puts in a wrapper and a default save button, and does the whole icon spin when submit thing.
|
602
|
+
|
603
|
+
The `f.save` is purely a input submit button.
|
604
|
+
|
605
|
+
```haml
|
606
|
+
= f.submit
|
607
|
+
= f.submit 'Save 2'
|
608
|
+
|
609
|
+
= f.submit 'Save', left: true
|
610
|
+
= f.submit 'Save', center: true
|
611
|
+
= f.submit 'Save', right: true
|
612
|
+
|
613
|
+
= f.submit 'Save', border: false
|
614
|
+
= f.submit 'Save', center: true, border: false
|
615
|
+
= f.submit 'Save', left: true, border: false
|
616
|
+
|
617
|
+
= f.submit(border: false) do
|
618
|
+
= f.save 'Save 1'
|
619
|
+
= f.save 'Save 2'
|
620
|
+
```
|
621
|
+
|
622
|
+
|
623
|
+
## License
|
624
|
+
|
625
|
+
MIT License. Copyright [Code and Effect Inc.](http://www.codeandeffect.com/)
|
626
|
+
|
627
|
+
[Feather icons](https://github.com/feathericons/feather#license) are licensed under the [MIT License](https://opensource.org/licenses/MIT).
|
628
|
+
|
629
|
+
[FontAwesome icons](https://fontawesome.com/license) are licensed under the [CC BY 4.0 License](https://creativecommons.org/licenses/by/4.0/) and require this attribution.
|
630
|
+
|
631
|
+
## Credits
|
632
|
+
|
633
|
+
The authors of this gem are not associated with any of the awesome projects used by this gem.
|
634
|
+
|
635
|
+
We are just extending these existing community projects for ease of use with Rails Form Helper and SimpleForm.
|
636
|
+
|
637
|
+
## Contributing
|
638
|
+
|
639
|
+
1. Fork it
|
640
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
641
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
642
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
643
|
+
5. Bonus points for test coverage
|
644
|
+
6. Create new Pull Request
|