vapid 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.gitmodules +6 -0
- data/.rspec +2 -0
- data/.rubocop.yml +133 -0
- data/.travis.yml +5 -0
- data/Gemfile +10 -0
- data/README.md +37 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/vapid +7 -0
- data/lib/vapid.rb +24 -0
- data/lib/vapid/assets/javascripts/vapid/admin.coffee +2 -0
- data/lib/vapid/assets/stylesheets/vapid/admin.scss +72 -0
- data/lib/vapid/builder.rb +70 -0
- data/lib/vapid/cli.rb +96 -0
- data/lib/vapid/controllers/admin_controller.rb +282 -0
- data/lib/vapid/controllers/project_controller.rb +41 -0
- data/lib/vapid/db/migrate/20170202182310_create_groups.rb +12 -0
- data/lib/vapid/db/migrate/20170202183017_create_records.rb +11 -0
- data/lib/vapid/db/migrate/20170202185150_create_users.rb +11 -0
- data/lib/vapid/directive.rb +168 -0
- data/lib/vapid/directives.rb +30 -0
- data/lib/vapid/directives/audio.rb +27 -0
- data/lib/vapid/directives/group.rb +71 -0
- data/lib/vapid/directives/hide.rb +11 -0
- data/lib/vapid/directives/href.rb +11 -0
- data/lib/vapid/directives/image.rb +14 -0
- data/lib/vapid/directives/richtext.rb +15 -0
- data/lib/vapid/directives/show.rb +11 -0
- data/lib/vapid/directives/text.rb +24 -0
- data/lib/vapid/directives/video.rb +28 -0
- data/lib/vapid/generator_template/.gitignore +21 -0
- data/lib/vapid/generator_template/Gemfile.tt +13 -0
- data/lib/vapid/generator_template/README.md +0 -0
- data/lib/vapid/generator_template/assets/favicon.ico +0 -0
- data/lib/vapid/generator_template/assets/images/.keep +0 -0
- data/lib/vapid/generator_template/assets/javascripts/.keep +0 -0
- data/lib/vapid/generator_template/assets/stylesheets/.keep +0 -0
- data/lib/vapid/generator_template/assets/stylesheets/application.css +120 -0
- data/lib/vapid/generator_template/config.ru +3 -0
- data/lib/vapid/generator_template/config/database.yml +12 -0
- data/lib/vapid/generator_template/config/settings.yml.tt +11 -0
- data/lib/vapid/generator_template/templates/index.html.erb +25 -0
- data/lib/vapid/generator_template/templates/layouts/default.html.erb +22 -0
- data/lib/vapid/models.rb +18 -0
- data/lib/vapid/models/group.rb +36 -0
- data/lib/vapid/models/record.rb +30 -0
- data/lib/vapid/models/user.rb +16 -0
- data/lib/vapid/server.rb +93 -0
- data/lib/vapid/settings.rb +13 -0
- data/lib/vapid/template.rb +79 -0
- data/lib/vapid/template/node.rb +91 -0
- data/lib/vapid/template/parser.rb +50 -0
- data/lib/vapid/vendor/semantic-ui/.versions +4 -0
- data/lib/vapid/vendor/semantic-ui/LICENSE +22 -0
- data/lib/vapid/vendor/semantic-ui/README.md +7 -0
- data/lib/vapid/vendor/semantic-ui/components/accordion.css +252 -0
- data/lib/vapid/vendor/semantic-ui/components/accordion.js +610 -0
- data/lib/vapid/vendor/semantic-ui/components/accordion.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/accordion.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/ad.css +275 -0
- data/lib/vapid/vendor/semantic-ui/components/ad.min.css +10 -0
- data/lib/vapid/vendor/semantic-ui/components/api.js +1167 -0
- data/lib/vapid/vendor/semantic-ui/components/api.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/breadcrumb.css +124 -0
- data/lib/vapid/vendor/semantic-ui/components/breadcrumb.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/button.css +3450 -0
- data/lib/vapid/vendor/semantic-ui/components/button.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/card.css +964 -0
- data/lib/vapid/vendor/semantic-ui/components/card.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/checkbox.css +625 -0
- data/lib/vapid/vendor/semantic-ui/components/checkbox.js +831 -0
- data/lib/vapid/vendor/semantic-ui/components/checkbox.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/checkbox.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/colorize.js +274 -0
- data/lib/vapid/vendor/semantic-ui/components/colorize.min.js +11 -0
- data/lib/vapid/vendor/semantic-ui/components/comment.css +270 -0
- data/lib/vapid/vendor/semantic-ui/components/comment.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/container.css +147 -0
- data/lib/vapid/vendor/semantic-ui/components/container.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/dimmer.css +200 -0
- data/lib/vapid/vendor/semantic-ui/components/dimmer.js +708 -0
- data/lib/vapid/vendor/semantic-ui/components/dimmer.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/dimmer.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/divider.css +260 -0
- data/lib/vapid/vendor/semantic-ui/components/divider.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/dropdown.css +1442 -0
- data/lib/vapid/vendor/semantic-ui/components/dropdown.js +3767 -0
- data/lib/vapid/vendor/semantic-ui/components/dropdown.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/dropdown.min.js +11 -0
- data/lib/vapid/vendor/semantic-ui/components/embed.css +166 -0
- data/lib/vapid/vendor/semantic-ui/components/embed.js +696 -0
- data/lib/vapid/vendor/semantic-ui/components/embed.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/embed.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/feed.css +296 -0
- data/lib/vapid/vendor/semantic-ui/components/feed.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/flag.css +1031 -0
- data/lib/vapid/vendor/semantic-ui/components/flag.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/form.css +1067 -0
- data/lib/vapid/vendor/semantic-ui/components/form.js +1603 -0
- data/lib/vapid/vendor/semantic-ui/components/form.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/form.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/grid.css +2002 -0
- data/lib/vapid/vendor/semantic-ui/components/grid.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/header.css +721 -0
- data/lib/vapid/vendor/semantic-ui/components/header.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/icon.css +3292 -0
- data/lib/vapid/vendor/semantic-ui/components/icon.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/image.css +306 -0
- data/lib/vapid/vendor/semantic-ui/components/image.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/input.css +510 -0
- data/lib/vapid/vendor/semantic-ui/components/input.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/item.css +486 -0
- data/lib/vapid/vendor/semantic-ui/components/item.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/label.css +1307 -0
- data/lib/vapid/vendor/semantic-ui/components/label.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/list.css +951 -0
- data/lib/vapid/vendor/semantic-ui/components/list.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/loader.css +347 -0
- data/lib/vapid/vendor/semantic-ui/components/loader.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/menu.css +2002 -0
- data/lib/vapid/vendor/semantic-ui/components/menu.min.css +1 -0
- data/lib/vapid/vendor/semantic-ui/components/message.css +477 -0
- data/lib/vapid/vendor/semantic-ui/components/message.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/modal.css +502 -0
- data/lib/vapid/vendor/semantic-ui/components/modal.js +913 -0
- data/lib/vapid/vendor/semantic-ui/components/modal.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/modal.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/nag.css +147 -0
- data/lib/vapid/vendor/semantic-ui/components/nag.js +507 -0
- data/lib/vapid/vendor/semantic-ui/components/nag.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/nag.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/popup.css +733 -0
- data/lib/vapid/vendor/semantic-ui/components/popup.js +1475 -0
- data/lib/vapid/vendor/semantic-ui/components/popup.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/popup.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/progress.css +516 -0
- data/lib/vapid/vendor/semantic-ui/components/progress.js +931 -0
- data/lib/vapid/vendor/semantic-ui/components/progress.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/progress.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/rail.css +152 -0
- data/lib/vapid/vendor/semantic-ui/components/rail.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/rating.css +263 -0
- data/lib/vapid/vendor/semantic-ui/components/rating.js +508 -0
- data/lib/vapid/vendor/semantic-ui/components/rating.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/rating.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/reset.css +424 -0
- data/lib/vapid/vendor/semantic-ui/components/reset.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/reveal.css +284 -0
- data/lib/vapid/vendor/semantic-ui/components/reveal.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/search.css +408 -0
- data/lib/vapid/vendor/semantic-ui/components/search.js +1442 -0
- data/lib/vapid/vendor/semantic-ui/components/search.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/search.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/segment.css +798 -0
- data/lib/vapid/vendor/semantic-ui/components/segment.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/shape.css +157 -0
- data/lib/vapid/vendor/semantic-ui/components/shape.js +921 -0
- data/lib/vapid/vendor/semantic-ui/components/shape.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/shape.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/sidebar.css +634 -0
- data/lib/vapid/vendor/semantic-ui/components/sidebar.js +1036 -0
- data/lib/vapid/vendor/semantic-ui/components/sidebar.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/sidebar.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/site.css +160 -0
- data/lib/vapid/vendor/semantic-ui/components/site.js +487 -0
- data/lib/vapid/vendor/semantic-ui/components/site.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/site.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/state.js +708 -0
- data/lib/vapid/vendor/semantic-ui/components/state.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/statistic.css +569 -0
- data/lib/vapid/vendor/semantic-ui/components/statistic.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/step.css +623 -0
- data/lib/vapid/vendor/semantic-ui/components/step.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/sticky.css +78 -0
- data/lib/vapid/vendor/semantic-ui/components/sticky.js +942 -0
- data/lib/vapid/vendor/semantic-ui/components/sticky.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/sticky.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/tab.css +91 -0
- data/lib/vapid/vendor/semantic-ui/components/tab.js +952 -0
- data/lib/vapid/vendor/semantic-ui/components/tab.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/tab.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/table.css +1108 -0
- data/lib/vapid/vendor/semantic-ui/components/table.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/transition.css +1964 -0
- data/lib/vapid/vendor/semantic-ui/components/transition.js +1095 -0
- data/lib/vapid/vendor/semantic-ui/components/transition.min.css +9 -0
- data/lib/vapid/vendor/semantic-ui/components/transition.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/video.css +125 -0
- data/lib/vapid/vendor/semantic-ui/components/video.js +532 -0
- data/lib/vapid/vendor/semantic-ui/components/video.min.css +10 -0
- data/lib/vapid/vendor/semantic-ui/components/video.min.js +11 -0
- data/lib/vapid/vendor/semantic-ui/components/visibility.js +1288 -0
- data/lib/vapid/vendor/semantic-ui/components/visibility.min.js +10 -0
- data/lib/vapid/vendor/semantic-ui/components/visit.js +517 -0
- data/lib/vapid/vendor/semantic-ui/components/visit.min.js +11 -0
- data/lib/vapid/vendor/semantic-ui/package.js +34 -0
- data/lib/vapid/vendor/semantic-ui/package.json +20 -0
- data/lib/vapid/vendor/semantic-ui/semantic.css +36844 -0
- data/lib/vapid/vendor/semantic-ui/semantic.js +22617 -0
- data/lib/vapid/vendor/semantic-ui/semantic.min.css +364 -0
- data/lib/vapid/vendor/semantic-ui/semantic.min.js +19 -0
- data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.eot +0 -0
- data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.otf +0 -0
- data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.svg +2671 -0
- data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.ttf +0 -0
- data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.woff +0 -0
- data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.woff2 +0 -0
- data/lib/vapid/vendor/semantic-ui/themes/default/assets/images/flags.png +0 -0
- data/lib/vapid/vendor/trix/.blade.yml +45 -0
- data/lib/vapid/vendor/trix/.github/ISSUE_TEMPLATE.md +13 -0
- data/lib/vapid/vendor/trix/.gitignore +3 -0
- data/lib/vapid/vendor/trix/.ruby-version +1 -0
- data/lib/vapid/vendor/trix/.travis.yml +6 -0
- data/lib/vapid/vendor/trix/CONDUCT.md +79 -0
- data/lib/vapid/vendor/trix/Gemfile +17 -0
- data/lib/vapid/vendor/trix/Gemfile.lock +152 -0
- data/lib/vapid/vendor/trix/LICENSE +20 -0
- data/lib/vapid/vendor/trix/README.md +382 -0
- data/lib/vapid/vendor/trix/assets/index.html +55 -0
- data/lib/vapid/vendor/trix/assets/trix-core.coffee +2 -0
- data/lib/vapid/vendor/trix/assets/trix.coffee +3 -0
- data/lib/vapid/vendor/trix/assets/trix.scss +5 -0
- data/lib/vapid/vendor/trix/assets/trix/banner/index.coffee.erb +3 -0
- data/lib/vapid/vendor/trix/assets/trix/banner/index.scss.erb +3 -0
- data/lib/vapid/vendor/trix/assets/trix/banner/index.txt.erb +3 -0
- data/lib/vapid/vendor/trix/assets/trix/images/README.md +6 -0
- data/lib/vapid/vendor/trix/assets/trix/images/attach.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/bold.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/bullets.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/code.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/heading_1.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/italic.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/link.svg +6 -0
- data/lib/vapid/vendor/trix/assets/trix/images/nesting_level_decrease.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/nesting_level_increase.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/numbers.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/quote.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/redo.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/remove.svg +4 -0
- data/lib/vapid/vendor/trix/assets/trix/images/strike.svg +6 -0
- data/lib/vapid/vendor/trix/assets/trix/images/trash.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/images/undo.svg +5 -0
- data/lib/vapid/vendor/trix/assets/trix/stylesheets/attachments.scss +112 -0
- data/lib/vapid/vendor/trix/assets/trix/stylesheets/content.scss +88 -0
- data/lib/vapid/vendor/trix/assets/trix/stylesheets/editor.scss +8 -0
- data/lib/vapid/vendor/trix/assets/trix/stylesheets/icons.scss +14 -0
- data/lib/vapid/vendor/trix/assets/trix/stylesheets/media-queries.scss +7 -0
- data/lib/vapid/vendor/trix/assets/trix/stylesheets/toolbar.scss +194 -0
- data/lib/vapid/vendor/trix/bin/blade +16 -0
- data/lib/vapid/vendor/trix/bin/ci +21 -0
- data/lib/vapid/vendor/trix/bin/rackup +16 -0
- data/lib/vapid/vendor/trix/bin/rake +16 -0
- data/lib/vapid/vendor/trix/bin/release +139 -0
- data/lib/vapid/vendor/trix/bin/setup +69 -0
- data/lib/vapid/vendor/trix/bin/update-status-image +100 -0
- data/lib/vapid/vendor/trix/bower.json +34 -0
- data/lib/vapid/vendor/trix/config.ru +32 -0
- data/lib/vapid/vendor/trix/dist/trix-core.js +11 -0
- data/lib/vapid/vendor/trix/dist/trix.css +286 -0
- data/lib/vapid/vendor/trix/dist/trix.js +20 -0
- data/lib/vapid/vendor/trix/package.json +29 -0
- data/lib/vapid/vendor/trix/polyfills/polyfills.coffee +3 -0
- data/lib/vapid/vendor/trix/polyfills/set.coffee +24 -0
- data/lib/vapid/vendor/trix/polyfills/vendor/CustomElements.js +1029 -0
- data/lib/vapid/vendor/trix/polyfills/vendor/README.md +2 -0
- data/lib/vapid/vendor/trix/polyfills/vendor/promise.js +228 -0
- data/lib/vapid/vendor/trix/src/trix/VERSION +1 -0
- data/lib/vapid/vendor/trix/src/trix/config/block_attributes.coffee +37 -0
- data/lib/vapid/vendor/trix/src/trix/config/css.coffee +12 -0
- data/lib/vapid/vendor/trix/src/trix/config/file_size_formatting.coffee +22 -0
- data/lib/vapid/vendor/trix/src/trix/config/index.coffee +9 -0
- data/lib/vapid/vendor/trix/src/trix/config/lang.coffee +26 -0
- data/lib/vapid/vendor/trix/src/trix/config/selection_elements.coffee +26 -0
- data/lib/vapid/vendor/trix/src/trix/config/serialization.coffee +63 -0
- data/lib/vapid/vendor/trix/src/trix/config/text_attributes.coffee +25 -0
- data/lib/vapid/vendor/trix/src/trix/config/toolbar.coffee +41 -0
- data/lib/vapid/vendor/trix/src/trix/config/undo_interval.coffee +7 -0
- data/lib/vapid/vendor/trix/src/trix/controllers/attachment_editor_controller.coffee +104 -0
- data/lib/vapid/vendor/trix/src/trix/controllers/composition_controller.coffee +117 -0
- data/lib/vapid/vendor/trix/src/trix/controllers/controller.coffee +3 -0
- data/lib/vapid/vendor/trix/src/trix/controllers/editor_controller.coffee +369 -0
- data/lib/vapid/vendor/trix/src/trix/controllers/input/composition_input.coffee +57 -0
- data/lib/vapid/vendor/trix/src/trix/controllers/input_controller.coffee +473 -0
- data/lib/vapid/vendor/trix/src/trix/controllers/toolbar_controller.coffee +173 -0
- data/lib/vapid/vendor/trix/src/trix/core/basic_object.coffee +44 -0
- data/lib/vapid/vendor/trix/src/trix/core/collections/element_store.coffee +21 -0
- data/lib/vapid/vendor/trix/src/trix/core/collections/hash.coffee +98 -0
- data/lib/vapid/vendor/trix/src/trix/core/collections/index.coffee +4 -0
- data/lib/vapid/vendor/trix/src/trix/core/collections/object_group.coffee +37 -0
- data/lib/vapid/vendor/trix/src/trix/core/collections/object_map.coffee +10 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/arrays.coffee +34 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/config.coffee +23 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/custom_elements.coffee +45 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/dom.coffee +185 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/extend.coffee +4 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/functions.coffee +3 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/global.coffee +23 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/index.coffee +10 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/objects.coffee +11 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/ranges.coffee +33 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/selection.coffee +25 -0
- data/lib/vapid/vendor/trix/src/trix/core/helpers/strings.coffee +46 -0
- data/lib/vapid/vendor/trix/src/trix/core/index.coffee +4 -0
- data/lib/vapid/vendor/trix/src/trix/core/object.coffee +33 -0
- data/lib/vapid/vendor/trix/src/trix/core/utilities/index.coffee +2 -0
- data/lib/vapid/vendor/trix/src/trix/core/utilities/operation.coffee +37 -0
- data/lib/vapid/vendor/trix/src/trix/core/utilities/utf16_string.coffee +93 -0
- data/lib/vapid/vendor/trix/src/trix/elements/trix_editor_element.coffee +166 -0
- data/lib/vapid/vendor/trix/src/trix/elements/trix_toolbar_element.coffee +28 -0
- data/lib/vapid/vendor/trix/src/trix/index.coffee.erb +14 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/control_element.coffee +60 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/debugger.coffee +104 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/element.coffee +86 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/index.coffee +17 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/polyfills/vendor/details-element-polyfill.js +5 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/templates/debug.jst.eco +17 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/templates/document.jst.eco +33 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/templates/performance.jst.eco +10 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/templates/render.jst.eco +1 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/templates/selection.jst.eco +5 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/templates/undo.jst.eco +13 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/view.coffee +58 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/views/debug_view.coffee +33 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/views/document_view.coffee +12 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/views/performance_view.coffee +51 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/views/render_view.coffee +21 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/views/selection_view.coffee +33 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/views/undo_view.coffee +12 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/deserializer.coffee +55 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/index.coffee +5 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/player.coffee +60 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/player_controller.coffee +43 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/player_element.coffee +32 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/player_view.coffee +133 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/recorder.coffee +82 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/recording.coffee +54 -0
- data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/serializer.coffee +61 -0
- data/lib/vapid/vendor/trix/src/trix/models/attachment.coffee +157 -0
- data/lib/vapid/vendor/trix/src/trix/models/attachment_manager.coffee +24 -0
- data/lib/vapid/vendor/trix/src/trix/models/attachment_piece.coffee +47 -0
- data/lib/vapid/vendor/trix/src/trix/models/block.coffee +230 -0
- data/lib/vapid/vendor/trix/src/trix/models/composition.coffee +521 -0
- data/lib/vapid/vendor/trix/src/trix/models/document.coffee +538 -0
- data/lib/vapid/vendor/trix/src/trix/models/editor.coffee +141 -0
- data/lib/vapid/vendor/trix/src/trix/models/html_parser.coffee +335 -0
- data/lib/vapid/vendor/trix/src/trix/models/line_break_insertion.coffee +31 -0
- data/lib/vapid/vendor/trix/src/trix/models/location_mapper.coffee +156 -0
- data/lib/vapid/vendor/trix/src/trix/models/managed_attachment.coffee +28 -0
- data/lib/vapid/vendor/trix/src/trix/models/piece.coffee +95 -0
- data/lib/vapid/vendor/trix/src/trix/models/point_mapper.coffee +28 -0
- data/lib/vapid/vendor/trix/src/trix/models/selection_manager.coffee +129 -0
- data/lib/vapid/vendor/trix/src/trix/models/splittable_list.coffee +168 -0
- data/lib/vapid/vendor/trix/src/trix/models/string_piece.coffee +49 -0
- data/lib/vapid/vendor/trix/src/trix/models/text.coffee +168 -0
- data/lib/vapid/vendor/trix/src/trix/models/undo_manager.coffee +40 -0
- data/lib/vapid/vendor/trix/src/trix/observers/mutation_observer.coffee +131 -0
- data/lib/vapid/vendor/trix/src/trix/observers/selection_change_observer.coffee +56 -0
- data/lib/vapid/vendor/trix/src/trix/operations/file_verification_operation.coffee +15 -0
- data/lib/vapid/vendor/trix/src/trix/operations/image_preload_operation.coffee +15 -0
- data/lib/vapid/vendor/trix/src/trix/views/attachment_view.coffee +99 -0
- data/lib/vapid/vendor/trix/src/trix/views/block_view.coffee +37 -0
- data/lib/vapid/vendor/trix/src/trix/views/document_view.coffee +68 -0
- data/lib/vapid/vendor/trix/src/trix/views/object_group_view.coffee +23 -0
- data/lib/vapid/vendor/trix/src/trix/views/object_view.coffee +86 -0
- data/lib/vapid/vendor/trix/src/trix/views/piece_view.coffee +97 -0
- data/lib/vapid/vendor/trix/src/trix/views/previewable_attachment_view.coffee +49 -0
- data/lib/vapid/vendor/trix/src/trix/views/text_view.coffee +30 -0
- data/lib/vapid/vendor/trix/test/.gitignore +1 -0
- data/lib/vapid/vendor/trix/test/src/system/attachment_test.coffee +70 -0
- data/lib/vapid/vendor/trix/test/src/system/basic_input_test.coffee +68 -0
- data/lib/vapid/vendor/trix/test/src/system/block_formatting_test.coffee +602 -0
- data/lib/vapid/vendor/trix/test/src/system/caching_test.coffee +21 -0
- data/lib/vapid/vendor/trix/test/src/system/composition_input_test.coffee +138 -0
- data/lib/vapid/vendor/trix/test/src/system/cursor_movement_test.coffee +54 -0
- data/lib/vapid/vendor/trix/test/src/system/custom_element_test.coffee +314 -0
- data/lib/vapid/vendor/trix/test/src/system/html_loading_test.coffee +62 -0
- data/lib/vapid/vendor/trix/test/src/system/html_replacement_test.coffee +101 -0
- data/lib/vapid/vendor/trix/test/src/system/installation_process_test.coffee +59 -0
- data/lib/vapid/vendor/trix/test/src/system/list_formatting_test.coffee +70 -0
- data/lib/vapid/vendor/trix/test/src/system/mutation_input_test.coffee +73 -0
- data/lib/vapid/vendor/trix/test/src/system/pasting_test.coffee +215 -0
- data/lib/vapid/vendor/trix/test/src/system/text_formatting_test.coffee +151 -0
- data/lib/vapid/vendor/trix/test/src/system/undo_test.coffee +48 -0
- data/lib/vapid/vendor/trix/test/src/test.coffee +16 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/assertions.coffee +38 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/editor_helpers.coffee +37 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_empty.jst.eco +1 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_html.jst.eco +2 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_in_table.jst.eco +7 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_with_block_styles.jst.eco +6 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_with_bold_styles.jst.eco +7 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_with_image.jst.eco +2 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_with_styled_content.jst.eco +7 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_with_toolbar_and_input.jst.eco +5 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/fixtures.coffee +536 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/logo.png +0 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/index.coffee +18 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/input_helpers.coffee +183 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/selection_helpers.coffee +91 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/test_helpers.coffee +72 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/test_stubs.coffee +31 -0
- data/lib/vapid/vendor/trix/test/src/test_helpers/toolbar_helpers.coffee +45 -0
- data/lib/vapid/vendor/trix/test/src/unit/attachment_test.coffee +23 -0
- data/lib/vapid/vendor/trix/test/src/unit/block_test.coffee +22 -0
- data/lib/vapid/vendor/trix/test/src/unit/composition_test.coffee +13 -0
- data/lib/vapid/vendor/trix/test/src/unit/document_test.coffee +11 -0
- data/lib/vapid/vendor/trix/test/src/unit/document_view_test.coffee +6 -0
- data/lib/vapid/vendor/trix/test/src/unit/html_parser_test.coffee +162 -0
- data/lib/vapid/vendor/trix/test/src/unit/location_mapper_test.coffee +185 -0
- data/lib/vapid/vendor/trix/test/src/unit/mutation_observer_test.coffee +84 -0
- data/lib/vapid/vendor/trix/test/src/unit/serialization_test.coffee +7 -0
- data/lib/vapid/vendor/trix/test/src/unit/string_change_summary_test.coffee +57 -0
- data/lib/vapid/vendor/trix/test/src/unit/text_test.coffee +19 -0
- data/lib/vapid/vendor/trix/test/vendor/rangy-core.js +3845 -0
- data/lib/vapid/vendor/trix/test/vendor/rangy-textrange.js +1930 -0
- data/lib/vapid/version.rb +4 -0
- data/lib/vapid/views/admin/install.html.erb +19 -0
- data/lib/vapid/views/admin/login.html.erb +11 -0
- data/lib/vapid/views/admin/overview/index.html.erb +1 -0
- data/lib/vapid/views/admin/records/_form.erb +9 -0
- data/lib/vapid/views/admin/records/edit.html.erb +5 -0
- data/lib/vapid/views/admin/records/index.html.erb +38 -0
- data/lib/vapid/views/admin/records/new.html.erb +3 -0
- data/lib/vapid/views/errors/404.html.erb +1 -0
- data/lib/vapid/views/errors/500.html.erb +1 -0
- data/lib/vapid/views/layouts/admin.html.erb +41 -0
- data/lib/vapid/views/layouts/admin_form.html.erb +22 -0
- data/lib/vapid/views/layouts/error.html.erb +11 -0
- data/vapid.gemspec +48 -0
- metadata +811 -0
@@ -0,0 +1,9 @@
|
|
1
|
+
/*!
|
2
|
+
* # Semantic UI 2.2.9 - Site
|
3
|
+
* http://github.com/semantic-org/semantic-ui/
|
4
|
+
*
|
5
|
+
*
|
6
|
+
* Released under the MIT license
|
7
|
+
* http://opensource.org/licenses/MIT
|
8
|
+
*
|
9
|
+
*/@import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic&subset=latin);body,html{height:100%}html{font-size:14px}body{margin:0;padding:0;overflow-x:hidden;min-width:320px;background:#fff;font-family:Lato,'Helvetica Neue',Arial,Helvetica,sans-serif;font-size:14px;line-height:1.4285em;color:rgba(0,0,0,.87);font-smoothing:antialiased}h1,h2,h3,h4,h5{font-family:Lato,'Helvetica Neue',Arial,Helvetica,sans-serif;line-height:1.28571429em;margin:calc(2rem - .14285714em) 0 1rem;font-weight:700;padding:0}h1{min-height:1rem;font-size:2rem}h2{font-size:1.71428571rem}h3{font-size:1.28571429rem}h4{font-size:1.07142857rem}h5{font-size:1rem}h1:first-child,h2:first-child,h3:first-child,h4:first-child,h5:first-child{margin-top:0}h1:last-child,h2:last-child,h3:last-child,h4:last-child,h5:last-child{margin-bottom:0}p{margin:0 0 1em;line-height:1.4285em}p:first-child{margin-top:0}p:last-child{margin-bottom:0}a{color:#4183c4;text-decoration:none}a:hover{color:#1e70bf;text-decoration:none}::-webkit-selection{background-color:#cce2ff;color:rgba(0,0,0,.87)}::-moz-selection{background-color:#cce2ff;color:rgba(0,0,0,.87)}::selection{background-color:#cce2ff;color:rgba(0,0,0,.87)}input::-webkit-selection,textarea::-webkit-selection{background-color:rgba(100,100,100,.4);color:rgba(0,0,0,.87)}input::-moz-selection,textarea::-moz-selection{background-color:rgba(100,100,100,.4);color:rgba(0,0,0,.87)}input::selection,textarea::selection{background-color:rgba(100,100,100,.4);color:rgba(0,0,0,.87)}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
/*!
|
2
|
+
* # Semantic UI 2.2.9 - Site
|
3
|
+
* http://github.com/semantic-org/semantic-ui/
|
4
|
+
*
|
5
|
+
*
|
6
|
+
* Released under the MIT license
|
7
|
+
* http://opensource.org/licenses/MIT
|
8
|
+
*
|
9
|
+
*/
|
10
|
+
!function(e,n,o,i){e.site=e.fn.site=function(t){var s,r,a=(new Date).getTime(),c=[],l=arguments[0],u="string"==typeof l,d=[].slice.call(arguments,1),f=e.isPlainObject(t)?e.extend(!0,{},e.site.settings,t):e.extend({},e.site.settings),m=f.namespace,g=f.error,b="module-"+m,p=e(o),v=p,h=this,y=v.data(b);return s={initialize:function(){s.instantiate()},instantiate:function(){s.verbose("Storing instance of site",s),y=s,v.data(b,s)},normalize:function(){s.fix.console(),s.fix.requestAnimationFrame()},fix:{console:function(){s.debug("Normalizing window.console"),console!==i&&console.log!==i||(s.verbose("Console not available, normalizing events"),s.disable.console()),"undefined"!=typeof console.group&&"undefined"!=typeof console.groupEnd&&"undefined"!=typeof console.groupCollapsed||(s.verbose("Console group not available, normalizing events"),n.console.group=function(){},n.console.groupEnd=function(){},n.console.groupCollapsed=function(){}),"undefined"==typeof console.markTimeline&&(s.verbose("Mark timeline not available, normalizing events"),n.console.markTimeline=function(){})},consoleClear:function(){s.debug("Disabling programmatic console clearing"),n.console.clear=function(){}},requestAnimationFrame:function(){s.debug("Normalizing requestAnimationFrame"),n.requestAnimationFrame===i&&(s.debug("RequestAnimationFrame not available, normalizing event"),n.requestAnimationFrame=n.requestAnimationFrame||n.mozRequestAnimationFrame||n.webkitRequestAnimationFrame||n.msRequestAnimationFrame||function(e){setTimeout(e,0)})}},moduleExists:function(n){return e.fn[n]!==i&&e.fn[n].settings!==i},enabled:{modules:function(n){var o=[];return n=n||f.modules,e.each(n,function(e,n){s.moduleExists(n)&&o.push(n)}),o}},disabled:{modules:function(n){var o=[];return n=n||f.modules,e.each(n,function(e,n){s.moduleExists(n)||o.push(n)}),o}},change:{setting:function(n,o,t,r){t="string"==typeof t?"all"===t?f.modules:[t]:t||f.modules,r=r===i||r,e.each(t,function(i,t){var a,c=!s.moduleExists(t)||(e.fn[t].settings.namespace||!1);s.moduleExists(t)&&(s.verbose("Changing default setting",n,o,t),e.fn[t].settings[n]=o,r&&c&&(a=e(":data(module-"+c+")"),a.length>0&&(s.verbose("Modifying existing settings",a),a[t]("setting",n,o))))})},settings:function(n,o,t){o="string"==typeof o?[o]:o||f.modules,t=t===i||t,e.each(o,function(o,i){var r;s.moduleExists(i)&&(s.verbose("Changing default setting",n,i),e.extend(!0,e.fn[i].settings,n),t&&m&&(r=e(":data(module-"+m+")"),r.length>0&&(s.verbose("Modifying existing settings",r),r[i]("setting",n))))})}},enable:{console:function(){s.console(!0)},debug:function(e,n){e=e||f.modules,s.debug("Enabling debug for modules",e),s.change.setting("debug",!0,e,n)},verbose:function(e,n){e=e||f.modules,s.debug("Enabling verbose debug for modules",e),s.change.setting("verbose",!0,e,n)}},disable:{console:function(){s.console(!1)},debug:function(e,n){e=e||f.modules,s.debug("Disabling debug for modules",e),s.change.setting("debug",!1,e,n)},verbose:function(e,n){e=e||f.modules,s.debug("Disabling verbose debug for modules",e),s.change.setting("verbose",!1,e,n)}},console:function(e){if(e){if(y.cache.console===i)return void s.error(g.console);s.debug("Restoring console function"),n.console=y.cache.console}else s.debug("Disabling console function"),y.cache.console=n.console,n.console={clear:function(){},error:function(){},group:function(){},groupCollapsed:function(){},groupEnd:function(){},info:function(){},log:function(){},markTimeline:function(){},warn:function(){}}},destroy:function(){s.verbose("Destroying previous site for",v),v.removeData(b)},cache:{},setting:function(n,o){if(e.isPlainObject(n))e.extend(!0,f,n);else{if(o===i)return f[n];f[n]=o}},internal:function(n,o){if(e.isPlainObject(n))e.extend(!0,s,n);else{if(o===i)return s[n];s[n]=o}},debug:function(){f.debug&&(f.performance?s.performance.log(arguments):(s.debug=Function.prototype.bind.call(console.info,console,f.name+":"),s.debug.apply(console,arguments)))},verbose:function(){f.verbose&&f.debug&&(f.performance?s.performance.log(arguments):(s.verbose=Function.prototype.bind.call(console.info,console,f.name+":"),s.verbose.apply(console,arguments)))},error:function(){s.error=Function.prototype.bind.call(console.error,console,f.name+":"),s.error.apply(console,arguments)},performance:{log:function(e){var n,o,i;f.performance&&(n=(new Date).getTime(),i=a||n,o=n-i,a=n,c.push({Element:h,Name:e[0],Arguments:[].slice.call(e,1)||"","Execution Time":o})),clearTimeout(s.performance.timer),s.performance.timer=setTimeout(s.performance.display,500)},display:function(){var n=f.name+":",o=0;a=!1,clearTimeout(s.performance.timer),e.each(c,function(e,n){o+=n["Execution Time"]}),n+=" "+o+"ms",(console.group!==i||console.table!==i)&&c.length>0&&(console.groupCollapsed(n),console.table?console.table(c):e.each(c,function(e,n){console.log(n.Name+": "+n["Execution Time"]+"ms")}),console.groupEnd()),c=[]}},invoke:function(n,o,t){var a,c,l,u=y;return o=o||d,t=h||t,"string"==typeof n&&u!==i&&(n=n.split(/[\. ]/),a=n.length-1,e.each(n,function(o,t){var r=o!=a?t+n[o+1].charAt(0).toUpperCase()+n[o+1].slice(1):n;if(e.isPlainObject(u[r])&&o!=a)u=u[r];else{if(u[r]!==i)return c=u[r],!1;if(!e.isPlainObject(u[t])||o==a)return u[t]!==i?(c=u[t],!1):(s.error(g.method,n),!1);u=u[t]}})),e.isFunction(c)?l=c.apply(t,o):c!==i&&(l=c),e.isArray(r)?r.push(l):r!==i?r=[r,l]:l!==i&&(r=l),c}},u?(y===i&&s.initialize(),s.invoke(l)):(y!==i&&s.destroy(),s.initialize()),r!==i?r:this},e.site.settings={name:"Site",namespace:"site",error:{console:"Console cannot be restored, most likely it was overwritten outside of module",method:"The method you called is not defined."},debug:!1,verbose:!1,performance:!0,modules:["accordion","api","checkbox","dimmer","dropdown","embed","form","modal","nag","popup","rating","shape","sidebar","state","sticky","tab","transition","visit","visibility"],siteNamespace:"site",namespaceStub:{cache:{},config:{},sections:{},section:{},utilities:{}}},e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(n){return function(o){return!!e.data(o,n)}}):function(n,o,i){return!!e.data(n,i[3])}})}(jQuery,window,document);
|
@@ -0,0 +1,708 @@
|
|
1
|
+
/*!
|
2
|
+
* # Semantic UI 2.2.9 - State
|
3
|
+
* http://github.com/semantic-org/semantic-ui/
|
4
|
+
*
|
5
|
+
*
|
6
|
+
* Released under the MIT license
|
7
|
+
* http://opensource.org/licenses/MIT
|
8
|
+
*
|
9
|
+
*/
|
10
|
+
|
11
|
+
;(function ($, window, document, undefined) {
|
12
|
+
|
13
|
+
"use strict";
|
14
|
+
|
15
|
+
window = (typeof window != 'undefined' && window.Math == Math)
|
16
|
+
? window
|
17
|
+
: (typeof self != 'undefined' && self.Math == Math)
|
18
|
+
? self
|
19
|
+
: Function('return this')()
|
20
|
+
;
|
21
|
+
|
22
|
+
$.fn.state = function(parameters) {
|
23
|
+
var
|
24
|
+
$allModules = $(this),
|
25
|
+
|
26
|
+
moduleSelector = $allModules.selector || '',
|
27
|
+
|
28
|
+
hasTouch = ('ontouchstart' in document.documentElement),
|
29
|
+
time = new Date().getTime(),
|
30
|
+
performance = [],
|
31
|
+
|
32
|
+
query = arguments[0],
|
33
|
+
methodInvoked = (typeof query == 'string'),
|
34
|
+
queryArguments = [].slice.call(arguments, 1),
|
35
|
+
|
36
|
+
returnedValue
|
37
|
+
;
|
38
|
+
$allModules
|
39
|
+
.each(function() {
|
40
|
+
var
|
41
|
+
settings = ( $.isPlainObject(parameters) )
|
42
|
+
? $.extend(true, {}, $.fn.state.settings, parameters)
|
43
|
+
: $.extend({}, $.fn.state.settings),
|
44
|
+
|
45
|
+
error = settings.error,
|
46
|
+
metadata = settings.metadata,
|
47
|
+
className = settings.className,
|
48
|
+
namespace = settings.namespace,
|
49
|
+
states = settings.states,
|
50
|
+
text = settings.text,
|
51
|
+
|
52
|
+
eventNamespace = '.' + namespace,
|
53
|
+
moduleNamespace = namespace + '-module',
|
54
|
+
|
55
|
+
$module = $(this),
|
56
|
+
|
57
|
+
element = this,
|
58
|
+
instance = $module.data(moduleNamespace),
|
59
|
+
|
60
|
+
module
|
61
|
+
;
|
62
|
+
module = {
|
63
|
+
|
64
|
+
initialize: function() {
|
65
|
+
module.verbose('Initializing module');
|
66
|
+
|
67
|
+
// allow module to guess desired state based on element
|
68
|
+
if(settings.automatic) {
|
69
|
+
module.add.defaults();
|
70
|
+
}
|
71
|
+
|
72
|
+
// bind events with delegated events
|
73
|
+
if(settings.context && moduleSelector !== '') {
|
74
|
+
$(settings.context)
|
75
|
+
.on(moduleSelector, 'mouseenter' + eventNamespace, module.change.text)
|
76
|
+
.on(moduleSelector, 'mouseleave' + eventNamespace, module.reset.text)
|
77
|
+
.on(moduleSelector, 'click' + eventNamespace, module.toggle.state)
|
78
|
+
;
|
79
|
+
}
|
80
|
+
else {
|
81
|
+
$module
|
82
|
+
.on('mouseenter' + eventNamespace, module.change.text)
|
83
|
+
.on('mouseleave' + eventNamespace, module.reset.text)
|
84
|
+
.on('click' + eventNamespace, module.toggle.state)
|
85
|
+
;
|
86
|
+
}
|
87
|
+
module.instantiate();
|
88
|
+
},
|
89
|
+
|
90
|
+
instantiate: function() {
|
91
|
+
module.verbose('Storing instance of module', module);
|
92
|
+
instance = module;
|
93
|
+
$module
|
94
|
+
.data(moduleNamespace, module)
|
95
|
+
;
|
96
|
+
},
|
97
|
+
|
98
|
+
destroy: function() {
|
99
|
+
module.verbose('Destroying previous module', instance);
|
100
|
+
$module
|
101
|
+
.off(eventNamespace)
|
102
|
+
.removeData(moduleNamespace)
|
103
|
+
;
|
104
|
+
},
|
105
|
+
|
106
|
+
refresh: function() {
|
107
|
+
module.verbose('Refreshing selector cache');
|
108
|
+
$module = $(element);
|
109
|
+
},
|
110
|
+
|
111
|
+
add: {
|
112
|
+
defaults: function() {
|
113
|
+
var
|
114
|
+
userStates = parameters && $.isPlainObject(parameters.states)
|
115
|
+
? parameters.states
|
116
|
+
: {}
|
117
|
+
;
|
118
|
+
$.each(settings.defaults, function(type, typeStates) {
|
119
|
+
if( module.is[type] !== undefined && module.is[type]() ) {
|
120
|
+
module.verbose('Adding default states', type, element);
|
121
|
+
$.extend(settings.states, typeStates, userStates);
|
122
|
+
}
|
123
|
+
});
|
124
|
+
}
|
125
|
+
},
|
126
|
+
|
127
|
+
is: {
|
128
|
+
|
129
|
+
active: function() {
|
130
|
+
return $module.hasClass(className.active);
|
131
|
+
},
|
132
|
+
loading: function() {
|
133
|
+
return $module.hasClass(className.loading);
|
134
|
+
},
|
135
|
+
inactive: function() {
|
136
|
+
return !( $module.hasClass(className.active) );
|
137
|
+
},
|
138
|
+
state: function(state) {
|
139
|
+
if(className[state] === undefined) {
|
140
|
+
return false;
|
141
|
+
}
|
142
|
+
return $module.hasClass( className[state] );
|
143
|
+
},
|
144
|
+
|
145
|
+
enabled: function() {
|
146
|
+
return !( $module.is(settings.filter.active) );
|
147
|
+
},
|
148
|
+
disabled: function() {
|
149
|
+
return ( $module.is(settings.filter.active) );
|
150
|
+
},
|
151
|
+
textEnabled: function() {
|
152
|
+
return !( $module.is(settings.filter.text) );
|
153
|
+
},
|
154
|
+
|
155
|
+
// definitions for automatic type detection
|
156
|
+
button: function() {
|
157
|
+
return $module.is('.button:not(a, .submit)');
|
158
|
+
},
|
159
|
+
input: function() {
|
160
|
+
return $module.is('input');
|
161
|
+
},
|
162
|
+
progress: function() {
|
163
|
+
return $module.is('.ui.progress');
|
164
|
+
}
|
165
|
+
},
|
166
|
+
|
167
|
+
allow: function(state) {
|
168
|
+
module.debug('Now allowing state', state);
|
169
|
+
states[state] = true;
|
170
|
+
},
|
171
|
+
disallow: function(state) {
|
172
|
+
module.debug('No longer allowing', state);
|
173
|
+
states[state] = false;
|
174
|
+
},
|
175
|
+
|
176
|
+
allows: function(state) {
|
177
|
+
return states[state] || false;
|
178
|
+
},
|
179
|
+
|
180
|
+
enable: function() {
|
181
|
+
$module.removeClass(className.disabled);
|
182
|
+
},
|
183
|
+
|
184
|
+
disable: function() {
|
185
|
+
$module.addClass(className.disabled);
|
186
|
+
},
|
187
|
+
|
188
|
+
setState: function(state) {
|
189
|
+
if(module.allows(state)) {
|
190
|
+
$module.addClass( className[state] );
|
191
|
+
}
|
192
|
+
},
|
193
|
+
|
194
|
+
removeState: function(state) {
|
195
|
+
if(module.allows(state)) {
|
196
|
+
$module.removeClass( className[state] );
|
197
|
+
}
|
198
|
+
},
|
199
|
+
|
200
|
+
toggle: {
|
201
|
+
state: function() {
|
202
|
+
var
|
203
|
+
apiRequest,
|
204
|
+
requestCancelled
|
205
|
+
;
|
206
|
+
if( module.allows('active') && module.is.enabled() ) {
|
207
|
+
module.refresh();
|
208
|
+
if($.fn.api !== undefined) {
|
209
|
+
apiRequest = $module.api('get request');
|
210
|
+
requestCancelled = $module.api('was cancelled');
|
211
|
+
if( requestCancelled ) {
|
212
|
+
module.debug('API Request cancelled by beforesend');
|
213
|
+
settings.activateTest = function(){ return false; };
|
214
|
+
settings.deactivateTest = function(){ return false; };
|
215
|
+
}
|
216
|
+
else if(apiRequest) {
|
217
|
+
module.listenTo(apiRequest);
|
218
|
+
return;
|
219
|
+
}
|
220
|
+
}
|
221
|
+
module.change.state();
|
222
|
+
}
|
223
|
+
}
|
224
|
+
},
|
225
|
+
|
226
|
+
listenTo: function(apiRequest) {
|
227
|
+
module.debug('API request detected, waiting for state signal', apiRequest);
|
228
|
+
if(apiRequest) {
|
229
|
+
if(text.loading) {
|
230
|
+
module.update.text(text.loading);
|
231
|
+
}
|
232
|
+
$.when(apiRequest)
|
233
|
+
.then(function() {
|
234
|
+
if(apiRequest.state() == 'resolved') {
|
235
|
+
module.debug('API request succeeded');
|
236
|
+
settings.activateTest = function(){ return true; };
|
237
|
+
settings.deactivateTest = function(){ return true; };
|
238
|
+
}
|
239
|
+
else {
|
240
|
+
module.debug('API request failed');
|
241
|
+
settings.activateTest = function(){ return false; };
|
242
|
+
settings.deactivateTest = function(){ return false; };
|
243
|
+
}
|
244
|
+
module.change.state();
|
245
|
+
})
|
246
|
+
;
|
247
|
+
}
|
248
|
+
},
|
249
|
+
|
250
|
+
// checks whether active/inactive state can be given
|
251
|
+
change: {
|
252
|
+
|
253
|
+
state: function() {
|
254
|
+
module.debug('Determining state change direction');
|
255
|
+
// inactive to active change
|
256
|
+
if( module.is.inactive() ) {
|
257
|
+
module.activate();
|
258
|
+
}
|
259
|
+
else {
|
260
|
+
module.deactivate();
|
261
|
+
}
|
262
|
+
if(settings.sync) {
|
263
|
+
module.sync();
|
264
|
+
}
|
265
|
+
settings.onChange.call(element);
|
266
|
+
},
|
267
|
+
|
268
|
+
text: function() {
|
269
|
+
if( module.is.textEnabled() ) {
|
270
|
+
if(module.is.disabled() ) {
|
271
|
+
module.verbose('Changing text to disabled text', text.hover);
|
272
|
+
module.update.text(text.disabled);
|
273
|
+
}
|
274
|
+
else if( module.is.active() ) {
|
275
|
+
if(text.hover) {
|
276
|
+
module.verbose('Changing text to hover text', text.hover);
|
277
|
+
module.update.text(text.hover);
|
278
|
+
}
|
279
|
+
else if(text.deactivate) {
|
280
|
+
module.verbose('Changing text to deactivating text', text.deactivate);
|
281
|
+
module.update.text(text.deactivate);
|
282
|
+
}
|
283
|
+
}
|
284
|
+
else {
|
285
|
+
if(text.hover) {
|
286
|
+
module.verbose('Changing text to hover text', text.hover);
|
287
|
+
module.update.text(text.hover);
|
288
|
+
}
|
289
|
+
else if(text.activate){
|
290
|
+
module.verbose('Changing text to activating text', text.activate);
|
291
|
+
module.update.text(text.activate);
|
292
|
+
}
|
293
|
+
}
|
294
|
+
}
|
295
|
+
}
|
296
|
+
|
297
|
+
},
|
298
|
+
|
299
|
+
activate: function() {
|
300
|
+
if( settings.activateTest.call(element) ) {
|
301
|
+
module.debug('Setting state to active');
|
302
|
+
$module
|
303
|
+
.addClass(className.active)
|
304
|
+
;
|
305
|
+
module.update.text(text.active);
|
306
|
+
settings.onActivate.call(element);
|
307
|
+
}
|
308
|
+
},
|
309
|
+
|
310
|
+
deactivate: function() {
|
311
|
+
if( settings.deactivateTest.call(element) ) {
|
312
|
+
module.debug('Setting state to inactive');
|
313
|
+
$module
|
314
|
+
.removeClass(className.active)
|
315
|
+
;
|
316
|
+
module.update.text(text.inactive);
|
317
|
+
settings.onDeactivate.call(element);
|
318
|
+
}
|
319
|
+
},
|
320
|
+
|
321
|
+
sync: function() {
|
322
|
+
module.verbose('Syncing other buttons to current state');
|
323
|
+
if( module.is.active() ) {
|
324
|
+
$allModules
|
325
|
+
.not($module)
|
326
|
+
.state('activate');
|
327
|
+
}
|
328
|
+
else {
|
329
|
+
$allModules
|
330
|
+
.not($module)
|
331
|
+
.state('deactivate')
|
332
|
+
;
|
333
|
+
}
|
334
|
+
},
|
335
|
+
|
336
|
+
get: {
|
337
|
+
text: function() {
|
338
|
+
return (settings.selector.text)
|
339
|
+
? $module.find(settings.selector.text).text()
|
340
|
+
: $module.html()
|
341
|
+
;
|
342
|
+
},
|
343
|
+
textFor: function(state) {
|
344
|
+
return text[state] || false;
|
345
|
+
}
|
346
|
+
},
|
347
|
+
|
348
|
+
flash: {
|
349
|
+
text: function(text, duration, callback) {
|
350
|
+
var
|
351
|
+
previousText = module.get.text()
|
352
|
+
;
|
353
|
+
module.debug('Flashing text message', text, duration);
|
354
|
+
text = text || settings.text.flash;
|
355
|
+
duration = duration || settings.flashDuration;
|
356
|
+
callback = callback || function() {};
|
357
|
+
module.update.text(text);
|
358
|
+
setTimeout(function(){
|
359
|
+
module.update.text(previousText);
|
360
|
+
callback.call(element);
|
361
|
+
}, duration);
|
362
|
+
}
|
363
|
+
},
|
364
|
+
|
365
|
+
reset: {
|
366
|
+
// on mouseout sets text to previous value
|
367
|
+
text: function() {
|
368
|
+
var
|
369
|
+
activeText = text.active || $module.data(metadata.storedText),
|
370
|
+
inactiveText = text.inactive || $module.data(metadata.storedText)
|
371
|
+
;
|
372
|
+
if( module.is.textEnabled() ) {
|
373
|
+
if( module.is.active() && activeText) {
|
374
|
+
module.verbose('Resetting active text', activeText);
|
375
|
+
module.update.text(activeText);
|
376
|
+
}
|
377
|
+
else if(inactiveText) {
|
378
|
+
module.verbose('Resetting inactive text', activeText);
|
379
|
+
module.update.text(inactiveText);
|
380
|
+
}
|
381
|
+
}
|
382
|
+
}
|
383
|
+
},
|
384
|
+
|
385
|
+
update: {
|
386
|
+
text: function(text) {
|
387
|
+
var
|
388
|
+
currentText = module.get.text()
|
389
|
+
;
|
390
|
+
if(text && text !== currentText) {
|
391
|
+
module.debug('Updating text', text);
|
392
|
+
if(settings.selector.text) {
|
393
|
+
$module
|
394
|
+
.data(metadata.storedText, text)
|
395
|
+
.find(settings.selector.text)
|
396
|
+
.text(text)
|
397
|
+
;
|
398
|
+
}
|
399
|
+
else {
|
400
|
+
$module
|
401
|
+
.data(metadata.storedText, text)
|
402
|
+
.html(text)
|
403
|
+
;
|
404
|
+
}
|
405
|
+
}
|
406
|
+
else {
|
407
|
+
module.debug('Text is already set, ignoring update', text);
|
408
|
+
}
|
409
|
+
}
|
410
|
+
},
|
411
|
+
|
412
|
+
setting: function(name, value) {
|
413
|
+
module.debug('Changing setting', name, value);
|
414
|
+
if( $.isPlainObject(name) ) {
|
415
|
+
$.extend(true, settings, name);
|
416
|
+
}
|
417
|
+
else if(value !== undefined) {
|
418
|
+
if($.isPlainObject(settings[name])) {
|
419
|
+
$.extend(true, settings[name], value);
|
420
|
+
}
|
421
|
+
else {
|
422
|
+
settings[name] = value;
|
423
|
+
}
|
424
|
+
}
|
425
|
+
else {
|
426
|
+
return settings[name];
|
427
|
+
}
|
428
|
+
},
|
429
|
+
internal: function(name, value) {
|
430
|
+
if( $.isPlainObject(name) ) {
|
431
|
+
$.extend(true, module, name);
|
432
|
+
}
|
433
|
+
else if(value !== undefined) {
|
434
|
+
module[name] = value;
|
435
|
+
}
|
436
|
+
else {
|
437
|
+
return module[name];
|
438
|
+
}
|
439
|
+
},
|
440
|
+
debug: function() {
|
441
|
+
if(!settings.silent && settings.debug) {
|
442
|
+
if(settings.performance) {
|
443
|
+
module.performance.log(arguments);
|
444
|
+
}
|
445
|
+
else {
|
446
|
+
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
447
|
+
module.debug.apply(console, arguments);
|
448
|
+
}
|
449
|
+
}
|
450
|
+
},
|
451
|
+
verbose: function() {
|
452
|
+
if(!settings.silent && settings.verbose && settings.debug) {
|
453
|
+
if(settings.performance) {
|
454
|
+
module.performance.log(arguments);
|
455
|
+
}
|
456
|
+
else {
|
457
|
+
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
458
|
+
module.verbose.apply(console, arguments);
|
459
|
+
}
|
460
|
+
}
|
461
|
+
},
|
462
|
+
error: function() {
|
463
|
+
if(!settings.silent) {
|
464
|
+
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
465
|
+
module.error.apply(console, arguments);
|
466
|
+
}
|
467
|
+
},
|
468
|
+
performance: {
|
469
|
+
log: function(message) {
|
470
|
+
var
|
471
|
+
currentTime,
|
472
|
+
executionTime,
|
473
|
+
previousTime
|
474
|
+
;
|
475
|
+
if(settings.performance) {
|
476
|
+
currentTime = new Date().getTime();
|
477
|
+
previousTime = time || currentTime;
|
478
|
+
executionTime = currentTime - previousTime;
|
479
|
+
time = currentTime;
|
480
|
+
performance.push({
|
481
|
+
'Name' : message[0],
|
482
|
+
'Arguments' : [].slice.call(message, 1) || '',
|
483
|
+
'Element' : element,
|
484
|
+
'Execution Time' : executionTime
|
485
|
+
});
|
486
|
+
}
|
487
|
+
clearTimeout(module.performance.timer);
|
488
|
+
module.performance.timer = setTimeout(module.performance.display, 500);
|
489
|
+
},
|
490
|
+
display: function() {
|
491
|
+
var
|
492
|
+
title = settings.name + ':',
|
493
|
+
totalTime = 0
|
494
|
+
;
|
495
|
+
time = false;
|
496
|
+
clearTimeout(module.performance.timer);
|
497
|
+
$.each(performance, function(index, data) {
|
498
|
+
totalTime += data['Execution Time'];
|
499
|
+
});
|
500
|
+
title += ' ' + totalTime + 'ms';
|
501
|
+
if(moduleSelector) {
|
502
|
+
title += ' \'' + moduleSelector + '\'';
|
503
|
+
}
|
504
|
+
if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
|
505
|
+
console.groupCollapsed(title);
|
506
|
+
if(console.table) {
|
507
|
+
console.table(performance);
|
508
|
+
}
|
509
|
+
else {
|
510
|
+
$.each(performance, function(index, data) {
|
511
|
+
console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
|
512
|
+
});
|
513
|
+
}
|
514
|
+
console.groupEnd();
|
515
|
+
}
|
516
|
+
performance = [];
|
517
|
+
}
|
518
|
+
},
|
519
|
+
invoke: function(query, passedArguments, context) {
|
520
|
+
var
|
521
|
+
object = instance,
|
522
|
+
maxDepth,
|
523
|
+
found,
|
524
|
+
response
|
525
|
+
;
|
526
|
+
passedArguments = passedArguments || queryArguments;
|
527
|
+
context = element || context;
|
528
|
+
if(typeof query == 'string' && object !== undefined) {
|
529
|
+
query = query.split(/[\. ]/);
|
530
|
+
maxDepth = query.length - 1;
|
531
|
+
$.each(query, function(depth, value) {
|
532
|
+
var camelCaseValue = (depth != maxDepth)
|
533
|
+
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
534
|
+
: query
|
535
|
+
;
|
536
|
+
if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
|
537
|
+
object = object[camelCaseValue];
|
538
|
+
}
|
539
|
+
else if( object[camelCaseValue] !== undefined ) {
|
540
|
+
found = object[camelCaseValue];
|
541
|
+
return false;
|
542
|
+
}
|
543
|
+
else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
|
544
|
+
object = object[value];
|
545
|
+
}
|
546
|
+
else if( object[value] !== undefined ) {
|
547
|
+
found = object[value];
|
548
|
+
return false;
|
549
|
+
}
|
550
|
+
else {
|
551
|
+
module.error(error.method, query);
|
552
|
+
return false;
|
553
|
+
}
|
554
|
+
});
|
555
|
+
}
|
556
|
+
if ( $.isFunction( found ) ) {
|
557
|
+
response = found.apply(context, passedArguments);
|
558
|
+
}
|
559
|
+
else if(found !== undefined) {
|
560
|
+
response = found;
|
561
|
+
}
|
562
|
+
if($.isArray(returnedValue)) {
|
563
|
+
returnedValue.push(response);
|
564
|
+
}
|
565
|
+
else if(returnedValue !== undefined) {
|
566
|
+
returnedValue = [returnedValue, response];
|
567
|
+
}
|
568
|
+
else if(response !== undefined) {
|
569
|
+
returnedValue = response;
|
570
|
+
}
|
571
|
+
return found;
|
572
|
+
}
|
573
|
+
};
|
574
|
+
|
575
|
+
if(methodInvoked) {
|
576
|
+
if(instance === undefined) {
|
577
|
+
module.initialize();
|
578
|
+
}
|
579
|
+
module.invoke(query);
|
580
|
+
}
|
581
|
+
else {
|
582
|
+
if(instance !== undefined) {
|
583
|
+
instance.invoke('destroy');
|
584
|
+
}
|
585
|
+
module.initialize();
|
586
|
+
}
|
587
|
+
})
|
588
|
+
;
|
589
|
+
|
590
|
+
return (returnedValue !== undefined)
|
591
|
+
? returnedValue
|
592
|
+
: this
|
593
|
+
;
|
594
|
+
};
|
595
|
+
|
596
|
+
$.fn.state.settings = {
|
597
|
+
|
598
|
+
// module info
|
599
|
+
name : 'State',
|
600
|
+
|
601
|
+
// debug output
|
602
|
+
debug : false,
|
603
|
+
|
604
|
+
// verbose debug output
|
605
|
+
verbose : false,
|
606
|
+
|
607
|
+
// namespace for events
|
608
|
+
namespace : 'state',
|
609
|
+
|
610
|
+
// debug data includes performance
|
611
|
+
performance : true,
|
612
|
+
|
613
|
+
// callback occurs on state change
|
614
|
+
onActivate : function() {},
|
615
|
+
onDeactivate : function() {},
|
616
|
+
onChange : function() {},
|
617
|
+
|
618
|
+
// state test functions
|
619
|
+
activateTest : function() { return true; },
|
620
|
+
deactivateTest : function() { return true; },
|
621
|
+
|
622
|
+
// whether to automatically map default states
|
623
|
+
automatic : true,
|
624
|
+
|
625
|
+
// activate / deactivate changes all elements instantiated at same time
|
626
|
+
sync : false,
|
627
|
+
|
628
|
+
// default flash text duration, used for temporarily changing text of an element
|
629
|
+
flashDuration : 1000,
|
630
|
+
|
631
|
+
// selector filter
|
632
|
+
filter : {
|
633
|
+
text : '.loading, .disabled',
|
634
|
+
active : '.disabled'
|
635
|
+
},
|
636
|
+
|
637
|
+
context : false,
|
638
|
+
|
639
|
+
// error
|
640
|
+
error: {
|
641
|
+
beforeSend : 'The before send function has cancelled state change',
|
642
|
+
method : 'The method you called is not defined.'
|
643
|
+
},
|
644
|
+
|
645
|
+
// metadata
|
646
|
+
metadata: {
|
647
|
+
promise : 'promise',
|
648
|
+
storedText : 'stored-text'
|
649
|
+
},
|
650
|
+
|
651
|
+
// change class on state
|
652
|
+
className: {
|
653
|
+
active : 'active',
|
654
|
+
disabled : 'disabled',
|
655
|
+
error : 'error',
|
656
|
+
loading : 'loading',
|
657
|
+
success : 'success',
|
658
|
+
warning : 'warning'
|
659
|
+
},
|
660
|
+
|
661
|
+
selector: {
|
662
|
+
// selector for text node
|
663
|
+
text: false
|
664
|
+
},
|
665
|
+
|
666
|
+
defaults : {
|
667
|
+
input: {
|
668
|
+
disabled : true,
|
669
|
+
loading : true,
|
670
|
+
active : true
|
671
|
+
},
|
672
|
+
button: {
|
673
|
+
disabled : true,
|
674
|
+
loading : true,
|
675
|
+
active : true,
|
676
|
+
},
|
677
|
+
progress: {
|
678
|
+
active : true,
|
679
|
+
success : true,
|
680
|
+
warning : true,
|
681
|
+
error : true
|
682
|
+
}
|
683
|
+
},
|
684
|
+
|
685
|
+
states : {
|
686
|
+
active : true,
|
687
|
+
disabled : true,
|
688
|
+
error : true,
|
689
|
+
loading : true,
|
690
|
+
success : true,
|
691
|
+
warning : true
|
692
|
+
},
|
693
|
+
|
694
|
+
text : {
|
695
|
+
disabled : false,
|
696
|
+
flash : false,
|
697
|
+
hover : false,
|
698
|
+
active : false,
|
699
|
+
inactive : false,
|
700
|
+
activate : false,
|
701
|
+
deactivate : false
|
702
|
+
}
|
703
|
+
|
704
|
+
};
|
705
|
+
|
706
|
+
|
707
|
+
|
708
|
+
})( jQuery, window, document );
|