locomotivecms 4.1.1 → 4.2.0.alpha2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +4 -3
- data/Rakefile +4 -0
- data/app/api/locomotive/api.rb +1 -1
- data/app/assets/config/locomotive_manifest.js +2 -0
- data/app/assets/javascripts/locomotive.js +2 -2
- data/app/assets/stylesheets/locomotive/account.scss +0 -1
- data/app/assets/stylesheets/locomotive/application.scss +0 -1
- data/app/assets/stylesheets/locomotive/live_editing_error.scss +0 -1
- data/app/assets/stylesheets/locomotive/live_editing_iframe.scss +0 -1
- data/app/controllers/locomotive/base_controller.rb +1 -1
- data/app/controllers/locomotive/concerns/authorization_controller.rb +1 -1
- data/app/controllers/locomotive/concerns/redirect_to_main_host_controller.rb +1 -1
- data/app/controllers/locomotive/concerns/site_dispatcher_controller.rb +1 -1
- data/app/controllers/locomotive/errors_controller.rb +1 -1
- data/app/controllers/locomotive/my_account_controller.rb +1 -1
- data/app/controllers/locomotive/passwords_controller.rb +3 -1
- data/app/controllers/locomotive/registrations_controller.rb +3 -1
- data/app/controllers/locomotive/sessions_controller.rb +3 -1
- data/app/controllers/locomotive/sites_controller.rb +1 -1
- data/app/helpers/locomotive/base_helper.rb +2 -2
- data/app/helpers/locomotive/custom_fields_helper.rb +2 -2
- data/app/helpers/locomotive/shared/activities_helper.rb +1 -1
- data/app/inputs/locomotive/api_key_input.rb +1 -1
- data/app/mailers/locomotive/notifications.rb +1 -1
- data/app/models/locomotive/account.rb +1 -1
- data/app/models/locomotive/concerns/account/api_key.rb +1 -1
- data/app/models/locomotive/concerns/content_entry/csv.rb +1 -1
- data/app/models/locomotive/concerns/content_entry/slug.rb +5 -5
- data/app/models/locomotive/concerns/content_type/entry_template.rb +3 -3
- data/app/models/locomotive/concerns/page/templatized.rb +1 -1
- data/app/models/locomotive/concerns/shared/json_attribute.rb +21 -2
- data/app/models/locomotive/concerns/site/routes.rb +1 -1
- data/app/models/locomotive/content_entry.rb +2 -2
- data/app/models/locomotive/page.rb +3 -3
- data/app/models/locomotive/section.rb +1 -1
- data/app/models/locomotive/snippet.rb +1 -1
- data/app/models/locomotive/translation.rb +1 -1
- data/app/services/locomotive/content_entry_import_service.rb +1 -1
- data/app/services/locomotive/content_entry_service.rb +2 -2
- data/app/services/locomotive/content_type_service.rb +13 -3
- data/app/services/locomotive/custom_field_service.rb +2 -2
- data/app/services/locomotive/editor_service.rb +1 -1
- data/app/uploaders/locomotive/base_uploader.rb +0 -10
- data/app/views/locomotive/dashboard/_activity.html.slim +1 -1
- data/app/views/locomotive/page_content/_edit.json.jbuilder +50 -0
- data/app/views/locomotive/page_content/edit.html.erb +1 -1
- data/app/views/locomotive/page_content/edit.json.jbuilder +52 -50
- data/config/initializers/devise.rb +5 -2
- data/lib/generators/locomotive/install/templates/locomotive.rb +0 -5
- data/lib/locomotive/action_controller/responder.rb +1 -1
- data/lib/locomotive/configuration.rb +2 -2
- data/lib/locomotive/dependencies.rb +0 -2
- data/lib/locomotive/engine.rb +14 -2
- data/lib/locomotive/mongoid/patches.rb +47 -65
- data/lib/locomotive/steam/services/api_entry_submission_service.rb +1 -0
- data/lib/locomotive/version.rb +1 -1
- data/vendor/assets/javascripts/locomotive/codemirror/addons/comment/comment.js +203 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/comment/continuecomment.js +85 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/dialog/dialog.js +157 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/display/autorefresh.js +47 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/display/fullscreen.js +41 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/display/panel.js +112 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/display/placeholder.js +62 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/display/rulers.js +51 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/closebrackets.js +195 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/closetag.js +169 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/continuelist.js +51 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/matchbrackets.js +120 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/matchtags.js +66 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/trailingspace.js +27 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/brace-fold.js +105 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/comment-fold.js +59 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/foldcode.js +150 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/foldgutter.js +146 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/indent-fold.js +44 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/markdown-fold.js +49 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/xml-fold.js +182 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/anyword-hint.js +41 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/css-hint.js +60 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/html-hint.js +348 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/javascript-hint.js +146 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/show-hint.js +437 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/sql-hint.js +271 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/xml-hint.js +110 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/coffeescript-lint.js +41 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/css-lint.js +35 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/html-lint.js +46 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/javascript-lint.js +136 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/json-lint.js +31 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/lint.js +239 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/yaml-lint.js +28 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/merge/merge.js +773 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/mode/loadmode.js +64 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/mode/multiplex.js +123 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/mode/overlay.js +85 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/mode/simple.js +213 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/runmode/colorize.js +40 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/runmode/runmode-standalone.js +157 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/runmode/runmode.js +72 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/runmode/runmode.node.js +179 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/scroll/annotatescrollbar.js +118 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/scroll/scrollpastend.js +48 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/scroll/simplescrollbars.js +152 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/search/jump-to-line.js +49 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/search/match-highlighter.js +146 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/search/matchesonscrollbar.js +97 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/search/search.js +249 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/search/searchcursor.js +189 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/selection/active-line.js +74 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/selection/mark-selection.js +118 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/selection/selection-pointer.js +98 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/tern/tern.js +701 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/tern/worker.js +44 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/wrap/hardwrap.js +144 -0
- data/vendor/assets/javascripts/locomotive/codemirror/keymaps/emacs.js +412 -0
- data/vendor/assets/javascripts/locomotive/codemirror/keymaps/sublime.js +580 -0
- data/vendor/assets/javascripts/locomotive/codemirror/keymaps/vim.js +5065 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/apl.js +174 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/asciiarmor.js +73 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/asn.1.js +204 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/asterisk.js +196 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/brainfuck.js +85 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/clike.js +786 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/clojure.js +306 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/cmake.js +97 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/cobol.js +255 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/coffeescript.js +355 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/commonlisp.js +123 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/crystal.js +391 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/css.js +825 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/cypher.js +146 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/d.js +218 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/dart.js +157 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/diff.js +47 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/django.js +356 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/dockerfile.js +79 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/dtd.js +142 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/dylan.js +344 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/ebnf.js +195 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/ecl.js +206 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/eiffel.js +160 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/elm.js +205 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/erlang.js +618 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/factor.js +83 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/fcl.js +173 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/forth.js +180 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/fortran.js +188 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/gas.js +345 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/gfm.js +130 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/gherkin.js +178 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/go.js +185 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/groovy.js +230 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/haml.js +161 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/handlebars.js +62 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/haskell-literate.js +43 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/haskell.js +267 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/haxe.js +515 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/htmlembedded.js +28 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/htmlmixed.js +152 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/http.js +113 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/idl.js +290 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/jade.js +590 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/javascript.js +748 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/jinja2.js +142 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/jsx.js +147 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/julia.js +392 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/livescript.js +280 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/lua.js +159 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/markdown.js +797 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/mathematica.js +176 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/mbox.js +129 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/mirc.js +193 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/mllike.js +205 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/modelica.js +245 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/mscgen.js +169 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/mumps.js +148 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/nginx.js +178 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/nsis.js +95 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/ntriples.js +186 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/octave.js +135 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/oz.js +252 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/pascal.js +109 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/pegjs.js +114 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/perl.js +837 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/php.js +234 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/pig.js +178 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/powershell.js +396 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/properties.js +78 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/protobuf.js +68 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/puppet.js +220 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/python.js +340 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/q.js +139 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/r.js +164 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/rpm.js +109 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/rst.js +557 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/ruby.js +285 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/rust.js +71 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/sas.js +315 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/sass.js +414 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/scheme.js +249 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/shell.js +139 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/sieve.js +193 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/slim.js +575 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/smalltalk.js +168 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/smarty.js +225 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/solr.js +104 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/soy.js +199 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/sparql.js +180 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/spreadsheet.js +112 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/sql.js +413 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/stex.js +251 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/stylus.js +769 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/swift.js +202 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/tcl.js +139 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/textile.js +469 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/tiddlywiki.js +308 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/tiki.js +312 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/toml.js +88 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/tornado.js +68 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/troff.js +84 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/ttcn-cfg.js +214 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/ttcn.js +283 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/turtle.js +162 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/twig.js +141 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/vb.js +276 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/vbscript.js +350 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/velocity.js +201 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/verilog.js +537 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/vhdl.js +189 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/vue.js +69 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/webidl.js +195 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/xml.js +394 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/xquery.js +437 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/yacas.js +204 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/yaml-frontmatter.js +68 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/yaml.js +117 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/z80.js +116 -0
- data/vendor/assets/javascripts/locomotive/codemirror.js +8922 -0
- data/vendor/assets/javascripts/locomotive/select2.js +436 -175
- data/vendor/assets/javascripts/locomotive/wysihtml5x-toolbar.js +1346 -564
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/dialog/dialog.css +32 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/display/fullscreen.css +6 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/fold/foldgutter.css +20 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/hint/show-hint.css +37 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/lint/lint.css +73 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/merge/merge.css +113 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/scroll/simplescrollbars.css +66 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/search/matchesonscrollbar.css +8 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/tern/tern.css +87 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/modes/tiddlywiki.css +14 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/modes/tiki.css +26 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/3024-day.css +41 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/3024-night.css +39 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/abcdef.css +32 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/ambiance-mobile.css +5 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/ambiance.css +74 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/base16-dark.css +38 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/base16-light.css +38 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/bespin.css +34 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/blackboard.css +32 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/cobalt.css +25 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/colorforth.css +33 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/dracula.css +41 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/eclipse.css +23 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/elegant.css +13 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/erlang-dark.css +34 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/hopscotch.css +34 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/icecoder.css +43 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/isotope.css +34 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/lesser-dark.css +47 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/liquibyte.css +95 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/material.css +53 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/mbo.css +37 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/mdn-like.css +46 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/midnight.css +45 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/monokai.css +36 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/neat.css +12 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/neo.css +43 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/night.css +27 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/paraiso-dark.css +38 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/paraiso-light.css +38 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/pastel-on-dark.css +53 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/railscasts.css +34 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/rubyblue.css +25 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/seti.css +44 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/solarized.css +169 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/the-matrix.css +30 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/tomorrow-night-bright.css +35 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/tomorrow-night-eighties.css +38 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/ttcn.css +64 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/twilight.css +32 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/vibrant-ink.css +34 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/xq-dark.css +53 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/xq-light.css +43 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/yeti.css +44 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/zenburn.css +37 -0
- data/vendor/assets/stylesheets/locomotive/codemirror.css +347 -0
- data/vendor/assets/stylesheets/locomotive/select2.css +3 -6
- metadata +349 -128
@@ -0,0 +1,271 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"), require("../../mode/sql/sql"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror", "../../mode/sql/sql"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
"use strict";
|
13
|
+
|
14
|
+
var tables;
|
15
|
+
var defaultTable;
|
16
|
+
var keywords;
|
17
|
+
var CONS = {
|
18
|
+
QUERY_DIV: ";",
|
19
|
+
ALIAS_KEYWORD: "AS"
|
20
|
+
};
|
21
|
+
var Pos = CodeMirror.Pos, cmpPos = CodeMirror.cmpPos;
|
22
|
+
|
23
|
+
function isArray(val) { return Object.prototype.toString.call(val) == "[object Array]" }
|
24
|
+
|
25
|
+
function getKeywords(editor) {
|
26
|
+
var mode = editor.doc.modeOption;
|
27
|
+
if (mode === "sql") mode = "text/x-sql";
|
28
|
+
return CodeMirror.resolveMode(mode).keywords;
|
29
|
+
}
|
30
|
+
|
31
|
+
function getText(item) {
|
32
|
+
return typeof item == "string" ? item : item.text;
|
33
|
+
}
|
34
|
+
|
35
|
+
function wrapTable(name, value) {
|
36
|
+
if (isArray(value)) value = {columns: value}
|
37
|
+
if (!value.text) value.text = name
|
38
|
+
return value
|
39
|
+
}
|
40
|
+
|
41
|
+
function parseTables(input) {
|
42
|
+
var result = {}
|
43
|
+
if (isArray(input)) {
|
44
|
+
for (var i = input.length - 1; i >= 0; i--) {
|
45
|
+
var item = input[i]
|
46
|
+
result[getText(item).toUpperCase()] = wrapTable(getText(item), item)
|
47
|
+
}
|
48
|
+
} else if (input) {
|
49
|
+
for (var name in input)
|
50
|
+
result[name.toUpperCase()] = wrapTable(name, input[name])
|
51
|
+
}
|
52
|
+
return result
|
53
|
+
}
|
54
|
+
|
55
|
+
function getTable(name) {
|
56
|
+
return tables[name.toUpperCase()]
|
57
|
+
}
|
58
|
+
|
59
|
+
function shallowClone(object) {
|
60
|
+
var result = {};
|
61
|
+
for (var key in object) if (object.hasOwnProperty(key))
|
62
|
+
result[key] = object[key];
|
63
|
+
return result;
|
64
|
+
}
|
65
|
+
|
66
|
+
function match(string, word) {
|
67
|
+
var len = string.length;
|
68
|
+
var sub = getText(word).substr(0, len);
|
69
|
+
return string.toUpperCase() === sub.toUpperCase();
|
70
|
+
}
|
71
|
+
|
72
|
+
function addMatches(result, search, wordlist, formatter) {
|
73
|
+
if (isArray(wordlist)) {
|
74
|
+
for (var i = 0; i < wordlist.length; i++)
|
75
|
+
if (match(search, wordlist[i])) result.push(formatter(wordlist[i]))
|
76
|
+
} else {
|
77
|
+
for (var word in wordlist) if (wordlist.hasOwnProperty(word)) {
|
78
|
+
var val = wordlist[word]
|
79
|
+
if (!val || val === true)
|
80
|
+
val = word
|
81
|
+
else
|
82
|
+
val = val.displayText ? {text: val.text, displayText: val.displayText} : val.text
|
83
|
+
if (match(search, val)) result.push(formatter(val))
|
84
|
+
}
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
function cleanName(name) {
|
89
|
+
// Get rid name from backticks(`) and preceding dot(.)
|
90
|
+
if (name.charAt(0) == ".") {
|
91
|
+
name = name.substr(1);
|
92
|
+
}
|
93
|
+
return name.replace(/`/g, "");
|
94
|
+
}
|
95
|
+
|
96
|
+
function insertBackticks(name) {
|
97
|
+
var nameParts = getText(name).split(".");
|
98
|
+
for (var i = 0; i < nameParts.length; i++)
|
99
|
+
nameParts[i] = "`" + nameParts[i] + "`";
|
100
|
+
var escaped = nameParts.join(".");
|
101
|
+
if (typeof name == "string") return escaped;
|
102
|
+
name = shallowClone(name);
|
103
|
+
name.text = escaped;
|
104
|
+
return name;
|
105
|
+
}
|
106
|
+
|
107
|
+
function nameCompletion(cur, token, result, editor) {
|
108
|
+
// Try to complete table, column names and return start position of completion
|
109
|
+
var useBacktick = false;
|
110
|
+
var nameParts = [];
|
111
|
+
var start = token.start;
|
112
|
+
var cont = true;
|
113
|
+
while (cont) {
|
114
|
+
cont = (token.string.charAt(0) == ".");
|
115
|
+
useBacktick = useBacktick || (token.string.charAt(0) == "`");
|
116
|
+
|
117
|
+
start = token.start;
|
118
|
+
nameParts.unshift(cleanName(token.string));
|
119
|
+
|
120
|
+
token = editor.getTokenAt(Pos(cur.line, token.start));
|
121
|
+
if (token.string == ".") {
|
122
|
+
cont = true;
|
123
|
+
token = editor.getTokenAt(Pos(cur.line, token.start));
|
124
|
+
}
|
125
|
+
}
|
126
|
+
|
127
|
+
// Try to complete table names
|
128
|
+
var string = nameParts.join(".");
|
129
|
+
addMatches(result, string, tables, function(w) {
|
130
|
+
return useBacktick ? insertBackticks(w) : w;
|
131
|
+
});
|
132
|
+
|
133
|
+
// Try to complete columns from defaultTable
|
134
|
+
addMatches(result, string, defaultTable, function(w) {
|
135
|
+
return useBacktick ? insertBackticks(w) : w;
|
136
|
+
});
|
137
|
+
|
138
|
+
// Try to complete columns
|
139
|
+
string = nameParts.pop();
|
140
|
+
var table = nameParts.join(".");
|
141
|
+
|
142
|
+
var alias = false;
|
143
|
+
var aliasTable = table;
|
144
|
+
// Check if table is available. If not, find table by Alias
|
145
|
+
if (!getTable(table)) {
|
146
|
+
var oldTable = table;
|
147
|
+
table = findTableByAlias(table, editor);
|
148
|
+
if (table !== oldTable) alias = true;
|
149
|
+
}
|
150
|
+
|
151
|
+
var columns = getTable(table);
|
152
|
+
if (columns && columns.columns)
|
153
|
+
columns = columns.columns;
|
154
|
+
|
155
|
+
if (columns) {
|
156
|
+
addMatches(result, string, columns, function(w) {
|
157
|
+
var tableInsert = table;
|
158
|
+
if (alias == true) tableInsert = aliasTable;
|
159
|
+
if (typeof w == "string") {
|
160
|
+
w = tableInsert + "." + w;
|
161
|
+
} else {
|
162
|
+
w = shallowClone(w);
|
163
|
+
w.text = tableInsert + "." + w.text;
|
164
|
+
}
|
165
|
+
return useBacktick ? insertBackticks(w) : w;
|
166
|
+
});
|
167
|
+
}
|
168
|
+
|
169
|
+
return start;
|
170
|
+
}
|
171
|
+
|
172
|
+
function eachWord(lineText, f) {
|
173
|
+
if (!lineText) return;
|
174
|
+
var excepted = /[,;]/g;
|
175
|
+
var words = lineText.split(" ");
|
176
|
+
for (var i = 0; i < words.length; i++) {
|
177
|
+
f(words[i]?words[i].replace(excepted, '') : '');
|
178
|
+
}
|
179
|
+
}
|
180
|
+
|
181
|
+
function findTableByAlias(alias, editor) {
|
182
|
+
var doc = editor.doc;
|
183
|
+
var fullQuery = doc.getValue();
|
184
|
+
var aliasUpperCase = alias.toUpperCase();
|
185
|
+
var previousWord = "";
|
186
|
+
var table = "";
|
187
|
+
var separator = [];
|
188
|
+
var validRange = {
|
189
|
+
start: Pos(0, 0),
|
190
|
+
end: Pos(editor.lastLine(), editor.getLineHandle(editor.lastLine()).length)
|
191
|
+
};
|
192
|
+
|
193
|
+
//add separator
|
194
|
+
var indexOfSeparator = fullQuery.indexOf(CONS.QUERY_DIV);
|
195
|
+
while(indexOfSeparator != -1) {
|
196
|
+
separator.push(doc.posFromIndex(indexOfSeparator));
|
197
|
+
indexOfSeparator = fullQuery.indexOf(CONS.QUERY_DIV, indexOfSeparator+1);
|
198
|
+
}
|
199
|
+
separator.unshift(Pos(0, 0));
|
200
|
+
separator.push(Pos(editor.lastLine(), editor.getLineHandle(editor.lastLine()).text.length));
|
201
|
+
|
202
|
+
//find valid range
|
203
|
+
var prevItem = null;
|
204
|
+
var current = editor.getCursor()
|
205
|
+
for (var i = 0; i < separator.length; i++) {
|
206
|
+
if ((prevItem == null || cmpPos(current, prevItem) > 0) && cmpPos(current, separator[i]) <= 0) {
|
207
|
+
validRange = {start: prevItem, end: separator[i]};
|
208
|
+
break;
|
209
|
+
}
|
210
|
+
prevItem = separator[i];
|
211
|
+
}
|
212
|
+
|
213
|
+
var query = doc.getRange(validRange.start, validRange.end, false);
|
214
|
+
|
215
|
+
for (var i = 0; i < query.length; i++) {
|
216
|
+
var lineText = query[i];
|
217
|
+
eachWord(lineText, function(word) {
|
218
|
+
var wordUpperCase = word.toUpperCase();
|
219
|
+
if (wordUpperCase === aliasUpperCase && getTable(previousWord))
|
220
|
+
table = previousWord;
|
221
|
+
if (wordUpperCase !== CONS.ALIAS_KEYWORD)
|
222
|
+
previousWord = word;
|
223
|
+
});
|
224
|
+
if (table) break;
|
225
|
+
}
|
226
|
+
return table;
|
227
|
+
}
|
228
|
+
|
229
|
+
CodeMirror.registerHelper("hint", "sql", function(editor, options) {
|
230
|
+
tables = parseTables(options && options.tables)
|
231
|
+
var defaultTableName = options && options.defaultTable;
|
232
|
+
var disableKeywords = options && options.disableKeywords;
|
233
|
+
defaultTable = defaultTableName && getTable(defaultTableName);
|
234
|
+
keywords = getKeywords(editor);
|
235
|
+
|
236
|
+
if (defaultTableName && !defaultTable)
|
237
|
+
defaultTable = findTableByAlias(defaultTableName, editor);
|
238
|
+
|
239
|
+
defaultTable = defaultTable || [];
|
240
|
+
|
241
|
+
if (defaultTable.columns)
|
242
|
+
defaultTable = defaultTable.columns;
|
243
|
+
|
244
|
+
var cur = editor.getCursor();
|
245
|
+
var result = [];
|
246
|
+
var token = editor.getTokenAt(cur), start, end, search;
|
247
|
+
if (token.end > cur.ch) {
|
248
|
+
token.end = cur.ch;
|
249
|
+
token.string = token.string.slice(0, cur.ch - token.start);
|
250
|
+
}
|
251
|
+
|
252
|
+
if (token.string.match(/^[.`\w@]\w*$/)) {
|
253
|
+
search = token.string;
|
254
|
+
start = token.start;
|
255
|
+
end = token.end;
|
256
|
+
} else {
|
257
|
+
start = end = cur.ch;
|
258
|
+
search = "";
|
259
|
+
}
|
260
|
+
if (search.charAt(0) == "." || search.charAt(0) == "`") {
|
261
|
+
start = nameCompletion(cur, token, result, editor);
|
262
|
+
} else {
|
263
|
+
addMatches(result, search, tables, function(w) {return w;});
|
264
|
+
addMatches(result, search, defaultTable, function(w) {return w;});
|
265
|
+
if (!disableKeywords)
|
266
|
+
addMatches(result, search, keywords, function(w) {return w.toUpperCase();});
|
267
|
+
}
|
268
|
+
|
269
|
+
return {list: result, from: Pos(cur.line, start), to: Pos(cur.line, end)};
|
270
|
+
});
|
271
|
+
});
|
@@ -0,0 +1,110 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
"use strict";
|
13
|
+
|
14
|
+
var Pos = CodeMirror.Pos;
|
15
|
+
|
16
|
+
function getHints(cm, options) {
|
17
|
+
var tags = options && options.schemaInfo;
|
18
|
+
var quote = (options && options.quoteChar) || '"';
|
19
|
+
if (!tags) return;
|
20
|
+
var cur = cm.getCursor(), token = cm.getTokenAt(cur);
|
21
|
+
if (token.end > cur.ch) {
|
22
|
+
token.end = cur.ch;
|
23
|
+
token.string = token.string.slice(0, cur.ch - token.start);
|
24
|
+
}
|
25
|
+
var inner = CodeMirror.innerMode(cm.getMode(), token.state);
|
26
|
+
if (inner.mode.name != "xml") return;
|
27
|
+
var result = [], replaceToken = false, prefix;
|
28
|
+
var tag = /\btag\b/.test(token.type) && !/>$/.test(token.string);
|
29
|
+
var tagName = tag && /^\w/.test(token.string), tagStart;
|
30
|
+
|
31
|
+
if (tagName) {
|
32
|
+
var before = cm.getLine(cur.line).slice(Math.max(0, token.start - 2), token.start);
|
33
|
+
var tagType = /<\/$/.test(before) ? "close" : /<$/.test(before) ? "open" : null;
|
34
|
+
if (tagType) tagStart = token.start - (tagType == "close" ? 2 : 1);
|
35
|
+
} else if (tag && token.string == "<") {
|
36
|
+
tagType = "open";
|
37
|
+
} else if (tag && token.string == "</") {
|
38
|
+
tagType = "close";
|
39
|
+
}
|
40
|
+
|
41
|
+
if (!tag && !inner.state.tagName || tagType) {
|
42
|
+
if (tagName)
|
43
|
+
prefix = token.string;
|
44
|
+
replaceToken = tagType;
|
45
|
+
var cx = inner.state.context, curTag = cx && tags[cx.tagName];
|
46
|
+
var childList = cx ? curTag && curTag.children : tags["!top"];
|
47
|
+
if (childList && tagType != "close") {
|
48
|
+
for (var i = 0; i < childList.length; ++i) if (!prefix || childList[i].lastIndexOf(prefix, 0) == 0)
|
49
|
+
result.push("<" + childList[i]);
|
50
|
+
} else if (tagType != "close") {
|
51
|
+
for (var name in tags)
|
52
|
+
if (tags.hasOwnProperty(name) && name != "!top" && name != "!attrs" && (!prefix || name.lastIndexOf(prefix, 0) == 0))
|
53
|
+
result.push("<" + name);
|
54
|
+
}
|
55
|
+
if (cx && (!prefix || tagType == "close" && cx.tagName.lastIndexOf(prefix, 0) == 0))
|
56
|
+
result.push("</" + cx.tagName + ">");
|
57
|
+
} else {
|
58
|
+
// Attribute completion
|
59
|
+
var curTag = tags[inner.state.tagName], attrs = curTag && curTag.attrs;
|
60
|
+
var globalAttrs = tags["!attrs"];
|
61
|
+
if (!attrs && !globalAttrs) return;
|
62
|
+
if (!attrs) {
|
63
|
+
attrs = globalAttrs;
|
64
|
+
} else if (globalAttrs) { // Combine tag-local and global attributes
|
65
|
+
var set = {};
|
66
|
+
for (var nm in globalAttrs) if (globalAttrs.hasOwnProperty(nm)) set[nm] = globalAttrs[nm];
|
67
|
+
for (var nm in attrs) if (attrs.hasOwnProperty(nm)) set[nm] = attrs[nm];
|
68
|
+
attrs = set;
|
69
|
+
}
|
70
|
+
if (token.type == "string" || token.string == "=") { // A value
|
71
|
+
var before = cm.getRange(Pos(cur.line, Math.max(0, cur.ch - 60)),
|
72
|
+
Pos(cur.line, token.type == "string" ? token.start : token.end));
|
73
|
+
var atName = before.match(/([^\s\u00a0=<>\"\']+)=$/), atValues;
|
74
|
+
if (!atName || !attrs.hasOwnProperty(atName[1]) || !(atValues = attrs[atName[1]])) return;
|
75
|
+
if (typeof atValues == 'function') atValues = atValues.call(this, cm); // Functions can be used to supply values for autocomplete widget
|
76
|
+
if (token.type == "string") {
|
77
|
+
prefix = token.string;
|
78
|
+
var n = 0;
|
79
|
+
if (/['"]/.test(token.string.charAt(0))) {
|
80
|
+
quote = token.string.charAt(0);
|
81
|
+
prefix = token.string.slice(1);
|
82
|
+
n++;
|
83
|
+
}
|
84
|
+
var len = token.string.length;
|
85
|
+
if (/['"]/.test(token.string.charAt(len - 1))) {
|
86
|
+
quote = token.string.charAt(len - 1);
|
87
|
+
prefix = token.string.substr(n, len - 2);
|
88
|
+
}
|
89
|
+
replaceToken = true;
|
90
|
+
}
|
91
|
+
for (var i = 0; i < atValues.length; ++i) if (!prefix || atValues[i].lastIndexOf(prefix, 0) == 0)
|
92
|
+
result.push(quote + atValues[i] + quote);
|
93
|
+
} else { // An attribute name
|
94
|
+
if (token.type == "attribute") {
|
95
|
+
prefix = token.string;
|
96
|
+
replaceToken = true;
|
97
|
+
}
|
98
|
+
for (var attr in attrs) if (attrs.hasOwnProperty(attr) && (!prefix || attr.lastIndexOf(prefix, 0) == 0))
|
99
|
+
result.push(attr);
|
100
|
+
}
|
101
|
+
}
|
102
|
+
return {
|
103
|
+
list: result,
|
104
|
+
from: replaceToken ? Pos(cur.line, tagStart == null ? token.start : tagStart) : cur,
|
105
|
+
to: replaceToken ? Pos(cur.line, token.end) : cur
|
106
|
+
};
|
107
|
+
}
|
108
|
+
|
109
|
+
CodeMirror.registerHelper("hint", "xml", getHints);
|
110
|
+
});
|
@@ -0,0 +1,41 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
// Depends on coffeelint.js from http://www.coffeelint.org/js/coffeelint.js
|
5
|
+
|
6
|
+
// declare global: coffeelint
|
7
|
+
|
8
|
+
(function(mod) {
|
9
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
10
|
+
mod(require("../../lib/codemirror"));
|
11
|
+
else if (typeof define == "function" && define.amd) // AMD
|
12
|
+
define(["../../lib/codemirror"], mod);
|
13
|
+
else // Plain browser env
|
14
|
+
mod(CodeMirror);
|
15
|
+
})(function(CodeMirror) {
|
16
|
+
"use strict";
|
17
|
+
|
18
|
+
CodeMirror.registerHelper("lint", "coffeescript", function(text) {
|
19
|
+
var found = [];
|
20
|
+
var parseError = function(err) {
|
21
|
+
var loc = err.lineNumber;
|
22
|
+
found.push({from: CodeMirror.Pos(loc-1, 0),
|
23
|
+
to: CodeMirror.Pos(loc, 0),
|
24
|
+
severity: err.level,
|
25
|
+
message: err.message});
|
26
|
+
};
|
27
|
+
try {
|
28
|
+
var res = coffeelint.lint(text);
|
29
|
+
for(var i = 0; i < res.length; i++) {
|
30
|
+
parseError(res[i]);
|
31
|
+
}
|
32
|
+
} catch(e) {
|
33
|
+
found.push({from: CodeMirror.Pos(e.location.first_line, 0),
|
34
|
+
to: CodeMirror.Pos(e.location.last_line, e.location.last_column),
|
35
|
+
severity: 'error',
|
36
|
+
message: e.message});
|
37
|
+
}
|
38
|
+
return found;
|
39
|
+
});
|
40
|
+
|
41
|
+
});
|
@@ -0,0 +1,35 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
// Depends on csslint.js from https://github.com/stubbornella/csslint
|
5
|
+
|
6
|
+
// declare global: CSSLint
|
7
|
+
|
8
|
+
(function(mod) {
|
9
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
10
|
+
mod(require("../../lib/codemirror"));
|
11
|
+
else if (typeof define == "function" && define.amd) // AMD
|
12
|
+
define(["../../lib/codemirror"], mod);
|
13
|
+
else // Plain browser env
|
14
|
+
mod(CodeMirror);
|
15
|
+
})(function(CodeMirror) {
|
16
|
+
"use strict";
|
17
|
+
|
18
|
+
CodeMirror.registerHelper("lint", "css", function(text) {
|
19
|
+
var found = [];
|
20
|
+
if (!window.CSSLint) return found;
|
21
|
+
var results = CSSLint.verify(text), messages = results.messages, message = null;
|
22
|
+
for ( var i = 0; i < messages.length; i++) {
|
23
|
+
message = messages[i];
|
24
|
+
var startLine = message.line -1, endLine = message.line -1, startCol = message.col -1, endCol = message.col;
|
25
|
+
found.push({
|
26
|
+
from: CodeMirror.Pos(startLine, startCol),
|
27
|
+
to: CodeMirror.Pos(endLine, endCol),
|
28
|
+
message: message.message,
|
29
|
+
severity : message.type
|
30
|
+
});
|
31
|
+
}
|
32
|
+
return found;
|
33
|
+
});
|
34
|
+
|
35
|
+
});
|
@@ -0,0 +1,46 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
// Depends on htmlhint.js from http://htmlhint.com/js/htmlhint.js
|
5
|
+
|
6
|
+
// declare global: HTMLHint
|
7
|
+
|
8
|
+
(function(mod) {
|
9
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
10
|
+
mod(require("../../lib/codemirror"), require("htmlhint"));
|
11
|
+
else if (typeof define == "function" && define.amd) // AMD
|
12
|
+
define(["../../lib/codemirror", "htmlhint"], mod);
|
13
|
+
else // Plain browser env
|
14
|
+
mod(CodeMirror);
|
15
|
+
})(function(CodeMirror) {
|
16
|
+
"use strict";
|
17
|
+
|
18
|
+
var defaultRules = {
|
19
|
+
"tagname-lowercase": true,
|
20
|
+
"attr-lowercase": true,
|
21
|
+
"attr-value-double-quotes": true,
|
22
|
+
"doctype-first": false,
|
23
|
+
"tag-pair": true,
|
24
|
+
"spec-char-escape": true,
|
25
|
+
"id-unique": true,
|
26
|
+
"src-not-empty": true,
|
27
|
+
"attr-no-duplication": true
|
28
|
+
};
|
29
|
+
|
30
|
+
CodeMirror.registerHelper("lint", "html", function(text, options) {
|
31
|
+
var found = [];
|
32
|
+
if (!window.HTMLHint) return found;
|
33
|
+
var messages = HTMLHint.verify(text, options && options.rules || defaultRules);
|
34
|
+
for (var i = 0; i < messages.length; i++) {
|
35
|
+
var message = messages[i];
|
36
|
+
var startLine = message.line - 1, endLine = message.line - 1, startCol = message.col - 1, endCol = message.col;
|
37
|
+
found.push({
|
38
|
+
from: CodeMirror.Pos(startLine, startCol),
|
39
|
+
to: CodeMirror.Pos(endLine, endCol),
|
40
|
+
message: message.message,
|
41
|
+
severity : message.type
|
42
|
+
});
|
43
|
+
}
|
44
|
+
return found;
|
45
|
+
});
|
46
|
+
});
|
@@ -0,0 +1,136 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
"use strict";
|
13
|
+
// declare global: JSHINT
|
14
|
+
|
15
|
+
var bogus = [ "Dangerous comment" ];
|
16
|
+
|
17
|
+
var warnings = [ [ "Expected '{'",
|
18
|
+
"Statement body should be inside '{ }' braces." ] ];
|
19
|
+
|
20
|
+
var errors = [ "Missing semicolon", "Extra comma", "Missing property name",
|
21
|
+
"Unmatched ", " and instead saw", " is not defined",
|
22
|
+
"Unclosed string", "Stopping, unable to continue" ];
|
23
|
+
|
24
|
+
function validator(text, options) {
|
25
|
+
if (!window.JSHINT) return [];
|
26
|
+
JSHINT(text, options, options.globals);
|
27
|
+
var errors = JSHINT.data().errors, result = [];
|
28
|
+
if (errors) parseErrors(errors, result);
|
29
|
+
return result;
|
30
|
+
}
|
31
|
+
|
32
|
+
CodeMirror.registerHelper("lint", "javascript", validator);
|
33
|
+
|
34
|
+
function cleanup(error) {
|
35
|
+
// All problems are warnings by default
|
36
|
+
fixWith(error, warnings, "warning", true);
|
37
|
+
fixWith(error, errors, "error");
|
38
|
+
|
39
|
+
return isBogus(error) ? null : error;
|
40
|
+
}
|
41
|
+
|
42
|
+
function fixWith(error, fixes, severity, force) {
|
43
|
+
var description, fix, find, replace, found;
|
44
|
+
|
45
|
+
description = error.description;
|
46
|
+
|
47
|
+
for ( var i = 0; i < fixes.length; i++) {
|
48
|
+
fix = fixes[i];
|
49
|
+
find = (typeof fix === "string" ? fix : fix[0]);
|
50
|
+
replace = (typeof fix === "string" ? null : fix[1]);
|
51
|
+
found = description.indexOf(find) !== -1;
|
52
|
+
|
53
|
+
if (force || found) {
|
54
|
+
error.severity = severity;
|
55
|
+
}
|
56
|
+
if (found && replace) {
|
57
|
+
error.description = replace;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
function isBogus(error) {
|
63
|
+
var description = error.description;
|
64
|
+
for ( var i = 0; i < bogus.length; i++) {
|
65
|
+
if (description.indexOf(bogus[i]) !== -1) {
|
66
|
+
return true;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
return false;
|
70
|
+
}
|
71
|
+
|
72
|
+
function parseErrors(errors, output) {
|
73
|
+
for ( var i = 0; i < errors.length; i++) {
|
74
|
+
var error = errors[i];
|
75
|
+
if (error) {
|
76
|
+
var linetabpositions, index;
|
77
|
+
|
78
|
+
linetabpositions = [];
|
79
|
+
|
80
|
+
// This next block is to fix a problem in jshint. Jshint
|
81
|
+
// replaces
|
82
|
+
// all tabs with spaces then performs some checks. The error
|
83
|
+
// positions (character/space) are then reported incorrectly,
|
84
|
+
// not taking the replacement step into account. Here we look
|
85
|
+
// at the evidence line and try to adjust the character position
|
86
|
+
// to the correct value.
|
87
|
+
if (error.evidence) {
|
88
|
+
// Tab positions are computed once per line and cached
|
89
|
+
var tabpositions = linetabpositions[error.line];
|
90
|
+
if (!tabpositions) {
|
91
|
+
var evidence = error.evidence;
|
92
|
+
tabpositions = [];
|
93
|
+
// ugggh phantomjs does not like this
|
94
|
+
// forEachChar(evidence, function(item, index) {
|
95
|
+
Array.prototype.forEach.call(evidence, function(item,
|
96
|
+
index) {
|
97
|
+
if (item === '\t') {
|
98
|
+
// First col is 1 (not 0) to match error
|
99
|
+
// positions
|
100
|
+
tabpositions.push(index + 1);
|
101
|
+
}
|
102
|
+
});
|
103
|
+
linetabpositions[error.line] = tabpositions;
|
104
|
+
}
|
105
|
+
if (tabpositions.length > 0) {
|
106
|
+
var pos = error.character;
|
107
|
+
tabpositions.forEach(function(tabposition) {
|
108
|
+
if (pos > tabposition) pos -= 1;
|
109
|
+
});
|
110
|
+
error.character = pos;
|
111
|
+
}
|
112
|
+
}
|
113
|
+
|
114
|
+
var start = error.character - 1, end = start + 1;
|
115
|
+
if (error.evidence) {
|
116
|
+
index = error.evidence.substring(start).search(/.\b/);
|
117
|
+
if (index > -1) {
|
118
|
+
end += index;
|
119
|
+
}
|
120
|
+
}
|
121
|
+
|
122
|
+
// Convert to format expected by validation service
|
123
|
+
error.description = error.reason;// + "(jshint)";
|
124
|
+
error.start = error.character;
|
125
|
+
error.end = end;
|
126
|
+
error = cleanup(error);
|
127
|
+
|
128
|
+
if (error)
|
129
|
+
output.push({message: error.description,
|
130
|
+
severity: error.severity,
|
131
|
+
from: CodeMirror.Pos(error.line - 1, start),
|
132
|
+
to: CodeMirror.Pos(error.line - 1, end)});
|
133
|
+
}
|
134
|
+
}
|
135
|
+
}
|
136
|
+
});
|
@@ -0,0 +1,31 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
// Depends on jsonlint.js from https://github.com/zaach/jsonlint
|
5
|
+
|
6
|
+
// declare global: jsonlint
|
7
|
+
|
8
|
+
(function(mod) {
|
9
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
10
|
+
mod(require("../../lib/codemirror"));
|
11
|
+
else if (typeof define == "function" && define.amd) // AMD
|
12
|
+
define(["../../lib/codemirror"], mod);
|
13
|
+
else // Plain browser env
|
14
|
+
mod(CodeMirror);
|
15
|
+
})(function(CodeMirror) {
|
16
|
+
"use strict";
|
17
|
+
|
18
|
+
CodeMirror.registerHelper("lint", "json", function(text) {
|
19
|
+
var found = [];
|
20
|
+
jsonlint.parseError = function(str, hash) {
|
21
|
+
var loc = hash.loc;
|
22
|
+
found.push({from: CodeMirror.Pos(loc.first_line - 1, loc.first_column),
|
23
|
+
to: CodeMirror.Pos(loc.last_line - 1, loc.last_column),
|
24
|
+
message: str});
|
25
|
+
};
|
26
|
+
try { jsonlint.parse(text); }
|
27
|
+
catch(e) {}
|
28
|
+
return found;
|
29
|
+
});
|
30
|
+
|
31
|
+
});
|