mosaico 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/.gitignore +8 -0
- data/Gemfile +7 -0
- data/LICENSE +680 -0
- data/README.md +179 -0
- data/Rakefile +5 -0
- data/app/assets/images/mosaico/logo_transparent.png +0 -0
- data/app/assets/javascripts/mosaico/application.js.erb +51 -0
- data/app/assets/javascripts/mosaico/plugins/debug.js.erb +10 -0
- data/app/assets/javascripts/mosaico/plugins/logo.js.erb +10 -0
- data/app/assets/javascripts/mosaico/plugins/preview.js +85 -0
- data/app/assets/javascripts/mosaico/plugins/save.js.erb +72 -0
- data/app/assets/javascripts/mosaico/plugins/template_path.js.erb +22 -0
- data/app/assets/javascripts/mosaico/plugins/translations.js +10 -0
- data/app/assets/javascripts/mosaico/utilities.js +25 -0
- data/app/assets/stylesheets/mosaico/application.css +6 -0
- data/app/controllers/mosaico/application_controller.rb +17 -0
- data/app/controllers/mosaico/images_controller.rb +142 -0
- data/app/controllers/mosaico/projects_controller.rb +31 -0
- data/app/controllers/mosaico/templates_controller.rb +8 -0
- data/app/helpers/mosaico/application_helper.rb +7 -0
- data/app/models/mosaico/image.rb +9 -0
- data/app/models/mosaico/placeholder_image.rb +9 -0
- data/app/models/mosaico/project.rb +13 -0
- data/app/models/mosaico/uploaded_image.rb +26 -0
- data/app/views/layouts/mosaico/application.html.erb +13 -0
- data/app/views/mosaico/projects/new.html.erb +1 -0
- data/app/views/mosaico/projects/show.html.erb +1 -0
- data/app/views/mosaico/shared/_metadata.html.erb +12 -0
- data/config/routes.rb +12 -0
- data/db/migrate/20170817202255_add_images.rb +14 -0
- data/db/migrate/20170824233755_add_projects.rb +11 -0
- data/lib/mosaico.rb +100 -0
- data/lib/mosaico/engine.rb +72 -0
- data/lib/mosaico/local_backend.rb +23 -0
- data/lib/mosaico/local_image_backend.rb +7 -0
- data/lib/mosaico/local_placeholder_backend.rb +7 -0
- data/lib/mosaico/placeholder.png +0 -0
- data/lib/mosaico/template.rb +89 -0
- data/lib/mosaico/versafix_template.rb +43 -0
- data/lib/mosaico/version.rb +4 -0
- data/lib/tasks/makeThumbs.js.erb +57 -0
- data/lib/tasks/thumbs.rake +35 -0
- data/mosaico.gemspec +22 -0
- data/screenshot.png +0 -0
- data/vendor/assets/fonts/LiberationSans-Regular.ttf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/.jsbeautifyrc +6 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/.jshintrc +8 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/.travis.yml +6 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/CONTRIBUTING.md +37 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/Dockerfile +21 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/Gruntfile.js +241 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/LICENSE +680 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/NOTICE.txt +87 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/README.md +73 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/backend/README.txt +23 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/backend/main.js +162 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/bower.json +76 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/build/mosaico-material.css +7425 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/build/mosaico.css +7133 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/build/mosaico.debug.js +1517 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/build/mosaico.js +12828 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/build/templates.js +15 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/fa/fonts/fontawesome-webfont.eot +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/fa/fonts/fontawesome-webfont.svg +685 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/fa/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/fa/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/fa/fonts/fontawesome-webfont.woff2 +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/byvoxmail.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/mosaico-badge.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/mosaico-v.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/mosaico32.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/mosaicologo.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/screenshot-orig.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/img/screenshot.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/README.md +26 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-de.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-en.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-es.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-fr.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-it.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-nl.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/lang/mosaico-sv.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/mosaico-material.min.css +5 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/mosaico-material.min.css.map +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/mosaico.min.css +5 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/mosaico.min.css.map +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/mosaico.min.js +1517 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/mosaico.min.js.map +147 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/canvas-to-blob.min.js +2 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery-ui.min.css +7 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery-ui.min.js +13 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.fileupload-image.js +324 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.fileupload-process.js +175 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.fileupload-validate.js +122 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.fileupload.js +1482 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.iframe-transport.js +217 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.min.js +5 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.min.map +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/jquery.ui.touch-punch.min.js +11 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/knockout-jqueryui.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/knockout.js +123 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/load-image.all.min.js +2 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/notoregular/NotoSans-Regular-webfont.eot +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/notoregular/NotoSans-Regular-webfont.ttf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/notoregular/NotoSans-Regular-webfont.woff +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/notoregular/stylesheet.css +9 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/advlist/plugin.js +101 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/advlist/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/anchor/plugin.js +55 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/anchor/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/autolink/plugin.js +204 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/autolink/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/autoresize/plugin.js +162 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/autoresize/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/autosave/plugin.js +165 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/autosave/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/bbcode/plugin.js +123 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/bbcode/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/charmap/plugin.js +462 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/charmap/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/code/plugin.js +60 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/code/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/codesample/css/prism.css +138 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/codesample/plugin.js +1319 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/codesample/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/colorpicker/plugin.js +112 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/colorpicker/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/contextmenu/plugin.js +100 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/contextmenu/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/directionality/plugin.js +64 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/directionality/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-cool.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-cry.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-embarassed.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-foot-in-mouth.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-frown.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-innocent.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-kiss.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-laughing.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-money-mouth.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-sealed.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-smile.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-surprised.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-tongue-out.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-undecided.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-wink.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/img/smiley-yell.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/plugin.js +65 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/emoticons/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/fullpage/plugin.js +490 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/fullpage/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/fullscreen/plugin.js +154 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/fullscreen/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/hr/plugin.js +30 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/hr/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/image/plugin.js +630 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/image/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/imagetools/plugin.js +2944 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/imagetools/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/importcss/plugin.js +273 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/importcss/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/insertdatetime/plugin.js +121 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/insertdatetime/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/layer/plugin.js +225 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/layer/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/legacyoutput/plugin.js +208 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/legacyoutput/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/link/plugin.js +403 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/link/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/lists/plugin.js +965 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/lists/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/media/moxieplayer.swf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/media/plugin.js +879 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/media/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/nonbreaking/plugin.js +53 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/nonbreaking/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/noneditable/plugin.js +101 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/noneditable/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/pagebreak/plugin.js +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/pagebreak/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/paste/plugin.js +1844 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/paste/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/preview/plugin.js +101 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/preview/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/print/plugin.js +32 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/print/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/save/plugin.js +98 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/save/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/searchreplace/plugin.js +609 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/searchreplace/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/spellchecker/plugin.js +1031 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/spellchecker/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/tabfocus/plugin.js +120 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/tabfocus/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/table/plugin.js +4400 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/table/plugin.min.js +2 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/template/plugin.js +276 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/template/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/textcolor/plugin.js +297 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/textcolor/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/textpattern/plugin.js +268 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/textpattern/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/visualblocks/css/visualblocks.css +135 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/visualblocks/plugin.js +86 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/visualblocks/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/visualchars/plugin.js +123 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/visualchars/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/wordcount/plugin.js +69 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/wordcount/plugin.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/Variables.less +196 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/content.inline.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/content.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/readme.md +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce-small.eot +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce-small.json +1277 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce-small.svg +63 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce-small.ttf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce-small.woff +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce.eot +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce.json +1972 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce.svg +98 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce.ttf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/fonts/tinymce.woff +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/img/anchor.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/img/loader.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/img/object.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/img/trans.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/skin.ie7.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/skin.json +79 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/gray-flat/skin.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/content.inline.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/content.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce-small.eot +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce-small.svg +63 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce-small.ttf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce-small.woff +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce.eot +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce.svg +129 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce.ttf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/fonts/tinymce.woff +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/img/anchor.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/img/loader.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/img/object.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/img/trans.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/skin.ie7.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/skins/lightgray/skin.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/themes/inlite/theme.js +1828 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/themes/inlite/theme.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/themes/modern/theme.js +934 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/themes/modern/theme.min.js +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/tinymce.min.js +14 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/editor.html +63 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/favicon.ico +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/index.html +368 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/package.json +92 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/img/byvoxmail.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/img/mosaico-badge.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/img/mosaico-v.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/img/mosaico32.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/img/mosaicologo.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/img/screenshot-orig.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/img/screenshot.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/README.md +26 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-de.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-en.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-es.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-fr.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-it.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-nl.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/lang/mosaico-sv.json +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/Variables.less +196 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/content.inline.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/content.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/readme.md +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce-small.eot +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce-small.json +1277 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce-small.svg +63 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce-small.ttf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce-small.woff +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce.eot +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce.json +1972 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce.svg +98 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce.ttf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/fonts/tinymce.woff +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/img/anchor.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/img/loader.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/img/object.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/img/trans.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/skin.ie7.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/skin.json +79 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/res/vendor/skins/gray-flat/skin.min.css +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/server-config.js +12 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/spec/converter-spec.js +115 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/spec/data/template-versafix-1.model.json +137 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/spec/declarations-spec.js +282 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/spec/mensch-spec.js +114 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/spec/model-spec.js +88 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/spec/stylesheet-spec.js +177 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/app_standalone.less +7 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/app_standalone_material.less +350 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/safarihack.css +17 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_elements.less +497 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_elements_jquery.less +344 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_elements_mixins.less +406 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_elements_moxie.less +130 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_mosaico.less +529 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_mosaico_content.less +391 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_mosaico_tools.less +1043 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_reset.less +45 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/css/style_variables.less +156 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/app.js +167 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/bind-iframe.js +64 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/blocks.js +118 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/choose-template.js +7 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/colorpicker.js +58 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/csstext.js +16 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/droppable.js +87 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/eventable.js +33 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/extender-pagination.js +60 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/extsortables.js +103 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/fileupload.js +373 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/if-subs.js +110 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/jqueryui-spinner.js +31 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/jqueryui-tabs.js +17 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/script-template.js +30 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/scrollfix.js +48 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/scrollintoview.js +83 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/string-template.js +76 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/tooltips.js +36 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/validated-value.js +40 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/virtuals.js +102 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/wysiwygs.js +304 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/checkmodel.js +114 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/declarations.js +279 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/domutils.js +93 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/editor.js +411 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/main.js +42 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/model.js +536 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/parser.js +485 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/stylesheet.js +205 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/utils.js +156 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/converter/wrapper.js +308 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/ext/color.js +53 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/ext/inliner.js +35 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/ext/localstorage.js +100 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/ko-bindings.js +22 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/template-loader.js +446 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/timed-call.js +31 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/undomanager/undomain.js +49 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/undomanager/undoserializer.js +120 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/js/viewmodel.js +595 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/array.tmpl.html +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/block-show.tmpl.html +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/block-wysiwyg.tmpl.html +18 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/blocks-show.tmpl.html +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/blocks-wysiwyg.tmpl.html +2 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/customstyle.tmpl.html +3 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/empty.tmpl.html +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/error.tmpl.html +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/gallery-images.tmpl.html +16 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/img-wysiwyg.tmpl.html +43 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/main.tmpl.html +102 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/src/tmpl/toolbox.tmpl.html +111 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/tasks/combineKOTemplates.js +24 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/tasks/lib/phantom-thumbnailer-editor.js +168 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/tasks/makeThumbs.js +79 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/README.md +1 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/_full.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/footerBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/headerBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/heroBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/socialBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/threetwoBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/edres/twoColumnBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tedc15/template-tedc15.html +567 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/edres/HeaderAndText.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/edres/_full.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/edres/fixedlist.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/mosaico-tutorial.md +335 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/mosaico-tutorial.pdf +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/screenshot_384.jpg +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/screenshot_385.jpg +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/screenshot_386.jpg +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/screenshot_387.jpg +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/screenshot_407.jpg +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/screenshot_408.jpg +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/tutorial/template-tutorial.html +68 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/_full.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/buttonBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/doubleArticleBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/doubleImageBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/hrBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/imageBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/logoBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/sideArticleBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/singleArticleBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/socialBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/spacerBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/textBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/titleBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/tripleArticleBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/edres/tripleImageBlock.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/facebook_bw_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/facebook_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/flickr_bw_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/flickr_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/google+_bw_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/google+_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/instagram_bw_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/instagram_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/linkedin_bw_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/linkedin_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/twitter_bw_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/twitter_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/vimeo_bw_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/vimeo_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/web_bw_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/web_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/youtube_bw_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/social_def/youtube_ok.png +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/img/sponsor.gif +0 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/templates/versafix-1/template-versafix-1.html +1531 -0
- data/vendor/assets/mosaico-0.16.0/mosaico/uploads/README.md +1 -0
- metadata +536 -0
@@ -0,0 +1,485 @@
|
|
1
|
+
"use strict";
|
2
|
+
/* global global: false */
|
3
|
+
|
4
|
+
var $ = require("jquery");
|
5
|
+
var console = require("console");
|
6
|
+
var converterUtils = require("./utils.js");
|
7
|
+
var elaborateDeclarations = require("./declarations.js");
|
8
|
+
var processStylesheetRules = require("./stylesheet.js");
|
9
|
+
var modelDef = require("./model.js");
|
10
|
+
var domutils = require("./domutils.js");
|
11
|
+
|
12
|
+
var wrapElementWithCondition = function(attribute, element, bindingProvider) {
|
13
|
+
var cond = domutils.getAttribute(element, attribute);
|
14
|
+
|
15
|
+
try {
|
16
|
+
var binding = converterUtils.conditionBinding(cond, bindingProvider);
|
17
|
+
$(element).before('<!-- ko if: ' + binding + ' -->');
|
18
|
+
$(element).after('<!-- /ko -->');
|
19
|
+
domutils.removeAttribute(element, attribute);
|
20
|
+
} catch (e) {
|
21
|
+
console.warn("Model ensure path failed in if/variant", element, cond, attribute);
|
22
|
+
throw e;
|
23
|
+
}
|
24
|
+
|
25
|
+
};
|
26
|
+
|
27
|
+
var replacedAttributes = function(element, attributeName) {
|
28
|
+
domutils.setAttribute(element, attributeName, domutils.getAttribute(element, "replaced" + attributeName));
|
29
|
+
};
|
30
|
+
|
31
|
+
var processStyle = function(element, templateUrlConverter, bindingProvider, addUniqueId) {
|
32
|
+
var style = domutils.getAttribute(element, 'replacedstyle');
|
33
|
+
var newStyle = null;
|
34
|
+
var newBindings;
|
35
|
+
if (addUniqueId) newBindings = {
|
36
|
+
uniqueId: '$data',
|
37
|
+
attr: {
|
38
|
+
id: 'id'
|
39
|
+
}
|
40
|
+
};
|
41
|
+
|
42
|
+
var removeDisplayNone = domutils.getAttribute(element, 'data-ko-display') !== null;
|
43
|
+
|
44
|
+
newStyle = elaborateDeclarations(style, undefined, templateUrlConverter, bindingProvider, element, newBindings, removeDisplayNone);
|
45
|
+
|
46
|
+
// only when using "replaced"
|
47
|
+
if (newStyle === null) {
|
48
|
+
newStyle = style;
|
49
|
+
} else {
|
50
|
+
// in case there are no bindings we keep replacedstyle to be used by IE during output
|
51
|
+
// otherwise I remove it because it will be overwritten by virtualAttrStyle binding.
|
52
|
+
// TODO maybe we better use different names for "replaced" used during template conversion
|
53
|
+
// and the ones used to create the output.
|
54
|
+
domutils.removeAttribute(element, 'replacedstyle');
|
55
|
+
}
|
56
|
+
|
57
|
+
if (newStyle !== null) {
|
58
|
+
if (newStyle.trim().length > 0) {
|
59
|
+
domutils.setAttribute(element, 'style', newStyle);
|
60
|
+
} else domutils.removeAttribute(element, 'style');
|
61
|
+
}
|
62
|
+
};
|
63
|
+
|
64
|
+
|
65
|
+
// TODO fixing URLs is also needed where styles uses path (e.g: background-image, @import)
|
66
|
+
var _fixRelativePath = function(attribute, templateUrlConverter, index, element) {
|
67
|
+
var url = domutils.getAttribute(element, attribute);
|
68
|
+
var newUrl = templateUrlConverter(url);
|
69
|
+
if (newUrl !== null) {
|
70
|
+
domutils.setAttribute(element, attribute, newUrl);
|
71
|
+
}
|
72
|
+
};
|
73
|
+
|
74
|
+
|
75
|
+
var processBlock = function(element, defs, themeUpdater, blockPusher, templateUrlConverter, contextName, rootModelName, containerName, generateUniqueId, templateCreator) {
|
76
|
+
|
77
|
+
try {
|
78
|
+
|
79
|
+
var templateName;
|
80
|
+
var variantName = '',
|
81
|
+
variantDef = '';
|
82
|
+
if (contextName == 'block') {
|
83
|
+
templateName = domutils.getAttribute(element, 'data-ko-block');
|
84
|
+
domutils.removeAttribute(element, 'data-ko-block');
|
85
|
+
} else if (contextName == 'template') {
|
86
|
+
templateName = rootModelName;
|
87
|
+
} else {
|
88
|
+
throw "Unexpected context name while processing block: " + contextName;
|
89
|
+
}
|
90
|
+
|
91
|
+
// console.log("processBlock", contextName, rootModelName, containerName, templateName);
|
92
|
+
|
93
|
+
// Remove element
|
94
|
+
$('[data-ko-remove]', element).remove();
|
95
|
+
|
96
|
+
var fixedBlocks = $('[data-ko-block]', element).replaceWith('<replacedblock>');
|
97
|
+
|
98
|
+
// Urls in these attributes needs "relativization"
|
99
|
+
var urlattrs = ['href', 'src', 'data-ko-placeholder-src', 'background'];
|
100
|
+
for (var i = 0; i < urlattrs.length; i++) {
|
101
|
+
// faccio il bind per non definire funzioni in un loop (jshint)
|
102
|
+
var func = _fixRelativePath.bind(undefined, urlattrs[i], templateUrlConverter);
|
103
|
+
$('[' + urlattrs[i] + ']', element).each(func);
|
104
|
+
}
|
105
|
+
|
106
|
+
var dataDefs = domutils.getAttribute(element, 'data-ko-properties');
|
107
|
+
if (dataDefs === null) dataDefs = "";
|
108
|
+
$("[data-ko-properties]", element).each(function(index, element) {
|
109
|
+
if (dataDefs.length > 0) dataDefs = dataDefs + " ";
|
110
|
+
dataDefs = dataDefs + domutils.getAttribute(element, 'data-ko-properties');
|
111
|
+
domutils.removeAttribute(element, 'data-ko-properties');
|
112
|
+
});
|
113
|
+
|
114
|
+
modelDef.createOrUpdateBlockDef(defs, templateName, dataDefs, { contextName: contextName });
|
115
|
+
|
116
|
+
var bindingProvider = modelDef.ensurePathAndGetBindValue.bind(undefined, defs, themeUpdater, rootModelName, templateName, '');
|
117
|
+
if (contextName == 'block') bindingProvider('id', '');
|
118
|
+
|
119
|
+
$('style', element).each(function(index, element) {
|
120
|
+
var style = domutils.getInnerHtml(element);
|
121
|
+
|
122
|
+
var blockDefsUpdater = modelDef.createOrUpdateBlockDef.bind(undefined, defs);
|
123
|
+
var localWithBindingProvider = modelDef.ensurePathAndGetBindValue.bind(undefined, defs, themeUpdater, rootModelName);
|
124
|
+
var newStyle = processStylesheetRules(style, undefined, localWithBindingProvider, blockDefsUpdater, themeUpdater, templateUrlConverter, rootModelName, templateName);
|
125
|
+
|
126
|
+
if (newStyle != style) {
|
127
|
+
if (newStyle.trim() !== '') {
|
128
|
+
var tmpName = templateCreator(newStyle);
|
129
|
+
domutils.setAttribute(element, 'data-bind', 'template: { name: \'' + tmpName + '\' }');
|
130
|
+
// ho creato il template quindi posso svuotare il sorgente.
|
131
|
+
domutils.setContent(element, '');
|
132
|
+
} else {
|
133
|
+
// remove empty styles blocks
|
134
|
+
domutils.removeElements($(element));
|
135
|
+
}
|
136
|
+
}
|
137
|
+
});
|
138
|
+
|
139
|
+
processStyle(element, templateUrlConverter, bindingProvider, generateUniqueId);
|
140
|
+
|
141
|
+
// TODO href should be supported. data-ko-display and data-ko-wrap should never happen in here.
|
142
|
+
var notsupported = ['data-ko-display', 'data-ko-editable', 'data-ko-wrap', 'href'];
|
143
|
+
for (var j = 0; j < notsupported.length; j++) {
|
144
|
+
var attr = domutils.getAttribute(element, notsupported[j]);
|
145
|
+
if (attr) {
|
146
|
+
console.warn("ERROR: Unsupported " + notsupported[j] + " used together with data-ko-block", element);
|
147
|
+
throw "ERROR: Unsupported " + notsupported[j] + " used together with data-ko-block";
|
148
|
+
}
|
149
|
+
}
|
150
|
+
|
151
|
+
// simply preprocessed as data-ko-wrap + -ko-attr-href
|
152
|
+
$("[data-ko-link]", element).each(function(index, element) {
|
153
|
+
var urlVar = domutils.getAttribute(element, 'data-ko-link');
|
154
|
+
var repStyle = domutils.getAttribute(element, 'replacedstyle');
|
155
|
+
if (typeof repStyle == 'undefined' || repStyle === null) repStyle = '';
|
156
|
+
if (repStyle !== '') repStyle = '-ko-attr-href: @' + urlVar + "; " + repStyle;
|
157
|
+
else repStyle = '-ko-attr-href: @' + urlVar;
|
158
|
+
domutils.setAttribute(element, 'replacedstyle', repStyle);
|
159
|
+
domutils.setAttribute(element, 'data-ko-wrap', urlVar);
|
160
|
+
domutils.removeAttribute(element, 'data-ko-link');
|
161
|
+
});
|
162
|
+
|
163
|
+
$("[replacedstyle]", element).each(function(index, element) {
|
164
|
+
processStyle(element, templateUrlConverter, bindingProvider, false);
|
165
|
+
});
|
166
|
+
|
167
|
+
$("[replacedhttp-equiv]", element).each(function(index, element) {
|
168
|
+
replacedAttributes(element, "http-equiv");
|
169
|
+
});
|
170
|
+
|
171
|
+
$("[data-ko-display]", element).each(function(index, element) {
|
172
|
+
wrapElementWithCondition('data-ko-display', element, bindingProvider);
|
173
|
+
});
|
174
|
+
|
175
|
+
$("[data-ko-editable]", element).each(function(index, element) {
|
176
|
+
var newBinding, defaultValue, model, currentBindings, dataBind;
|
177
|
+
|
178
|
+
|
179
|
+
var dataEditable = domutils.getAttribute(element, "data-ko-editable");
|
180
|
+
|
181
|
+
// TODO add validation of the editable
|
182
|
+
|
183
|
+
var itemBindValue;
|
184
|
+
var selectBinding;
|
185
|
+
if (dataEditable.lastIndexOf('.') > 0) {
|
186
|
+
var subs = dataEditable.substr(0, dataEditable.lastIndexOf('.'));
|
187
|
+
itemBindValue = bindingProvider(subs);
|
188
|
+
} else {
|
189
|
+
itemBindValue = bindingProvider(dataEditable);
|
190
|
+
}
|
191
|
+
selectBinding = "wysiwygClick: function(obj, evt) { $root.selectItem(" + itemBindValue + ", $data); return false }, clickBubble: false, wysiwygCss: { selecteditem: $root.isSelectedItem(" + itemBindValue + ") }, scrollIntoView: $root.isSelectedItem(" + itemBindValue + ")";
|
192
|
+
|
193
|
+
if (domutils.getLowerTagName(element) != 'img') {
|
194
|
+
|
195
|
+
|
196
|
+
defaultValue = domutils.getInnerHtml(element);
|
197
|
+
var modelBindValue = bindingProvider(dataEditable, defaultValue, true, 'wysiwyg');
|
198
|
+
newBinding = "";
|
199
|
+
|
200
|
+
if (!domutils.getAttribute(element, "id")) {
|
201
|
+
newBinding += "wysiwygId: id()+'_" + dataEditable.replace('.', '_') + "', ";
|
202
|
+
}
|
203
|
+
|
204
|
+
if (typeof selectBinding !== 'undefined') {
|
205
|
+
newBinding += selectBinding + ", ";
|
206
|
+
}
|
207
|
+
|
208
|
+
newBinding += "wysiwygOrHtml: " + modelBindValue;
|
209
|
+
|
210
|
+
if (domutils.getLowerTagName(element) == 'td') {
|
211
|
+
var wrappingDiv = $('<div data-ko-wrap="false" style="width: 100%; height: 100%"></div>')[0];
|
212
|
+
domutils.setAttribute(wrappingDiv, 'data-bind', newBinding);
|
213
|
+
var newContent = domutils.getInnerHtml($('<div></div>').append(wrappingDiv));
|
214
|
+
domutils.setContent(element, newContent);
|
215
|
+
} else {
|
216
|
+
currentBindings = domutils.getAttribute(element, 'data-bind');
|
217
|
+
dataBind = (currentBindings !== null ? currentBindings + ", " : "") + newBinding;
|
218
|
+
domutils.setAttribute(element, 'data-bind', dataBind);
|
219
|
+
domutils.setContent(element, '');
|
220
|
+
}
|
221
|
+
domutils.removeAttribute(element, 'data-ko-editable');
|
222
|
+
} else {
|
223
|
+
var width = domutils.getAttribute(element, 'width');
|
224
|
+
if (width === '') width = null;
|
225
|
+
if (width === null) {
|
226
|
+
console.error("ERROR: data-ko-editable images must declare a WIDTH attribute!", element);
|
227
|
+
throw "ERROR: data-ko-editable images must declare a WIDTH attribute!";
|
228
|
+
}
|
229
|
+
var height = domutils.getAttribute(element, 'height');
|
230
|
+
if (height === '') height = null;
|
231
|
+
|
232
|
+
var align = domutils.getAttribute(element, 'align');
|
233
|
+
|
234
|
+
currentBindings = domutils.getAttribute(element, 'data-bind');
|
235
|
+
|
236
|
+
// TODO this is ugly... maybe a better strategy is to pass this around using "data-" attributes
|
237
|
+
var dynHeight = currentBindings && currentBindings.match(/virtualAttr: {[^}]* height: ([^,}]*)[,}]/);
|
238
|
+
if (dynHeight) height = dynHeight[1];
|
239
|
+
var dynWidth = currentBindings && currentBindings.match(/virtualAttr: {[^}]* width: ([^,}]*)[,}]/);
|
240
|
+
if (dynWidth) width = dynWidth[1];
|
241
|
+
|
242
|
+
var method;
|
243
|
+
|
244
|
+
defaultValue = domutils.getAttribute(element, 'data-ko-placeholder-src');
|
245
|
+
// TODO make sure this default value is the same as the one checked by img-wysiwyg template.
|
246
|
+
var value = '';
|
247
|
+
if (defaultValue) {
|
248
|
+
value = domutils.getAttribute(element, 'src');
|
249
|
+
} else {
|
250
|
+
defaultValue = domutils.getAttribute(element, 'src');
|
251
|
+
}
|
252
|
+
|
253
|
+
var size;
|
254
|
+
if (width && height) {
|
255
|
+
size = width + "+'x'+" + height;
|
256
|
+
} else if (!height) {
|
257
|
+
size = "'w'+" + width + "+''";
|
258
|
+
} else if (!width) {
|
259
|
+
size = "'h'+" + height + "+''";
|
260
|
+
}
|
261
|
+
var placeholdersrc;
|
262
|
+
var plheight = height || domutils.getAttribute(element, 'data-ko-placeholder-height');
|
263
|
+
var plwidth = width || domutils.getAttribute(element, 'data-ko-placeholder-width');
|
264
|
+
|
265
|
+
domutils.removeAttribute(element, 'src');
|
266
|
+
domutils.removeAttribute(element, 'data-ko-editable');
|
267
|
+
domutils.removeAttribute(element, 'data-ko-placeholder-height');
|
268
|
+
domutils.removeAttribute(element, 'data-ko-placeholder-width');
|
269
|
+
domutils.removeAttribute(element, 'data-ko-placeholder-src');
|
270
|
+
|
271
|
+
if (defaultValue) {
|
272
|
+
placeholdersrc = "{ width: " + plwidth + ", height: " + plheight + ", text: " + size + "}";
|
273
|
+
}
|
274
|
+
|
275
|
+
if (!plwidth || !plheight) {
|
276
|
+
// TODO raise an exception?
|
277
|
+
console.error("IMG data-ko-editable must declare width and height attributes, or their placeholder counterparts data-ko-placeholder-width/data-ko-placeholder-height", element);
|
278
|
+
throw "ERROR: IMG data-ko-editable MUST declare width and height attributes, or their placeholder counterparts data-ko-placeholder-width/data-ko-placeholder-height";
|
279
|
+
}
|
280
|
+
|
281
|
+
var bindingValue = bindingProvider(dataEditable, value, false, 'wysiwyg');
|
282
|
+
newBinding = "wysiwygSrc: { width: " + width + ", height: " + height + ", src: " + bindingValue + ", placeholder: " + placeholdersrc + " }";
|
283
|
+
dataBind = (currentBindings !== null ? currentBindings + ", " : "") + newBinding;
|
284
|
+
domutils.setAttribute(element, 'data-bind', dataBind);
|
285
|
+
|
286
|
+
var tmplName = templateCreator(element);
|
287
|
+
|
288
|
+
var containerBind = '{ width: ' + width;
|
289
|
+
if (align == 'left') containerBind += ', float: \'left\'';
|
290
|
+
else if (align == 'right') containerBind += ', float: \'right\'';
|
291
|
+
else if (align == 'center') console.log('non so cosa fa align=center su una img e quindi non so come simularne l\'editing');
|
292
|
+
else if (align == 'top') containerBind += ', verticalAlign: \'top\'';
|
293
|
+
else if (align == 'middle') containerBind += ', verticalAlign: \'middle\'';
|
294
|
+
else if (align == 'bottom') containerBind += ', verticalAlign: \'bottom\'';
|
295
|
+
containerBind += '}';
|
296
|
+
|
297
|
+
$(element).before('<!-- ko wysiwygImg: { _data: $data, _item: ' + itemBindValue + ', _template: \'' + tmplName + '\', _editTemplate: \'img-wysiwyg\', _src: ' + bindingValue + ', _width: ' + width + ', _height: ' + height + ', _align: ' + (align === null ? undefined : '\'' + align + '\'') + ', _size: ' + size + ', _method: ' + method + ', _placeholdersrc: ' + placeholdersrc + ', _stylebind: ' + containerBind + ' } -->');
|
298
|
+
$(element).after('<!-- /ko -->');
|
299
|
+
}
|
300
|
+
|
301
|
+
});
|
302
|
+
|
303
|
+
// Applied after the data-editable so to avoid processing hrefs for editable content
|
304
|
+
$("[href]", element).each(function(index, element) {
|
305
|
+
var attrValue = domutils.getAttribute(element, 'href');
|
306
|
+
var newBinding = 'wysiwygHref: \'' + converterUtils.addSlashes(attrValue) + '\'';
|
307
|
+
var currentBindings = domutils.getAttribute(element, 'data-bind');
|
308
|
+
var dataBind = (currentBindings !== null ? currentBindings + ", " : "") + newBinding;
|
309
|
+
domutils.setAttribute(element, 'data-bind', dataBind);
|
310
|
+
});
|
311
|
+
|
312
|
+
$("replacedblock", element).each(function(index, element) {
|
313
|
+
var blockElement = fixedBlocks[index];
|
314
|
+
|
315
|
+
var blockName = processBlock(blockElement, defs, themeUpdater, blockPusher, templateUrlConverter, 'block', templateName, containerName, true, templateCreator);
|
316
|
+
// replaced blocks are defined in the model root
|
317
|
+
var modelBindValue = modelDef.ensurePathAndGetBindValue(defs, themeUpdater, rootModelName, templateName, '', blockName);
|
318
|
+
|
319
|
+
// this way we call block-wysiwyg or block-show and not directly the right block
|
320
|
+
$(element).before('<!-- ko block: { data: ' + converterUtils.addSlashes(modelBindValue) + ', template: \'block\' } -->');
|
321
|
+
$(element).after('<!-- /ko -->');
|
322
|
+
$(element).remove();
|
323
|
+
});
|
324
|
+
|
325
|
+
// TODO do we really need to loop in reverse order?
|
326
|
+
// data-ko-wrap have to be processed at the end, expecially after "replaceblocks"
|
327
|
+
// otherwise a data-ko-wrap wrapping a data-ko-block would break everything.
|
328
|
+
$($("[data-ko-wrap]", element).get().reverse(), element).each(function(index, element) {
|
329
|
+
var cond = domutils.getAttribute(element, 'data-ko-wrap');
|
330
|
+
if (typeof cond === 'undefined' || cond === '' || cond === 'true') {
|
331
|
+
throw "Unsupported empty value for data-ko-wrap: use false value if you want to always remove the tag";
|
332
|
+
}
|
333
|
+
|
334
|
+
var condBinding = converterUtils.conditionBinding(cond, bindingProvider);
|
335
|
+
|
336
|
+
/*
|
337
|
+
var condBinding = false;
|
338
|
+
if (typeof cond === 'undefined' || cond === '') {
|
339
|
+
throw "Unsupported empty value for data-ko-wrap: use false value if you want to always remove the tag";
|
340
|
+
} else if (cond === 'false') {
|
341
|
+
condBinding = false;
|
342
|
+
} else if (cond === 'true') {
|
343
|
+
throw "Unsupported true value for data-ko-wrap. This makes no sense: use false or a variable";
|
344
|
+
} else {
|
345
|
+
condBinding = bindingProvider(cond)+'()';
|
346
|
+
}
|
347
|
+
*/
|
348
|
+
|
349
|
+
var dataBind = domutils.getAttribute(element, 'data-bind');
|
350
|
+
|
351
|
+
var innerTmplName, outerTmplName;
|
352
|
+
// TODO ugly hardcoded handling: at the very least this should be invoked by the data-container caller.
|
353
|
+
if (dataBind !== '' && dataBind !== null && dataBind.match(/(block|wysiwygOrHtml):/)) {
|
354
|
+
// we can't put the content in a template because it will be overwritten by the binding
|
355
|
+
var innerTmplContent = '<!-- ko ' + dataBind + ' -->' + domutils.getInnerHtml(element) + '<!-- /ko -->';
|
356
|
+
innerTmplName = templateCreator(innerTmplContent);
|
357
|
+
domutils.removeAttribute(element, 'data-ko-wrap');
|
358
|
+
outerTmplName = templateCreator(element);
|
359
|
+
domutils.replaceHtml(element, '<!-- ko template: /* special */ (typeof templateMode != \'undefined\' && templateMode == \'wysiwyg\') || ' + condBinding + ' ? \'' + outerTmplName + '\' : \'' + innerTmplName + '\' --><!-- /ko -->');
|
360
|
+
} else {
|
361
|
+
// we put the content in a template and the frame in another template including this one.
|
362
|
+
innerTmplName = templateCreator(domutils.getInnerHtml(element));
|
363
|
+
domutils.removeAttribute(element, 'data-ko-wrap');
|
364
|
+
domutils.setContent(element, '<!-- ko template: \'' + innerTmplName + '\' --><!-- /ko -->');
|
365
|
+
outerTmplName = templateCreator(element);
|
366
|
+
domutils.replaceHtml(element, '<!-- ko template: (typeof templateMode != \'undefined\' && templateMode == \'wysiwyg\') || ' + condBinding + ' ? \'' + outerTmplName + '\' : \'' + innerTmplName + '\' --><!-- /ko -->');
|
367
|
+
}
|
368
|
+
|
369
|
+
});
|
370
|
+
|
371
|
+
templateCreator(element, templateName, 'show');
|
372
|
+
|
373
|
+
blockPusher(rootModelName, templateName, contextName, containerName);
|
374
|
+
|
375
|
+
return templateName;
|
376
|
+
|
377
|
+
} catch (e) {
|
378
|
+
console.error("Exception while parsing the template", e, element);
|
379
|
+
throw e;
|
380
|
+
}
|
381
|
+
|
382
|
+
};
|
383
|
+
|
384
|
+
function conditional_replace(html) {
|
385
|
+
return html.replace(/<!--\[if ([^\]]*)\]>((?:(?!--)[\s\S])*?)<!\[endif\]-->/g, function(match, condition, body) {
|
386
|
+
var dd = '<!-- cc:start -->';
|
387
|
+
dd += body.replace(/<([A-Za-z:]+)/g, '<!-- cc:bo:$1 --><cc') // before open tag
|
388
|
+
.replace(/<\/([A-Za-z:]+)>/g,'<!-- cc:bc:$1 --></cc><!-- cc:ac:$1 -->') // before/after close tag
|
389
|
+
.replace(/\/>/g,'/><!-- cc:sc -->'); // self-close tag
|
390
|
+
dd += '<!-- cc:end -->';
|
391
|
+
var output = '<replacedcc condition="'+condition+'" style="display: none">';
|
392
|
+
output += $('<div>').append($(dd)).html()
|
393
|
+
.replace(/^<!-- cc:start -->/, '')
|
394
|
+
.replace(/<!-- cc:end -->$/, '');
|
395
|
+
output += '</replacedcc>';
|
396
|
+
return output;
|
397
|
+
});
|
398
|
+
}
|
399
|
+
|
400
|
+
|
401
|
+
var translateTemplate = function(templateName, html, templateUrlConverter, templateCreator) {
|
402
|
+
var defs = {};
|
403
|
+
var replacedHtml = conditional_replace(html.replace(/(<[^>]+\s)(style|http-equiv)(="[^"]*"[^>]*>)/gi, function(match, p1, p2, p3) {
|
404
|
+
return p1 + 'replaced' + p2 + p3;
|
405
|
+
}));
|
406
|
+
var content = $(replacedHtml);
|
407
|
+
var element = content[0];
|
408
|
+
|
409
|
+
var blocks = []; // {rootName, blockName, containerName}
|
410
|
+
var _blockPusher = function(rootName, blockName, contextName, containerName) {
|
411
|
+
blocks.push({
|
412
|
+
root: rootName,
|
413
|
+
block: blockName,
|
414
|
+
context: contextName,
|
415
|
+
container: containerName
|
416
|
+
});
|
417
|
+
};
|
418
|
+
|
419
|
+
// TODO have to accept nulls as undefineds (because of model.js behaviour)
|
420
|
+
var themeUpdater = function(name, key, val) {
|
421
|
+
if (typeof defs['themes'] === 'undefined') defs['themes'] = {};
|
422
|
+
if (typeof defs['themes'][name] === 'undefined') defs['themes'][name] = {};
|
423
|
+
if (typeof defs['themes'][name][key] === 'undefined' || defs['themes'][name][key] === null) defs['themes'][name][key] = val;
|
424
|
+
else if (typeof val !== 'undefined' && val !== null) {
|
425
|
+
var precVal = defs['themes'][name][key];
|
426
|
+
if (precVal != val) console.log("Error setting a new default for property " + key + " in theme " + name + ". old:" + precVal + " new:" + val + "!");
|
427
|
+
}
|
428
|
+
};
|
429
|
+
|
430
|
+
var containers = $("[data-ko-container]", content);
|
431
|
+
var containersDom = {};
|
432
|
+
containers.each(function(index, element) {
|
433
|
+
var containerName = domutils.getAttribute(element, 'data-ko-container') + "Blocks";
|
434
|
+
|
435
|
+
domutils.removeAttribute(element, 'data-ko-container');
|
436
|
+
domutils.setAttribute(element, 'data-bind', 'block: ' + containerName);
|
437
|
+
|
438
|
+
var containerBlocks = $("> [data-ko-block]", element);
|
439
|
+
domutils.removeElements(containerBlocks, true);
|
440
|
+
|
441
|
+
containersDom[containerName] = containerBlocks;
|
442
|
+
});
|
443
|
+
|
444
|
+
// TODO remove hardcoded properties: we need them because without these loading a basic template fails.
|
445
|
+
// Needed in order to use data-ko-block
|
446
|
+
modelDef.createOrUpdateBlockDef(defs, 'id');
|
447
|
+
// Needed always as it is the default theme section.
|
448
|
+
modelDef.createOrUpdateBlockDef(defs, 'bodyTheme');
|
449
|
+
// Needed for data-ko-container
|
450
|
+
modelDef.createOrUpdateBlockDef(defs, 'blocks', 'blocks[]');
|
451
|
+
|
452
|
+
// Needed if you want to use a text variable? TODO this should not be needed!
|
453
|
+
modelDef.createOrUpdateBlockDef(defs, 'text');
|
454
|
+
|
455
|
+
processBlock(element, defs, themeUpdater, _blockPusher, templateUrlConverter, 'template', templateName, undefined, false, templateCreator);
|
456
|
+
|
457
|
+
var blockProcess = function(containerName, index, element) {
|
458
|
+
processBlock(element, defs, themeUpdater, _blockPusher, templateUrlConverter, 'block', templateName, containerName, true, templateCreator);
|
459
|
+
};
|
460
|
+
|
461
|
+
for (var prop in containersDom)
|
462
|
+
if (containersDom.hasOwnProperty(prop)) {
|
463
|
+
var containerBlocks = containersDom[prop];
|
464
|
+
var containerName = prop;
|
465
|
+
|
466
|
+
modelDef.ensurePathAndGetBindValue(defs, themeUpdater, templateName, templateName, '', containerName + ".blocks", "[]");
|
467
|
+
|
468
|
+
containerBlocks.each(blockProcess.bind(undefined, containerName));
|
469
|
+
}
|
470
|
+
|
471
|
+
var templateDef = {
|
472
|
+
_defs: defs,
|
473
|
+
templateName: templateName,
|
474
|
+
_blocks: blocks
|
475
|
+
};
|
476
|
+
|
477
|
+
if (typeof defs[templateName]._version !== 'undefined') {
|
478
|
+
templateDef.version = defs[templateName]._version;
|
479
|
+
}
|
480
|
+
|
481
|
+
return templateDef;
|
482
|
+
};
|
483
|
+
|
484
|
+
|
485
|
+
module.exports = translateTemplate;
|