integral 1.0.0
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 +105 -0
- data/Rakefile +22 -0
- data/app/assets/images/integral/backend/data-unavailable.png +0 -0
- data/app/assets/images/integral/backend/logo.png +0 -0
- data/app/assets/images/integral/defaults/no_image_available.jpg +0 -0
- data/app/assets/images/integral/defaults/user_avatar.jpg +0 -0
- data/app/assets/images/integral/image-not-set.png +0 -0
- data/app/assets/images/integral/posts-hero-banner.jpg +0 -0
- data/app/assets/javascripts/ckeditor/loader.js.erb +6 -0
- data/app/assets/javascripts/ckeditor/my_config.js.erb +154 -0
- data/app/assets/javascripts/ckeditor/my_contents.sass +22 -0
- data/app/assets/javascripts/ckeditor/my_javascript.js +12 -0
- data/app/assets/javascripts/ckeditor/my_styles.js +5 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/az.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/bg.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/ca.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/cs.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/da.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/de-ch.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/de.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/el.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/en-au.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/en.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/eo.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/es-mx.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/es.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/eu.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/fr.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/gl.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/hr.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/hu.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/it.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/ja.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/km.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/ko.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/ku.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/mk.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/nb.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/nl.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/oc.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/pl.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/pt-br.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/pt.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/ro.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/ru.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/sk.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/sq.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/sv.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/tr.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/ug.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/uk.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/vi.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/zh-cn.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/zh.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/autoembed/plugin.js +218 -0
- data/app/assets/javascripts/ckeditor/plugins/autogrow/plugin.js +232 -0
- data/app/assets/javascripts/ckeditor/plugins/autogrow/samples/autogrow.html +102 -0
- data/app/assets/javascripts/ckeditor/plugins/autolink/plugin.js +69 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/css/codemirror.min.css +1 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/icons/autocomplete.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/icons/autoformat.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/icons/commentselectedrange.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/icons/searchcode.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/icons/uncommentselectedrange.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/js/beautify.min.js +2 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.min.js +2 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.search.min.js +1 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.min.js +6 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.bbcode.min.js +1 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.bbcodemixed.min.js +1 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.htmlmixed.min.js +2 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.javascript.min.js +1 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.php.min.js +3 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.twig.min.js +1 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/af.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/ar.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/bg.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/bn.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/bs.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/ca.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/cs.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/cy.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/da.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/de.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/el.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/en-au.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/en-ca.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/en-gb.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/en.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/eo.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/es.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/et.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/eu.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/fa.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/fi.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/fo.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/fr-ca.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/fr.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/gl.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/gu.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/he.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/hi.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/hr.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/hu.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/is.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/it.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/ja.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/ka.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/km.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/ko.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/ku.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/lt.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/lv.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/mk.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/mn.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/ms.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/nb.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/nl.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/no.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/pl.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/pt-br.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/pt.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/ro.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/ru.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/sk.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/sl.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/sr-latn.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/sr.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/sv.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/th.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/tr.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/ug.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/uk.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/vi.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/zh-cn.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/zh.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/plugin.js +1311 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/3024-day.css +41 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/3024-night.css +39 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/abcdef.css +32 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/ambiance-mobile.css +5 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/ambiance.css +74 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/base16-dark.css +38 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/base16-light.css +38 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/bespin.css +34 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/blackboard.css +32 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/cobalt.css +25 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/colorforth.css +33 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/dracula.css +40 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/duotone-dark.css +35 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/duotone-light.css +36 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/eclipse.css +23 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/elegant.css +13 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/erlang-dark.css +34 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/hopscotch.css +34 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/icecoder.css +43 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/isotope.css +34 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/lesser-dark.css +47 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/liquibyte.css +95 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/material.css +53 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/mbo.css +37 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/mdn-like.css +46 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/midnight.css +43 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/monokai.css +36 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/neat.css +12 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/neo.css +43 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/night.css +27 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/panda-syntax.css +85 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/paraiso-dark.css +38 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/paraiso-light.css +38 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/pastel-on-dark.css +52 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/railscasts.css +34 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/rubyblue.css +25 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/seti.css +44 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/solarized.css +168 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/the-matrix.css +30 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/tomorrow-night-bright.css +35 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/tomorrow-night-eighties.css +38 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/ttcn.css +64 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/twilight.css +32 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/vibrant-ink.css +34 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/xq-dark.css +53 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/xq-light.css +43 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/yeti.css +44 -0
- data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/zenburn.css +37 -0
- data/app/assets/javascripts/ckeditor/plugins/embed/icons/embed.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/embed/icons/hidpi/embed.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/embed/plugin.js +105 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/dialogs/embedbase.js +99 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/az.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/bg.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/ca.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/cs.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/da.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/de-ch.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/de.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/en-au.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/en.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/eo.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/es-mx.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/es.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/eu.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/fr.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/gl.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/hr.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/hu.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/id.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/it.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/ja.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/ko.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/ku.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/nb.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/nl.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/oc.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/pl.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/pt-br.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/pt.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/ro.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/ru.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/sk.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/sq.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/sv.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/tr.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/ug.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/uk.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/zh-cn.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/zh.js +15 -0
- data/app/assets/javascripts/ckeditor/plugins/embedbase/plugin.js +652 -0
- data/app/assets/javascripts/ckeditor/plugins/embedjs/plugin.js +110 -0
- data/app/assets/javascripts/ckeditor/plugins/lineutils/dev/dnd.html +172 -0
- data/app/assets/javascripts/ckeditor/plugins/lineutils/dev/magicfinger.html +285 -0
- data/app/assets/javascripts/ckeditor/plugins/lineutils/plugin.js +1018 -0
- data/app/assets/javascripts/ckeditor/plugins/notification/lang/cs.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/notification/lang/da.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/notification/lang/de-ch.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/notification/lang/de.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/notification/lang/en.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/notification/lang/eo.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/notification/lang/eu.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/notification/lang/fr.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/notification/lang/gl.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/notification/lang/id.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/notification/lang/it.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/notification/lang/km.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/notification/lang/ko.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/notification/lang/ku.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/notification/lang/nb.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/notification/lang/nl.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/notification/lang/pl.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/notification/lang/pt-br.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/notification/lang/pt.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/notification/lang/ru.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/notification/lang/sv.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/notification/lang/tr.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/notification/lang/ug.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/notification/lang/uk.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/notification/lang/zh-cn.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/notification/lang/zh.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/notification/plugin.js +923 -0
- data/app/assets/javascripts/ckeditor/plugins/notificationaggregator/plugin.js +548 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/dev/placeholder.html +60 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/dialogs/placeholder.js +49 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/icons/hidpi/placeholder.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/icons/placeholder.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/af.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/ar.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/az.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/bg.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/ca.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/cs.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/cy.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/da.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/de-ch.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/de.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/el.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/en-gb.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/en.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/eo.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/es-mx.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/es.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/et.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/eu.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/fa.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/fi.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/fr-ca.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/fr.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/gl.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/he.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/hr.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/hu.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/id.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/it.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/ja.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/km.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/ko.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/ku.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/lv.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/nb.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/nl.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/no.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/oc.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/pl.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/pt-br.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/pt.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/ru.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/si.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/sk.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/sl.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/sq.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/sv.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/th.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/tr.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/tt.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/ug.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/uk.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/vi.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/zh-cn.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/zh.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/plugin.js +99 -0
- data/app/assets/javascripts/ckeditor/plugins/placeholder/samples/placeholder.html +75 -0
- data/app/assets/javascripts/ckeditor/plugins/strinsert/README.md +76 -0
- data/app/assets/javascripts/ckeditor/plugins/strinsert/bower.json +16 -0
- data/app/assets/javascripts/ckeditor/plugins/strinsert/plugin.js +107 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/dev/assets/contents.css +23 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/dev/assets/sample.jpg +0 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/dev/assets/simplebox/contents.css +36 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/dev/assets/simplebox/dialogs/simplebox.js +51 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/dev/assets/simplebox/icons/simplebox.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/dev/assets/simplebox/plugin.js +114 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/dev/console.js +131 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/dev/nestedwidgets.html +134 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/dev/widgetstyles.html +144 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/images/handle.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/af.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/ar.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/az.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/bg.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/ca.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/cs.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/cy.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/da.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/de-ch.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/de.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/el.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/en-gb.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/en.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/eo.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/es-mx.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/es.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/eu.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/fa.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/fi.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/fr.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/gl.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/he.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/hr.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/hu.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/id.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/it.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/ja.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/km.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/ko.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/ku.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/lv.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/nb.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/nl.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/no.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/oc.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/pl.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/pt-br.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/pt.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/ru.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/sk.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/sl.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/sq.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/sv.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/tr.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/tt.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/ug.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/uk.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/vi.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/zh-cn.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/lang/zh.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/widget/plugin.js +4147 -0
- data/app/assets/javascripts/ckeditor/plugins/widgetselection/plugin.js +366 -0
- data/app/assets/javascripts/ckeditor/plugins/wordcount/css/wordcount.css +3 -0
- data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/ar.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/ca.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/da.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/de.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/el.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/en.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/es.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/fi.js +14 -0
- data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/fr.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/he.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/hr.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/it.js +14 -0
- data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/ja.js +14 -0
- data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/jp.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/nl.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/no.js +10 -0
- data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/pl.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/pt-br.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/pt.js +9 -0
- data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/ru.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/sv.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/tr.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/zh-cn.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/wordcount/plugin.js +407 -0
- data/app/assets/javascripts/ckeditor/plugins/wordcount/samples/wordcount.html +61 -0
- data/app/assets/javascripts/ckeditor/plugins/wordcount/samples/wordcountWithMaxCount.html +110 -0
- data/app/assets/javascripts/integral/backend.js +268 -0
- data/app/assets/javascripts/integral/backend/extensions.js +1 -0
- data/app/assets/javascripts/integral/backend/support/Chart.bundle.min.js +10 -0
- data/app/assets/javascripts/integral/frontend.js +60 -0
- data/app/assets/javascripts/integral/support/character_counter.js +67 -0
- data/app/assets/javascripts/integral/support/chart_manager.coffee +145 -0
- data/app/assets/javascripts/integral/support/click_to_copy.coffee +28 -0
- data/app/assets/javascripts/integral/support/confirm_modal.coffee +58 -0
- data/app/assets/javascripts/integral/support/date_picker.coffee +83 -0
- data/app/assets/javascripts/integral/support/date_picker/picker.date.js +1435 -0
- data/app/assets/javascripts/integral/support/date_picker/picker.js +1132 -0
- data/app/assets/javascripts/integral/support/gallery.coffee +82 -0
- data/app/assets/javascripts/integral/support/google_analytics.coffee +23 -0
- data/app/assets/javascripts/integral/support/grid.coffee +92 -0
- data/app/assets/javascripts/integral/support/header_anchors.coffee +22 -0
- data/app/assets/javascripts/integral/support/image-preview.coffee +14 -0
- data/app/assets/javascripts/integral/support/image_selector.coffee +43 -0
- data/app/assets/javascripts/integral/support/image_uploader.coffee +59 -0
- data/app/assets/javascripts/integral/support/lib/html.sortable.js +691 -0
- data/app/assets/javascripts/integral/support/lib/jquery.are-you-sure.js +231 -0
- data/app/assets/javascripts/integral/support/lib/jquery_form.js +11 -0
- data/app/assets/javascripts/integral/support/lib/js.cookie.js +165 -0
- data/app/assets/javascripts/integral/support/lib/materialize-tags.js +758 -0
- data/app/assets/javascripts/integral/support/lib/materialize.clockpicker.js +699 -0
- data/app/assets/javascripts/integral/support/lib/swiper.js +7719 -0
- data/app/assets/javascripts/integral/support/lib/typeahead.js +2451 -0
- data/app/assets/javascripts/integral/support/lib/underscore.js +6 -0
- data/app/assets/javascripts/integral/support/list.coffee +71 -0
- data/app/assets/javascripts/integral/support/list_item.coffee +249 -0
- data/app/assets/javascripts/integral/support/notification_manager.coffee +17 -0
- data/app/assets/javascripts/integral/support/record_selector.coffee +161 -0
- data/app/assets/javascripts/integral/support/remote_form.coffee +87 -0
- data/app/assets/javascripts/integral/support/responsive_swiper.coffee +26 -0
- data/app/assets/javascripts/integral/support/scroll_to_top.coffee +17 -0
- data/app/assets/javascripts/integral/support/slug_generator.coffee +49 -0
- data/app/assets/stylesheets/errors.css +1834 -0
- data/app/assets/stylesheets/integral/backend.sass +66 -0
- data/app/assets/stylesheets/integral/backend/_foundation_settings.scss +867 -0
- data/app/assets/stylesheets/integral/backend/dashboard-layout.scss +491 -0
- data/app/assets/stylesheets/integral/backend/devise.sass +40 -0
- data/app/assets/stylesheets/integral/backend/foundation_and_overrides.scss +56 -0
- data/app/assets/stylesheets/integral/backend/materialize-tags.sass +70 -0
- data/app/assets/stylesheets/integral/backend/notifications.sass +43 -0
- data/app/assets/stylesheets/integral/backend/overrides.sass +1 -0
- data/app/assets/stylesheets/integral/backend/shared.sass +770 -0
- data/app/assets/stylesheets/integral/emails.scss +19 -0
- data/app/assets/stylesheets/integral/emails/colors.sass +3 -0
- data/app/assets/stylesheets/integral/frontend.sass +26 -0
- data/app/assets/stylesheets/integral/frontend/_foundation_settings.scss +863 -0
- data/app/assets/stylesheets/integral/frontend/blog.sass +263 -0
- data/app/assets/stylesheets/integral/frontend/demo.sass +158 -0
- data/app/assets/stylesheets/integral/frontend/foundation_and_overrides.scss +56 -0
- data/app/assets/stylesheets/integral/frontend/layout.sass +66 -0
- data/app/assets/stylesheets/integral/frontend/overrides.sass +1 -0
- data/app/assets/stylesheets/integral/frontend/share_modal.sass +25 -0
- data/app/assets/stylesheets/integral/frontend/shared.sass +73 -0
- data/app/assets/stylesheets/integral/support/date-picker.scss +16 -0
- data/app/assets/stylesheets/integral/support/date_picker/_default.date.scss +452 -0
- data/app/assets/stylesheets/integral/support/date_picker/_default.scss +201 -0
- data/app/assets/stylesheets/integral/support/date_picker/_default.time.scss +125 -0
- data/app/assets/stylesheets/integral/support/date_picker/materialize_clockpicker.sass +220 -0
- data/app/assets/stylesheets/integral/support/gallery.sass +54 -0
- data/app/assets/stylesheets/integral/support/media-query-indicator.sass +25 -0
- data/app/assets/stylesheets/integral/support/mixins.sass +29 -0
- data/app/assets/stylesheets/integral/support/scroll-to-top.sass +19 -0
- data/app/assets/stylesheets/integral/support/swiper.css +618 -0
- data/app/assets/stylesheets/integral/wysiwyg.sass +13 -0
- data/app/controllers/integral/application_controller.rb +130 -0
- data/app/controllers/integral/backend/activities_controller.rb +55 -0
- data/app/controllers/integral/backend/base_controller.rb +123 -0
- data/app/controllers/integral/backend/images_controller.rb +120 -0
- data/app/controllers/integral/backend/lists_controller.rb +138 -0
- data/app/controllers/integral/backend/pages_controller.rb +142 -0
- data/app/controllers/integral/backend/posts_controller.rb +132 -0
- data/app/controllers/integral/backend/settings_controller.rb +53 -0
- data/app/controllers/integral/backend/static_pages_controller.rb +10 -0
- data/app/controllers/integral/backend/users_controller.rb +130 -0
- data/app/controllers/integral/blog_controller.rb +19 -0
- data/app/controllers/integral/contact_controller.rb +36 -0
- data/app/controllers/integral/pages_controller.rb +45 -0
- data/app/controllers/integral/posts_controller.rb +71 -0
- data/app/controllers/integral/tags_controller.rb +38 -0
- data/app/decorators/integral/image_decorator.rb +16 -0
- data/app/decorators/integral/list_decorator.rb +21 -0
- data/app/decorators/integral/page_decorator.rb +26 -0
- data/app/decorators/integral/post_decorator.rb +63 -0
- data/app/decorators/integral/user_decorator.rb +21 -0
- data/app/decorators/integral/version_decorator.rb +57 -0
- data/app/helpers/integral/application_helper.rb +52 -0
- data/app/helpers/integral/backend/base_helper.rb +72 -0
- data/app/helpers/integral/blog_helper.rb +26 -0
- data/app/helpers/integral/gallery_helper.rb +36 -0
- data/app/helpers/integral/mail_helper.rb +16 -0
- data/app/helpers/integral/social_helper.rb +123 -0
- data/app/helpers/integral/support_helper.rb +60 -0
- data/app/jobs/integral/application_job.rb +10 -0
- data/app/jobs/integral/newsletter_signup_job.rb +28 -0
- data/app/mailers/integral/contact_mailer.rb +56 -0
- data/app/models/ckeditor/asset.rb +8 -0
- data/app/models/ckeditor/attachment_file.rb +9 -0
- data/app/models/ckeditor/picture.rb +21 -0
- data/app/models/integral/application_record.rb +6 -0
- data/app/models/integral/basic.rb +11 -0
- data/app/models/integral/enquiry.rb +46 -0
- data/app/models/integral/image.rb +67 -0
- data/app/models/integral/image_version.rb +8 -0
- data/app/models/integral/link.rb +11 -0
- data/app/models/integral/list.rb +69 -0
- data/app/models/integral/list_item.rb +89 -0
- data/app/models/integral/list_version.rb +8 -0
- data/app/models/integral/newsletter_signup.rb +22 -0
- data/app/models/integral/object.rb +30 -0
- data/app/models/integral/page.rb +153 -0
- data/app/models/integral/page_version.rb +8 -0
- data/app/models/integral/post.rb +149 -0
- data/app/models/integral/post_version.rb +8 -0
- data/app/models/integral/post_viewing.rb +19 -0
- data/app/models/integral/role.rb +14 -0
- data/app/models/integral/role_assignment.rb +7 -0
- data/app/models/integral/settings.rb +5 -0
- data/app/models/integral/user.rb +59 -0
- data/app/models/integral/user_version.rb +8 -0
- data/app/models/integral/version.rb +31 -0
- data/app/models/paper_trail/version.rb +9 -0
- data/app/policies/integral/base_policy.rb +50 -0
- data/app/policies/integral/image_policy.rb +14 -0
- data/app/policies/integral/list_policy.rb +9 -0
- data/app/policies/integral/page_policy.rb +45 -0
- data/app/policies/integral/post_policy.rb +9 -0
- data/app/policies/integral/settings_policy.rb +17 -0
- data/app/policies/integral/user_policy.rb +17 -0
- data/app/policies/integral/version_policy.rb +19 -0
- data/app/uploaders/ckeditor_attachment_file_uploader.rb +34 -0
- data/app/uploaders/ckeditor_picture_uploader.rb +55 -0
- data/app/uploaders/integral/avatar_uploader.rb +9 -0
- data/app/uploaders/integral/image_uploader.rb +114 -0
- data/app/views/devise/invitations/edit.haml +17 -0
- data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/devise/mailer/invitation_instructions.html.erb +13 -0
- data/app/views/devise/mailer/invitation_instructions.text.erb +12 -0
- data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/devise/passwords/edit.haml +17 -0
- data/app/views/devise/passwords/new.haml +12 -0
- data/app/views/devise/sessions/new.haml +18 -0
- data/app/views/devise/shared/_links.html.erb +25 -0
- data/app/views/integral/backend/activities/_grid.haml +23 -0
- data/app/views/integral/backend/activities/index.haml +15 -0
- data/app/views/integral/backend/activities/shared/_grid.haml +20 -0
- data/app/views/integral/backend/activities/shared/_listing.haml +14 -0
- data/app/views/integral/backend/activities/shared/_log.haml +56 -0
- data/app/views/integral/backend/activities/show.haml +18 -0
- data/app/views/integral/backend/images/_create_modal.haml +17 -0
- data/app/views/integral/backend/images/_form.haml +41 -0
- data/app/views/integral/backend/images/_grid.haml +16 -0
- data/app/views/integral/backend/images/edit.haml +3 -0
- data/app/views/integral/backend/images/index.haml +18 -0
- data/app/views/integral/backend/images/new.haml +1 -0
- data/app/views/integral/backend/lists/_child_fields.haml +26 -0
- data/app/views/integral/backend/lists/_form.haml +25 -0
- data/app/views/integral/backend/lists/_grid.haml +16 -0
- data/app/views/integral/backend/lists/_item_container.haml +26 -0
- data/app/views/integral/backend/lists/_item_modal.haml +46 -0
- data/app/views/integral/backend/lists/_list_item_fields.haml +26 -0
- data/app/views/integral/backend/lists/_manager.haml +14 -0
- data/app/views/integral/backend/lists/edit.haml +2 -0
- data/app/views/integral/backend/lists/index.haml +18 -0
- data/app/views/integral/backend/lists/new.haml +1 -0
- data/app/views/integral/backend/lists/show.haml +26 -0
- data/app/views/integral/backend/pages/_form.haml +52 -0
- data/app/views/integral/backend/pages/_grid.haml +21 -0
- data/app/views/integral/backend/pages/activities.haml +2 -0
- data/app/views/integral/backend/pages/activity.haml +1 -0
- data/app/views/integral/backend/pages/edit.html.haml +15 -0
- data/app/views/integral/backend/pages/index.haml +22 -0
- data/app/views/integral/backend/pages/new.haml +2 -0
- data/app/views/integral/backend/posts/_form.haml +57 -0
- data/app/views/integral/backend/posts/_grid.haml +25 -0
- data/app/views/integral/backend/posts/activities.haml +3 -0
- data/app/views/integral/backend/posts/activity.haml +1 -0
- data/app/views/integral/backend/posts/edit.haml +16 -0
- data/app/views/integral/backend/posts/index.haml +20 -0
- data/app/views/integral/backend/posts/new.haml +2 -0
- data/app/views/integral/backend/settings/_input.haml +4 -0
- data/app/views/integral/backend/settings/_section.haml +11 -0
- data/app/views/integral/backend/settings/index.haml +10 -0
- data/app/views/integral/backend/settings/sections/_general.haml +12 -0
- data/app/views/integral/backend/settings/sections/_lists.haml +4 -0
- data/app/views/integral/backend/settings/sections/_seo.haml +8 -0
- data/app/views/integral/backend/settings/sections/_social.haml +16 -0
- data/app/views/integral/backend/shared/_breadcrumbs.haml +9 -0
- data/app/views/integral/backend/shared/_empty_grid.haml +7 -0
- data/app/views/integral/backend/shared/_grid.haml +18 -0
- data/app/views/integral/backend/shared/_image_preview.haml +23 -0
- data/app/views/integral/backend/shared/_image_selector.haml +4 -0
- data/app/views/integral/backend/shared/_pagination.haml +1 -0
- data/app/views/integral/backend/shared/cards/_at_a_glance.haml +5 -0
- data/app/views/integral/backend/shared/cards/_welcome.haml +29 -0
- data/app/views/integral/backend/shared/graphs/_donut.haml +5 -0
- data/app/views/integral/backend/shared/graphs/_line.haml +5 -0
- data/app/views/integral/backend/shared/graphs/_no_data_available.haml +2 -0
- data/app/views/integral/backend/shared/record_selector/_collection.haml +13 -0
- data/app/views/integral/backend/shared/record_selector/_modal.haml +42 -0
- data/app/views/integral/backend/shared/record_selector/_record.haml +6 -0
- data/app/views/integral/backend/static_pages/_card.haml +24 -0
- data/app/views/integral/backend/static_pages/dashboard.haml +20 -0
- data/app/views/integral/backend/users/_form.haml +58 -0
- data/app/views/integral/backend/users/_grid.haml +19 -0
- data/app/views/integral/backend/users/edit.haml +3 -0
- data/app/views/integral/backend/users/index.haml +18 -0
- data/app/views/integral/backend/users/new.haml +2 -0
- data/app/views/integral/backend/users/show.haml +36 -0
- data/app/views/integral/contact_mailer/auto_reply.html.haml +16 -0
- data/app/views/integral/contact_mailer/auto_reply.text.erb +15 -0
- data/app/views/integral/contact_mailer/forward_enquiry.haml +12 -0
- data/app/views/integral/contact_mailer/forward_enquiry.text.erb +9 -0
- data/app/views/integral/pages/_demo.haml +188 -0
- data/app/views/integral/pages/templates/default.haml +6 -0
- data/app/views/integral/posts/_item.haml +16 -0
- data/app/views/integral/posts/index.haml +6 -0
- data/app/views/integral/posts/templates/default.haml +38 -0
- data/app/views/integral/shared/_blog_layout.haml +15 -0
- data/app/views/integral/shared/_blog_sidebar.haml +49 -0
- data/app/views/integral/shared/_breadcrumbs.haml +5 -0
- data/app/views/integral/shared/_media_query_indicator.haml +2 -0
- data/app/views/integral/shared/_scroll_to_top.haml +3 -0
- data/app/views/integral/shared/_share_modal.haml +20 -0
- data/app/views/integral/shared/_social_list_items.haml +41 -0
- data/app/views/integral/shared/_swiper_layout.haml +20 -0
- data/app/views/integral/shared/gallery/_placeholder.haml +7 -0
- data/app/views/integral/shared/gallery/_slide.haml +5 -0
- data/app/views/integral/shared/gallery/_thumb_slide.haml +2 -0
- data/app/views/integral/shared/gallery/gallery.haml +7 -0
- data/app/views/integral/tags/index.haml +6 -0
- data/app/views/integral/tags/show.haml +6 -0
- data/app/views/layouts/error.haml +12 -0
- data/app/views/layouts/integral/backend.html.haml +93 -0
- data/app/views/layouts/integral/backend/_create_dropdown.haml +30 -0
- data/app/views/layouts/integral/backend/_head.html.haml +17 -0
- data/app/views/layouts/integral/backend/_main_menu_items.haml +91 -0
- data/app/views/layouts/integral/frontend.html.haml +36 -0
- data/app/views/layouts/integral/frontend/_admin_bar.haml +25 -0
- data/app/views/layouts/integral/frontend/_footer.haml +23 -0
- data/app/views/layouts/integral/frontend/_header.haml +12 -0
- data/app/views/layouts/integral/login.haml +8 -0
- data/app/views/layouts/integral/mailer.html.inky-haml +17 -0
- data/app/views/layouts/integral/mailer/_footer.html.inky-haml +11 -0
- data/app/views/layouts/integral/mailer/_header.html.inky-haml +7 -0
- data/config/initializers/acts_as_taggable_on.rb +6 -0
- data/config/initializers/ckeditor.rb +51 -0
- data/config/initializers/client_side_validations.rb +20 -0
- data/config/initializers/compression.rb +46 -0
- data/config/initializers/devise.rb +308 -0
- data/config/initializers/extensions/ckeditor.rb +31 -0
- data/config/initializers/friendly_id.rb +88 -0
- data/config/initializers/gaffe.rb +3 -0
- data/config/initializers/simple_form.rb +169 -0
- data/config/initializers/simple_form/length_component.rb +36 -0
- data/config/locales/devise.en.yml +60 -0
- data/config/locales/devise_invitable.en.yml +31 -0
- data/config/locales/en.yml +477 -0
- data/config/locales/simple_form.en.yml +31 -0
- data/config/routes.rb +3 -0
- data/db/migrate/20160129021044_devise_create_integral_users.rb +42 -0
- data/db/migrate/20160130051535_add_name_and_avatar_to_users.rb +6 -0
- data/db/migrate/20160201003936_add_roles.rb +13 -0
- data/db/migrate/20160302071241_create_integral_images.rb +13 -0
- data/db/migrate/20160311092506_create_ckeditor_assets.rb +26 -0
- data/db/migrate/20160318004136_create_integral_pages.rb +12 -0
- data/db/migrate/20160513033619_create_integral_posts.rb +12 -0
- data/db/migrate/20160514063048_add_slug_column_to_post.rb +6 -0
- data/db/migrate/20160516084702_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb +31 -0
- data/db/migrate/20160516084703_add_missing_unique_indices.acts_as_taggable_on_engine.rb +20 -0
- data/db/migrate/20160516084704_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +15 -0
- data/db/migrate/20160516084705_add_missing_taggable_index.acts_as_taggable_on_engine.rb +10 -0
- data/db/migrate/20160516084706_change_collation_for_tag_names.acts_as_taggable_on_engine.rb +10 -0
- data/db/migrate/20160519005736_add_image_to_posts.rb +5 -0
- data/db/migrate/20160519053329_create_friendly_id_slugs.rb +15 -0
- data/db/migrate/20160610021858_add_view_count_to_posts.rb +5 -0
- data/db/migrate/20160613035508_add_drafting_to_posts.rb +6 -0
- data/db/migrate/20160628050006_create_integral_post_viewings.rb +10 -0
- data/db/migrate/20160718011218_add_locale_to_integral_users.rb +5 -0
- data/db/migrate/20160722100113_devise_invitable_add_to_integral_users.rb +23 -0
- data/db/migrate/20160809115906_add_drafting_to_pages.rb +5 -0
- data/db/migrate/20160909124940_add_deleted_at_to_objects.rb +15 -0
- data/db/migrate/20161014175823_create_lists.rb +31 -0
- data/db/migrate/20161102094859_create_settings.rb +18 -0
- data/db/migrate/20170215012231_add_templates_to_pages.rb +5 -0
- data/db/migrate/20170425091312_add_image_processing_fields.rb +7 -0
- data/db/migrate/20170516033523_add_timestamps_to_lists.rb +6 -0
- data/db/migrate/20170608131624_add_file_size_to_images.rb +5 -0
- data/db/migrate/20170801182434_add_parent_to_pages.rb +5 -0
- data/db/migrate/20170922201940_add_image_id_to_posts.rb +9 -0
- data/db/migrate/20171008193414_create_post_versions.rb +21 -0
- data/db/migrate/20171030215146_create_page_versions.rb +20 -0
- data/db/migrate/20171030215154_create_user_versions.rb +20 -0
- data/db/migrate/20171030215202_create_list_versions.rb +20 -0
- data/db/migrate/20171123155010_create_integral_enquiries.rb +13 -0
- data/db/migrate/20171127141132_add_deleted_at_to_lists.rb +6 -0
- data/db/migrate/20171230213848_add_image_to_pages.rb +6 -0
- data/db/migrate/20180202010010_add_lock_version_to_integral_objects.rb +9 -0
- data/db/migrate/20180202010020_create_image_versions.rb +20 -0
- data/db/migrate/20180207174914_add_fields_to_lists.rb +7 -0
- data/db/migrate/20180223232512_create_integral_newsletter_signups.rb +11 -0
- data/db/migrate/20180306204912_add_admin_to_integral_users.rb +5 -0
- data/db/migrate/20180326224500_add_processed_to_enquiries_and_newsletters.rb +6 -0
- data/db/migrate/20180509101917_add_context_to_enquiries.rb +6 -0
- data/db/migrate/20180920030236_update_posts_and_pages_null.rb +6 -0
- data/db/migrate/20181011234446_add_preview_image_to_posts.rb +6 -0
- data/db/seeds.rb +53 -0
- data/lib/generators/integral/install_generator.rb +19 -0
- data/lib/generators/templates/app.yml +24 -0
- data/lib/generators/templates/carrierwave.rb +35 -0
- data/lib/generators/templates/carrierwave_backgrounder.rb +11 -0
- data/lib/generators/templates/integral.rb +129 -0
- data/lib/generators/templates/sitemap.rb +41 -0
- data/lib/integral.rb +155 -0
- data/lib/integral/acts_as_listable.rb +45 -0
- data/lib/integral/button_link_renderer.rb +54 -0
- data/lib/integral/chart_renderer/base.rb +80 -0
- data/lib/integral/chart_renderer/donut.rb +21 -0
- data/lib/integral/chart_renderer/line.rb +24 -0
- data/lib/integral/content_renderer.rb +78 -0
- data/lib/integral/engine.rb +124 -0
- data/lib/integral/foundation_builder.rb +33 -0
- data/lib/integral/google_tag_manager.rb +33 -0
- data/lib/integral/grids/activities_grid.rb +37 -0
- data/lib/integral/grids/images_grid.rb +21 -0
- data/lib/integral/grids/lists_grid.rb +21 -0
- data/lib/integral/grids/pages_grid.rb +27 -0
- data/lib/integral/grids/posts_grid.rb +32 -0
- data/lib/integral/grids/users_grid.rb +22 -0
- data/lib/integral/list_item_renderer.rb +204 -0
- data/lib/integral/list_renderer.rb +91 -0
- data/lib/integral/middleware/page_router.rb +84 -0
- data/lib/integral/partial_list_item_renderer.rb +40 -0
- data/lib/integral/router.rb +106 -0
- data/lib/integral/slack_bot.rb +45 -0
- data/lib/integral/swiper_list_renderer.rb +30 -0
- data/lib/integral/version.rb +5 -0
- data/lib/integral/widgets/recent_posts.rb +41 -0
- data/lib/integral/widgets/swiper_list.rb +40 -0
- data/lib/tasks/integral_tasks.rake +57 -0
- data/lib/templates/erb/scaffold/_form.html.erb +13 -0
- data/spec/factories.rb +114 -0
- data/spec/support/image.jpg +0 -0
- metadata +1734 -0
@@ -0,0 +1,231 @@
|
|
1
|
+
/*!
|
2
|
+
*
|
3
|
+
* EDITED VERSION OF Are-You-Sure plugin.
|
4
|
+
* Addition now checks for dirty CKEditor instances
|
5
|
+
*
|
6
|
+
* jQuery Plugin: Are-You-Sure (Dirty Form Detection)
|
7
|
+
* https://github.com/codedance/jquery.AreYouSure/
|
8
|
+
*
|
9
|
+
* Copyright (c) 2012-2014, Chris Dance and PaperCut Software http://www.papercut.com/
|
10
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
11
|
+
* http://jquery.org/license
|
12
|
+
*
|
13
|
+
* Author: chris.dance@papercut.com
|
14
|
+
* Version: 1.9.0
|
15
|
+
* Date: 13th August 2014
|
16
|
+
*/
|
17
|
+
(function($) {
|
18
|
+
|
19
|
+
$.fn.areYouSure = function(options) {
|
20
|
+
|
21
|
+
var settings = $.extend(
|
22
|
+
{
|
23
|
+
'message' : I18n.t('integral.prompts.unsaved_changes'),
|
24
|
+
'dirtyClass' : 'dirty',
|
25
|
+
'change' : null,
|
26
|
+
'silent' : false,
|
27
|
+
'addRemoveFieldsMarksDirty' : false,
|
28
|
+
'fieldEvents' : 'change keyup propertychange input',
|
29
|
+
'fieldSelector': ":input:not(input[type=submit]):not(input[type=button])"
|
30
|
+
}, options);
|
31
|
+
|
32
|
+
var getValue = function($field) {
|
33
|
+
if ($field.hasClass('ays-ignore')
|
34
|
+
|| $field.hasClass('aysIgnore')
|
35
|
+
|| $field.attr('data-ays-ignore')
|
36
|
+
|| $field.attr('name') === undefined) {
|
37
|
+
return null;
|
38
|
+
}
|
39
|
+
|
40
|
+
if ($field.is(':disabled')) {
|
41
|
+
return 'ays-disabled';
|
42
|
+
}
|
43
|
+
|
44
|
+
var val;
|
45
|
+
var type = $field.attr('type');
|
46
|
+
if ($field.is('select')) {
|
47
|
+
type = 'select';
|
48
|
+
}
|
49
|
+
|
50
|
+
switch (type) {
|
51
|
+
case 'checkbox':
|
52
|
+
case 'radio':
|
53
|
+
val = $field.is(':checked');
|
54
|
+
break;
|
55
|
+
case 'select':
|
56
|
+
val = '';
|
57
|
+
$field.find('option').each(function(o) {
|
58
|
+
var $option = $(this);
|
59
|
+
if ($option.is(':selected')) {
|
60
|
+
val += $option.val();
|
61
|
+
}
|
62
|
+
});
|
63
|
+
break;
|
64
|
+
default:
|
65
|
+
val = $field.val();
|
66
|
+
}
|
67
|
+
|
68
|
+
return val;
|
69
|
+
};
|
70
|
+
|
71
|
+
var storeOrigValue = function($field) {
|
72
|
+
$field.data('ays-orig', getValue($field));
|
73
|
+
};
|
74
|
+
|
75
|
+
var checkForm = function(evt) {
|
76
|
+
|
77
|
+
var isFieldDirty = function($field) {
|
78
|
+
var origValue = $field.data('ays-orig');
|
79
|
+
if (undefined === origValue) {
|
80
|
+
return false;
|
81
|
+
}
|
82
|
+
return (getValue($field) != origValue);
|
83
|
+
};
|
84
|
+
|
85
|
+
var $form = ($(this).is('form'))
|
86
|
+
? $(this)
|
87
|
+
: $(this).parents('form');
|
88
|
+
|
89
|
+
// Test on the target first as it's the most likely to be dirty
|
90
|
+
if (isFieldDirty($(evt.target))) {
|
91
|
+
setDirtyStatus($form, true);
|
92
|
+
return;
|
93
|
+
}
|
94
|
+
|
95
|
+
$fields = $form.find(settings.fieldSelector);
|
96
|
+
|
97
|
+
if (settings.addRemoveFieldsMarksDirty) {
|
98
|
+
// Check if field count has changed
|
99
|
+
var origCount = $form.data("ays-orig-field-count");
|
100
|
+
if (origCount != $fields.length) {
|
101
|
+
setDirtyStatus($form, true);
|
102
|
+
return;
|
103
|
+
}
|
104
|
+
}
|
105
|
+
|
106
|
+
// Brute force - check each field
|
107
|
+
var isDirty = false;
|
108
|
+
$fields.each(function() {
|
109
|
+
$field = $(this);
|
110
|
+
if (isFieldDirty($field)) {
|
111
|
+
isDirty = true;
|
112
|
+
return false; // break
|
113
|
+
}
|
114
|
+
});
|
115
|
+
|
116
|
+
setDirtyStatus($form, isDirty);
|
117
|
+
};
|
118
|
+
|
119
|
+
var initForm = function($form) {
|
120
|
+
var fields = $form.find(settings.fieldSelector);
|
121
|
+
$(fields).each(function() { storeOrigValue($(this)); });
|
122
|
+
$(fields).unbind(settings.fieldEvents, checkForm);
|
123
|
+
$(fields).bind(settings.fieldEvents, checkForm);
|
124
|
+
$form.data("ays-orig-field-count", $(fields).length);
|
125
|
+
setDirtyStatus($form, false);
|
126
|
+
};
|
127
|
+
|
128
|
+
var setDirtyStatus = function($form, isDirty) {
|
129
|
+
var changed = isDirty != $form.hasClass(settings.dirtyClass);
|
130
|
+
$form.toggleClass(settings.dirtyClass, isDirty);
|
131
|
+
|
132
|
+
// Fire change event if required
|
133
|
+
if (changed) {
|
134
|
+
if (settings.change) settings.change.call($form, $form);
|
135
|
+
|
136
|
+
if (isDirty) $form.trigger('dirty.areYouSure', [$form]);
|
137
|
+
if (!isDirty) $form.trigger('clean.areYouSure', [$form]);
|
138
|
+
$form.trigger('change.areYouSure', [$form]);
|
139
|
+
}
|
140
|
+
};
|
141
|
+
|
142
|
+
var rescan = function() {
|
143
|
+
var $form = $(this);
|
144
|
+
var fields = $form.find(settings.fieldSelector);
|
145
|
+
$(fields).each(function() {
|
146
|
+
var $field = $(this);
|
147
|
+
if (!$field.data('ays-orig')) {
|
148
|
+
storeOrigValue($field);
|
149
|
+
$field.bind(settings.fieldEvents, checkForm);
|
150
|
+
}
|
151
|
+
});
|
152
|
+
// Check for changes while we're here
|
153
|
+
$form.trigger('checkform.areYouSure');
|
154
|
+
};
|
155
|
+
|
156
|
+
var reinitialize = function() {
|
157
|
+
initForm($(this));
|
158
|
+
}
|
159
|
+
|
160
|
+
var checkIsDirty = function() {
|
161
|
+
$dirtyForms = $("form").filter('.' + settings.dirtyClass);
|
162
|
+
|
163
|
+
/** CKEDITOR DIRTY CHECKER START **/
|
164
|
+
editors = $('form:not(.submitting) textarea.ckeditor')
|
165
|
+
cleanEditors = 0;
|
166
|
+
editors.each(function() {
|
167
|
+
isDirty = CKEDITOR.instances[this.id].checkDirty();
|
168
|
+
|
169
|
+
if (!isDirty) {
|
170
|
+
cleanEditors++;
|
171
|
+
}
|
172
|
+
});
|
173
|
+
|
174
|
+
/** CKEDITOR DIRTY CHECKER END **/
|
175
|
+
|
176
|
+
// Checks no dirty forms + no dirty editors
|
177
|
+
if (($dirtyForms.length == 0) && cleanEditors == editors.length) {
|
178
|
+
return false;
|
179
|
+
}
|
180
|
+
return true;
|
181
|
+
}
|
182
|
+
|
183
|
+
if (!settings.silent && !window.aysUnloadSet) {
|
184
|
+
window.aysUnloadSet = true;
|
185
|
+
|
186
|
+
$(window).bind('turbolinks:before-visit', function(ev) {
|
187
|
+
if (!checkIsDirty()) {
|
188
|
+
return;
|
189
|
+
}
|
190
|
+
|
191
|
+
if (!confirm(settings.message)) {
|
192
|
+
ev.preventDefault();
|
193
|
+
}
|
194
|
+
});
|
195
|
+
|
196
|
+
$(window).bind('beforeunload', function() {
|
197
|
+
if (!checkIsDirty()) {
|
198
|
+
return;
|
199
|
+
}
|
200
|
+
|
201
|
+
// Prevent multiple prompts - seen on Chrome and IE
|
202
|
+
if (navigator.userAgent.toLowerCase().match(/msie|chrome/)) {
|
203
|
+
if (window.aysHasPrompted) {
|
204
|
+
return;
|
205
|
+
}
|
206
|
+
window.aysHasPrompted = true;
|
207
|
+
window.setTimeout(function() {window.aysHasPrompted = false;}, 900);
|
208
|
+
}
|
209
|
+
return settings.message;
|
210
|
+
});
|
211
|
+
}
|
212
|
+
|
213
|
+
return this.each(function(elem) {
|
214
|
+
if (!$(this).is('form')) {
|
215
|
+
return;
|
216
|
+
}
|
217
|
+
var $form = $(this);
|
218
|
+
|
219
|
+
$form.submit(function() {
|
220
|
+
$form.removeClass(settings.dirtyClass);
|
221
|
+
$form.addClass('submitting')
|
222
|
+
});
|
223
|
+
$form.bind('reset', function() { setDirtyStatus($form, false); });
|
224
|
+
// Add a custom events
|
225
|
+
$form.bind('rescan.areYouSure', rescan);
|
226
|
+
$form.bind('reinitialize.areYouSure', reinitialize);
|
227
|
+
$form.bind('checkform.areYouSure', checkForm);
|
228
|
+
initForm($form);
|
229
|
+
});
|
230
|
+
};
|
231
|
+
})(jQuery);
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/*!
|
2
|
+
* jQuery Form Plugin
|
3
|
+
* version: 3.51.0-2014.06.20
|
4
|
+
* Requires jQuery v1.5 or later
|
5
|
+
* Copyright (c) 2014 M. Alsup
|
6
|
+
* Examples and documentation at: http://malsup.com/jquery/form/
|
7
|
+
* Project repository: https://github.com/malsup/form
|
8
|
+
* Dual licensed under the MIT and GPL licenses.
|
9
|
+
* https://github.com/malsup/form#copyright-and-license
|
10
|
+
*/
|
11
|
+
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):e("undefined"!=typeof jQuery?jQuery:window.Zepto)}(function(e){"use strict";function t(t){var r=t.data;t.isDefaultPrevented()||(t.preventDefault(),e(t.target).ajaxSubmit(r))}function r(t){var r=t.target,a=e(r);if(!a.is("[type=submit],[type=image]")){var n=a.closest("[type=submit]");if(0===n.length)return;r=n[0]}var i=this;if(i.clk=r,"image"==r.type)if(void 0!==t.offsetX)i.clk_x=t.offsetX,i.clk_y=t.offsetY;else if("function"==typeof e.fn.offset){var o=a.offset();i.clk_x=t.pageX-o.left,i.clk_y=t.pageY-o.top}else i.clk_x=t.pageX-r.offsetLeft,i.clk_y=t.pageY-r.offsetTop;setTimeout(function(){i.clk=i.clk_x=i.clk_y=null},100)}function a(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(t):window.opera&&window.opera.postError&&window.opera.postError(t)}}var n={};n.fileapi=void 0!==e("<input type='file'/>").get(0).files,n.formdata=void 0!==window.FormData;var i=!!e.fn.prop;e.fn.attr2=function(){if(!i)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t){function r(r){var a,n,i=e.param(r,t.traditional).split("&"),o=i.length,s=[];for(a=0;o>a;a++)i[a]=i[a].replace(/\+/g," "),n=i[a].split("="),s.push([decodeURIComponent(n[0]),decodeURIComponent(n[1])]);return s}function o(a){for(var n=new FormData,i=0;i<a.length;i++)n.append(a[i].name,a[i].value);if(t.extraData){var o=r(t.extraData);for(i=0;i<o.length;i++)o[i]&&n.append(o[i][0],o[i][1])}t.data=null;var s=e.extend(!0,{},e.ajaxSettings,t,{contentType:!1,processData:!1,cache:!1,type:u||"POST"});t.uploadProgress&&(s.xhr=function(){var r=e.ajaxSettings.xhr();return r.upload&&r.upload.addEventListener("progress",function(e){var r=0,a=e.loaded||e.position,n=e.total;e.lengthComputable&&(r=Math.ceil(a/n*100)),t.uploadProgress(e,a,n,r)},!1),r}),s.data=null;var c=s.beforeSend;return s.beforeSend=function(e,r){r.data=t.formData?t.formData:n,c&&c.call(this,e,r)},e.ajax(s)}function s(r){function n(e){var t=null;try{e.contentWindow&&(t=e.contentWindow.document)}catch(r){a("cannot get iframe.contentWindow document: "+r)}if(t)return t;try{t=e.contentDocument?e.contentDocument:e.document}catch(r){a("cannot get iframe.contentDocument: "+r),t=e.document}return t}function o(){function t(){try{var e=n(g).readyState;a("state = "+e),e&&"uninitialized"==e.toLowerCase()&&setTimeout(t,50)}catch(r){a("Server abort: ",r," (",r.name,")"),s(k),j&&clearTimeout(j),j=void 0}}var r=f.attr2("target"),i=f.attr2("action"),o="multipart/form-data",c=f.attr("enctype")||f.attr("encoding")||o;w.setAttribute("target",p),(!u||/post/i.test(u))&&w.setAttribute("method","POST"),i!=m.url&&w.setAttribute("action",m.url),m.skipEncodingOverride||u&&!/post/i.test(u)||f.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"}),m.timeout&&(j=setTimeout(function(){T=!0,s(D)},m.timeout));var l=[];try{if(m.extraData)for(var d in m.extraData)m.extraData.hasOwnProperty(d)&&l.push(e.isPlainObject(m.extraData[d])&&m.extraData[d].hasOwnProperty("name")&&m.extraData[d].hasOwnProperty("value")?e('<input type="hidden" name="'+m.extraData[d].name+'">').val(m.extraData[d].value).appendTo(w)[0]:e('<input type="hidden" name="'+d+'">').val(m.extraData[d]).appendTo(w)[0]);m.iframeTarget||v.appendTo("body"),g.attachEvent?g.attachEvent("onload",s):g.addEventListener("load",s,!1),setTimeout(t,15);try{w.submit()}catch(h){var x=document.createElement("form").submit;x.apply(w)}}finally{w.setAttribute("action",i),w.setAttribute("enctype",c),r?w.setAttribute("target",r):f.removeAttr("target"),e(l).remove()}}function s(t){if(!x.aborted&&!F){if(M=n(g),M||(a("cannot access response document"),t=k),t===D&&x)return x.abort("timeout"),void S.reject(x,"timeout");if(t==k&&x)return x.abort("server abort"),void S.reject(x,"error","server abort");if(M&&M.location.href!=m.iframeSrc||T){g.detachEvent?g.detachEvent("onload",s):g.removeEventListener("load",s,!1);var r,i="success";try{if(T)throw"timeout";var o="xml"==m.dataType||M.XMLDocument||e.isXMLDoc(M);if(a("isXml="+o),!o&&window.opera&&(null===M.body||!M.body.innerHTML)&&--O)return a("requeing onLoad callback, DOM not available"),void setTimeout(s,250);var u=M.body?M.body:M.documentElement;x.responseText=u?u.innerHTML:null,x.responseXML=M.XMLDocument?M.XMLDocument:M,o&&(m.dataType="xml"),x.getResponseHeader=function(e){var t={"content-type":m.dataType};return t[e.toLowerCase()]},u&&(x.status=Number(u.getAttribute("status"))||x.status,x.statusText=u.getAttribute("statusText")||x.statusText);var c=(m.dataType||"").toLowerCase(),l=/(json|script|text)/.test(c);if(l||m.textarea){var f=M.getElementsByTagName("textarea")[0];if(f)x.responseText=f.value,x.status=Number(f.getAttribute("status"))||x.status,x.statusText=f.getAttribute("statusText")||x.statusText;else if(l){var p=M.getElementsByTagName("pre")[0],h=M.getElementsByTagName("body")[0];p?x.responseText=p.textContent?p.textContent:p.innerText:h&&(x.responseText=h.textContent?h.textContent:h.innerText)}}else"xml"==c&&!x.responseXML&&x.responseText&&(x.responseXML=X(x.responseText));try{E=_(x,c,m)}catch(y){i="parsererror",x.error=r=y||i}}catch(y){a("error caught: ",y),i="error",x.error=r=y||i}x.aborted&&(a("upload aborted"),i=null),x.status&&(i=x.status>=200&&x.status<300||304===x.status?"success":"error"),"success"===i?(m.success&&m.success.call(m.context,E,"success",x),S.resolve(x.responseText,"success",x),d&&e.event.trigger("ajaxSuccess",[x,m])):i&&(void 0===r&&(r=x.statusText),m.error&&m.error.call(m.context,x,i,r),S.reject(x,"error",r),d&&e.event.trigger("ajaxError",[x,m,r])),d&&e.event.trigger("ajaxComplete",[x,m]),d&&!--e.active&&e.event.trigger("ajaxStop"),m.complete&&m.complete.call(m.context,x,i),F=!0,m.timeout&&clearTimeout(j),setTimeout(function(){m.iframeTarget?v.attr("src",m.iframeSrc):v.remove(),x.responseXML=null},100)}}}var c,l,m,d,p,v,g,x,y,b,T,j,w=f[0],S=e.Deferred();if(S.abort=function(e){x.abort(e)},r)for(l=0;l<h.length;l++)c=e(h[l]),i?c.prop("disabled",!1):c.removeAttr("disabled");if(m=e.extend(!0,{},e.ajaxSettings,t),m.context=m.context||m,p="jqFormIO"+(new Date).getTime(),m.iframeTarget?(v=e(m.iframeTarget),b=v.attr2("name"),b?p=b:v.attr2("name",p)):(v=e('<iframe name="'+p+'" src="'+m.iframeSrc+'" />'),v.css({position:"absolute",top:"-1000px",left:"-1000px"})),g=v[0],x={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(t){var r="timeout"===t?"timeout":"aborted";a("aborting upload... "+r),this.aborted=1;try{g.contentWindow.document.execCommand&&g.contentWindow.document.execCommand("Stop")}catch(n){}v.attr("src",m.iframeSrc),x.error=r,m.error&&m.error.call(m.context,x,r,t),d&&e.event.trigger("ajaxError",[x,m,r]),m.complete&&m.complete.call(m.context,x,r)}},d=m.global,d&&0===e.active++&&e.event.trigger("ajaxStart"),d&&e.event.trigger("ajaxSend",[x,m]),m.beforeSend&&m.beforeSend.call(m.context,x,m)===!1)return m.global&&e.active--,S.reject(),S;if(x.aborted)return S.reject(),S;y=w.clk,y&&(b=y.name,b&&!y.disabled&&(m.extraData=m.extraData||{},m.extraData[b]=y.value,"image"==y.type&&(m.extraData[b+".x"]=w.clk_x,m.extraData[b+".y"]=w.clk_y)));var D=1,k=2,A=e("meta[name=csrf-token]").attr("content"),L=e("meta[name=csrf-param]").attr("content");L&&A&&(m.extraData=m.extraData||{},m.extraData[L]=A),m.forceSync?o():setTimeout(o,10);var E,M,F,O=50,X=e.parseXML||function(e,t){return window.ActiveXObject?(t=new ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e)):t=(new DOMParser).parseFromString(e,"text/xml"),t&&t.documentElement&&"parsererror"!=t.documentElement.nodeName?t:null},C=e.parseJSON||function(e){return window.eval("("+e+")")},_=function(t,r,a){var n=t.getResponseHeader("content-type")||"",i="xml"===r||!r&&n.indexOf("xml")>=0,o=i?t.responseXML:t.responseText;return i&&"parsererror"===o.documentElement.nodeName&&e.error&&e.error("parsererror"),a&&a.dataFilter&&(o=a.dataFilter(o,r)),"string"==typeof o&&("json"===r||!r&&n.indexOf("json")>=0?o=C(o):("script"===r||!r&&n.indexOf("javascript")>=0)&&e.globalEval(o)),o};return S}if(!this.length)return a("ajaxSubmit: skipping submit process - no element selected"),this;var u,c,l,f=this;"function"==typeof t?t={success:t}:void 0===t&&(t={}),u=t.type||this.attr2("method"),c=t.url||this.attr2("action"),l="string"==typeof c?e.trim(c):"",l=l||window.location.href||"",l&&(l=(l.match(/^([^#]+)/)||[])[1]),t=e.extend(!0,{url:l,success:e.ajaxSettings.success,type:u||e.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},t);var m={};if(this.trigger("form-pre-serialize",[this,t,m]),m.veto)return a("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(t.beforeSerialize&&t.beforeSerialize(this,t)===!1)return a("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var d=t.traditional;void 0===d&&(d=e.ajaxSettings.traditional);var p,h=[],v=this.formToArray(t.semantic,h);if(t.data&&(t.extraData=t.data,p=e.param(t.data,d)),t.beforeSubmit&&t.beforeSubmit(v,this,t)===!1)return a("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[v,this,t,m]),m.veto)return a("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var g=e.param(v,d);p&&(g=g?g+"&"+p:p),"GET"==t.type.toUpperCase()?(t.url+=(t.url.indexOf("?")>=0?"&":"?")+g,t.data=null):t.data=g;var x=[];if(t.resetForm&&x.push(function(){f.resetForm()}),t.clearForm&&x.push(function(){f.clearForm(t.includeHidden)}),!t.dataType&&t.target){var y=t.success||function(){};x.push(function(r){var a=t.replaceTarget?"replaceWith":"html";e(t.target)[a](r).each(y,arguments)})}else t.success&&x.push(t.success);if(t.success=function(e,r,a){for(var n=t.context||this,i=0,o=x.length;o>i;i++)x[i].apply(n,[e,r,a||f,f])},t.error){var b=t.error;t.error=function(e,r,a){var n=t.context||this;b.apply(n,[e,r,a,f])}}if(t.complete){var T=t.complete;t.complete=function(e,r){var a=t.context||this;T.apply(a,[e,r,f])}}var j=e("input[type=file]:enabled",this).filter(function(){return""!==e(this).val()}),w=j.length>0,S="multipart/form-data",D=f.attr("enctype")==S||f.attr("encoding")==S,k=n.fileapi&&n.formdata;a("fileAPI :"+k);var A,L=(w||D)&&!k;t.iframe!==!1&&(t.iframe||L)?t.closeKeepAlive?e.get(t.closeKeepAlive,function(){A=s(v)}):A=s(v):A=(w||D)&&k?o(v):e.ajax(t),f.removeData("jqxhr").data("jqxhr",A);for(var E=0;E<h.length;E++)h[E]=null;return this.trigger("form-submit-notify",[this,t]),this},e.fn.ajaxForm=function(n){if(n=n||{},n.delegation=n.delegation&&e.isFunction(e.fn.on),!n.delegation&&0===this.length){var i={s:this.selector,c:this.context};return!e.isReady&&i.s?(a("DOM not ready, queuing ajaxForm"),e(function(){e(i.s,i.c).ajaxForm(n)}),this):(a("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)")),this)}return n.delegation?(e(document).off("submit.form-plugin",this.selector,t).off("click.form-plugin",this.selector,r).on("submit.form-plugin",this.selector,n,t).on("click.form-plugin",this.selector,n,r),this):this.ajaxFormUnbind().bind("submit.form-plugin",n,t).bind("click.form-plugin",n,r)},e.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")},e.fn.formToArray=function(t,r){var a=[];if(0===this.length)return a;var i,o=this[0],s=this.attr("id"),u=t?o.getElementsByTagName("*"):o.elements;if(u&&!/MSIE [678]/.test(navigator.userAgent)&&(u=e(u).get()),s&&(i=e(':input[form="'+s+'"]').get(),i.length&&(u=(u||[]).concat(i))),!u||!u.length)return a;var c,l,f,m,d,p,h;for(c=0,p=u.length;p>c;c++)if(d=u[c],f=d.name,f&&!d.disabled)if(t&&o.clk&&"image"==d.type)o.clk==d&&(a.push({name:f,value:e(d).val(),type:d.type}),a.push({name:f+".x",value:o.clk_x},{name:f+".y",value:o.clk_y}));else if(m=e.fieldValue(d,!0),m&&m.constructor==Array)for(r&&r.push(d),l=0,h=m.length;h>l;l++)a.push({name:f,value:m[l]});else if(n.fileapi&&"file"==d.type){r&&r.push(d);var v=d.files;if(v.length)for(l=0;l<v.length;l++)a.push({name:f,value:v[l],type:d.type});else a.push({name:f,value:"",type:d.type})}else null!==m&&"undefined"!=typeof m&&(r&&r.push(d),a.push({name:f,value:m,type:d.type,required:d.required}));if(!t&&o.clk){var g=e(o.clk),x=g[0];f=x.name,f&&!x.disabled&&"image"==x.type&&(a.push({name:f,value:g.val()}),a.push({name:f+".x",value:o.clk_x},{name:f+".y",value:o.clk_y}))}return a},e.fn.formSerialize=function(t){return e.param(this.formToArray(t))},e.fn.fieldSerialize=function(t){var r=[];return this.each(function(){var a=this.name;if(a){var n=e.fieldValue(this,t);if(n&&n.constructor==Array)for(var i=0,o=n.length;o>i;i++)r.push({name:a,value:n[i]});else null!==n&&"undefined"!=typeof n&&r.push({name:this.name,value:n})}}),e.param(r)},e.fn.fieldValue=function(t){for(var r=[],a=0,n=this.length;n>a;a++){var i=this[a],o=e.fieldValue(i,t);null===o||"undefined"==typeof o||o.constructor==Array&&!o.length||(o.constructor==Array?e.merge(r,o):r.push(o))}return r},e.fieldValue=function(t,r){var a=t.name,n=t.type,i=t.tagName.toLowerCase();if(void 0===r&&(r=!0),r&&(!a||t.disabled||"reset"==n||"button"==n||("checkbox"==n||"radio"==n)&&!t.checked||("submit"==n||"image"==n)&&t.form&&t.form.clk!=t||"select"==i&&-1==t.selectedIndex))return null;if("select"==i){var o=t.selectedIndex;if(0>o)return null;for(var s=[],u=t.options,c="select-one"==n,l=c?o+1:u.length,f=c?o:0;l>f;f++){var m=u[f];if(m.selected){var d=m.value;if(d||(d=m.attributes&&m.attributes.value&&!m.attributes.value.specified?m.text:m.value),c)return d;s.push(d)}}return s}return e(t).val()},e.fn.clearForm=function(t){return this.each(function(){e("input,select,textarea",this).clearFields(t)})},e.fn.clearFields=e.fn.clearInputs=function(t){var r=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var a=this.type,n=this.tagName.toLowerCase();r.test(a)||"textarea"==n?this.value="":"checkbox"==a||"radio"==a?this.checked=!1:"select"==n?this.selectedIndex=-1:"file"==a?/MSIE/.test(navigator.userAgent)?e(this).replaceWith(e(this).clone(!0)):e(this).val(""):t&&(t===!0&&/hidden/.test(a)||"string"==typeof t&&e(this).is(t))&&(this.value="")})},e.fn.resetForm=function(){return this.each(function(){("function"==typeof this.reset||"object"==typeof this.reset&&!this.reset.nodeType)&&this.reset()})},e.fn.enable=function(e){return void 0===e&&(e=!0),this.each(function(){this.disabled=!e})},e.fn.selected=function(t){return void 0===t&&(t=!0),this.each(function(){var r=this.type;if("checkbox"==r||"radio"==r)this.checked=t;else if("option"==this.tagName.toLowerCase()){var a=e(this).parent("select");t&&a[0]&&"select-one"==a[0].type&&a.find("option").selected(!1),this.selected=t}})},e.fn.ajaxSubmit.debug=!1});
|
@@ -0,0 +1,165 @@
|
|
1
|
+
/*!
|
2
|
+
* JavaScript Cookie v2.1.4
|
3
|
+
* https://github.com/js-cookie/js-cookie
|
4
|
+
*
|
5
|
+
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
|
6
|
+
* Released under the MIT license
|
7
|
+
*/
|
8
|
+
;(function (factory) {
|
9
|
+
var registeredInModuleLoader = false;
|
10
|
+
if (typeof define === 'function' && define.amd) {
|
11
|
+
define(factory);
|
12
|
+
registeredInModuleLoader = true;
|
13
|
+
}
|
14
|
+
if (typeof exports === 'object') {
|
15
|
+
module.exports = factory();
|
16
|
+
registeredInModuleLoader = true;
|
17
|
+
}
|
18
|
+
if (!registeredInModuleLoader) {
|
19
|
+
var OldCookies = window.Cookies;
|
20
|
+
var api = window.Cookies = factory();
|
21
|
+
api.noConflict = function () {
|
22
|
+
window.Cookies = OldCookies;
|
23
|
+
return api;
|
24
|
+
};
|
25
|
+
}
|
26
|
+
}(function () {
|
27
|
+
function extend () {
|
28
|
+
var i = 0;
|
29
|
+
var result = {};
|
30
|
+
for (; i < arguments.length; i++) {
|
31
|
+
var attributes = arguments[ i ];
|
32
|
+
for (var key in attributes) {
|
33
|
+
result[key] = attributes[key];
|
34
|
+
}
|
35
|
+
}
|
36
|
+
return result;
|
37
|
+
}
|
38
|
+
|
39
|
+
function init (converter) {
|
40
|
+
function api (key, value, attributes) {
|
41
|
+
var result;
|
42
|
+
if (typeof document === 'undefined') {
|
43
|
+
return;
|
44
|
+
}
|
45
|
+
|
46
|
+
// Write
|
47
|
+
|
48
|
+
if (arguments.length > 1) {
|
49
|
+
attributes = extend({
|
50
|
+
path: '/'
|
51
|
+
}, api.defaults, attributes);
|
52
|
+
|
53
|
+
if (typeof attributes.expires === 'number') {
|
54
|
+
var expires = new Date();
|
55
|
+
expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
|
56
|
+
attributes.expires = expires;
|
57
|
+
}
|
58
|
+
|
59
|
+
// We're using "expires" because "max-age" is not supported by IE
|
60
|
+
attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
|
61
|
+
|
62
|
+
try {
|
63
|
+
result = JSON.stringify(value);
|
64
|
+
if (/^[\{\[]/.test(result)) {
|
65
|
+
value = result;
|
66
|
+
}
|
67
|
+
} catch (e) {}
|
68
|
+
|
69
|
+
if (!converter.write) {
|
70
|
+
value = encodeURIComponent(String(value))
|
71
|
+
.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
|
72
|
+
} else {
|
73
|
+
value = converter.write(value, key);
|
74
|
+
}
|
75
|
+
|
76
|
+
key = encodeURIComponent(String(key));
|
77
|
+
key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
|
78
|
+
key = key.replace(/[\(\)]/g, escape);
|
79
|
+
|
80
|
+
var stringifiedAttributes = '';
|
81
|
+
|
82
|
+
for (var attributeName in attributes) {
|
83
|
+
if (!attributes[attributeName]) {
|
84
|
+
continue;
|
85
|
+
}
|
86
|
+
stringifiedAttributes += '; ' + attributeName;
|
87
|
+
if (attributes[attributeName] === true) {
|
88
|
+
continue;
|
89
|
+
}
|
90
|
+
stringifiedAttributes += '=' + attributes[attributeName];
|
91
|
+
}
|
92
|
+
return (document.cookie = key + '=' + value + stringifiedAttributes);
|
93
|
+
}
|
94
|
+
|
95
|
+
// Read
|
96
|
+
|
97
|
+
if (!key) {
|
98
|
+
result = {};
|
99
|
+
}
|
100
|
+
|
101
|
+
// To prevent the for loop in the first place assign an empty array
|
102
|
+
// in case there are no cookies at all. Also prevents odd result when
|
103
|
+
// calling "get()"
|
104
|
+
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
105
|
+
var rdecode = /(%[0-9A-Z]{2})+/g;
|
106
|
+
var i = 0;
|
107
|
+
|
108
|
+
for (; i < cookies.length; i++) {
|
109
|
+
var parts = cookies[i].split('=');
|
110
|
+
var cookie = parts.slice(1).join('=');
|
111
|
+
|
112
|
+
if (cookie.charAt(0) === '"') {
|
113
|
+
cookie = cookie.slice(1, -1);
|
114
|
+
}
|
115
|
+
|
116
|
+
try {
|
117
|
+
var name = parts[0].replace(rdecode, decodeURIComponent);
|
118
|
+
cookie = converter.read ?
|
119
|
+
converter.read(cookie, name) : converter(cookie, name) ||
|
120
|
+
cookie.replace(rdecode, decodeURIComponent);
|
121
|
+
|
122
|
+
if (this.json) {
|
123
|
+
try {
|
124
|
+
cookie = JSON.parse(cookie);
|
125
|
+
} catch (e) {}
|
126
|
+
}
|
127
|
+
|
128
|
+
if (key === name) {
|
129
|
+
result = cookie;
|
130
|
+
break;
|
131
|
+
}
|
132
|
+
|
133
|
+
if (!key) {
|
134
|
+
result[name] = cookie;
|
135
|
+
}
|
136
|
+
} catch (e) {}
|
137
|
+
}
|
138
|
+
|
139
|
+
return result;
|
140
|
+
}
|
141
|
+
|
142
|
+
api.set = api;
|
143
|
+
api.get = function (key) {
|
144
|
+
return api.call(api, key);
|
145
|
+
};
|
146
|
+
api.getJSON = function () {
|
147
|
+
return api.apply({
|
148
|
+
json: true
|
149
|
+
}, [].slice.call(arguments));
|
150
|
+
};
|
151
|
+
api.defaults = {};
|
152
|
+
|
153
|
+
api.remove = function (key, attributes) {
|
154
|
+
api(key, '', extend(attributes, {
|
155
|
+
expires: -1
|
156
|
+
}));
|
157
|
+
};
|
158
|
+
|
159
|
+
api.withConverter = init;
|
160
|
+
|
161
|
+
return api;
|
162
|
+
}
|
163
|
+
|
164
|
+
return init(function () {});
|
165
|
+
}));
|
@@ -0,0 +1,758 @@
|
|
1
|
+
(function ($)
|
2
|
+
{
|
3
|
+
"use strict";
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Default Configuration
|
7
|
+
*
|
8
|
+
* @type {{tagClass: tagClass, itemValue: itemValue, itemText: itemText, itemTitle: itemTitle, freeInput: boolean, addOnBlur: boolean, maxTags: undefined, maxChars: undefined, confirmKeys: number[], onTagExists: onTagExists, trimValue: boolean, allowDuplicates: boolean}}
|
9
|
+
*/
|
10
|
+
var defaultOptions = {
|
11
|
+
tagClass : tagClass,
|
12
|
+
itemValue : itemValue,
|
13
|
+
itemText : itemText,
|
14
|
+
itemTitle : itemTitle,
|
15
|
+
freeInput : true,
|
16
|
+
addOnBlur : true,
|
17
|
+
maxTags : undefined,
|
18
|
+
maxChars : undefined,
|
19
|
+
confirmKeys : [9,13, 44, 32],
|
20
|
+
onTagExists : onTagExists,
|
21
|
+
trimValue : true,
|
22
|
+
allowDuplicates : false
|
23
|
+
};
|
24
|
+
|
25
|
+
function tagClass(item)
|
26
|
+
{
|
27
|
+
return 'label';
|
28
|
+
}
|
29
|
+
|
30
|
+
function itemValue(item)
|
31
|
+
{
|
32
|
+
return item ? item.toString() : item;
|
33
|
+
}
|
34
|
+
|
35
|
+
function itemText(item)
|
36
|
+
{
|
37
|
+
return this.itemValue(item);
|
38
|
+
}
|
39
|
+
|
40
|
+
function itemTitle(item)
|
41
|
+
{
|
42
|
+
return null;
|
43
|
+
}
|
44
|
+
|
45
|
+
function onTagExists(item, $tag)
|
46
|
+
{
|
47
|
+
$tag.hide().fadeIn();
|
48
|
+
}
|
49
|
+
|
50
|
+
/**
|
51
|
+
* Constructor function
|
52
|
+
*
|
53
|
+
* @param element
|
54
|
+
* @param options
|
55
|
+
* @constructor
|
56
|
+
*/
|
57
|
+
function TagsMaterialize(element, options)
|
58
|
+
{
|
59
|
+
this.itemsArray = [];
|
60
|
+
|
61
|
+
this.$element = $(element);
|
62
|
+
this.$element.hide();
|
63
|
+
|
64
|
+
this.objectItems = options && options.itemValue;
|
65
|
+
this.placeholderText = element.hasAttribute('placeholder') ? this.$element.attr('placeholder') : '';
|
66
|
+
this.inputSize = Math.max(1, this.placeholderText.length);
|
67
|
+
|
68
|
+
this.$container = $('<div class="materialize-tags"></div>');
|
69
|
+
this.$input = $('<input type="text" class="n-tag" placeholder="' + this.placeholderText + '"/>').appendTo(this.$container);
|
70
|
+
this.$label = this.$element.parent().find('label');
|
71
|
+
|
72
|
+
this.$element.before(this.$container);
|
73
|
+
this.build(options);
|
74
|
+
|
75
|
+
this.$label.on('click', function ()
|
76
|
+
{
|
77
|
+
$(this).addClass('active');
|
78
|
+
$(this).next('.materialize-tags').find('input.n-tag').focus();
|
79
|
+
});
|
80
|
+
|
81
|
+
this.$input.on('focus', function ()
|
82
|
+
{
|
83
|
+
var label = $(this).parents('.materialize-tags').parent().find('label');
|
84
|
+
$(this).parents('.materialize-tags').addClass('active');
|
85
|
+
|
86
|
+
if (!label.hasClass('active'))
|
87
|
+
{
|
88
|
+
label.addClass('active');
|
89
|
+
}
|
90
|
+
}).on('focusout', function ()
|
91
|
+
{
|
92
|
+
var parentContainer = $(this).parents('.materialize-tags'),
|
93
|
+
tags = parentContainer.find('span.chip');
|
94
|
+
parentContainer.removeClass('active');
|
95
|
+
// Verify if is empty and remove "active" class from label
|
96
|
+
if (tags.length == 0)
|
97
|
+
{
|
98
|
+
parentContainer.parent().find('label').removeClass('active');
|
99
|
+
}
|
100
|
+
});
|
101
|
+
}
|
102
|
+
|
103
|
+
TagsMaterialize.prototype = {
|
104
|
+
constructor : TagsMaterialize,
|
105
|
+
|
106
|
+
/**
|
107
|
+
* Adds the given item as a new tag. Pass true to dontPushVal to prevent
|
108
|
+
* updating the elements val()
|
109
|
+
*
|
110
|
+
* @param item
|
111
|
+
* @param dontPushVal
|
112
|
+
* @param options
|
113
|
+
*/
|
114
|
+
add : function (item, dontPushVal, options)
|
115
|
+
{
|
116
|
+
var self = this;
|
117
|
+
|
118
|
+
if (self.options.maxTags && self.itemsArray.length >= self.options.maxTags)
|
119
|
+
{
|
120
|
+
return;
|
121
|
+
}
|
122
|
+
|
123
|
+
// Ignore false values, except false
|
124
|
+
if (item !== false && !item)
|
125
|
+
{
|
126
|
+
return;
|
127
|
+
}
|
128
|
+
|
129
|
+
// Trim value
|
130
|
+
if (typeof item === "string" && self.options.trimValue)
|
131
|
+
{
|
132
|
+
item = $.trim(item);
|
133
|
+
}
|
134
|
+
|
135
|
+
// Throw an error when trying to add an object while the itemValue option was not set
|
136
|
+
if (typeof item === "object" && !self.objectItems)
|
137
|
+
{
|
138
|
+
throw("Can't add objects when itemValue option is not set");
|
139
|
+
}
|
140
|
+
|
141
|
+
// Ignore strings only contain whitespace
|
142
|
+
if (item.toString().match(/^\s*$/))
|
143
|
+
{
|
144
|
+
return;
|
145
|
+
}
|
146
|
+
|
147
|
+
if (typeof item === "string" && this.$element[0].tagName === 'INPUT')
|
148
|
+
{
|
149
|
+
var items = item.split(',');
|
150
|
+
if (items.length > 1)
|
151
|
+
{
|
152
|
+
for (var i = 0; i < items.length; i++)
|
153
|
+
{
|
154
|
+
this.add(items[i], true);
|
155
|
+
}
|
156
|
+
|
157
|
+
if (!dontPushVal)
|
158
|
+
{
|
159
|
+
self.pushVal();
|
160
|
+
}
|
161
|
+
return;
|
162
|
+
}
|
163
|
+
}
|
164
|
+
|
165
|
+
// Strip special characters
|
166
|
+
item = item.replace(/([~!@#$£%^&*()_+=`{}\[\]\|\\:;'<>,.\/? ])+/g, '-').replace(/^(-)+|(-)+$/g,'').replace(/['"]+/g, '').toLowerCase();
|
167
|
+
// Ignore strings only contain whitespace
|
168
|
+
if (item.toString().match(/^\s*$/))
|
169
|
+
{
|
170
|
+
return;
|
171
|
+
}
|
172
|
+
|
173
|
+
var itemValue = self.options.itemValue(item),
|
174
|
+
itemText = self.options.itemText(item),
|
175
|
+
tagClass = self.options.tagClass(item),
|
176
|
+
itemTitle = self.options.itemTitle(item);
|
177
|
+
|
178
|
+
// Ignore items all ready added
|
179
|
+
var existing = $.grep(self.itemsArray, function (item) { return self.options.itemValue(item) === itemValue; })[0];
|
180
|
+
if (existing && !self.options.allowDuplicates)
|
181
|
+
{
|
182
|
+
// Invoke onTagExists
|
183
|
+
if (self.options.onTagExists)
|
184
|
+
{
|
185
|
+
var $existingTag = $(".chip", self.$container).filter(function () { return $(this).data("item") === existing; });
|
186
|
+
self.options.onTagExists(item, $existingTag);
|
187
|
+
}
|
188
|
+
return;
|
189
|
+
}
|
190
|
+
|
191
|
+
// if length greater than limit
|
192
|
+
if (self.items().toString().length + item.length + 1 > self.options.maxInputLength)
|
193
|
+
{
|
194
|
+
return;
|
195
|
+
}
|
196
|
+
|
197
|
+
// raise beforeItemAdd arg
|
198
|
+
var beforeItemAddEvent = $.Event('beforeItemAdd', {item : item, cancel : false, options : options});
|
199
|
+
self.$element.trigger(beforeItemAddEvent);
|
200
|
+
if (beforeItemAddEvent.cancel)
|
201
|
+
{
|
202
|
+
return;
|
203
|
+
}
|
204
|
+
|
205
|
+
// register item in internal array and map
|
206
|
+
self.itemsArray.push(item);
|
207
|
+
|
208
|
+
// add a tag element
|
209
|
+
var $tag = $('<span class="' + htmlEncode(tagClass) + (itemTitle !== null ? ('" title="' + itemTitle) : '') + '">' + htmlEncode(itemText) + '<i class="fa fa-times" data-role="remove"></i></span>');
|
210
|
+
$tag.data('item', item);
|
211
|
+
self.findInputWrapper().before($tag);
|
212
|
+
$tag.after(' ');
|
213
|
+
|
214
|
+
if (!dontPushVal)
|
215
|
+
{
|
216
|
+
self.pushVal();
|
217
|
+
}
|
218
|
+
|
219
|
+
// Add class when reached maxTags
|
220
|
+
if (self.options.maxTags === self.itemsArray.length || self.items().toString().length === self.options.maxInputLength)
|
221
|
+
{
|
222
|
+
self.$container.addClass('materialize-tags-max');
|
223
|
+
}
|
224
|
+
|
225
|
+
self.$element.trigger($.Event('itemAdded', {item : item, options : options}));
|
226
|
+
},
|
227
|
+
|
228
|
+
/**
|
229
|
+
* Removes the given item. Pass true to dontPushVal to prevent updating the
|
230
|
+
* elements val()
|
231
|
+
*
|
232
|
+
* @param item
|
233
|
+
* @param dontPushVal
|
234
|
+
* @param options
|
235
|
+
*/
|
236
|
+
remove : function (item, dontPushVal, options)
|
237
|
+
{
|
238
|
+
var self = this;
|
239
|
+
|
240
|
+
if (self.objectItems)
|
241
|
+
{
|
242
|
+
if (typeof item === "object")
|
243
|
+
{
|
244
|
+
item = $.grep(self.itemsArray, function (other) { return self.options.itemValue(other) == self.options.itemValue(item); });
|
245
|
+
}
|
246
|
+
else
|
247
|
+
{
|
248
|
+
item = $.grep(self.itemsArray, function (other) { return self.options.itemValue(other) == item; });
|
249
|
+
}
|
250
|
+
|
251
|
+
item = item[item.length - 1];
|
252
|
+
}
|
253
|
+
|
254
|
+
if (item)
|
255
|
+
{
|
256
|
+
var beforeItemRemoveEvent = $.Event('beforeItemRemove', {
|
257
|
+
item : item,
|
258
|
+
cancel : false,
|
259
|
+
options : options
|
260
|
+
});
|
261
|
+
self.$element.trigger(beforeItemRemoveEvent);
|
262
|
+
if (beforeItemRemoveEvent.cancel)
|
263
|
+
{
|
264
|
+
return;
|
265
|
+
}
|
266
|
+
|
267
|
+
$('.label', self.$container).filter(function () { return $(this).data('item') === item; }).remove();
|
268
|
+
|
269
|
+
if ($.inArray(item, self.itemsArray) !== -1)
|
270
|
+
{
|
271
|
+
self.itemsArray.splice($.inArray(item, self.itemsArray), 1);
|
272
|
+
}
|
273
|
+
}
|
274
|
+
|
275
|
+
if (!dontPushVal)
|
276
|
+
{
|
277
|
+
self.pushVal();
|
278
|
+
}
|
279
|
+
|
280
|
+
// Remove class when reached maxTags
|
281
|
+
if (self.options.maxTags > self.itemsArray.length)
|
282
|
+
{
|
283
|
+
self.$container.removeClass('materialize-tags-max');
|
284
|
+
}
|
285
|
+
|
286
|
+
self.$element.trigger($.Event('itemRemoved', {item : item, options : options}));
|
287
|
+
},
|
288
|
+
|
289
|
+
/**
|
290
|
+
* Removes all items
|
291
|
+
*/
|
292
|
+
removeAll : function ()
|
293
|
+
{
|
294
|
+
var self = this;
|
295
|
+
|
296
|
+
$('.chip', self.$container).remove();
|
297
|
+
|
298
|
+
while (self.itemsArray.length > 0)
|
299
|
+
{
|
300
|
+
self.itemsArray.pop();
|
301
|
+
}
|
302
|
+
|
303
|
+
self.pushVal();
|
304
|
+
},
|
305
|
+
|
306
|
+
/**
|
307
|
+
* Refreshes the tags so they match the text/value of their corresponding
|
308
|
+
* item.
|
309
|
+
*/
|
310
|
+
refresh : function ()
|
311
|
+
{
|
312
|
+
var self = this;
|
313
|
+
$('.chip', self.$container).each(function ()
|
314
|
+
{
|
315
|
+
var $tag = $(this),
|
316
|
+
item = $tag.data('item'),
|
317
|
+
itemValue = self.options.itemValue(item),
|
318
|
+
itemText = self.options.itemText(item),
|
319
|
+
tagClass = self.options.tagClass(item);
|
320
|
+
|
321
|
+
// Update tag's class and inner text
|
322
|
+
$tag.attr('class', null);
|
323
|
+
$tag.addClass('tag ' + htmlEncode(tagClass));
|
324
|
+
$tag.contents().filter(function ()
|
325
|
+
{
|
326
|
+
return this.nodeType == 3;
|
327
|
+
})[0].nodeValue = htmlEncode(itemText);
|
328
|
+
|
329
|
+
});
|
330
|
+
},
|
331
|
+
|
332
|
+
/**
|
333
|
+
* Returns the items added as tags
|
334
|
+
*/
|
335
|
+
items : function ()
|
336
|
+
{
|
337
|
+
return this.itemsArray;
|
338
|
+
},
|
339
|
+
|
340
|
+
/**
|
341
|
+
* Assembly value by retrieving the value of each item, and set it on the
|
342
|
+
* element.
|
343
|
+
*/
|
344
|
+
pushVal : function ()
|
345
|
+
{
|
346
|
+
var self = this,
|
347
|
+
val = $.map(self.items(), function (item)
|
348
|
+
{
|
349
|
+
return self.options.itemValue(item).toString();
|
350
|
+
});
|
351
|
+
|
352
|
+
self.$element.val(val, true).trigger('change');
|
353
|
+
},
|
354
|
+
|
355
|
+
/**
|
356
|
+
* Initializes the tags input behaviour on the element
|
357
|
+
*
|
358
|
+
* @param options
|
359
|
+
*/
|
360
|
+
build : function (options)
|
361
|
+
{
|
362
|
+
var self = this;
|
363
|
+
|
364
|
+
self.options = $.extend({}, defaultOptions, options);
|
365
|
+
// When itemValue is set, freeInput should always be false
|
366
|
+
if (self.objectItems)
|
367
|
+
{
|
368
|
+
self.options.freeInput = false;
|
369
|
+
}
|
370
|
+
|
371
|
+
makeOptionItemFunction(self.options, 'itemValue');
|
372
|
+
makeOptionItemFunction(self.options, 'itemText');
|
373
|
+
makeOptionFunction(self.options, 'tagClass');
|
374
|
+
|
375
|
+
// Typeahead.js
|
376
|
+
if (self.options.typeaheadjs)
|
377
|
+
{
|
378
|
+
var typeaheadConfig = null;
|
379
|
+
var typeaheadDatasets = {};
|
380
|
+
|
381
|
+
// Determine if main configurations were passed or simply a dataset
|
382
|
+
var typeaheadjs = self.options.typeaheadjs;
|
383
|
+
if ($.isArray(typeaheadjs))
|
384
|
+
{
|
385
|
+
typeaheadConfig = typeaheadjs[0];
|
386
|
+
typeaheadDatasets = typeaheadjs[1];
|
387
|
+
}
|
388
|
+
else
|
389
|
+
{
|
390
|
+
typeaheadDatasets = typeaheadjs;
|
391
|
+
}
|
392
|
+
|
393
|
+
self.$input.typeahead(typeaheadConfig, typeaheadDatasets).on('typeahead:selected', $.proxy(function (obj, datum)
|
394
|
+
{
|
395
|
+
if (typeaheadDatasets.valueKey)
|
396
|
+
{
|
397
|
+
self.add(datum[typeaheadDatasets.valueKey]);
|
398
|
+
}
|
399
|
+
else
|
400
|
+
{
|
401
|
+
self.add(datum);
|
402
|
+
}
|
403
|
+
self.$input.typeahead('val', '');
|
404
|
+
}, self));
|
405
|
+
}
|
406
|
+
|
407
|
+
self.$container.on('click', $.proxy(function (event)
|
408
|
+
{
|
409
|
+
if (!self.$element.attr('disabled'))
|
410
|
+
{
|
411
|
+
self.$input.removeAttr('disabled');
|
412
|
+
}
|
413
|
+
self.$input.focus();
|
414
|
+
}, self));
|
415
|
+
|
416
|
+
if (self.options.addOnBlur && self.options.freeInput)
|
417
|
+
{
|
418
|
+
self.$input.on('focusout', $.proxy(function (event)
|
419
|
+
{
|
420
|
+
// HACK: only process on focusout when no typeahead opened, to
|
421
|
+
// avoid adding the typeahead text as tag
|
422
|
+
if ($('.typeahead, .twitter-typeahead', self.$container).length === 0)
|
423
|
+
{
|
424
|
+
self.add(self.$input.val());
|
425
|
+
self.$input.val('');
|
426
|
+
}
|
427
|
+
}, self));
|
428
|
+
}
|
429
|
+
|
430
|
+
self.$container.on('keydown', 'input', $.proxy(function (event)
|
431
|
+
{
|
432
|
+
var $input = $(event.target),
|
433
|
+
$inputWrapper = self.findInputWrapper();
|
434
|
+
|
435
|
+
if (self.$element.attr('disabled'))
|
436
|
+
{
|
437
|
+
self.$input.attr('disabled', 'disabled');
|
438
|
+
return;
|
439
|
+
}
|
440
|
+
|
441
|
+
switch (event.which)
|
442
|
+
{
|
443
|
+
// BACKSPACE
|
444
|
+
case 8:
|
445
|
+
if (doGetCaretPosition($input[0]) === 0)
|
446
|
+
{
|
447
|
+
var prev = $inputWrapper.prev();
|
448
|
+
if (prev)
|
449
|
+
{
|
450
|
+
self.remove(prev.data('item'));
|
451
|
+
}
|
452
|
+
}
|
453
|
+
break;
|
454
|
+
|
455
|
+
// DELETE
|
456
|
+
case 46:
|
457
|
+
if (doGetCaretPosition($input[0]) === 0)
|
458
|
+
{
|
459
|
+
var next = $inputWrapper.next();
|
460
|
+
if (next)
|
461
|
+
{
|
462
|
+
self.remove(next.data('item'));
|
463
|
+
}
|
464
|
+
}
|
465
|
+
break;
|
466
|
+
|
467
|
+
// LEFT ARROW
|
468
|
+
case 37:
|
469
|
+
// Try to move the input before the previous tag
|
470
|
+
var $prevTag = $inputWrapper.prev();
|
471
|
+
if ($input.val().length === 0 && $prevTag[0])
|
472
|
+
{
|
473
|
+
$prevTag.before($inputWrapper);
|
474
|
+
$input.focus();
|
475
|
+
}
|
476
|
+
break;
|
477
|
+
// RIGHT ARROW
|
478
|
+
case 39:
|
479
|
+
// Try to move the input after the next tag
|
480
|
+
var $nextTag = $inputWrapper.next();
|
481
|
+
if ($input.val().length === 0 && $nextTag[0])
|
482
|
+
{
|
483
|
+
$nextTag.after($inputWrapper);
|
484
|
+
$input.focus();
|
485
|
+
}
|
486
|
+
break;
|
487
|
+
default:
|
488
|
+
// ignore
|
489
|
+
}
|
490
|
+
|
491
|
+
// Reset internal input's size
|
492
|
+
var textLength = $input.val().length,
|
493
|
+
wordSpace = Math.ceil(textLength / 5),
|
494
|
+
size = textLength + wordSpace + 1;
|
495
|
+
$input.attr('size', Math.max(this.inputSize, $input.val().length));
|
496
|
+
}, self));
|
497
|
+
|
498
|
+
self.$container.on('keydown', 'input', $.proxy(function (event)
|
499
|
+
{
|
500
|
+
var $input = $(event.target);
|
501
|
+
|
502
|
+
if (self.$element.attr('disabled'))
|
503
|
+
{
|
504
|
+
self.$input.attr('disabled', 'disabled');
|
505
|
+
return;
|
506
|
+
}
|
507
|
+
|
508
|
+
var text = $input.val(),
|
509
|
+
maxLengthReached = self.options.maxChars && text.length >= self.options.maxChars;
|
510
|
+
if (self.options.freeInput && (keyCombinationInList(event, self.options.confirmKeys) || maxLengthReached))
|
511
|
+
{
|
512
|
+
self.add(maxLengthReached ? text.substr(0, self.options.maxChars) : text);
|
513
|
+
$input.val('');
|
514
|
+
(self.$input.typeahead) && self.$input.typeahead("val","");
|
515
|
+
event.preventDefault();
|
516
|
+
}
|
517
|
+
|
518
|
+
// Reset internal input's size
|
519
|
+
var textLength = $input.val().length,
|
520
|
+
wordSpace = Math.ceil(textLength / 5),
|
521
|
+
size = textLength + wordSpace + 1;
|
522
|
+
$input.attr('size', Math.max(this.inputSize, $input.val().length));
|
523
|
+
}, self));
|
524
|
+
|
525
|
+
// Remove icon clicked
|
526
|
+
self.$container.on('click', '[data-role=remove]', $.proxy(function (event)
|
527
|
+
{
|
528
|
+
if (self.$element.attr('disabled'))
|
529
|
+
{
|
530
|
+
return;
|
531
|
+
}
|
532
|
+
self.remove($(event.target).closest('.label').data('item'));
|
533
|
+
}, self));
|
534
|
+
|
535
|
+
// Only add existing value as tags when using strings as tags
|
536
|
+
if (self.options.itemValue === defaultOptions.itemValue)
|
537
|
+
{
|
538
|
+
if (self.$element[0].tagName === 'INPUT')
|
539
|
+
{
|
540
|
+
self.add(self.$element.val());
|
541
|
+
}
|
542
|
+
}
|
543
|
+
},
|
544
|
+
|
545
|
+
/**
|
546
|
+
* Removes all materialtags behaviour and unregsiter all event handlers
|
547
|
+
*/
|
548
|
+
destroy : function ()
|
549
|
+
{
|
550
|
+
var self = this;
|
551
|
+
|
552
|
+
// Unbind events
|
553
|
+
self.$container.off('keydown', 'input');
|
554
|
+
self.$container.off('click', '[role=remove]');
|
555
|
+
|
556
|
+
self.$container.remove();
|
557
|
+
self.$element.removeData('materialtags');
|
558
|
+
self.$element.show();
|
559
|
+
},
|
560
|
+
|
561
|
+
/**
|
562
|
+
* Sets focus on the materialtags
|
563
|
+
*/
|
564
|
+
focus : function ()
|
565
|
+
{
|
566
|
+
this.$input.focus();
|
567
|
+
},
|
568
|
+
|
569
|
+
/**
|
570
|
+
* Returns the internal input element
|
571
|
+
*/
|
572
|
+
input : function ()
|
573
|
+
{
|
574
|
+
return this.$input;
|
575
|
+
},
|
576
|
+
|
577
|
+
/**
|
578
|
+
* Returns the element which is wrapped around the internal input. This
|
579
|
+
* is normally the $container, but typeahead.js moves the $input element.
|
580
|
+
*/
|
581
|
+
findInputWrapper : function ()
|
582
|
+
{
|
583
|
+
var elt = this.$input[0],
|
584
|
+
container = this.$container[0];
|
585
|
+
while (elt && elt.parentNode !== container)
|
586
|
+
{
|
587
|
+
elt = elt.parentNode;
|
588
|
+
}
|
589
|
+
|
590
|
+
return $(elt);
|
591
|
+
}
|
592
|
+
};
|
593
|
+
|
594
|
+
/**
|
595
|
+
* Register JQuery plugin
|
596
|
+
*
|
597
|
+
* @param arg1
|
598
|
+
* @param arg2
|
599
|
+
* @param arg3
|
600
|
+
* @returns {Array}
|
601
|
+
*/
|
602
|
+
$.fn.materialtags = function (arg1, arg2, arg3)
|
603
|
+
{
|
604
|
+
var results = [];
|
605
|
+
|
606
|
+
this.each(function ()
|
607
|
+
{
|
608
|
+
var materialtags = $(this).data('materialtags');
|
609
|
+
// Initialize a new material tags input
|
610
|
+
if (!materialtags)
|
611
|
+
{
|
612
|
+
materialtags = new TagsMaterialize(this, arg1);
|
613
|
+
$(this).data('materialtags', materialtags);
|
614
|
+
results.push(materialtags);
|
615
|
+
|
616
|
+
// Init tags from $(this).val()
|
617
|
+
$(this).val($(this).val());
|
618
|
+
}
|
619
|
+
else if (!arg1 && !arg2)
|
620
|
+
{
|
621
|
+
// materialtags already exists
|
622
|
+
// no function, trying to init
|
623
|
+
results.push(materialtags);
|
624
|
+
}
|
625
|
+
else if (materialtags[arg1] !== undefined)
|
626
|
+
{
|
627
|
+
// Invoke function on existing tags input
|
628
|
+
if (materialtags[arg1].length === 3 && arg3 !== undefined)
|
629
|
+
{
|
630
|
+
var retVal = materialtags[arg1](arg2, null, arg3);
|
631
|
+
}
|
632
|
+
else
|
633
|
+
{
|
634
|
+
var retVal = materialtags[arg1](arg2);
|
635
|
+
}
|
636
|
+
if (retVal !== undefined)
|
637
|
+
{
|
638
|
+
results.push(retVal);
|
639
|
+
}
|
640
|
+
}
|
641
|
+
});
|
642
|
+
|
643
|
+
if (typeof arg1 == 'string')
|
644
|
+
{
|
645
|
+
// Return the results from the invoked function calls
|
646
|
+
return results.length > 1 ? results : results[0];
|
647
|
+
}
|
648
|
+
else
|
649
|
+
{
|
650
|
+
return results;
|
651
|
+
}
|
652
|
+
};
|
653
|
+
|
654
|
+
$.fn.materialtags.Constructor = TagsMaterialize;
|
655
|
+
|
656
|
+
/**
|
657
|
+
* Most options support both a string or number as well as a function as
|
658
|
+
* option value. This function makes sure that the option with the given
|
659
|
+
* key in the given options is wrapped in a function
|
660
|
+
*
|
661
|
+
* @param options
|
662
|
+
* @param key
|
663
|
+
*/
|
664
|
+
function makeOptionItemFunction(options, key)
|
665
|
+
{
|
666
|
+
if (typeof options[key] !== 'function')
|
667
|
+
{
|
668
|
+
var propertyName = options[key];
|
669
|
+
options[key] = function (item) { return item[propertyName]; };
|
670
|
+
}
|
671
|
+
}
|
672
|
+
|
673
|
+
function makeOptionFunction(options, key)
|
674
|
+
{
|
675
|
+
if (typeof options[key] !== 'function')
|
676
|
+
{
|
677
|
+
var value = options[key];
|
678
|
+
options[key] = function () { return value; };
|
679
|
+
}
|
680
|
+
}
|
681
|
+
|
682
|
+
/**
|
683
|
+
* HtmlEncodes the given value
|
684
|
+
*/
|
685
|
+
var htmlEncodeContainer = $('<div />');
|
686
|
+
|
687
|
+
function htmlEncode(value)
|
688
|
+
{
|
689
|
+
if (value)
|
690
|
+
{
|
691
|
+
return htmlEncodeContainer.text(value).html();
|
692
|
+
}
|
693
|
+
else
|
694
|
+
{
|
695
|
+
return '';
|
696
|
+
}
|
697
|
+
}
|
698
|
+
|
699
|
+
/**
|
700
|
+
* Returns the position of the caret in the given input field
|
701
|
+
* http://flightschool.acylt.com/devnotes/caret-position-woes/
|
702
|
+
*
|
703
|
+
* @param oField
|
704
|
+
* @returns {number}
|
705
|
+
*/
|
706
|
+
function doGetCaretPosition(oField)
|
707
|
+
{
|
708
|
+
var iCaretPos = 0;
|
709
|
+
if (document.selection)
|
710
|
+
{
|
711
|
+
oField.focus();
|
712
|
+
var oSel = document.selection.createRange();
|
713
|
+
oSel.moveStart('character', -oField.value.length);
|
714
|
+
iCaretPos = oSel.text.length;
|
715
|
+
}
|
716
|
+
else if (oField.selectionStart || oField.selectionStart == '0')
|
717
|
+
{
|
718
|
+
iCaretPos = oField.selectionStart;
|
719
|
+
}
|
720
|
+
return (iCaretPos);
|
721
|
+
}
|
722
|
+
|
723
|
+
/**
|
724
|
+
* Returns boolean indicates whether user has pressed an expected key combination.
|
725
|
+
* http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
|
726
|
+
* [13, {which: 188, shiftKey: true}]
|
727
|
+
*
|
728
|
+
* @param keyDownEvent
|
729
|
+
* @param lookupList
|
730
|
+
* @returns {boolean}
|
731
|
+
*/
|
732
|
+
function keyCombinationInList(keyDownEvent, lookupList)
|
733
|
+
{
|
734
|
+
var found = false;
|
735
|
+
$.each(lookupList, function (index, keyCombination)
|
736
|
+
{
|
737
|
+
if (typeof (keyCombination) === 'number' && keyDownEvent.which === keyCombination)
|
738
|
+
{
|
739
|
+
found = true;
|
740
|
+
return false;
|
741
|
+
}
|
742
|
+
|
743
|
+
if (keyDownEvent.which === keyCombination.which)
|
744
|
+
{
|
745
|
+
var alt = !keyCombination.hasOwnProperty('altKey') || keyDownEvent.altKey === keyCombination.altKey,
|
746
|
+
shift = !keyCombination.hasOwnProperty('shiftKey') || keyDownEvent.shiftKey === keyCombination.shiftKey,
|
747
|
+
ctrl = !keyCombination.hasOwnProperty('ctrlKey') || keyDownEvent.ctrlKey === keyCombination.ctrlKey;
|
748
|
+
if (alt && shift && ctrl)
|
749
|
+
{
|
750
|
+
found = true;
|
751
|
+
return false;
|
752
|
+
}
|
753
|
+
}
|
754
|
+
});
|
755
|
+
|
756
|
+
return found;
|
757
|
+
}
|
758
|
+
})(window.jQuery);
|