jruby_activiti 1.2.5 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/.ruby-version +1 -1
- data/CHANGELOG +6 -0
- data/Jarfile +5 -0
- data/Jarfile.lock +52 -13
- data/README.md +21 -9
- data/java/build.md +3 -0
- data/java/mapping.md +20 -0
- data/java/pom.xml +30 -0
- data/java/src/main/java/jrubyactiviti/Modeler.java +95 -0
- data/java/src/main/java/jrubyactiviti/ProcessDiagram.java +491 -0
- data/java/src/main/java/jrubyactiviti/ProcessInstanceHighlights.java +237 -0
- data/java/src/main/java/jrubyactiviti/StencilsetResource.java +16 -0
- data/java/src/main/resources/stencilset.json +1339 -0
- data/jruby_activiti.gemspec +3 -2
- data/lib/generators/jruby_activiti/install_generator.rb +4 -0
- data/lib/jar/jrubyactiviti-2.0.jar +0 -0
- data/lib/jruby_activiti/version.rb +1 -1
- data/lib/jruby_activiti/web.rb +81 -0
- data/lib/jruby_activiti.rb +28 -20
- data/test/{base_test.rb → activiti_test.rb} +1 -3
- data/test/instance_hights_test.rb +18 -0
- data/test/modeler_test.rb +35 -0
- data/test/process_diagram_test.rb +33 -0
- data/test/resources/model_init_editor_source.json +1 -0
- data/test/resources/model_json_xml.json +278 -0
- data/test/resources/model_svg_xml.xml +66 -0
- data/test/stencilset_test.rb +7 -0
- data/test/test_helper.rb +2 -0
- data/web/public/diagram-viewer/images/bg.png +0 -0
- data/web/public/diagram-viewer/images/breadcrumbs.png +0 -0
- data/web/public/diagram-viewer/images/checker-bg.png +0 -0
- data/web/public/diagram-viewer/images/deployer/blue/message_catch.png +0 -0
- data/web/public/diagram-viewer/images/deployer/business_rule.png +0 -0
- data/web/public/diagram-viewer/images/deployer/error_catch.png +0 -0
- data/web/public/diagram-viewer/images/deployer/error_throw.png +0 -0
- data/web/public/diagram-viewer/images/deployer/manual.png +0 -0
- data/web/public/diagram-viewer/images/deployer/message_catch.png +0 -0
- data/web/public/diagram-viewer/images/deployer/message_throw.png +0 -0
- data/web/public/diagram-viewer/images/deployer/receive.png +0 -0
- data/web/public/diagram-viewer/images/deployer/script.png +0 -0
- data/web/public/diagram-viewer/images/deployer/send.png +0 -0
- data/web/public/diagram-viewer/images/deployer/service.png +0 -0
- data/web/public/diagram-viewer/images/deployer/signal_catch.png +0 -0
- data/web/public/diagram-viewer/images/deployer/signal_throw.png +0 -0
- data/web/public/diagram-viewer/images/deployer/timer.png +0 -0
- data/web/public/diagram-viewer/images/deployer/user.png +0 -0
- data/web/public/diagram-viewer/index.html +130 -0
- data/web/public/diagram-viewer/js/ActivitiRest.js +74 -0
- data/web/public/diagram-viewer/js/ActivityImpl.js +1 -0
- data/web/public/diagram-viewer/js/Color.js +603 -0
- data/web/public/diagram-viewer/js/LineBreakMeasurer.js +270 -0
- data/web/public/diagram-viewer/js/Polyline.js +387 -0
- data/web/public/diagram-viewer/js/ProcessDiagramCanvas.js +2172 -0
- data/web/public/diagram-viewer/js/ProcessDiagramGenerator.js +1087 -0
- data/web/public/diagram-viewer/js/jquery/jquery.asyncqueue.js +125 -0
- data/web/public/diagram-viewer/js/jquery/jquery.js +9266 -0
- data/web/public/diagram-viewer/js/jquery/jquery.progressbar.js +131 -0
- data/web/public/diagram-viewer/js/jstools.js +23 -0
- data/web/public/diagram-viewer/js/raphael.2.1.1.js +10 -0
- data/web/public/diagram-viewer/js/raphael.js +10 -0
- data/web/public/diagram-viewer/js/raphael_uncompressed.js +5815 -0
- data/web/public/diagram-viewer/js/textlayout.js +441 -0
- data/web/public/diagram-viewer/style.css +1 -0
- data/web/public/editor-app/app-cfg.js +25 -0
- data/web/public/editor-app/app.js +432 -0
- data/web/public/editor-app/configuration/properties/assignment-display-template.html +4 -0
- data/web/public/editor-app/configuration/properties/assignment-popup.html +44 -0
- data/web/public/editor-app/configuration/properties/assignment-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/boolean-property-template.html +4 -0
- data/web/public/editor-app/configuration/properties/condition-expression-display-template.html +2 -0
- data/web/public/editor-app/configuration/properties/condition-expression-popup.html +29 -0
- data/web/public/editor-app/configuration/properties/condition-expression-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/default-value-display-template.html +4 -0
- data/web/public/editor-app/configuration/properties/event-listeners-display-template.html +3 -0
- data/web/public/editor-app/configuration/properties/event-listeners-popup.html +115 -0
- data/web/public/editor-app/configuration/properties/event-listeners-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/execution-listeners-display-template.html +3 -0
- data/web/public/editor-app/configuration/properties/execution-listeners-popup.html +101 -0
- data/web/public/editor-app/configuration/properties/execution-listeners-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/feedback-popup.html +17 -0
- data/web/public/editor-app/configuration/properties/fields-display-template.html +3 -0
- data/web/public/editor-app/configuration/properties/fields-popup.html +61 -0
- data/web/public/editor-app/configuration/properties/fields-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/form-properties-display-template.html +3 -0
- data/web/public/editor-app/configuration/properties/form-properties-popup.html +93 -0
- data/web/public/editor-app/configuration/properties/form-properties-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/in-parameters-display-template.html +3 -0
- data/web/public/editor-app/configuration/properties/in-parameters-popup.html +53 -0
- data/web/public/editor-app/configuration/properties/in-parameters-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/message-definitions-display-template.html +2 -0
- data/web/public/editor-app/configuration/properties/message-definitions-popup.html +50 -0
- data/web/public/editor-app/configuration/properties/message-definitions-write-template.html +3 -0
- data/web/public/editor-app/configuration/properties/message-property-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/multiinstance-property-write-template.html +8 -0
- data/web/public/editor-app/configuration/properties/out-parameters-display-template.html +3 -0
- data/web/public/editor-app/configuration/properties/out-parameters-popup.html +53 -0
- data/web/public/editor-app/configuration/properties/out-parameters-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/sequenceflow-order-display-template.html +3 -0
- data/web/public/editor-app/configuration/properties/sequenceflow-order-popup.html +47 -0
- data/web/public/editor-app/configuration/properties/sequenceflow-order-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/signal-definitions-display-template.html +3 -0
- data/web/public/editor-app/configuration/properties/signal-definitions-popup.html +58 -0
- data/web/public/editor-app/configuration/properties/signal-definitions-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/signal-property-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/string-property-write-mode-template.html +8 -0
- data/web/public/editor-app/configuration/properties/subprocess-reference-display-template.html +3 -0
- data/web/public/editor-app/configuration/properties/subprocess-reference-popup.html +43 -0
- data/web/public/editor-app/configuration/properties/subprocess-reference-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/task-listeners-display-template.html +3 -0
- data/web/public/editor-app/configuration/properties/task-listeners-popup.html +102 -0
- data/web/public/editor-app/configuration/properties/task-listeners-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/text-popup.html +17 -0
- data/web/public/editor-app/configuration/properties/text-property-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties-assignment-controller.js +150 -0
- data/web/public/editor-app/configuration/properties-condition-expression-controller.js +58 -0
- data/web/public/editor-app/configuration/properties-custom-controllers.js +18 -0
- data/web/public/editor-app/configuration/properties-default-controllers.js +115 -0
- data/web/public/editor-app/configuration/properties-event-listeners-controller.js +266 -0
- data/web/public/editor-app/configuration/properties-execution-listeners-controller.js +326 -0
- data/web/public/editor-app/configuration/properties-fields-controller.js +192 -0
- data/web/public/editor-app/configuration/properties-form-properties-controller.js +192 -0
- data/web/public/editor-app/configuration/properties-in-parameters-controller.js +158 -0
- data/web/public/editor-app/configuration/properties-message-definitions-controller.js +137 -0
- data/web/public/editor-app/configuration/properties-message-scope-controller.js +48 -0
- data/web/public/editor-app/configuration/properties-multiinstance-controller.js +34 -0
- data/web/public/editor-app/configuration/properties-out-parameters-controller.js +158 -0
- data/web/public/editor-app/configuration/properties-sequenceflow-order-controller.js +130 -0
- data/web/public/editor-app/configuration/properties-signal-definitions-controller.js +136 -0
- data/web/public/editor-app/configuration/properties-signal-scope-controller.js +47 -0
- data/web/public/editor-app/configuration/properties-task-listeners-controller.js +325 -0
- data/web/public/editor-app/configuration/properties.js +99 -0
- data/web/public/editor-app/configuration/toolbar-custom-actions.js +18 -0
- data/web/public/editor-app/configuration/toolbar-default-actions.js +429 -0
- data/web/public/editor-app/configuration/toolbar.js +175 -0
- data/web/public/editor-app/configuration/url-config.js +34 -0
- data/web/public/editor-app/css/style-common.css +1518 -0
- data/web/public/editor-app/css/style-editor.css +639 -0
- data/web/public/editor-app/css/style.css +471 -0
- data/web/public/editor-app/editor/css/editor.css +202 -0
- data/web/public/editor-app/editor/i18n/translation_de.js +383 -0
- data/web/public/editor-app/editor/i18n/translation_en_us.js +423 -0
- data/web/public/editor-app/editor/i18n/translation_signavio_de.js +106 -0
- data/web/public/editor-app/editor/i18n/translation_signavio_en_us.js +108 -0
- data/web/public/editor-app/editor/oryx.debug.js +24510 -0
- data/web/public/editor-app/editor/oryx.js +30 -0
- data/web/public/editor-app/editor-config.js +32 -0
- data/web/public/editor-app/editor-controller.js +65 -0
- data/web/public/editor-app/editor-utils.js +135 -0
- data/web/public/editor-app/editor.html +136 -0
- data/web/public/editor-app/eventbus.js +133 -0
- data/web/public/editor-app/fonts/activiti-admin-webfont.eot +0 -0
- data/web/public/editor-app/fonts/activiti-admin-webfont.svg +43 -0
- data/web/public/editor-app/fonts/activiti-admin-webfont.ttf +0 -0
- data/web/public/editor-app/fonts/activiti-admin-webfont.woff +0 -0
- data/web/public/editor-app/fonts/glyphicons-halflings-regular.eot +0 -0
- data/web/public/editor-app/fonts/glyphicons-halflings-regular.svg +229 -0
- data/web/public/editor-app/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/web/public/editor-app/fonts/glyphicons-halflings-regular.woff +0 -0
- data/web/public/editor-app/header-controller.js +31 -0
- data/web/public/editor-app/i18n/en.json +286 -0
- data/web/public/editor-app/images/bpmn-error.png +0 -0
- data/web/public/editor-app/images/bpmn-warning.png +0 -0
- data/web/public/editor-app/images/datadefinition.png +0 -0
- data/web/public/editor-app/images/delete.png +0 -0
- data/web/public/editor-app/images/loading.gif +0 -0
- data/web/public/editor-app/images/logo-2x.png +0 -0
- data/web/public/editor-app/images/logo.png +0 -0
- data/web/public/editor-app/images/nw-handle-dark.gif +0 -0
- data/web/public/editor-app/images/se-handle-dark.gif +0 -0
- data/web/public/editor-app/images/shapemenu_highlight.png +0 -0
- data/web/public/editor-app/images/wrench.png +0 -0
- data/web/public/editor-app/libs/angular-cookies_1.2.13/angular-cookies.min.js +8 -0
- data/web/public/editor-app/libs/angular-cookies_1.2.13/angular-cookies.min.js.map +8 -0
- data/web/public/editor-app/libs/angular-dragdrop.min-1.0.3.js +9 -0
- data/web/public/editor-app/libs/angular-dragdrop_1.0.7/angular-dragdrop.min.js +29 -0
- data/web/public/editor-app/libs/angular-mocks_1.2.13/angular-mocks.js +2136 -0
- data/web/public/editor-app/libs/angular-resource_1.2.13/angular-resource.js +596 -0
- data/web/public/editor-app/libs/angular-resource_1.2.13/angular-resource.min.js +13 -0
- data/web/public/editor-app/libs/angular-resource_1.2.13/angular-resource.min.js.map +8 -0
- data/web/public/editor-app/libs/angular-route_1.2.13/angular-route.js +921 -0
- data/web/public/editor-app/libs/angular-route_1.2.13/angular-route.min.js +14 -0
- data/web/public/editor-app/libs/angular-route_1.2.13/angular-route.min.js.map +8 -0
- data/web/public/editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.js +625 -0
- data/web/public/editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.min.js +14 -0
- data/web/public/editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.min.js.map +8 -0
- data/web/public/editor-app/libs/angular-scroll_0.5.7/angular-scroll.min.js +1 -0
- data/web/public/editor-app/libs/angular-strap_2.0.5/angular-strap.min.js +9 -0
- data/web/public/editor-app/libs/angular-strap_2.0.5/angular-strap.tpl.min.js +8 -0
- data/web/public/editor-app/libs/angular-translate-loader-static-files/.bower.json +19 -0
- data/web/public/editor-app/libs/angular-translate-loader-static-files/angular-translate-loader-static-files.js +31 -0
- data/web/public/editor-app/libs/angular-translate-loader-static-files/angular-translate-loader-static-files.min.js +6 -0
- data/web/public/editor-app/libs/angular-translate-storage-cookie/.bower.json +20 -0
- data/web/public/editor-app/libs/angular-translate-storage-cookie/angular-translate-storage-cookie.js +19 -0
- data/web/public/editor-app/libs/angular-translate-storage-cookie/angular-translate-storage-cookie.min.js +6 -0
- data/web/public/editor-app/libs/angular-translate_2.4.2/angular-translate.js +960 -0
- data/web/public/editor-app/libs/angular-translate_2.4.2/angular-translate.min.js +6 -0
- data/web/public/editor-app/libs/angular_1.2.13/angular-animate.min.js +27 -0
- data/web/public/editor-app/libs/angular_1.2.13/angular.min.js +204 -0
- data/web/public/editor-app/libs/bootstrap-daterangepicker_1.3.7/daterangepicker-bs3.css +267 -0
- data/web/public/editor-app/libs/bootstrap-daterangepicker_1.3.7/daterangepicker.js +1026 -0
- data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap-theme.css +347 -0
- data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap-theme.css.map +1 -0
- data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap-theme.min.css +7 -0
- data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap.css +5785 -0
- data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap.css.map +1 -0
- data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap.min.css +7 -0
- data/web/public/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.eot +0 -0
- data/web/public/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.svg +229 -0
- data/web/public/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/web/public/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.woff +0 -0
- data/web/public/editor-app/libs/bootstrap_3.1.1/js/bootstrap.js +1951 -0
- data/web/public/editor-app/libs/bootstrap_3.1.1/js/bootstrap.min.js +6 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/.bower.json +14 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/.gitignore +2 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/CHANGES +93 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/CONTRIBUTORS.md +25 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/LICENSE +19 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/README.md +161 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-sham.js +444 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-sham.map +1 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-sham.min.js +4 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-shim.js +1314 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-shim.map +1 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-shim.min.js +4 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/package.json +34 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h-kill.js +64 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h-matchers.js +34 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h.js +3 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/index.html +64 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/index.min.html +63 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine-html.js +190 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine.css +166 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine.js +2477 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine_favicon.png +0 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/lib/json2.js +478 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-array.js +1223 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-date.js +152 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-function.js +147 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-number.js +14 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-object.js +181 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-string.js +204 -0
- data/web/public/editor-app/libs/jquery-ui-1.10.3.custom.min.js +6 -0
- data/web/public/editor-app/libs/jquery.autogrow-textarea.js +61 -0
- data/web/public/editor-app/libs/jquery_1.11.0/jquery.js +9789 -0
- data/web/public/editor-app/libs/jquery_1.11.0/jquery.min.js +4 -0
- data/web/public/editor-app/libs/jquery_1.11.0/jquery.min.map +1 -0
- data/web/public/editor-app/libs/json3_3.2.6/LICENSE +20 -0
- data/web/public/editor-app/libs/json3_3.2.6/lib/json3.js +861 -0
- data/web/public/editor-app/libs/json3_3.2.6/lib/json3.min.js +18 -0
- data/web/public/editor-app/libs/momentjs_2.5.1/momentjs.min.js +6 -0
- data/web/public/editor-app/libs/mousetrap-1.4.5.min.js +9 -0
- data/web/public/editor-app/libs/ng-grid-2.0.7-min.js +2 -0
- data/web/public/editor-app/libs/ng-grid-2.0.7.min.css +1 -0
- data/web/public/editor-app/libs/path_parser.js +30 -0
- data/web/public/editor-app/libs/prototype-1.5.1.js +3272 -0
- data/web/public/editor-app/libs/ui-utils.min-0.0.4.js +7 -0
- data/web/public/editor-app/partials/root-stencil-item-template.html +11 -0
- data/web/public/editor-app/partials/stencil-item-template.html +27 -0
- data/web/public/editor-app/plugins.xml +58 -0
- data/web/public/editor-app/popups/icon-template.html +3 -0
- data/web/public/editor-app/popups/save-model.html +41 -0
- data/web/public/editor-app/popups/select-shape.html +20 -0
- data/web/public/editor-app/popups/unsaved-changes.html +22 -0
- data/web/public/editor-app/select-shape-controller.js +314 -0
- data/web/public/editor-app/stencil-controller.js +1421 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/event.subprocess.collapsed.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/event.subprocess.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/expanded.subprocess.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.business.rule.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.camel.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.manual.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.mule.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.receive.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.script.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.send.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.service.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.shell.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.user.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/subprocess.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/task.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/artifact/text.annotation.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/cancel.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/compensation.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/error.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/message.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/signal.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/timer.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/connector/association.undirected.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/connector/association.unidirectional.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/connector/messageflow.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/connector/sequenceflow.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/dataobject/data.store.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/diagram.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/endevent/cancel.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/endevent/error.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/endevent/none.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/endevent/terminate.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/gateway/eventbased.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/gateway/exclusive.databased.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/gateway/inclusive.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/gateway/parallel.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/startevent/error.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/startevent/message.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/startevent/none.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/startevent/signal.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/startevent/timer.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/swimlane/lane.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/swimlane/pool.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/throwing/none.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/throwing/signal.png +0 -0
- data/web/public/editor-app/toolbar-controller.js +162 -0
- data/web/public/modeler.html +140 -0
- data/web/views/models/index.erb +32 -0
- data/web/views/models/new.erb +15 -0
- metadata +334 -10
@@ -0,0 +1,960 @@
|
|
1
|
+
/*!
|
2
|
+
* angular-translate - v2.4.2 - 2014-10-21
|
3
|
+
* http://github.com/angular-translate/angular-translate
|
4
|
+
* Copyright (c) 2014 ; Licensed MIT
|
5
|
+
*/
|
6
|
+
angular.module('pascalprecht.translate', ['ng']).run([
|
7
|
+
'$translate',
|
8
|
+
function ($translate) {
|
9
|
+
var key = $translate.storageKey(), storage = $translate.storage();
|
10
|
+
if (storage) {
|
11
|
+
if (!storage.get(key)) {
|
12
|
+
if (angular.isString($translate.preferredLanguage())) {
|
13
|
+
$translate.use($translate.preferredLanguage());
|
14
|
+
} else {
|
15
|
+
storage.set(key, $translate.use());
|
16
|
+
}
|
17
|
+
} else {
|
18
|
+
$translate.use(storage.get(key));
|
19
|
+
}
|
20
|
+
} else if (angular.isString($translate.preferredLanguage())) {
|
21
|
+
$translate.use($translate.preferredLanguage());
|
22
|
+
}
|
23
|
+
}
|
24
|
+
]);
|
25
|
+
angular.module('pascalprecht.translate').provider('$translate', [
|
26
|
+
'$STORAGE_KEY',
|
27
|
+
function ($STORAGE_KEY) {
|
28
|
+
var $translationTable = {}, $preferredLanguage, $availableLanguageKeys = [], $languageKeyAliases, $fallbackLanguage, $fallbackWasString, $uses, $nextLang, $storageFactory, $storageKey = $STORAGE_KEY, $storagePrefix, $missingTranslationHandlerFactory, $interpolationFactory, $interpolatorFactories = [], $interpolationSanitizationStrategy = false, $loaderFactory, $cloakClassName = 'translate-cloak', $loaderOptions, $notFoundIndicatorLeft, $notFoundIndicatorRight, $postCompilingEnabled = false, NESTED_OBJECT_DELIMITER = '.', loaderCache;
|
29
|
+
var version = '2.4.2';
|
30
|
+
var getLocale = function () {
|
31
|
+
var nav = window.navigator;
|
32
|
+
return ((angular.isArray(nav.languages) ? nav.languages[0] : nav.language || nav.browserLanguage || nav.systemLanguage || nav.userLanguage) || '').split('-').join('_');
|
33
|
+
};
|
34
|
+
var indexOf = function (array, searchElement) {
|
35
|
+
for (var i = 0, len = array.length; i < len; i++) {
|
36
|
+
if (array[i] === searchElement) {
|
37
|
+
return i;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
return -1;
|
41
|
+
};
|
42
|
+
var trim = function () {
|
43
|
+
return this.replace(/^\s+|\s+$/g, '');
|
44
|
+
};
|
45
|
+
var negotiateLocale = function (preferred) {
|
46
|
+
var avail = [], locale = angular.lowercase(preferred), i = 0, n = $availableLanguageKeys.length;
|
47
|
+
for (; i < n; i++) {
|
48
|
+
avail.push(angular.lowercase($availableLanguageKeys[i]));
|
49
|
+
}
|
50
|
+
if (indexOf(avail, locale) > -1) {
|
51
|
+
return preferred;
|
52
|
+
}
|
53
|
+
if ($languageKeyAliases) {
|
54
|
+
var alias;
|
55
|
+
for (var langKeyAlias in $languageKeyAliases) {
|
56
|
+
var hasWildcardKey = false;
|
57
|
+
var hasExactKey = Object.prototype.hasOwnProperty.call($languageKeyAliases, langKeyAlias) && angular.lowercase(langKeyAlias) === angular.lowercase(preferred);
|
58
|
+
if (langKeyAlias.slice(-1) === '*') {
|
59
|
+
hasWildcardKey = langKeyAlias.slice(0, -1) === preferred.slice(0, langKeyAlias.length - 1);
|
60
|
+
}
|
61
|
+
if (hasExactKey || hasWildcardKey) {
|
62
|
+
alias = $languageKeyAliases[langKeyAlias];
|
63
|
+
if (indexOf(avail, angular.lowercase(alias)) > -1) {
|
64
|
+
return alias;
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
69
|
+
var parts = preferred.split('_');
|
70
|
+
if (parts.length > 1 && indexOf(avail, angular.lowercase(parts[0])) > -1) {
|
71
|
+
return parts[0];
|
72
|
+
}
|
73
|
+
return preferred;
|
74
|
+
};
|
75
|
+
var translations = function (langKey, translationTable) {
|
76
|
+
if (!langKey && !translationTable) {
|
77
|
+
return $translationTable;
|
78
|
+
}
|
79
|
+
if (langKey && !translationTable) {
|
80
|
+
if (angular.isString(langKey)) {
|
81
|
+
return $translationTable[langKey];
|
82
|
+
}
|
83
|
+
} else {
|
84
|
+
if (!angular.isObject($translationTable[langKey])) {
|
85
|
+
$translationTable[langKey] = {};
|
86
|
+
}
|
87
|
+
angular.extend($translationTable[langKey], flatObject(translationTable));
|
88
|
+
}
|
89
|
+
return this;
|
90
|
+
};
|
91
|
+
this.translations = translations;
|
92
|
+
this.cloakClassName = function (name) {
|
93
|
+
if (!name) {
|
94
|
+
return $cloakClassName;
|
95
|
+
}
|
96
|
+
$cloakClassName = name;
|
97
|
+
return this;
|
98
|
+
};
|
99
|
+
var flatObject = function (data, path, result, prevKey) {
|
100
|
+
var key, keyWithPath, keyWithShortPath, val;
|
101
|
+
if (!path) {
|
102
|
+
path = [];
|
103
|
+
}
|
104
|
+
if (!result) {
|
105
|
+
result = {};
|
106
|
+
}
|
107
|
+
for (key in data) {
|
108
|
+
if (!Object.prototype.hasOwnProperty.call(data, key)) {
|
109
|
+
continue;
|
110
|
+
}
|
111
|
+
val = data[key];
|
112
|
+
if (angular.isObject(val)) {
|
113
|
+
flatObject(val, path.concat(key), result, key);
|
114
|
+
} else {
|
115
|
+
keyWithPath = path.length ? '' + path.join(NESTED_OBJECT_DELIMITER) + NESTED_OBJECT_DELIMITER + key : key;
|
116
|
+
if (path.length && key === prevKey) {
|
117
|
+
keyWithShortPath = '' + path.join(NESTED_OBJECT_DELIMITER);
|
118
|
+
result[keyWithShortPath] = '@:' + keyWithPath;
|
119
|
+
}
|
120
|
+
result[keyWithPath] = val;
|
121
|
+
}
|
122
|
+
}
|
123
|
+
return result;
|
124
|
+
};
|
125
|
+
this.addInterpolation = function (factory) {
|
126
|
+
$interpolatorFactories.push(factory);
|
127
|
+
return this;
|
128
|
+
};
|
129
|
+
this.useMessageFormatInterpolation = function () {
|
130
|
+
return this.useInterpolation('$translateMessageFormatInterpolation');
|
131
|
+
};
|
132
|
+
this.useInterpolation = function (factory) {
|
133
|
+
$interpolationFactory = factory;
|
134
|
+
return this;
|
135
|
+
};
|
136
|
+
this.useSanitizeValueStrategy = function (value) {
|
137
|
+
$interpolationSanitizationStrategy = value;
|
138
|
+
return this;
|
139
|
+
};
|
140
|
+
this.preferredLanguage = function (langKey) {
|
141
|
+
setupPreferredLanguage(langKey);
|
142
|
+
return this;
|
143
|
+
};
|
144
|
+
var setupPreferredLanguage = function (langKey) {
|
145
|
+
if (langKey) {
|
146
|
+
$preferredLanguage = langKey;
|
147
|
+
}
|
148
|
+
return $preferredLanguage;
|
149
|
+
};
|
150
|
+
this.translationNotFoundIndicator = function (indicator) {
|
151
|
+
this.translationNotFoundIndicatorLeft(indicator);
|
152
|
+
this.translationNotFoundIndicatorRight(indicator);
|
153
|
+
return this;
|
154
|
+
};
|
155
|
+
this.translationNotFoundIndicatorLeft = function (indicator) {
|
156
|
+
if (!indicator) {
|
157
|
+
return $notFoundIndicatorLeft;
|
158
|
+
}
|
159
|
+
$notFoundIndicatorLeft = indicator;
|
160
|
+
return this;
|
161
|
+
};
|
162
|
+
this.translationNotFoundIndicatorRight = function (indicator) {
|
163
|
+
if (!indicator) {
|
164
|
+
return $notFoundIndicatorRight;
|
165
|
+
}
|
166
|
+
$notFoundIndicatorRight = indicator;
|
167
|
+
return this;
|
168
|
+
};
|
169
|
+
this.fallbackLanguage = function (langKey) {
|
170
|
+
fallbackStack(langKey);
|
171
|
+
return this;
|
172
|
+
};
|
173
|
+
var fallbackStack = function (langKey) {
|
174
|
+
if (langKey) {
|
175
|
+
if (angular.isString(langKey)) {
|
176
|
+
$fallbackWasString = true;
|
177
|
+
$fallbackLanguage = [langKey];
|
178
|
+
} else if (angular.isArray(langKey)) {
|
179
|
+
$fallbackWasString = false;
|
180
|
+
$fallbackLanguage = langKey;
|
181
|
+
}
|
182
|
+
if (angular.isString($preferredLanguage) && indexOf($fallbackLanguage, $preferredLanguage) < 0) {
|
183
|
+
$fallbackLanguage.push($preferredLanguage);
|
184
|
+
}
|
185
|
+
return this;
|
186
|
+
} else {
|
187
|
+
if ($fallbackWasString) {
|
188
|
+
return $fallbackLanguage[0];
|
189
|
+
} else {
|
190
|
+
return $fallbackLanguage;
|
191
|
+
}
|
192
|
+
}
|
193
|
+
};
|
194
|
+
this.use = function (langKey) {
|
195
|
+
if (langKey) {
|
196
|
+
if (!$translationTable[langKey] && !$loaderFactory) {
|
197
|
+
throw new Error('$translateProvider couldn\'t find translationTable for langKey: \'' + langKey + '\'');
|
198
|
+
}
|
199
|
+
$uses = langKey;
|
200
|
+
return this;
|
201
|
+
}
|
202
|
+
return $uses;
|
203
|
+
};
|
204
|
+
var storageKey = function (key) {
|
205
|
+
if (!key) {
|
206
|
+
if ($storagePrefix) {
|
207
|
+
return $storagePrefix + $storageKey;
|
208
|
+
}
|
209
|
+
return $storageKey;
|
210
|
+
}
|
211
|
+
$storageKey = key;
|
212
|
+
};
|
213
|
+
this.storageKey = storageKey;
|
214
|
+
this.useUrlLoader = function (url, options) {
|
215
|
+
return this.useLoader('$translateUrlLoader', angular.extend({ url: url }, options));
|
216
|
+
};
|
217
|
+
this.useStaticFilesLoader = function (options) {
|
218
|
+
return this.useLoader('$translateStaticFilesLoader', options);
|
219
|
+
};
|
220
|
+
this.useLoader = function (loaderFactory, options) {
|
221
|
+
$loaderFactory = loaderFactory;
|
222
|
+
$loaderOptions = options || {};
|
223
|
+
return this;
|
224
|
+
};
|
225
|
+
this.useLocalStorage = function () {
|
226
|
+
return this.useStorage('$translateLocalStorage');
|
227
|
+
};
|
228
|
+
this.useCookieStorage = function () {
|
229
|
+
return this.useStorage('$translateCookieStorage');
|
230
|
+
};
|
231
|
+
this.useStorage = function (storageFactory) {
|
232
|
+
$storageFactory = storageFactory;
|
233
|
+
return this;
|
234
|
+
};
|
235
|
+
this.storagePrefix = function (prefix) {
|
236
|
+
if (!prefix) {
|
237
|
+
return prefix;
|
238
|
+
}
|
239
|
+
$storagePrefix = prefix;
|
240
|
+
return this;
|
241
|
+
};
|
242
|
+
this.useMissingTranslationHandlerLog = function () {
|
243
|
+
return this.useMissingTranslationHandler('$translateMissingTranslationHandlerLog');
|
244
|
+
};
|
245
|
+
this.useMissingTranslationHandler = function (factory) {
|
246
|
+
$missingTranslationHandlerFactory = factory;
|
247
|
+
return this;
|
248
|
+
};
|
249
|
+
this.usePostCompiling = function (value) {
|
250
|
+
$postCompilingEnabled = !!value;
|
251
|
+
return this;
|
252
|
+
};
|
253
|
+
this.determinePreferredLanguage = function (fn) {
|
254
|
+
var locale = fn && angular.isFunction(fn) ? fn() : getLocale();
|
255
|
+
if (!$availableLanguageKeys.length) {
|
256
|
+
$preferredLanguage = locale;
|
257
|
+
} else {
|
258
|
+
$preferredLanguage = negotiateLocale(locale);
|
259
|
+
}
|
260
|
+
return this;
|
261
|
+
};
|
262
|
+
this.registerAvailableLanguageKeys = function (languageKeys, aliases) {
|
263
|
+
if (languageKeys) {
|
264
|
+
$availableLanguageKeys = languageKeys;
|
265
|
+
if (aliases) {
|
266
|
+
$languageKeyAliases = aliases;
|
267
|
+
}
|
268
|
+
return this;
|
269
|
+
}
|
270
|
+
return $availableLanguageKeys;
|
271
|
+
};
|
272
|
+
this.useLoaderCache = function (cache) {
|
273
|
+
if (cache === false) {
|
274
|
+
loaderCache = undefined;
|
275
|
+
} else if (cache === true) {
|
276
|
+
loaderCache = true;
|
277
|
+
} else if (typeof cache === 'undefined') {
|
278
|
+
loaderCache = '$translationCache';
|
279
|
+
} else if (cache) {
|
280
|
+
loaderCache = cache;
|
281
|
+
}
|
282
|
+
return this;
|
283
|
+
};
|
284
|
+
this.$get = [
|
285
|
+
'$log',
|
286
|
+
'$injector',
|
287
|
+
'$rootScope',
|
288
|
+
'$q',
|
289
|
+
function ($log, $injector, $rootScope, $q) {
|
290
|
+
var Storage, defaultInterpolator = $injector.get($interpolationFactory || '$translateDefaultInterpolation'), pendingLoader = false, interpolatorHashMap = {}, langPromises = {}, fallbackIndex, startFallbackIteration;
|
291
|
+
var $translate = function (translationId, interpolateParams, interpolationId) {
|
292
|
+
if (angular.isArray(translationId)) {
|
293
|
+
var translateAll = function (translationIds) {
|
294
|
+
var results = {};
|
295
|
+
var promises = [];
|
296
|
+
var translate = function (translationId) {
|
297
|
+
var deferred = $q.defer();
|
298
|
+
var regardless = function (value) {
|
299
|
+
results[translationId] = value;
|
300
|
+
deferred.resolve([
|
301
|
+
translationId,
|
302
|
+
value
|
303
|
+
]);
|
304
|
+
};
|
305
|
+
$translate(translationId, interpolateParams, interpolationId).then(regardless, regardless);
|
306
|
+
return deferred.promise;
|
307
|
+
};
|
308
|
+
for (var i = 0, c = translationIds.length; i < c; i++) {
|
309
|
+
promises.push(translate(translationIds[i]));
|
310
|
+
}
|
311
|
+
return $q.all(promises).then(function () {
|
312
|
+
return results;
|
313
|
+
});
|
314
|
+
};
|
315
|
+
return translateAll(translationId);
|
316
|
+
}
|
317
|
+
var deferred = $q.defer();
|
318
|
+
if (translationId) {
|
319
|
+
translationId = trim.apply(translationId);
|
320
|
+
}
|
321
|
+
var promiseToWaitFor = function () {
|
322
|
+
var promise = $preferredLanguage ? langPromises[$preferredLanguage] : langPromises[$uses];
|
323
|
+
fallbackIndex = 0;
|
324
|
+
if ($storageFactory && !promise) {
|
325
|
+
var langKey = Storage.get($storageKey);
|
326
|
+
promise = langPromises[langKey];
|
327
|
+
if ($fallbackLanguage && $fallbackLanguage.length) {
|
328
|
+
var index = indexOf($fallbackLanguage, langKey);
|
329
|
+
fallbackIndex = index === 0 ? 1 : 0;
|
330
|
+
if (indexOf($fallbackLanguage, $preferredLanguage) < 0) {
|
331
|
+
$fallbackLanguage.push($preferredLanguage);
|
332
|
+
}
|
333
|
+
}
|
334
|
+
}
|
335
|
+
return promise;
|
336
|
+
}();
|
337
|
+
if (!promiseToWaitFor) {
|
338
|
+
determineTranslation(translationId, interpolateParams, interpolationId).then(deferred.resolve, deferred.reject);
|
339
|
+
} else {
|
340
|
+
promiseToWaitFor.then(function () {
|
341
|
+
determineTranslation(translationId, interpolateParams, interpolationId).then(deferred.resolve, deferred.reject);
|
342
|
+
}, deferred.reject);
|
343
|
+
}
|
344
|
+
return deferred.promise;
|
345
|
+
};
|
346
|
+
var applyNotFoundIndicators = function (translationId) {
|
347
|
+
if ($notFoundIndicatorLeft) {
|
348
|
+
translationId = [
|
349
|
+
$notFoundIndicatorLeft,
|
350
|
+
translationId
|
351
|
+
].join(' ');
|
352
|
+
}
|
353
|
+
if ($notFoundIndicatorRight) {
|
354
|
+
translationId = [
|
355
|
+
translationId,
|
356
|
+
$notFoundIndicatorRight
|
357
|
+
].join(' ');
|
358
|
+
}
|
359
|
+
return translationId;
|
360
|
+
};
|
361
|
+
var useLanguage = function (key) {
|
362
|
+
$uses = key;
|
363
|
+
$rootScope.$emit('$translateChangeSuccess', { language: key });
|
364
|
+
if ($storageFactory) {
|
365
|
+
Storage.set($translate.storageKey(), $uses);
|
366
|
+
}
|
367
|
+
defaultInterpolator.setLocale($uses);
|
368
|
+
angular.forEach(interpolatorHashMap, function (interpolator, id) {
|
369
|
+
interpolatorHashMap[id].setLocale($uses);
|
370
|
+
});
|
371
|
+
$rootScope.$emit('$translateChangeEnd', { language: key });
|
372
|
+
};
|
373
|
+
var loadAsync = function (key) {
|
374
|
+
if (!key) {
|
375
|
+
throw 'No language key specified for loading.';
|
376
|
+
}
|
377
|
+
var deferred = $q.defer();
|
378
|
+
$rootScope.$emit('$translateLoadingStart', { language: key });
|
379
|
+
pendingLoader = true;
|
380
|
+
var cache = loaderCache;
|
381
|
+
if (typeof cache === 'string') {
|
382
|
+
cache = $injector.get(cache);
|
383
|
+
}
|
384
|
+
var loaderOptions = angular.extend({}, $loaderOptions, {
|
385
|
+
key: key,
|
386
|
+
$http: angular.extend({}, { cache: cache }, $loaderOptions.$http)
|
387
|
+
});
|
388
|
+
$injector.get($loaderFactory)(loaderOptions).then(function (data) {
|
389
|
+
var translationTable = {};
|
390
|
+
$rootScope.$emit('$translateLoadingSuccess', { language: key });
|
391
|
+
if (angular.isArray(data)) {
|
392
|
+
angular.forEach(data, function (table) {
|
393
|
+
angular.extend(translationTable, flatObject(table));
|
394
|
+
});
|
395
|
+
} else {
|
396
|
+
angular.extend(translationTable, flatObject(data));
|
397
|
+
}
|
398
|
+
pendingLoader = false;
|
399
|
+
deferred.resolve({
|
400
|
+
key: key,
|
401
|
+
table: translationTable
|
402
|
+
});
|
403
|
+
$rootScope.$emit('$translateLoadingEnd', { language: key });
|
404
|
+
}, function (key) {
|
405
|
+
$rootScope.$emit('$translateLoadingError', { language: key });
|
406
|
+
deferred.reject(key);
|
407
|
+
$rootScope.$emit('$translateLoadingEnd', { language: key });
|
408
|
+
});
|
409
|
+
return deferred.promise;
|
410
|
+
};
|
411
|
+
if ($storageFactory) {
|
412
|
+
Storage = $injector.get($storageFactory);
|
413
|
+
if (!Storage.get || !Storage.set) {
|
414
|
+
throw new Error('Couldn\'t use storage \'' + $storageFactory + '\', missing get() or set() method!');
|
415
|
+
}
|
416
|
+
}
|
417
|
+
if (angular.isFunction(defaultInterpolator.useSanitizeValueStrategy)) {
|
418
|
+
defaultInterpolator.useSanitizeValueStrategy($interpolationSanitizationStrategy);
|
419
|
+
}
|
420
|
+
if ($interpolatorFactories.length) {
|
421
|
+
angular.forEach($interpolatorFactories, function (interpolatorFactory) {
|
422
|
+
var interpolator = $injector.get(interpolatorFactory);
|
423
|
+
interpolator.setLocale($preferredLanguage || $uses);
|
424
|
+
if (angular.isFunction(interpolator.useSanitizeValueStrategy)) {
|
425
|
+
interpolator.useSanitizeValueStrategy($interpolationSanitizationStrategy);
|
426
|
+
}
|
427
|
+
interpolatorHashMap[interpolator.getInterpolationIdentifier()] = interpolator;
|
428
|
+
});
|
429
|
+
}
|
430
|
+
var getTranslationTable = function (langKey) {
|
431
|
+
var deferred = $q.defer();
|
432
|
+
if (Object.prototype.hasOwnProperty.call($translationTable, langKey)) {
|
433
|
+
deferred.resolve($translationTable[langKey]);
|
434
|
+
} else if (langPromises[langKey]) {
|
435
|
+
langPromises[langKey].then(function (data) {
|
436
|
+
translations(data.key, data.table);
|
437
|
+
deferred.resolve(data.table);
|
438
|
+
}, deferred.reject);
|
439
|
+
} else {
|
440
|
+
deferred.reject();
|
441
|
+
}
|
442
|
+
return deferred.promise;
|
443
|
+
};
|
444
|
+
var getFallbackTranslation = function (langKey, translationId, interpolateParams, Interpolator) {
|
445
|
+
var deferred = $q.defer();
|
446
|
+
getTranslationTable(langKey).then(function (translationTable) {
|
447
|
+
if (Object.prototype.hasOwnProperty.call(translationTable, translationId)) {
|
448
|
+
Interpolator.setLocale(langKey);
|
449
|
+
deferred.resolve(Interpolator.interpolate(translationTable[translationId], interpolateParams));
|
450
|
+
Interpolator.setLocale($uses);
|
451
|
+
} else {
|
452
|
+
deferred.reject();
|
453
|
+
}
|
454
|
+
}, deferred.reject);
|
455
|
+
return deferred.promise;
|
456
|
+
};
|
457
|
+
var getFallbackTranslationInstant = function (langKey, translationId, interpolateParams, Interpolator) {
|
458
|
+
var result, translationTable = $translationTable[langKey];
|
459
|
+
if (Object.prototype.hasOwnProperty.call(translationTable, translationId)) {
|
460
|
+
Interpolator.setLocale(langKey);
|
461
|
+
result = Interpolator.interpolate(translationTable[translationId], interpolateParams);
|
462
|
+
Interpolator.setLocale($uses);
|
463
|
+
}
|
464
|
+
return result;
|
465
|
+
};
|
466
|
+
var translateByHandler = function (translationId) {
|
467
|
+
if ($missingTranslationHandlerFactory) {
|
468
|
+
var resultString = $injector.get($missingTranslationHandlerFactory)(translationId, $uses);
|
469
|
+
if (resultString !== undefined) {
|
470
|
+
return resultString;
|
471
|
+
} else {
|
472
|
+
return translationId;
|
473
|
+
}
|
474
|
+
} else {
|
475
|
+
return translationId;
|
476
|
+
}
|
477
|
+
};
|
478
|
+
var resolveForFallbackLanguage = function (fallbackLanguageIndex, translationId, interpolateParams, Interpolator) {
|
479
|
+
var deferred = $q.defer();
|
480
|
+
if (fallbackLanguageIndex < $fallbackLanguage.length) {
|
481
|
+
var langKey = $fallbackLanguage[fallbackLanguageIndex];
|
482
|
+
getFallbackTranslation(langKey, translationId, interpolateParams, Interpolator).then(deferred.resolve, function () {
|
483
|
+
resolveForFallbackLanguage(fallbackLanguageIndex + 1, translationId, interpolateParams, Interpolator).then(deferred.resolve);
|
484
|
+
});
|
485
|
+
} else {
|
486
|
+
deferred.resolve(translateByHandler(translationId));
|
487
|
+
}
|
488
|
+
return deferred.promise;
|
489
|
+
};
|
490
|
+
var resolveForFallbackLanguageInstant = function (fallbackLanguageIndex, translationId, interpolateParams, Interpolator) {
|
491
|
+
var result;
|
492
|
+
if (fallbackLanguageIndex < $fallbackLanguage.length) {
|
493
|
+
var langKey = $fallbackLanguage[fallbackLanguageIndex];
|
494
|
+
result = getFallbackTranslationInstant(langKey, translationId, interpolateParams, Interpolator);
|
495
|
+
if (!result) {
|
496
|
+
result = resolveForFallbackLanguageInstant(fallbackLanguageIndex + 1, translationId, interpolateParams, Interpolator);
|
497
|
+
}
|
498
|
+
}
|
499
|
+
return result;
|
500
|
+
};
|
501
|
+
var fallbackTranslation = function (translationId, interpolateParams, Interpolator) {
|
502
|
+
return resolveForFallbackLanguage(startFallbackIteration > 0 ? startFallbackIteration : fallbackIndex, translationId, interpolateParams, Interpolator);
|
503
|
+
};
|
504
|
+
var fallbackTranslationInstant = function (translationId, interpolateParams, Interpolator) {
|
505
|
+
return resolveForFallbackLanguageInstant(startFallbackIteration > 0 ? startFallbackIteration : fallbackIndex, translationId, interpolateParams, Interpolator);
|
506
|
+
};
|
507
|
+
var determineTranslation = function (translationId, interpolateParams, interpolationId) {
|
508
|
+
var deferred = $q.defer();
|
509
|
+
var table = $uses ? $translationTable[$uses] : $translationTable, Interpolator = interpolationId ? interpolatorHashMap[interpolationId] : defaultInterpolator;
|
510
|
+
if (table && Object.prototype.hasOwnProperty.call(table, translationId)) {
|
511
|
+
var translation = table[translationId];
|
512
|
+
if (translation.substr(0, 2) === '@:') {
|
513
|
+
$translate(translation.substr(2), interpolateParams, interpolationId).then(deferred.resolve, deferred.reject);
|
514
|
+
} else {
|
515
|
+
deferred.resolve(Interpolator.interpolate(translation, interpolateParams));
|
516
|
+
}
|
517
|
+
} else {
|
518
|
+
var missingTranslationHandlerTranslation;
|
519
|
+
if ($missingTranslationHandlerFactory && !pendingLoader) {
|
520
|
+
missingTranslationHandlerTranslation = translateByHandler(translationId);
|
521
|
+
}
|
522
|
+
if ($uses && $fallbackLanguage && $fallbackLanguage.length) {
|
523
|
+
fallbackTranslation(translationId, interpolateParams, Interpolator).then(function (translation) {
|
524
|
+
deferred.resolve(translation);
|
525
|
+
}, function (_translationId) {
|
526
|
+
deferred.reject(applyNotFoundIndicators(_translationId));
|
527
|
+
});
|
528
|
+
} else if ($missingTranslationHandlerFactory && !pendingLoader && missingTranslationHandlerTranslation) {
|
529
|
+
deferred.resolve(missingTranslationHandlerTranslation);
|
530
|
+
} else {
|
531
|
+
deferred.reject(applyNotFoundIndicators(translationId));
|
532
|
+
}
|
533
|
+
}
|
534
|
+
return deferred.promise;
|
535
|
+
};
|
536
|
+
var determineTranslationInstant = function (translationId, interpolateParams, interpolationId) {
|
537
|
+
var result, table = $uses ? $translationTable[$uses] : $translationTable, Interpolator = interpolationId ? interpolatorHashMap[interpolationId] : defaultInterpolator;
|
538
|
+
if (table && Object.prototype.hasOwnProperty.call(table, translationId)) {
|
539
|
+
var translation = table[translationId];
|
540
|
+
if (translation.substr(0, 2) === '@:') {
|
541
|
+
result = determineTranslationInstant(translation.substr(2), interpolateParams, interpolationId);
|
542
|
+
} else {
|
543
|
+
result = Interpolator.interpolate(translation, interpolateParams);
|
544
|
+
}
|
545
|
+
} else {
|
546
|
+
var missingTranslationHandlerTranslation;
|
547
|
+
if ($missingTranslationHandlerFactory && !pendingLoader) {
|
548
|
+
missingTranslationHandlerTranslation = translateByHandler(translationId);
|
549
|
+
}
|
550
|
+
if ($uses && $fallbackLanguage && $fallbackLanguage.length) {
|
551
|
+
fallbackIndex = 0;
|
552
|
+
result = fallbackTranslationInstant(translationId, interpolateParams, Interpolator);
|
553
|
+
} else if ($missingTranslationHandlerFactory && !pendingLoader && missingTranslationHandlerTranslation) {
|
554
|
+
result = missingTranslationHandlerTranslation;
|
555
|
+
} else {
|
556
|
+
result = applyNotFoundIndicators(translationId);
|
557
|
+
}
|
558
|
+
}
|
559
|
+
return result;
|
560
|
+
};
|
561
|
+
$translate.preferredLanguage = function (langKey) {
|
562
|
+
if (langKey) {
|
563
|
+
setupPreferredLanguage(langKey);
|
564
|
+
}
|
565
|
+
return $preferredLanguage;
|
566
|
+
};
|
567
|
+
$translate.cloakClassName = function () {
|
568
|
+
return $cloakClassName;
|
569
|
+
};
|
570
|
+
$translate.fallbackLanguage = function (langKey) {
|
571
|
+
if (langKey !== undefined && langKey !== null) {
|
572
|
+
fallbackStack(langKey);
|
573
|
+
if ($loaderFactory) {
|
574
|
+
if ($fallbackLanguage && $fallbackLanguage.length) {
|
575
|
+
for (var i = 0, len = $fallbackLanguage.length; i < len; i++) {
|
576
|
+
if (!langPromises[$fallbackLanguage[i]]) {
|
577
|
+
langPromises[$fallbackLanguage[i]] = loadAsync($fallbackLanguage[i]);
|
578
|
+
}
|
579
|
+
}
|
580
|
+
}
|
581
|
+
}
|
582
|
+
$translate.use($translate.use());
|
583
|
+
}
|
584
|
+
if ($fallbackWasString) {
|
585
|
+
return $fallbackLanguage[0];
|
586
|
+
} else {
|
587
|
+
return $fallbackLanguage;
|
588
|
+
}
|
589
|
+
};
|
590
|
+
$translate.useFallbackLanguage = function (langKey) {
|
591
|
+
if (langKey !== undefined && langKey !== null) {
|
592
|
+
if (!langKey) {
|
593
|
+
startFallbackIteration = 0;
|
594
|
+
} else {
|
595
|
+
var langKeyPosition = indexOf($fallbackLanguage, langKey);
|
596
|
+
if (langKeyPosition > -1) {
|
597
|
+
startFallbackIteration = langKeyPosition;
|
598
|
+
}
|
599
|
+
}
|
600
|
+
}
|
601
|
+
};
|
602
|
+
$translate.proposedLanguage = function () {
|
603
|
+
return $nextLang;
|
604
|
+
};
|
605
|
+
$translate.storage = function () {
|
606
|
+
return Storage;
|
607
|
+
};
|
608
|
+
$translate.use = function (key) {
|
609
|
+
if (!key) {
|
610
|
+
return $uses;
|
611
|
+
}
|
612
|
+
var deferred = $q.defer();
|
613
|
+
$rootScope.$emit('$translateChangeStart', { language: key });
|
614
|
+
var aliasedKey = negotiateLocale(key);
|
615
|
+
if (aliasedKey) {
|
616
|
+
key = aliasedKey;
|
617
|
+
}
|
618
|
+
if (!$translationTable[key] && $loaderFactory && !langPromises[key]) {
|
619
|
+
$nextLang = key;
|
620
|
+
langPromises[key] = loadAsync(key).then(function (translation) {
|
621
|
+
translations(translation.key, translation.table);
|
622
|
+
deferred.resolve(translation.key);
|
623
|
+
useLanguage(translation.key);
|
624
|
+
if ($nextLang === key) {
|
625
|
+
$nextLang = undefined;
|
626
|
+
}
|
627
|
+
}, function (key) {
|
628
|
+
if ($nextLang === key) {
|
629
|
+
$nextLang = undefined;
|
630
|
+
}
|
631
|
+
$rootScope.$emit('$translateChangeError', { language: key });
|
632
|
+
deferred.reject(key);
|
633
|
+
$rootScope.$emit('$translateChangeEnd', { language: key });
|
634
|
+
});
|
635
|
+
} else {
|
636
|
+
deferred.resolve(key);
|
637
|
+
useLanguage(key);
|
638
|
+
}
|
639
|
+
return deferred.promise;
|
640
|
+
};
|
641
|
+
$translate.storageKey = function () {
|
642
|
+
return storageKey();
|
643
|
+
};
|
644
|
+
$translate.isPostCompilingEnabled = function () {
|
645
|
+
return $postCompilingEnabled;
|
646
|
+
};
|
647
|
+
$translate.refresh = function (langKey) {
|
648
|
+
if (!$loaderFactory) {
|
649
|
+
throw new Error('Couldn\'t refresh translation table, no loader registered!');
|
650
|
+
}
|
651
|
+
var deferred = $q.defer();
|
652
|
+
function resolve() {
|
653
|
+
deferred.resolve();
|
654
|
+
$rootScope.$emit('$translateRefreshEnd', { language: langKey });
|
655
|
+
}
|
656
|
+
function reject() {
|
657
|
+
deferred.reject();
|
658
|
+
$rootScope.$emit('$translateRefreshEnd', { language: langKey });
|
659
|
+
}
|
660
|
+
$rootScope.$emit('$translateRefreshStart', { language: langKey });
|
661
|
+
if (!langKey) {
|
662
|
+
var tables = [], loadingKeys = {};
|
663
|
+
if ($fallbackLanguage && $fallbackLanguage.length) {
|
664
|
+
for (var i = 0, len = $fallbackLanguage.length; i < len; i++) {
|
665
|
+
tables.push(loadAsync($fallbackLanguage[i]));
|
666
|
+
loadingKeys[$fallbackLanguage[i]] = true;
|
667
|
+
}
|
668
|
+
}
|
669
|
+
if ($uses && !loadingKeys[$uses]) {
|
670
|
+
tables.push(loadAsync($uses));
|
671
|
+
}
|
672
|
+
$q.all(tables).then(function (tableData) {
|
673
|
+
angular.forEach(tableData, function (data) {
|
674
|
+
if ($translationTable[data.key]) {
|
675
|
+
delete $translationTable[data.key];
|
676
|
+
}
|
677
|
+
translations(data.key, data.table);
|
678
|
+
});
|
679
|
+
if ($uses) {
|
680
|
+
useLanguage($uses);
|
681
|
+
}
|
682
|
+
resolve();
|
683
|
+
});
|
684
|
+
} else if ($translationTable[langKey]) {
|
685
|
+
loadAsync(langKey).then(function (data) {
|
686
|
+
translations(data.key, data.table);
|
687
|
+
if (langKey === $uses) {
|
688
|
+
useLanguage($uses);
|
689
|
+
}
|
690
|
+
resolve();
|
691
|
+
}, reject);
|
692
|
+
} else {
|
693
|
+
reject();
|
694
|
+
}
|
695
|
+
return deferred.promise;
|
696
|
+
};
|
697
|
+
$translate.instant = function (translationId, interpolateParams, interpolationId) {
|
698
|
+
if (translationId === null || angular.isUndefined(translationId)) {
|
699
|
+
return translationId;
|
700
|
+
}
|
701
|
+
if (angular.isArray(translationId)) {
|
702
|
+
var results = {};
|
703
|
+
for (var i = 0, c = translationId.length; i < c; i++) {
|
704
|
+
results[translationId[i]] = $translate.instant(translationId[i], interpolateParams, interpolationId);
|
705
|
+
}
|
706
|
+
return results;
|
707
|
+
}
|
708
|
+
if (angular.isString(translationId) && translationId.length < 1) {
|
709
|
+
return translationId;
|
710
|
+
}
|
711
|
+
if (translationId) {
|
712
|
+
translationId = trim.apply(translationId);
|
713
|
+
}
|
714
|
+
var result, possibleLangKeys = [];
|
715
|
+
if ($preferredLanguage) {
|
716
|
+
possibleLangKeys.push($preferredLanguage);
|
717
|
+
}
|
718
|
+
if ($uses) {
|
719
|
+
possibleLangKeys.push($uses);
|
720
|
+
}
|
721
|
+
if ($fallbackLanguage && $fallbackLanguage.length) {
|
722
|
+
possibleLangKeys = possibleLangKeys.concat($fallbackLanguage);
|
723
|
+
}
|
724
|
+
for (var j = 0, d = possibleLangKeys.length; j < d; j++) {
|
725
|
+
var possibleLangKey = possibleLangKeys[j];
|
726
|
+
if ($translationTable[possibleLangKey]) {
|
727
|
+
if (typeof $translationTable[possibleLangKey][translationId] !== 'undefined') {
|
728
|
+
result = determineTranslationInstant(translationId, interpolateParams, interpolationId);
|
729
|
+
}
|
730
|
+
}
|
731
|
+
if (typeof result !== 'undefined') {
|
732
|
+
break;
|
733
|
+
}
|
734
|
+
}
|
735
|
+
if (!result && result !== '') {
|
736
|
+
result = defaultInterpolator.interpolate(translationId, interpolateParams);
|
737
|
+
if ($missingTranslationHandlerFactory && !pendingLoader) {
|
738
|
+
result = translateByHandler(translationId);
|
739
|
+
}
|
740
|
+
}
|
741
|
+
return result;
|
742
|
+
};
|
743
|
+
$translate.versionInfo = function () {
|
744
|
+
return version;
|
745
|
+
};
|
746
|
+
$translate.loaderCache = function () {
|
747
|
+
return loaderCache;
|
748
|
+
};
|
749
|
+
if ($loaderFactory) {
|
750
|
+
if (angular.equals($translationTable, {})) {
|
751
|
+
$translate.use($translate.use());
|
752
|
+
}
|
753
|
+
if ($fallbackLanguage && $fallbackLanguage.length) {
|
754
|
+
var processAsyncResult = function (translation) {
|
755
|
+
translations(translation.key, translation.table);
|
756
|
+
$rootScope.$emit('$translateChangeEnd', { language: translation.key });
|
757
|
+
};
|
758
|
+
for (var i = 0, len = $fallbackLanguage.length; i < len; i++) {
|
759
|
+
langPromises[$fallbackLanguage[i]] = loadAsync($fallbackLanguage[i]).then(processAsyncResult);
|
760
|
+
}
|
761
|
+
}
|
762
|
+
}
|
763
|
+
return $translate;
|
764
|
+
}
|
765
|
+
];
|
766
|
+
}
|
767
|
+
]);
|
768
|
+
angular.module('pascalprecht.translate').factory('$translateDefaultInterpolation', [
|
769
|
+
'$interpolate',
|
770
|
+
function ($interpolate) {
|
771
|
+
var $translateInterpolator = {}, $locale, $identifier = 'default', $sanitizeValueStrategy = null, sanitizeValueStrategies = {
|
772
|
+
escaped: function (params) {
|
773
|
+
var result = {};
|
774
|
+
for (var key in params) {
|
775
|
+
if (Object.prototype.hasOwnProperty.call(params, key)) {
|
776
|
+
result[key] = angular.element('<div></div>').text(params[key]).html();
|
777
|
+
}
|
778
|
+
}
|
779
|
+
return result;
|
780
|
+
}
|
781
|
+
};
|
782
|
+
var sanitizeParams = function (params) {
|
783
|
+
var result;
|
784
|
+
if (angular.isFunction(sanitizeValueStrategies[$sanitizeValueStrategy])) {
|
785
|
+
result = sanitizeValueStrategies[$sanitizeValueStrategy](params);
|
786
|
+
} else {
|
787
|
+
result = params;
|
788
|
+
}
|
789
|
+
return result;
|
790
|
+
};
|
791
|
+
$translateInterpolator.setLocale = function (locale) {
|
792
|
+
$locale = locale;
|
793
|
+
};
|
794
|
+
$translateInterpolator.getInterpolationIdentifier = function () {
|
795
|
+
return $identifier;
|
796
|
+
};
|
797
|
+
$translateInterpolator.useSanitizeValueStrategy = function (value) {
|
798
|
+
$sanitizeValueStrategy = value;
|
799
|
+
return this;
|
800
|
+
};
|
801
|
+
$translateInterpolator.interpolate = function (string, interpolateParams) {
|
802
|
+
if ($sanitizeValueStrategy) {
|
803
|
+
interpolateParams = sanitizeParams(interpolateParams);
|
804
|
+
}
|
805
|
+
return $interpolate(string)(interpolateParams || {});
|
806
|
+
};
|
807
|
+
return $translateInterpolator;
|
808
|
+
}
|
809
|
+
]);
|
810
|
+
angular.module('pascalprecht.translate').constant('$STORAGE_KEY', 'NG_TRANSLATE_LANG_KEY');
|
811
|
+
angular.module('pascalprecht.translate').directive('translate', [
|
812
|
+
'$translate',
|
813
|
+
'$q',
|
814
|
+
'$interpolate',
|
815
|
+
'$compile',
|
816
|
+
'$parse',
|
817
|
+
'$rootScope',
|
818
|
+
function ($translate, $q, $interpolate, $compile, $parse, $rootScope) {
|
819
|
+
return {
|
820
|
+
restrict: 'AE',
|
821
|
+
scope: true,
|
822
|
+
compile: function (tElement, tAttr) {
|
823
|
+
var translateValuesExist = tAttr.translateValues ? tAttr.translateValues : undefined;
|
824
|
+
var translateInterpolation = tAttr.translateInterpolation ? tAttr.translateInterpolation : undefined;
|
825
|
+
var translateValueExist = tElement[0].outerHTML.match(/translate-value-+/i);
|
826
|
+
var interpolateRegExp = '^(.*)(' + $interpolate.startSymbol() + '.*' + $interpolate.endSymbol() + ')(.*)';
|
827
|
+
return function linkFn(scope, iElement, iAttr) {
|
828
|
+
scope.interpolateParams = {};
|
829
|
+
scope.preText = '';
|
830
|
+
scope.postText = '';
|
831
|
+
iAttr.$observe('translate', function (translationId) {
|
832
|
+
if (angular.equals(translationId, '') || !angular.isDefined(translationId)) {
|
833
|
+
var interpolateMatches = iElement.text().match(interpolateRegExp);
|
834
|
+
if (angular.isArray(interpolateMatches)) {
|
835
|
+
scope.preText = interpolateMatches[1];
|
836
|
+
scope.postText = interpolateMatches[3];
|
837
|
+
scope.translationId = $interpolate(interpolateMatches[2])(scope.$parent);
|
838
|
+
} else {
|
839
|
+
scope.translationId = iElement.text().replace(/^\s+|\s+$/g, '');
|
840
|
+
}
|
841
|
+
} else {
|
842
|
+
scope.translationId = translationId;
|
843
|
+
}
|
844
|
+
});
|
845
|
+
iAttr.$observe('translateDefault', function (value) {
|
846
|
+
scope.defaultText = value;
|
847
|
+
});
|
848
|
+
if (translateValuesExist) {
|
849
|
+
iAttr.$observe('translateValues', function (interpolateParams) {
|
850
|
+
if (interpolateParams) {
|
851
|
+
scope.$parent.$watch(function () {
|
852
|
+
angular.extend(scope.interpolateParams, $parse(interpolateParams)(scope.$parent));
|
853
|
+
});
|
854
|
+
}
|
855
|
+
});
|
856
|
+
}
|
857
|
+
if (translateValueExist) {
|
858
|
+
var fn = function (attrName) {
|
859
|
+
iAttr.$observe(attrName, function (value) {
|
860
|
+
scope.interpolateParams[angular.lowercase(attrName.substr(14, 1)) + attrName.substr(15)] = value;
|
861
|
+
});
|
862
|
+
};
|
863
|
+
for (var attr in iAttr) {
|
864
|
+
if (Object.prototype.hasOwnProperty.call(iAttr, attr) && attr.substr(0, 14) === 'translateValue' && attr !== 'translateValues') {
|
865
|
+
fn(attr);
|
866
|
+
}
|
867
|
+
}
|
868
|
+
}
|
869
|
+
var applyElementContent = function (value, scope, successful) {
|
870
|
+
if (!successful && typeof scope.defaultText !== 'undefined') {
|
871
|
+
value = scope.defaultText;
|
872
|
+
}
|
873
|
+
iElement.html(scope.preText + value + scope.postText);
|
874
|
+
var globallyEnabled = $translate.isPostCompilingEnabled();
|
875
|
+
var locallyDefined = typeof tAttr.translateCompile !== 'undefined';
|
876
|
+
var locallyEnabled = locallyDefined && tAttr.translateCompile !== 'false';
|
877
|
+
if (globallyEnabled && !locallyDefined || locallyEnabled) {
|
878
|
+
$compile(iElement.contents())(scope);
|
879
|
+
}
|
880
|
+
};
|
881
|
+
var updateTranslationFn = function () {
|
882
|
+
if (!translateValuesExist && !translateValueExist) {
|
883
|
+
return function () {
|
884
|
+
var unwatch = scope.$watch('translationId', function (value) {
|
885
|
+
if (scope.translationId && value) {
|
886
|
+
$translate(value, {}, translateInterpolation).then(function (translation) {
|
887
|
+
applyElementContent(translation, scope, true);
|
888
|
+
unwatch();
|
889
|
+
}, function (translationId) {
|
890
|
+
applyElementContent(translationId, scope, false);
|
891
|
+
unwatch();
|
892
|
+
});
|
893
|
+
}
|
894
|
+
}, true);
|
895
|
+
};
|
896
|
+
} else {
|
897
|
+
return function () {
|
898
|
+
var updateTranslations = function () {
|
899
|
+
if (scope.translationId && scope.interpolateParams) {
|
900
|
+
$translate(scope.translationId, scope.interpolateParams, translateInterpolation).then(function (translation) {
|
901
|
+
applyElementContent(translation, scope, true);
|
902
|
+
}, function (translationId) {
|
903
|
+
applyElementContent(translationId, scope, false);
|
904
|
+
});
|
905
|
+
}
|
906
|
+
};
|
907
|
+
scope.$watch('interpolateParams', updateTranslations, true);
|
908
|
+
scope.$watch('translationId', updateTranslations);
|
909
|
+
};
|
910
|
+
}
|
911
|
+
}();
|
912
|
+
var unbind = $rootScope.$on('$translateChangeSuccess', updateTranslationFn);
|
913
|
+
updateTranslationFn();
|
914
|
+
scope.$on('$destroy', unbind);
|
915
|
+
};
|
916
|
+
}
|
917
|
+
};
|
918
|
+
}
|
919
|
+
]);
|
920
|
+
angular.module('pascalprecht.translate').directive('translateCloak', [
|
921
|
+
'$rootScope',
|
922
|
+
'$translate',
|
923
|
+
function ($rootScope, $translate) {
|
924
|
+
return {
|
925
|
+
compile: function (tElement) {
|
926
|
+
var applyCloak = function () {
|
927
|
+
tElement.addClass($translate.cloakClassName());
|
928
|
+
}, removeCloak = function () {
|
929
|
+
tElement.removeClass($translate.cloakClassName());
|
930
|
+
}, removeListener = $rootScope.$on('$translateChangeEnd', function () {
|
931
|
+
removeCloak();
|
932
|
+
removeListener();
|
933
|
+
removeListener = null;
|
934
|
+
});
|
935
|
+
applyCloak();
|
936
|
+
return function linkFn(scope, iElement, iAttr) {
|
937
|
+
if (iAttr.translateCloak && iAttr.translateCloak.length) {
|
938
|
+
iAttr.$observe('translateCloak', function (translationId) {
|
939
|
+
$translate(translationId).then(removeCloak, applyCloak);
|
940
|
+
});
|
941
|
+
}
|
942
|
+
};
|
943
|
+
}
|
944
|
+
};
|
945
|
+
}
|
946
|
+
]);
|
947
|
+
angular.module('pascalprecht.translate').filter('translate', [
|
948
|
+
'$parse',
|
949
|
+
'$translate',
|
950
|
+
function ($parse, $translate) {
|
951
|
+
var translateFilter = function (translationId, interpolateParams, interpolation) {
|
952
|
+
if (!angular.isObject(interpolateParams)) {
|
953
|
+
interpolateParams = $parse(interpolateParams)(this);
|
954
|
+
}
|
955
|
+
return $translate.instant(translationId, interpolateParams, interpolation);
|
956
|
+
};
|
957
|
+
translateFilter.$stateful = true;
|
958
|
+
return translateFilter;
|
959
|
+
}
|
960
|
+
]);
|