diff --git a/.gitignore b/.gitignore index 080b946b0ae0..0e99e2666e32 100644 --- a/.gitignore +++ b/.gitignore @@ -4,83 +4,83 @@ # or operating system, you probably want to add a global ignore instead: # git config --global core.excludesfile ~/.gitignore_global -# Ignore .swp files -.*.swp +# Configuration ================================================================ +# These files will differ from one user to another; +# committing them may cause Zammad to behave unexpectedly on other machines -# Ignore bundler config -/.bundle - -# Ignore mac stuff -.DS_Store - -# Ignore Rubymine config -/.idea - -# Ignore .project files -/.project - -# Ignore .rbenv-vars -/.rbenv-vars - -# exclude the figaro ENV setting helper file - run 'bundle exec figaro install' for creating your own -# see: https://github.com/laserlemon/figaro -# Ignore application configuration -/config/application.yml - -# Ignore .envrc for direnv -/.envrc +# Zammad ----------------------------------------------------------------------- -# Ignore database config +# database (copy from config/database/database.yml, or use `rails bs:init`) /config/database.yml -# Ignore translation cache files -/config/locales*.yml -/config/translations/*.yml +# Third-Party ------------------------------------------------------------------ +# The config files / dev tools listed below are optional +# and may not be present on most users' machines -# Ignore generated documentation -/doc +# Bundler +/.bundle +/Gemfile.local -# Ignore coverage stuff -/coverage +# Clutter ====================================================================== +# These files are automatically generated; +# in most cases, committing them won't do anything other than bloat the repo -# Ignore the default SQLite database. -/db/*.sqlite3 +# Zammad ----------------------------------------------------------------------- -# Ignore local changes to schema.rb (e. g. through extentions) +# database files +/db/*.sqlite3 /db/schema.rb -# Ignore custom gem file -/Gemfile.local +# translation cache files +/config/locales*.yml +/config/translations/*.yml -# Ignore node modules +# NPM / Yarn /node_modules -# Ignore all logfiles and tempfiles. +# logfiles and tempfiles /log /public/assets/*.* /public/assets/app /public/assets/custom /public/assets/chat/node_modules /tmp/* -/tmp/pids/* -/storage/fs - -# except /tmp/pids/ which is needed for certain Zammad processes -!/tmp !/tmp/pids +/tmp/pids/* !/tmp/pids/.keep +/storage/fs -# ignore doorkeeper auto generated folder +# doorkeeper (OAuth 2) /public/assets/doorkeeper -# ignore all automatically downloaded images except the default ones +# images /public/assets/images/* -!/public/assets/images/icons +!/public/assets/images/icons/ !/public/assets/images/avatar-bg.png !/public/assets/images/chat-demo-avatar.png !/public/assets/images/eyedropper.gif !/public/assets/images/icons.svg !/public/assets/images/logo.svg -# ignore byebug history -/.byebug_history \ No newline at end of file +# Third-Party ------------------------------------------------------------------ + +# macOS +.DS_Store + +# vim +.*.sw[pon] + +# RubyMine +/.idea + +# Eclipse +/.project + +# Byebug +/.byebug_history + +# SimpleCov +/coverage + +# RDoc / YARD +/doc diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1bdd0f0d77a6..c38300881fc7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -78,7 +78,6 @@ test:unit:mysql: - rake db:migrate - rake db:seed - rake test:units - - rake test:controllers - ruby -I test/ test/integration/object_manager_test.rb - ruby -I test/ test/integration/object_manager_attributes_controller_test.rb - ruby -I test/ test/integration/package_test.rb @@ -96,7 +95,6 @@ test:unit:postgresql: - rake db:migrate - rake db:seed - rake test:units - - rake test:controllers - ruby -I test/ test/integration/object_manager_test.rb - ruby -I test/ test/integration/object_manager_attributes_controller_test.rb - ruby -I test/ test/integration/package_test.rb @@ -240,12 +238,10 @@ test:integration:es_mysql: - export ES_URL="http://localhost:9200" - rake db:create - rake db:migrate + - ruby -I test/ test/integration/elasticsearch_active_test.rb - ruby -I test/ test/integration/elasticsearch_test.rb - - ruby -I test/ test/controllers/search_controller_test.rb - ruby -I test/ test/integration/report_test.rb - - ruby -I test/ test/controllers/form_controller_test.rb - - ruby -I test/ test/controllers/user_controller_test.rb - - ruby -I test/ test/controllers/organization_controller_test.rb + - bundle exec rspec --tag searchindex - rake db:drop test:integration:es_postgresql: @@ -259,12 +255,10 @@ test:integration:es_postgresql: - export ES_URL="http://localhost:9200" - rake db:create - rake db:migrate + - ruby -I test/ test/integration/elasticsearch_active_test.rb - ruby -I test/ test/integration/elasticsearch_test.rb - - ruby -I test/ test/controllers/search_controller_test.rb - ruby -I test/ test/integration/report_test.rb - - ruby -I test/ test/controllers/form_controller_test.rb - - ruby -I test/ test/controllers/user_controller_test.rb - - ruby -I test/ test/controllers/organization_controller_test.rb + - bundle exec rspec --tag searchindex - rake db:drop test:integration:zendesk_mysql: @@ -300,7 +294,7 @@ test:integration:otrs_6_mysql: - mysql script: - export RAILS_ENV=test - - export IMPORT_OTRS_ENDPOINT="http://vz1185.test.znuny.com/otrs/public.pl?Action=ZammadMigrator" + - export IMPORT_OTRS_ENDPOINT="https://vz1185.test.znuny.com/otrs/public.pl?Action=ZammadMigrator" - rake db:create - rake db:migrate - ruby -I test/ test/integration/otrs_import_test.rb @@ -313,7 +307,7 @@ test:integration:otrs_6_postgresql: - postgresql script: - export RAILS_ENV=test - - export IMPORT_OTRS_ENDPOINT="http://vz1185.test.znuny.com/otrs/public.pl?Action=ZammadMigrator" + - export IMPORT_OTRS_ENDPOINT="https://vz1185.test.znuny.com/otrs/public.pl?Action=ZammadMigrator" - rake db:create - rake db:migrate - ruby -I test/ test/integration/otrs_import_test.rb @@ -405,13 +399,13 @@ test:browser:integration:api_client_ruby: script: - RAILS_ENV=test rake db:create - cp contrib/auto_wizard_test.json auto_wizard.json - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - git clone git@github.com:zammad/zammad-api-client-ruby.git || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 0 + - git clone git@github.com:zammad/zammad-api-client-ruby.git || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 0 - cd zammad-api-client-ruby - bundle install --jobs 8 - export TEST_URL=http://$IP:$BROWSER_PORT/ - - bundle exec rspec || (cd .. && script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1) - - cd .. && script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - bundle exec rspec || (cd .. && script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 0) + - cd .. && script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 0 test:browser:integration:api_client_php: stage: browser-core @@ -422,16 +416,16 @@ test:browser:integration:api_client_php: script: - RAILS_ENV=test rake db:create - cp contrib/auto_wizard_test.json auto_wizard.json - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - git clone git@github.com:zammad/zammad-api-client-php || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 0 + - git clone git@github.com:zammad/zammad-api-client-php || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 0 - wget http://$IP:$BROWSER_PORT/api/v1/getting_started/auto_wizard - cd zammad-api-client-php - composer install - export ZAMMAD_PHP_API_CLIENT_UNIT_TESTS_URL=http://$IP:$BROWSER_PORT - export ZAMMAD_PHP_API_CLIENT_UNIT_TESTS_USERNAME=master@example.com - export ZAMMAD_PHP_API_CLIENT_UNIT_TESTS_PASSWORD=test - - vendor/bin/phpunit || (cd .. && script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1) - - cd .. && script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - vendor/bin/phpunit || (cd .. && script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 0) + - cd .. && script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 0 test:browser:twitter_ff: stage: browser-integration @@ -443,12 +437,12 @@ test:browser:twitter_ff: script: - export BROWSER=firefox - export BROWSER_URL=http://$IP:$BROWSER_PORT - - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" + - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" - RAILS_ENV=test rake db:create - cp contrib/auto_wizard_test.json auto_wizard.json - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - ruby -I test/ test/integration/twitter_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 0 + - ruby -I test/ test/integration/twitter_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 0 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 0 test:browser:facebook_ff: stage: browser-integration @@ -460,12 +454,12 @@ test:browser:facebook_ff: script: - export BROWSER=firefox - export BROWSER_URL=http://$IP:$BROWSER_PORT - - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" + - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" - RAILS_ENV=test rake db:create - cp contrib/auto_wizard_test.json auto_wizard.json - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - ruby -I test/ test/integration/facebook_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 0 + - ruby -I test/ test/integration/facebook_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 0 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 0 test:browser:autowizard_ff: stage: browser-core @@ -476,12 +470,12 @@ test:browser:autowizard_ff: script: - export BROWSER=firefox - export BROWSER_URL=http://$IP:$BROWSER_PORT - - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" + - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" - RAILS_ENV=test rake db:create - cp contrib/auto_wizard_example.json auto_wizard.json - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - ruby -I test/ test/integration/auto_wizard_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - ruby -I test/ test/integration/auto_wizard_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 1 test:browser:core:ff_1_mysql: stage: browser-core @@ -493,16 +487,16 @@ test:browser:core:ff_1_mysql: script: - export BROWSER=firefox - export BROWSER_URL=http://$IP:$BROWSER_PORT - - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" + - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" - unset MAILBOX_AUTO1 - unset MAILBOX_AUTO2 - unset MAILBOX_MANUAL1 - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 1 - RAILS_ENV=test rake db:create - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 1 test:browser:core:ff_2_mysql: stage: browser-core @@ -514,16 +508,16 @@ test:browser:core:ff_2_mysql: script: - export BROWSER=firefox - export BROWSER_URL=http://$IP:$BROWSER_PORT - - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" + - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" - unset MAILBOX_AUTO1 - unset MAILBOX_AUTO2 - unset MAILBOX_MANUAL1 - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 2 - RAILS_ENV=test rake db:create - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 1 test:browser:core:ff_3_mysql: stage: browser-core @@ -535,12 +529,12 @@ test:browser:core:ff_3_mysql: script: - export BROWSER=firefox - export BROWSER_URL=http://$IP:$BROWSER_PORT - - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" + - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" - script/build/test_slice_tests.sh 3 - RAILS_ENV=test rake db:create - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 1 test:browser:core:ff_4_mysql: stage: browser-core @@ -552,16 +546,16 @@ test:browser:core:ff_4_mysql: script: - export BROWSER=firefox - export BROWSER_URL=http://$IP:$BROWSER_PORT - - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" + - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" - unset MAILBOX_AUTO1 - unset MAILBOX_AUTO2 - unset MAILBOX_MANUAL1 - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 4 - RAILS_ENV=test rake db:create - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 1 test:browser:core:ff_5_mysql: stage: browser-core @@ -573,16 +567,16 @@ test:browser:core:ff_5_mysql: script: - export BROWSER=firefox - export BROWSER_URL=http://$IP:$BROWSER_PORT - - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" + - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" - unset MAILBOX_AUTO1 - unset MAILBOX_AUTO2 - unset MAILBOX_MANUAL1 - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 5 - RAILS_ENV=test rake db:create - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 1 test:browser:core:ff_6_mysql: stage: browser-core @@ -594,16 +588,16 @@ test:browser:core:ff_6_mysql: script: - export BROWSER=firefox - export BROWSER_URL=http://$IP:$BROWSER_PORT - - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" + - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" - unset MAILBOX_AUTO1 - unset MAILBOX_AUTO2 - unset MAILBOX_MANUAL1 - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 6 - RAILS_ENV=test rake db:create - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 1 test:browser:core:ff_1_postgresql: stage: browser-core @@ -615,16 +609,16 @@ test:browser:core:ff_1_postgresql: script: - export BROWSER=firefox - export BROWSER_URL=http://$IP:$BROWSER_PORT - - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" + - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" - unset MAILBOX_AUTO1 - unset MAILBOX_AUTO2 - unset MAILBOX_MANUAL1 - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 1 - RAILS_ENV=test rake db:create - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 1 test:browser:core:ff_2_postgresql: stage: browser-core @@ -636,16 +630,16 @@ test:browser:core:ff_2_postgresql: script: - export BROWSER=firefox - export BROWSER_URL=http://$IP:$BROWSER_PORT - - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" + - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" - unset MAILBOX_AUTO1 - unset MAILBOX_AUTO2 - unset MAILBOX_MANUAL1 - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 2 - RAILS_ENV=test rake db:create - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 1 test:browser:core:ff_3_postgresql: stage: browser-core @@ -657,12 +651,12 @@ test:browser:core:ff_3_postgresql: script: - export BROWSER=firefox - export BROWSER_URL=http://$IP:$BROWSER_PORT - - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" + - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" - script/build/test_slice_tests.sh 3 - RAILS_ENV=test rake db:create - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 1 test:browser:core:ff_4_postgresql: stage: browser-core @@ -674,16 +668,16 @@ test:browser:core:ff_4_postgresql: script: - export BROWSER=firefox - export BROWSER_URL=http://$IP:$BROWSER_PORT - - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" + - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" - unset MAILBOX_AUTO1 - unset MAILBOX_AUTO2 - unset MAILBOX_MANUAL1 - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 4 - RAILS_ENV=test rake db:create - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 1 test:browser:core:ff_5_postgresql: stage: browser-core @@ -695,16 +689,16 @@ test:browser:core:ff_5_postgresql: script: - export BROWSER=firefox - export BROWSER_URL=http://$IP:$BROWSER_PORT - - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" + - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" - unset MAILBOX_AUTO1 - unset MAILBOX_AUTO2 - unset MAILBOX_MANUAL1 - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 5 - RAILS_ENV=test rake db:create - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 1 test:browser:core:ff_6_postgresql: stage: browser-core @@ -716,16 +710,16 @@ test:browser:core:ff_6_postgresql: script: - export BROWSER=firefox - export BROWSER_URL=http://$IP:$BROWSER_PORT - - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" + - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" - unset MAILBOX_AUTO1 - unset MAILBOX_AUTO2 - unset MAILBOX_MANUAL1 - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 6 - RAILS_ENV=test rake db:create - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 1 test:browser:core:chrome_1_mysql: stage: browser-core @@ -737,16 +731,16 @@ test:browser:core:chrome_1_mysql: script: - export BROWSER=chrome - export BROWSER_URL=http://$IP:$BROWSER_PORT - - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" + - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" - unset MAILBOX_AUTO1 - unset MAILBOX_AUTO2 - unset MAILBOX_MANUAL1 - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 1 - RAILS_ENV=test rake db:create - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 1 test:browser:core:chrome_2_mysql: stage: browser-core @@ -758,16 +752,16 @@ test:browser:core:chrome_2_mysql: script: - export BROWSER=chrome - export BROWSER_URL=http://$IP:$BROWSER_PORT - - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" + - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" - unset MAILBOX_AUTO1 - unset MAILBOX_AUTO2 - unset MAILBOX_MANUAL1 - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 2 - RAILS_ENV=test rake db:create - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 1 test:browser:core:chrome_3_mysql: stage: browser-core @@ -779,16 +773,16 @@ test:browser:core:chrome_3_mysql: script: - export BROWSER=chrome - export BROWSER_URL=http://$IP:$BROWSER_PORT - - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" + - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" - unset MAILBOX_AUTO1 - unset MAILBOX_AUTO2 - unset MAILBOX_MANUAL1 - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 3 - RAILS_ENV=test rake db:create - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 1 test:browser:core:chrome_4_mysql: stage: browser-core @@ -800,16 +794,16 @@ test:browser:core:chrome_4_mysql: script: - export BROWSER=chrome - export BROWSER_URL=http://$IP:$BROWSER_PORT - - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" + - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" - unset MAILBOX_AUTO1 - unset MAILBOX_AUTO2 - unset MAILBOX_MANUAL1 - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 4 - RAILS_ENV=test rake db:create - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 1 test:browser:core:chrome_5_mysql: stage: browser-core @@ -821,16 +815,16 @@ test:browser:core:chrome_5_mysql: script: - export BROWSER=chrome - export BROWSER_URL=http://$IP:$BROWSER_PORT - - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" + - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" - unset MAILBOX_AUTO1 - unset MAILBOX_AUTO2 - unset MAILBOX_MANUAL1 - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 5 - RAILS_ENV=test rake db:create - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 1 test:browser:core:chrome_6_mysql: stage: browser-core @@ -842,16 +836,16 @@ test:browser:core:chrome_6_mysql: script: - export BROWSER=chrome - export BROWSER_URL=http://$IP:$BROWSER_PORT - - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" + - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" - unset MAILBOX_AUTO1 - unset MAILBOX_AUTO2 - unset MAILBOX_MANUAL1 - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 6 - RAILS_ENV=test rake db:create - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 1 test:browser:core:chrome_1_postgresql: stage: browser-core @@ -863,16 +857,16 @@ test:browser:core:chrome_1_postgresql: script: - export BROWSER=chrome - export BROWSER_URL=http://$IP:$BROWSER_PORT - - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" + - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" - unset MAILBOX_AUTO1 - unset MAILBOX_AUTO2 - unset MAILBOX_MANUAL1 - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 1 - RAILS_ENV=test rake db:create - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 1 test:browser:core:chrome_2_postgresql: stage: browser-core @@ -884,16 +878,16 @@ test:browser:core:chrome_2_postgresql: script: - export BROWSER=chrome - export BROWSER_URL=http://$IP:$BROWSER_PORT - - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" + - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" - unset MAILBOX_AUTO1 - unset MAILBOX_AUTO2 - unset MAILBOX_MANUAL1 - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 2 - RAILS_ENV=test rake db:create - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 1 test:browser:core:chrome_3_postgresql: stage: browser-core @@ -905,16 +899,16 @@ test:browser:core:chrome_3_postgresql: script: - export BROWSER=chrome - export BROWSER_URL=http://$IP:$BROWSER_PORT - - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" + - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" - unset MAILBOX_AUTO1 - unset MAILBOX_AUTO2 - unset MAILBOX_MANUAL1 - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 3 - RAILS_ENV=test rake db:create - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 1 test:browser:core:chrome_4_postgresql: stage: browser-core @@ -926,16 +920,16 @@ test:browser:core:chrome_4_postgresql: script: - export BROWSER=chrome - export BROWSER_URL=http://$IP:$BROWSER_PORT - - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" + - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" - unset MAILBOX_AUTO1 - unset MAILBOX_AUTO2 - unset MAILBOX_MANUAL1 - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 4 - RAILS_ENV=test rake db:create - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 1 test:browser:core:chrome_5_postgresql: stage: browser-core @@ -947,16 +941,16 @@ test:browser:core:chrome_5_postgresql: script: - export BROWSER=chrome - export BROWSER_URL=http://$IP:$BROWSER_PORT - - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" + - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" - unset MAILBOX_AUTO1 - unset MAILBOX_AUTO2 - unset MAILBOX_MANUAL1 - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 5 - RAILS_ENV=test rake db:create - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 1 test:browser:core:chrome_6_postgresql: stage: browser-core @@ -968,16 +962,16 @@ test:browser:core:chrome_6_postgresql: script: - export BROWSER=chrome - export BROWSER_URL=http://$IP:$BROWSER_PORT - - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" + - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0 0 && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 0" - unset MAILBOX_AUTO1 - unset MAILBOX_AUTO2 - unset MAILBOX_MANUAL1 - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 6 - RAILS_ENV=test rake db:create - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 1 test:browser:autowizard_chrome: stage: browser-core @@ -990,9 +984,9 @@ test:browser:autowizard_chrome: - export BROWSER_URL=http://$IP:$BROWSER_PORT - RAILS_ENV=test rake db:create - cp contrib/auto_wizard_example.json auto_wizard.json - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - ruby -I test/ test/integration/auto_wizard_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - ruby -I test/ test/integration/auto_wizard_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 1 test:browser:integration:twitter_chrome: stage: browser-integration @@ -1006,9 +1000,9 @@ test:browser:integration:twitter_chrome: - export BROWSER_URL=http://$IP:$BROWSER_PORT - RAILS_ENV=test rake db:create - cp contrib/auto_wizard_test.json auto_wizard.json - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - ruby -I test/ test/integration/twitter_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 0 + - ruby -I test/ test/integration/twitter_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 0 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 0 test:browser:integration:facebook_chrome: stage: browser-integration @@ -1022,9 +1016,9 @@ test:browser:integration:facebook_chrome: - export BROWSER_URL=http://$IP:$BROWSER_PORT - RAILS_ENV=test rake db:create - cp contrib/auto_wizard_test.json auto_wizard.json - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - ruby -I test/ test/integration/facebook_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 0 + - ruby -I test/ test/integration/facebook_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 0 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 0 test:browser:integration:otrs_chrome: stage: browser-integration @@ -1036,9 +1030,9 @@ test:browser:integration:otrs_chrome: - export BROWSER=chrome - export BROWSER_URL=http://$IP:$BROWSER_PORT - RAILS_ENV=test rake db:create - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - ruby -I test/ test/integration/otrs_import_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 0 + - ruby -I test/ test/integration/otrs_import_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 0 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 0 test:browser:integration:zendesk_chrome: stage: browser-integration @@ -1050,6 +1044,21 @@ test:browser:integration:zendesk_chrome: - export BROWSER=chrome - export BROWSER_URL=http://$IP:$BROWSER_PORT - RAILS_ENV=test rake db:create - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - ruby -I test/ test/integration/zendesk_import_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 0 + - ruby -I test/ test/integration/zendesk_import_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 0 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 0 + +test:browser:integration:idoit_chrome: + stage: browser-integration + dependencies: + - browser:build + tags: + - browser + script: + - export BROWSER=chrome + - export BROWSER_URL=http://$IP:$BROWSER_PORT + - RAILS_ENV=test rake db:create + - cp contrib/auto_wizard_test.json auto_wizard.json + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 0 + - ruby -I test/ test/integration/idoit_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 0 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 0 diff --git a/.travis.yml b/.travis.yml index 59b08827a93c..fc3afe9bbd9c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -65,7 +65,6 @@ script: - bundle exec rspec - rake db:reset - rake test:units - - rake test:controllers - ruby -I test/ test/integration/object_manager_test.rb - ruby -I test/ test/integration/package_test.rb after_success: diff --git a/CHANGELOG.md b/CHANGELOG.md index 0afee119e7c4..6f90af7148e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Change Log -## [2.6.0](https://github.com/zammad/zammad/tree/2.6.0) (2018-xx-xx) -[Full Changelog](https://github.com/zammad/zammad/compare/2.5.0...2.6.0) +## [2.7.0](https://github.com/zammad/zammad/tree/2.7.0) (2018-xx-xx) +[Full Changelog](https://github.com/zammad/zammad/compare/2.6.0...2.7.0) **Implemented enhancements:** @@ -12,5 +12,4 @@ - \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file diff --git a/Gemfile b/Gemfile index b7a61f748628..29b129d0d9fa 100644 --- a/Gemfile +++ b/Gemfile @@ -5,6 +5,7 @@ ruby '2.4.4' gem 'rails', '5.1.5' # core - rails additions +gem 'activerecord-import' gem 'activerecord-session_store' gem 'composite_primary_keys' gem 'json' @@ -80,7 +81,7 @@ gem 'twitter' # channels - email additions gem 'htmlentities' -gem 'mail', '>= 2.7.1.rc1' +gem 'mail', '2.6.6' gem 'mime-types' gem 'rchardet', '>= 1.8.0' gem 'valid_email2' @@ -158,14 +159,15 @@ group :development, :test do # changelog generation gem 'github_changelog_generator' - # Setting ENV for testing purposes - gem 'figaro' - # Use Factory Bot for generating random test data gem 'factory_bot_rails' # mock http calls gem 'webmock' + + # record and replay TCP/HTTP transactions + gem 'tcr' + gem 'vcr' end # Want to extend Zammad with additional gems? @@ -174,4 +176,5 @@ end # without having your changes overwritten during upgrades.) # ZAMMAD DEVS: Consult the internal wiki # (or else risk pushing unwanted changes to Gemfile.lock!) +# https://git.znuny.com/zammad/zammad/wikis/Tips#user-content-customizing-the-gemfile eval_gemfile 'Gemfile.local' if File.exist?('Gemfile.local') diff --git a/Gemfile.lock b/Gemfile.lock index 77042459404e..592e36c5f7c7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -49,6 +49,8 @@ GEM activemodel (= 5.1.5) activesupport (= 5.1.5) arel (~> 8.0) + activerecord-import (0.25.0) + activerecord (>= 3.2) activerecord-nulldb-adapter (0.3.7) activerecord (>= 2.0.0) activerecord-session_store (1.1.0) @@ -108,7 +110,7 @@ GEM thor crack (0.4.3) safe_yaml (~> 1.0.0) - crass (1.0.3) + crass (1.0.4) daemons (1.2.5) dalli (2.7.6) debug_inspector (0.0.3) @@ -122,7 +124,7 @@ GEM docile (1.1.5) domain_name (0.5.20180417) unf (>= 0.0.5, < 1.0.0) - doorkeeper (4.2.6) + doorkeeper (4.4.0) railties (>= 4.2) eco (1.0.0) coffee-script @@ -145,12 +147,10 @@ GEM multipart-post (>= 1.2, < 3) faraday-http-cache (2.0.0) faraday (~> 0.8) - ffi (1.9.23) + ffi (1.9.25) ffi-compiler (0.1.3) ffi (>= 1.0.0) rake - figaro (1.1.1) - thor (~> 0.14) formatador (0.2.5) github_changelog_generator (1.14.3) activesupport @@ -222,15 +222,14 @@ GEM crass (~> 1.0.2) nokogiri (>= 1.5.9) lumberjack (1.0.12) - mail (2.7.1.rc1) - mini_mime (>= 0.1.1) + mail (2.6.6) + mime-types (>= 1.16, < 4) memoizable (0.4.2) thread_safe (~> 0.3, >= 0.3.1) method_source (0.9.0) mime-types (3.1) mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) - mini_mime (1.0.0) mini_portile2 (2.3.0) minitest (5.11.3) multi_json (1.12.2) @@ -243,7 +242,7 @@ GEM net-ldap (0.16.1) netrc (0.11.0) nio4r (2.3.0) - nokogiri (1.8.2) + nokogiri (1.8.4) mini_portile2 (~> 2.3.0) nori (2.6.0) notiffany (0.1.1) @@ -320,7 +319,7 @@ GEM rack (2.0.5) rack-livereload (0.3.16) rack - rack-test (1.0.0) + rack-test (1.1.0) rack (>= 1.0, < 3) rails (5.1.5) actioncable (= 5.1.5) @@ -360,23 +359,23 @@ GEM mime-types (>= 1.16, < 4.0) netrc (~> 0.8) retriable (2.1.0) - rspec-core (3.7.0) - rspec-support (~> 3.7.0) - rspec-expectations (3.7.0) + rspec-core (3.8.0) + rspec-support (~> 3.8.0) + rspec-expectations (3.8.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.7.0) - rspec-mocks (3.7.0) + rspec-support (~> 3.8.0) + rspec-mocks (3.8.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.7.0) - rspec-rails (3.7.2) + rspec-support (~> 3.8.0) + rspec-rails (3.8.0) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) - rspec-core (~> 3.7.0) - rspec-expectations (~> 3.7.0) - rspec-mocks (~> 3.7.0) - rspec-support (~> 3.7.0) - rspec-support (3.7.0) + rspec-core (~> 3.8.0) + rspec-expectations (~> 3.8.0) + rspec-mocks (~> 3.8.0) + rspec-support (~> 3.8.0) + rspec-support (3.8.0) rubocop (0.54.0) parallel (~> 1.10) parser (>= 2.5) @@ -386,7 +385,7 @@ GEM unicode-display_width (~> 1.0, >= 1.0.1) ruby-progressbar (1.9.0) ruby_dep (1.5.0) - rubyzip (1.2.1) + rubyzip (1.2.2) safe_yaml (1.0.4) sass (3.5.3) sass-listen (~> 4.0.0) @@ -402,7 +401,7 @@ GEM sawyer (0.8.1) addressable (>= 2.3.5, < 2.6) faraday (~> 0.8, < 1.0) - selenium-webdriver (3.11.0) + selenium-webdriver (3.13.1) childprocess (~> 0.5) rubyzip (~> 1.2) shellany (0.0.1) @@ -424,6 +423,7 @@ GEM activesupport (>= 4.0) sprockets (>= 3.0.0) sqlite3 (1.3.13) + tcr (0.2.0) telegramAPI (1.4.2) rest-client (~> 2.0, >= 2.0.2) telephone_number (1.3.0) @@ -463,6 +463,7 @@ GEM valid_email2 (2.1.0) activemodel (>= 3.2) mail (~> 2.5) + vcr (4.0.0) viewpoint (1.1.0) httpclient logging @@ -487,6 +488,7 @@ PLATFORMS ruby DEPENDENCIES + activerecord-import activerecord-nulldb-adapter activerecord-session_store argon2 @@ -511,7 +513,6 @@ DEPENDENCIES eventmachine execjs factory_bot_rails - figaro github_changelog_generator guard guard-livereload @@ -522,7 +523,7 @@ DEPENDENCIES json koala libv8 - mail (>= 2.7.1.rc1) + mail (= 2.6.6) mime-types mysql2 net-ldap @@ -559,6 +560,7 @@ DEPENDENCIES slack-notifier sprockets sqlite3 + tcr telegramAPI telephone_number test-unit @@ -567,6 +569,7 @@ DEPENDENCIES uglifier unicorn valid_email2 + vcr viewpoint webmock writeexcel diff --git a/VERSION b/VERSION index 3c8067655b26..e17ae7579770 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.6.x +2.7.x diff --git a/app/assets/javascripts/app/controllers/_application_controller.coffee b/app/assets/javascripts/app/controllers/_application_controller.coffee index 56f4a520a922..f51d9094b550 100644 --- a/app/assets/javascripts/app/controllers/_application_controller.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller.coffee @@ -77,10 +77,6 @@ class App.Controller extends Spine.Controller if @ajaxCalls for callId in @ajaxCalls App.Ajax.abort(callId) - @userTicketPopupsDestroy() - @ticketPopupsDestroy() - @userPopupsDestroy() - @organizationPopupsDestroy() release: -> # release custom bindings after it got removed from dom @@ -182,11 +178,11 @@ class App.Controller extends Spine.Controller formParam: (form) -> App.ControllerForm.params(form) - formDisable: (form) -> - App.ControllerForm.disable(form) + formDisable: (form, type) -> + App.ControllerForm.disable(form, type) - formEnable: (form) -> - App.ControllerForm.enable(form) + formEnable: (form, type) -> + App.ControllerForm.enable(form, type) formValidate: (data) -> App.ControllerForm.validate(data) @@ -295,228 +291,6 @@ class App.Controller extends Spine.Controller item.attr('title', App.i18n.translateTimestamp(timestamp)) item.html(time) - ticketPopups: (position = 'right') -> - - # open ticket in new task if curent user agent - if @permissionCheck('ticket.agent') - @$('div.ticket-popover, span.ticket-popover').bind('click', (e) => - id = $(e.target).data('id') - return if !id - ticket = App.Ticket.findNative(id) - @navigate ticket.uiUrl() - ) - - @ticketPopupsDestroy() - - # show ticket popup - ui = @ - @ticketPopupsList = @el.find('.ticket-popover').popover( - trigger: 'hover' - container: 'body' - html: true - animation: false - delay: 100 - placement: position - title: -> - ticketId = $(@).data('id') - ticket = App.Ticket.find(ticketId) - App.Utils.htmlEscape(ticket.title) - content: -> - ticketId = $(@).data('id') - ticket = App.Ticket.fullLocal(ticketId) - html = $(App.view('popover/ticket')( - ticket: ticket - )) - html.find('.humanTimeFromNow').each(-> - ui.frontendTimeUpdateItem($(@)) - ) - html - ) - - ticketPopupsDestroy: => - if @ticketPopupsList - @ticketPopupsList.popover('destroy') - - userPopups: (position = 'right') -> - - # open user in new task if current user is agent - return if !@permissionCheck('ticket.agent') - @$('div.user-popover, span.user-popover').bind('click', (e) => - id = $(e.target).data('id') - return if !id - user = App.User.findNative(id) - @navigate user.uiUrl() - ) - - @userPopupsDestroy() - - # show user popup - @userPopupsList = @el.find('.user-popover').popover( - trigger: 'hover' - container: 'body' - html: true - animation: false - delay: 100 - placement: "auto #{position}" - title: -> - userId = $(@).data('id') - user = App.User.find(userId) - headline = App.Utils.htmlEscape(user.displayName()) - if user.isOutOfOffice() - headline += " (#{App.Utils.htmlEscape(user.outOfOfficeText())})" - headline - content: -> - userId = $(@).data('id') - user = App.User.fullLocal(userId) - - # get display data - userData = [] - for attributeName, attributeConfig of App.User.attributesGet('view') - - # check if value for _id exists - name = attributeName - nameNew = name.substr(0, name.length - 3) - if nameNew of user - name = nameNew - - # add to show if value exists - if user[name] && attributeConfig.shown - - # do not show firstname and lastname / already show via diplayName() - if name isnt 'firstname' && name isnt 'lastname' && name isnt 'organization' - userData.push attributeConfig - - # insert data - App.view('popover/user')( - user: user - userData: userData - ) - ) - - userPopupsDestroy: => - if @userPopupsList - @userPopupsList.popover('destroy') - - organizationPopups: (position = 'right') -> - - # open org in new task if current user agent - return if !@permissionCheck('ticket.agent') - - @$('div.organization-popover, span.organization-popover').bind('click', (e) => - id = $(e.target).data('id') - return if !id - organization = App.Organization.find(id) - @navigate organization.uiUrl() - ) - - @organizationPopupsDestroy() - - # show organization popup - @organizationPopupsList = @el.find('.organization-popover').popover( - trigger: 'hover' - container: 'body' - html: true - animation: false - delay: 100 - placement: "auto #{position}" - title: -> - organization_id = $(@).data('id') - organization = App.Organization.find(organization_id) - App.Utils.htmlEscape(organization.name) - content: -> - organization_id = $(@).data('id') - organization = App.Organization.fullLocal(organization_id) - - # get display data - organizationData = [] - for attributeName, attributeConfig of App.Organization.attributesGet('view') - - # check if value for _id exists - name = attributeName - nameNew = name.substr(0, name.length - 3) - if nameNew of organization - name = nameNew - - # add to show if value exists - if organization[name] && attributeConfig.shown - - # do not show firstname and lastname / already show via diplayName() - if name isnt 'name' - organizationData.push attributeConfig - - # insert data - App.view('popover/organization')( - organization: organization, - organizationData: organizationData, - ) - ) - - organizationPopupsDestroy: => - if @organizationPopupsList - @organizationPopupsList.popover('destroy') - - userTicketPopups: (params) -> - - show = (data, ticket_list) => - - if !data.position - data.position = 'left' - - @userTicketPopupsDestroy() - - # show user popup - ui = @ - @userTicketPopupsList = @el.find(data.selector).popover( - trigger: 'hover' - container: 'body' - html: true - animation: false - delay: 100 - placement: "auto #{data.position}" - title: -> - $(@).find('[title="*"]').val() - - content: -> - type = $(@).filter('[data-type]').data('type') - tickets = [] - if ticket_list[type] - for ticketId in ticket_list[type] - tickets.push App.Ticket.fullLocal(ticketId) - - # insert data - html = $(App.view('popover/user_ticket_list')( - tickets: tickets - )) - html.find('.humanTimeFromNow').each( -> - ui.frontendTimeUpdateItem($(@)) - ) - html - ) - - fetch = (params) => - @ajax( - type: 'GET' - url: "#{@Config.get('api_path')}/ticket_customer" - data: - customer_id: params.user_id - processData: true - success: (data, status, xhr) -> - App.Collection.loadAssets(data.assets) - show(params, { open: data.ticket_ids_open, closed: data.ticket_ids_closed }) - ) - - # get data - fetch(params) - - userTicketPopupsDestroy: => - if @userTicketPopupsList - @userTicketPopupsList.popover('destroy') - - anyPopoversDestroy: -> - - # do not remove permanent .popover--notifications widget - $('.popover:not(.popover--notifications)').remove() - recentView: (object, o_id) => params = object: object @@ -556,6 +330,10 @@ class App.Controller extends Spine.Controller stopPropagation: (e) -> e.stopPropagation() + preventDefaultAndstopPropagation: (e) -> + e.preventDefault() + e.stopPropagation() + startLoading: (el) => return if @initLoadingDone && !el @initLoadingDone = true diff --git a/app/assets/javascripts/app/controllers/_application_controller_form.coffee b/app/assets/javascripts/app/controllers/_application_controller_form.coffee index ed8b58084f9a..b7e43d5752cb 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_form.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_form.coffee @@ -3,7 +3,6 @@ class App.ControllerForm extends App.Controller super for key, value of params @[key] = value - if !@handlers @handlers = [] @@ -14,7 +13,6 @@ class App.ControllerForm extends App.Controller @handlers.push @showHideToggle @handlers.push @requiredMandantoryToggle - if !@model @model = {} if !@attributes @@ -64,9 +62,7 @@ class App.ControllerForm extends App.Controller fieldset = @el else fieldset = $('
') - return fieldset if _.isEmpty(@model) - # collect form attributes @attributes = [] if @model.attributesGet @@ -330,7 +326,7 @@ class App.ControllerForm extends App.Controller bookmarkable: @bookmarkable ) ) - fullItem.find('.controls').prepend( item ) + fullItem.find('.controls').prepend(item) # hide/show item if attribute.hide @@ -632,48 +628,49 @@ class App.ControllerForm extends App.Controller App.Log.error 'ControllerForm', 'no form found!', form form - @disable: (form) -> + @disable: (form, type = 'form') -> lookupForm = @findForm(form) - if lookupForm + if lookupForm && type is 'form' if lookupForm.is('button, input, select, textarea, div, span') + console.log(2) App.Log.debug 'ControllerForm', 'disable item...', lookupForm - lookupForm.attr('readonly', true) - lookupForm.attr('disabled', true) + lookupForm.prop('readonly', true) + lookupForm.prop('disabled', true) return App.Log.debug 'ControllerForm', 'disable form...', lookupForm # set forms to read only during communication with backend - lookupForm.find('button, input, select, textarea').attr('readonly', true) + lookupForm.find('button, input, select, textarea').prop('readonly', true) # disable additionals submits - lookupForm.find('button').attr('disabled', true) + lookupForm.find('button').prop('disabled', true) else App.Log.debug 'ControllerForm', 'disable item...', form - form.attr('readonly', true) - form.attr('disabled', true) + form.prop('readonly', true) + form.prop('disabled', true) - @enable: (form) -> + @enable: (form, type = 'form') -> lookupForm = @findForm(form) - if lookupForm + if lookupForm && type is 'form' if lookupForm.is('button, input, select, textarea, div, span') App.Log.debug 'ControllerForm', 'disable item...', lookupForm - lookupForm.attr('readonly', false) - lookupForm.attr('disabled', false) + lookupForm.prop('readonly', false) + lookupForm.prop('disabled', false) return App.Log.debug 'ControllerForm', 'enable form...', lookupForm # enable fields again - lookupForm.find('button, input, select, textarea').attr('readonly', false) + lookupForm.find('button, input, select, textarea').prop('readonly', false) # enable submits again - lookupForm.find('button').attr('disabled', false) + lookupForm.find('button').prop('disabled', false) else App.Log.debug 'ControllerForm', 'enable item...', form - form.attr('readonly', false) - form.attr('disabled', false) + form.prop('readonly', false) + form.prop('disabled', false) @validate: (data) -> diff --git a/app/assets/javascripts/app/controllers/_application_controller_form_organization.coffee b/app/assets/javascripts/app/controllers/_application_controller_form_organization.coffee new file mode 100644 index 000000000000..2415a2cbb74f --- /dev/null +++ b/app/assets/javascripts/app/controllers/_application_controller_form_organization.coffee @@ -0,0 +1,10 @@ +class App.ControllerFormOrganization extends App.ControllerForm + constructor: (params) -> + @user = App.User.find(App.Session.get('id')) + @organizations = [] + if @user.organization_id + @organizations.push @user.organization_id + if @user.organization_ids + @organizations = @organizations.concat @user.organization_ids + params['filter']['organization_id'] = @organizations + super \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/_application_controller_generic.coffee b/app/assets/javascripts/app/controllers/_application_controller_generic.coffee index 9a9855a45843..2f9bff2fc9db 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_generic.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_generic.coffee @@ -545,6 +545,9 @@ class App.ControllerNavSidbar extends App.Controller sidebar: @$('.sidebar').scrollTop() class App.GenericHistory extends App.ControllerModal + @extend App.PopoverProvidable + @registerPopovers 'User' + buttonClose: true buttonCancel: false buttonSubmit: false @@ -568,7 +571,7 @@ class App.GenericHistory extends App.ControllerModal content onShown: => - @userPopups() + @renderPopovers() sortorder: => @items = @items.reverse() @@ -1403,4 +1406,4 @@ class App.ImportResult extends App.ControllerModal content onSubmit: (e) => - @close() \ No newline at end of file + @close() diff --git a/app/assets/javascripts/app/controllers/_application_controller_table.coffee b/app/assets/javascripts/app/controllers/_application_controller_table.coffee index d32477773108..6240cca77b36 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_table.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_table.coffee @@ -113,6 +113,7 @@ class App.ControllerTable extends App.Controller radio: false renderState: undefined groupBy: undefined + groupDirection: undefined shownPerPage: 150 shownPage: 0 @@ -771,6 +772,9 @@ class App.ControllerTable extends App.Controller for key of groupObjects groupsSorted.push key groupsSorted = groupsSorted.sort() + # Reverse the sorted groups depending on the groupDirection + if @groupDirection == 'DESC' + groupsSorted.reverse() # get new order localObjects = [] diff --git a/app/assets/javascripts/app/controllers/_channel/email.coffee b/app/assets/javascripts/app/controllers/_channel/email.coffee index e5e4ba32115c..6889e4c14819 100644 --- a/app/assets/javascripts/app/controllers/_channel/email.coffee +++ b/app/assets/javascripts/app/controllers/_channel/email.coffee @@ -60,68 +60,23 @@ class App.ChannelEmailFilter extends App.Controller new: (e) => e.preventDefault() - new App.ChannelEmailFilterEdit( + new App.ControllerGenericNew( + pageData: + object: 'Postmaster Filter' + genericObject: 'PostmasterFilter' container: @el.closest('.content') + callback: @load ) - + edit: (id, e) => e.preventDefault() - new App.ChannelEmailFilterEdit( - object: App.PostmasterFilter.find(id) + new App.ControllerGenericEdit( + id: id, + pageData: + object: 'Postmaster Filter' + genericObject: 'PostmasterFilter' container: @el.closest('.content') - ) - -class App.ChannelEmailFilterEdit extends App.ControllerModal - buttonClose: true - buttonCancel: true - buttonSubmit: true - head: 'Postmaster Filter' - - content: => - if @object - @form = new App.ControllerForm( - model: App.PostmasterFilter, - params: @object, - autofocus: true, - ) - else - @form = new App.ControllerForm( - model: App.PostmasterFilter, - autofocus: true, - ) - - @form.form - - onSubmit: (e) => - e.preventDefault() - - # get params - params = @formParam(e.target) - params['channel'] = 'email' - - object = @object || new App.PostmasterFilter - object.load(params) - - # validate form - errors = @form.validate(params) - - # show errors in form - if errors - @log 'error', errors - @formValidate(form: e.target, errors: errors) - return false - - # disable form - @formDisable(e) - - # save object - object.save( - done: => - @close() - fail: (settings, details) => - @log 'errors', details - @formEnable(e) - @form.showAlert(details.error_human || details.error || 'Unable to create object!') + callback: @load ) class App.ChannelEmailSignature extends App.Controller diff --git a/app/assets/javascripts/app/controllers/_ui_element/_application_ui_element.coffee b/app/assets/javascripts/app/controllers/_ui_element/_application_ui_element.coffee index cc272b47f43b..546d3e29b605 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/_application_ui_element.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/_application_ui_element.coffee @@ -52,11 +52,9 @@ class App.UiElement.ApplicationUiElement row.name = App.i18n.translateInline(row.name) attribute.options.push row else - order = _.sortBy( - _.keys(selection), (item) -> - return '' if !selection[item] || !selection[item].toString - selection[item].toString().toLowerCase() - ) + forceString = (s) -> + return if !selection[s] || !selection[s].toString then '' else selection[s].toString() + order = _.keys(selection).sort( (a, b) -> forceString(a).localeCompare(forceString(b)) ) for key in order name_new = selection[key] if attribute.translate diff --git a/app/assets/javascripts/app/controllers/_ui_element/autocompletion_multiple_ajax.coffee b/app/assets/javascripts/app/controllers/_ui_element/autocompletion_multiple_ajax.coffee new file mode 100644 index 000000000000..48ec08a4dbbd --- /dev/null +++ b/app/assets/javascripts/app/controllers/_ui_element/autocompletion_multiple_ajax.coffee @@ -0,0 +1,19 @@ +class App.UiElement.autocompletion_multiple_ajax + @render: (attribute, params = {}) -> + if params[attribute.name]?.length > 0 || attribute.value?.length > 0 + object = App[attribute.relation].find(params[attribute.name][0] || attribute.value[0]) + valueName = object.displayName() + + # selectable search + searchableAjaxSelectObject = new App.SearchableMultipleSelect( + attribute: + value: params[attribute.name] || attribute.value + valueName: valueName + name: attribute.name + id: attribute.value + placeholder: App.i18n.translateInline('Search...') + limit: 40 + object: attribute.relation + ajax: true + ) + searchableAjaxSelectObject.element() \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/_ui_element/basedate.coffee b/app/assets/javascripts/app/controllers/_ui_element/basedate.coffee new file mode 100644 index 000000000000..2603e6a1011e --- /dev/null +++ b/app/assets/javascripts/app/controllers/_ui_element/basedate.coffee @@ -0,0 +1,156 @@ +# coffeelint: disable=camel_case_classes +# Base class for providing date picker. Must be extended +class App.UiElement.basedate + @templateName: -> + throw 'Must override in a subclass' + + @render: (attributeOrig) -> + attribute = _.clone(attributeOrig) + attribute.nameRaw = attribute.name + attribute.name = "{#{@templateName()}}#{attribute.name}" + + item = $( App.view("generic/#{@templateName()}")( + attribute: attribute + ) ) + + # set our custom template + $.fn.datepicker.defaults.template = App.view('generic/datepicker')() + + # apply date widgets + $.fn.datepicker.dates['custom'] = @buildCustomDates() + + @applyPickers(item, attribute) + @bindEvents(item, attribute) + + item + + @log: (name, args...) -> + App.Log.debug "Ui.element.#{@templateName()}.#{name}", args... + + @applyPickers: (item, attribute) -> + item.find('.js-datepicker').datepicker( + weekStart: 1 + autoclose: true + todayBtn: 'linked' + todayHighlight: true + format: App.i18n.timeFormat().date + rtl: App.i18n.dir() is 'rtl' + container: item + language: 'custom' + ) + + @setNewTimeInitial(item, attribute) + + # observer changes / update needed to forece rerender to get correct today shown + @bindEvents: (item, attribute) -> + item + .find('input') + .bind('focus', (e) -> + item.find('.js-datepicker').datepicker('rerender') + ).bind('keyup blur change', (e) => + @setNewTime(item, attribute, 0) + @validation(item, attribute, true) + ) + + item.bind('validate', (e) => + @validation(item, attribute) + ) + + @setNewTime: (item, attribute, tolerant = false) -> + currentInput = @currentInput(item, attribute) + return if !currentInput + + if !@validateInput(currentInput) + item.find("[name=\"#{attribute.name}\"]").val('') + return + + item.find("[name=\"#{attribute.name}\"]").val(@buildTimestamp(currentInput)) + + # returns array with date or false if cannot get date + @currentInput: (item, attribute) -> + datetime = item.find('.js-datepicker').datepicker('getDate') + if !datetime || datetime.toString() is 'Invalid Date' + item.find("[name=\"#{attribute.name}\"]").val('') + return false + + @log 'setNewTime', datetime + + year = datetime.getFullYear() + month = datetime.getMonth() + 1 + day = datetime.getDate() + date = "#{App.Utils.formatTime(year)}-#{App.Utils.formatTime(month,2)}-#{App.Utils.formatTime(day,2)}" + [date] + + @validateInput: (currentInput) -> + currentInput[0] isnt '' + + @buildTimestamp: (currentInput) -> + throw 'Must override in a subclass' + + @dateSetter: -> + throw 'Must override in a subclass' + + @setNewTimeInitial: (item, attribute) -> + timestamp = item.find("[name=\"#{attribute.name}\"]").val() + @log 'setNewTimeInitial', timestamp + if !timestamp + @setNoTimestamp(item) + return + + timeObject = new Date( Date.parse( timestamp ) ) + + @log 'setNewTimeInitial', timestamp, timeObject + @setTimestamp(item, timeObject) + item.find('.js-datepicker').datepicker('update') + + @setNoTimestamp: (item) -> + return + + @setTimestamp: (item, timeObject) -> + item.find('.js-datepicker').datepicker(@dateSetter(), timeObject) + + @validation: (item, attribute, runtime) -> + # remove old validation + if attribute.validationContainer is 'self' + item.find('.js-datepicker').removeClass('has-error') + else + item.closest('.form-group').removeClass('has-error') + item.find('.has-error').removeClass('has-error') + item.find('.help-inline').html('') + item.closest('.form-group').find('.help-inline').html('') + + timestamp = item.find("[name=\"#{attribute.name}\"]").val() + + # check required attributes + errors = {} + if !timestamp + if !attribute.null + errors[attribute.name] = 'missing' + else + timeObject = new Date( Date.parse( timestamp ) ) + + + @log 'validation', errors + return if _.isEmpty(errors) + + # show invalid options + if attribute.validationContainer is 'self' + item.find('.js-datepicker').addClass('has-error') + else + formGroup = item.closest('.form-group') + for key, value of errors + formGroup.addClass('has-error') + + @buildCustomDates: -> + data = { + days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], + daysMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], + daysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], + months: ['January', 'February', 'March', 'April', 'May', 'June', + 'July', 'August', 'September', 'October', 'November', 'December'], + monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], + today: 'today', + clear: 'clear' + } + + App.i18n.translateDeep(data) diff --git a/app/assets/javascripts/app/controllers/_ui_element/date.coffee b/app/assets/javascripts/app/controllers/_ui_element/date.coffee index e70a6d8347dd..0e48d3041afc 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/date.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/date.coffee @@ -1,161 +1,11 @@ # coffeelint: disable=camel_case_classes -class App.UiElement.date - @render: (attributeOrig) -> +# Provides date-only picker +class App.UiElement.date extends App.UiElement.basedate + @templateName: -> + 'date' - attribute = _.clone(attributeOrig) - attribute.nameRaw = attribute.name - attribute.name = "{date}#{attribute.name}" + @buildTimestamp: (currentInput) -> + currentInput[0] - item = $( App.view('generic/date')( - attribute: attribute - ) ) - - # set our custom template - $.fn.datepicker.defaults.template = App.view('generic/datepicker')() - - # apply date widgets - $.fn.datepicker.dates['custom'] = - days: [ - App.i18n.translateInline('Sunday'), - App.i18n.translateInline('Monday'), - App.i18n.translateInline('Tuesday'), - App.i18n.translateInline('Wednesday'), - App.i18n.translateInline('Thursday'), - App.i18n.translateInline('Friday'), - App.i18n.translateInline('Saturday'), - App.i18n.translateInline('Sunday'), - ], - daysMin: [ - App.i18n.translateInline('Sun'), - App.i18n.translateInline('Mon'), - App.i18n.translateInline('Tue'), - App.i18n.translateInline('Wed'), - App.i18n.translateInline('Thu'), - App.i18n.translateInline('Fri'), - App.i18n.translateInline('Sat'), - App.i18n.translateInline('Sun') - ], - daysShort: [ - App.i18n.translateInline('Sun'), - App.i18n.translateInline('Mon'), - App.i18n.translateInline('Tue'), - App.i18n.translateInline('Wed'), - App.i18n.translateInline('Thu'), - App.i18n.translateInline('Fri'), - App.i18n.translateInline('Sat'), - App.i18n.translateInline('Sun') - ], - months: [ - App.i18n.translateInline('January'), - App.i18n.translateInline('February'), - App.i18n.translateInline('March'), - App.i18n.translateInline('April'), - App.i18n.translateInline('May'), - App.i18n.translateInline('June'), - App.i18n.translateInline('July'), - App.i18n.translateInline('August'), - App.i18n.translateInline('September'), - App.i18n.translateInline('October'), - App.i18n.translateInline('November'), - App.i18n.translateInline('December'), - ], - monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], - today: App.i18n.translateInline('today'), - clear: App.i18n.translateInline('clear') - currentDate = undefined - - item.find('.js-datepicker').datepicker( - weekStart: 1 - autoclose: true - todayBtn: 'linked' - todayHighlight: true - format: App.i18n.timeFormat().date - rtl: App.i18n.dir() is 'rtl' - container: item - language: 'custom' - ) - - # set initial date time - @setNewTimeInitial(item, attribute) - - # observer changes / update needed to forece rerender to get correct today shown - item.find('input').bind('focus', (e) -> - item.find('.js-datepicker').datepicker('rerender') - ) - item.find('input').bind('keyup blur change', (e) => - @setNewTime(item, attribute, 0) - @validation(item, attribute, true) - ) - item.bind('validate', (e) => - @validation(item, attribute) - ) - - item - - @setNewTime: (item, attribute, tolerant = false) -> - - datetime = item.find('.js-datepicker').datepicker('getDate') - if !datetime || datetime.toString() is 'Invalid Date' - App.Log.debug 'UiElement.date.setNewTime', datetime - item.find("[name=\"#{attribute.name}\"]").val('') - return - - App.Log.debug 'UiElement.date.setNewTime', datetime - year = datetime.getFullYear() - month = datetime.getMonth() + 1 - day = datetime.getDate() - date = "#{App.Utils.formatTime(year)}-#{App.Utils.formatTime(month,2)}-#{App.Utils.formatTime(day,2)}" - - if date is '' - item.find("[name=\"#{attribute.name}\"]").val('') - return - - App.Log.debug 'UiElement.date.setNewTime', date - item.find("[name=\"#{attribute.name}\"]").val(date) - - @setNewTimeInitial: (item, attribute) -> - App.Log.debug 'UiElement.date.setNewTimeInitial', timestamp - timestamp = item.find("[name=\"#{attribute.name}\"]").val() - return if !timestamp - - timeObject = new Date( Date.parse( timestamp ) ) - - hour = timeObject.getHours() - minute = timeObject.getMinutes() - - App.Log.debug 'UiElement.date.setNewTimeInitial', timestamp, timeObject - item.find('.js-datepicker').datepicker('setUTCDate', timeObject) - item.find('.js-datepicker').datepicker('update') - - @validation: (item, attribute, runtime) -> - - # remove old validation - if attribute.validationContainer is 'self' - item.find('.js-datepicker').removeClass('has-error') - else - item.closest('.form-group').removeClass('has-error') - item.find('.has-error').removeClass('has-error') - item.find('.help-inline').html('') - item.closest('.form-group').find('.help-inline').html('') - - timestamp = item.find("[name=\"#{attribute.name}\"]").val() - - # check required attributes - errors = {} - if !timestamp - if !attribute.null - errors[attribute.name] = 'missing' - else - timeObject = new Date( Date.parse( timestamp ) ) - - - App.Log.debug 'UiElement.date.validation', errors - return if _.isEmpty(errors) - - # show invalid options - if attribute.validationContainer is 'self' - item.find('.js-datepicker').addClass('has-error') - else - formGroup = item.closest('.form-group') - for key, value of errors - formGroup.addClass('has-error') + @dateSetter: -> + 'setUTCDate' diff --git a/app/assets/javascripts/app/controllers/_ui_element/datetime.coffee b/app/assets/javascripts/app/controllers/_ui_element/datetime.coffee index 6e8397572a34..648aa9981e92 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/datetime.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/datetime.coffee @@ -1,174 +1,45 @@ # coffeelint: disable=camel_case_classes -class App.UiElement.datetime - @render: (attributeOrig) -> +# Provides full date and time picker +class App.UiElement.datetime extends App.UiElement.basedate + @templateName: -> + 'datetime' - attribute = _.clone(attributeOrig) - attribute.nameRaw = attribute.name - attribute.name = "{datetime}#{attribute.name}" + @applyPickers: (item, attribute) -> + super(item, attribute) - item = $( App.view('generic/datetime')( - attribute: attribute - ) ) - - # set our custom template - $.fn.datepicker.defaults.template = App.view('generic/datepicker')() - - # apply date widgets - $.fn.datepicker.dates['custom'] = - days: [ - App.i18n.translateInline('Sunday'), - App.i18n.translateInline('Monday'), - App.i18n.translateInline('Tuesday'), - App.i18n.translateInline('Wednesday'), - App.i18n.translateInline('Thursday'), - App.i18n.translateInline('Friday'), - App.i18n.translateInline('Saturday'), - App.i18n.translateInline('Sunday'), - ], - daysMin: [ - App.i18n.translateInline('Sun'), - App.i18n.translateInline('Mon'), - App.i18n.translateInline('Tue'), - App.i18n.translateInline('Wed'), - App.i18n.translateInline('Thu'), - App.i18n.translateInline('Fri'), - App.i18n.translateInline('Sat'), - App.i18n.translateInline('Sun') - ], - daysShort: [ - App.i18n.translateInline('Sun'), - App.i18n.translateInline('Mon'), - App.i18n.translateInline('Tue'), - App.i18n.translateInline('Wed'), - App.i18n.translateInline('Thu'), - App.i18n.translateInline('Fri'), - App.i18n.translateInline('Sat'), - App.i18n.translateInline('Sun') - ], - months: [ - App.i18n.translateInline('January'), - App.i18n.translateInline('February'), - App.i18n.translateInline('March'), - App.i18n.translateInline('April'), - App.i18n.translateInline('May'), - App.i18n.translateInline('June'), - App.i18n.translateInline('July'), - App.i18n.translateInline('August'), - App.i18n.translateInline('September'), - App.i18n.translateInline('October'), - App.i18n.translateInline('November'), - App.i18n.translateInline('December'), - ], - monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], - today: App.i18n.translateInline('today'), - clear: App.i18n.translateInline('clear') - currentDate = undefined - - item.find('.js-datepicker').datepicker( - weekStart: 1 - autoclose: true - todayBtn: 'linked' - todayHighlight: true - format: App.i18n.timeFormat().date - rtl: App.i18n.dir() is 'rtl' - container: item - language: 'custom' - ) - - # set initial date time - @setNewTimeInitial(item, attribute) - - # apply time widgets item.find('.js-timepicker').timepicker() - # observer changes / update needed to forece rerender to get correct today shown - item.find('input').bind('focus', (e) -> - item.find('.js-datepicker').datepicker('rerender') - ) - item.find('input').bind('keyup blur change', (e) => - @setNewTime(item, attribute, 0) - @validation(item, attribute, true) - ) - item.bind('validate', (e) => - @validation(item, attribute) - ) - item + # returns array with date and time or false if cannot get date + @currentInput: (item, attribute) -> + result = super(item, attribute) - @setNewTime: (item, attribute, tolerant = false) -> + if _.isArray(result) + result.push item.find('.js-timepicker').val() - datetime = item.find('.js-datepicker').datepicker('getDate') - if !datetime || datetime.toString() is 'Invalid Date' - App.Log.debug 'UiElement.datetime.setNewTime', datetime - item.find("[name=\"#{attribute.name}\"]").val('') - return + result - App.Log.debug 'UiElement.datetime.setNewTime', datetime - year = datetime.getFullYear() - month = datetime.getMonth() + 1 - day = datetime.getDate() - date = "#{App.Utils.formatTime(year)}-#{App.Utils.formatTime(month,2)}-#{App.Utils.formatTime(day,2)}" - time = item.find('.js-timepicker').val() - - if date is '' || time is '' - item.find("[name=\"#{attribute.name}\"]").val('') - return - - timestamp = "#{date}T#{time}:00.000Z" - time = new Date( Date.parse(timestamp) ) - time.setMinutes( time.getMinutes() + time.getTimezoneOffset() ) - App.Log.debug 'UiElement.datetime.setNewTime', time.toString() - timestamp = time.toISOString().replace(/\d\d\.\d\d\dZ$/, '00.000Z') - item.find("[name=\"#{attribute.name}\"]").val(timestamp) + @validateInput: (currentInput) -> + currentInput[0] isnt '' || currentInput[1] isnt '' - @setNewTimeInitial: (item, attribute) -> - App.Log.debug 'UiElement.datetime.setNewTimeInitial', timestamp - timestamp = item.find("[name=\"#{attribute.name}\"]").val() - if !timestamp - item.find('.js-timepicker').val('08:00') - return + @setNoTimestamp: (item) -> + item.find('.js-timepicker').val('08:00') - timeObject = new Date( Date.parse( timestamp ) ) + @setTimestamp: (item, timeObject) -> + super(item, timeObject) hour = timeObject.getHours() minute = timeObject.getMinutes() time = "#{App.Utils.formatTime(hour,2)}:#{App.Utils.formatTime(minute,2)}" - App.Log.debug 'UiElement.datetime.setNewTimeInitial', timestamp, timeObject - item.find('.js-datepicker').datepicker('setUTCDate', timeObject) item.find('.js-timepicker').val(time) - item.find('.js-datepicker').datepicker('update') - - @validation: (item, attribute, runtime) -> - - # remove old validation - if attribute.validationContainer is 'self' - item.find('.js-datepicker').removeClass('has-error') - else - item.closest('.form-group').removeClass('has-error') - item.find('.has-error').removeClass('has-error') - item.find('.help-inline').html('') - item.closest('.form-group').find('.help-inline').html('') - - timestamp = item.find("[name=\"#{attribute.name}\"]").val() - - # check required attributes - errors = {} - if !timestamp - if !attribute.null - errors[attribute.name] = 'missing' - else - timeObject = new Date( Date.parse( timestamp ) ) - - App.Log.debug 'UiElement.datetime.validation', errors - return if _.isEmpty(errors) - - # show invalid options - if attribute.validationContainer is 'self' - item.find('.js-datepicker').addClass('has-error') - else - formGroup = item.closest('.form-group') - for key, value of errors - formGroup.addClass('has-error') + @buildTimestamp: (currentInput) -> + timestamp = "#{currentInput[0]}T#{currentInput[1]}:00.000Z" + time = new Date( Date.parse(timestamp) ) + time.setMinutes( time.getMinutes() + time.getTimezoneOffset() ) + @log 'setNewTime', time.toString() + time.toISOString().replace(/\d\d\.\d\d\dZ$/, '00.000Z') + @dateSetter: -> + 'setDate' diff --git a/app/assets/javascripts/app/controllers/_ui_element/object_manager_attribute.coffee b/app/assets/javascripts/app/controllers/_ui_element/object_manager_attribute.coffee index 71fd11be64db..99ae033f6187 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/object_manager_attribute.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/object_manager_attribute.coffee @@ -7,6 +7,10 @@ class App.UiElement.object_manager_attribute extends App.UiElement.ApplicationUi if params.data_option_new && !_.isEmpty(params.data_option_new) params.data_option = params.data_option_new + if attribute.value == 'select' && params.data_option? && params.data_option.options? + sorted = _.map params.data_option.options, (value, key) -> [key.toString(), value.toString()] + params.data_option.sorted = sorted.sort( (a, b) -> a[1].localeCompare(b[1]) ) + item = $(App.view('object_manager/attribute')(attribute: attribute)) updateDataMap = (localParams, localAttribute, localAttributes, localClassname, localForm, localA) => diff --git a/app/assets/javascripts/app/controllers/_ui_element/postmaster_set.coffee b/app/assets/javascripts/app/controllers/_ui_element/postmaster_set.coffee index 25e29568a413..b3803ed49577 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/postmaster_set.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/postmaster_set.coffee @@ -72,10 +72,7 @@ class App.UiElement.postmaster_set elements = {} for groupKey, groupMeta of groups - if !App[groupMeta.model] - elements["#{groupKey}.email"] = { name: 'email', display: 'Email' } - else - + if groupMeta.model && App[groupMeta.model] for row in App[groupMeta.model].configure_attributes # ignore passwords and relations @@ -117,32 +114,39 @@ class App.UiElement.postmaster_set [elements, groups] + @placeholder: (elementFull, attribute, params = {}, groups) -> + item = $( App.view('generic/postmaster_set_row')( attribute: attribute ) ) + selector = @buildAttributeSelector(elementFull, groups, attribute, item) + item.find('.js-attributeSelector').prepend(selector) + item + @render: (attribute, params = {}) -> [elements, groups] = @defaults() - selector = @buildAttributeSelector(groups, attribute) - # scaffold of match elements item = $( App.view('generic/postmaster_set')( attribute: attribute ) ) - item.find('.js-attributeSelector').prepend(selector) # add filter - item.find('.js-add').bind('click', (e) -> + item.on('click', '.js-add', (e) => element = $(e.target).closest('.js-filterElement') - elementClone = element.clone(true) - element.after(elementClone) - elementClone.find('.js-attributeSelector select').trigger('change') + placeholder = @placeholder(item, attribute, params, groups) + if element.get(0) + element.after(placeholder) + else + item.append(placeholder) + placeholder.find('.js-attributeSelector select').trigger('change') ) # remove filter - item.find('.js-remove').bind('click', (e) => + item.on('click', '.js-remove', (e) => + return if $(e.currentTarget).hasClass('is-disabled') $(e.target).closest('.js-filterElement').remove() @rebuildAttributeSelectors(item) ) # change attribute selector - item.find('.js-attributeSelector select').bind('change', (e) => + item.on('change', '.js-attributeSelector select', (e) => key = $(e.target).find('option:selected').attr('value') elementRow = $(e.target).closest('.js-filterElement') groupAndAttribute = elementRow.find('.js-attributeSelector option:selected').attr('value') @@ -152,27 +156,20 @@ class App.UiElement.postmaster_set ) # build inital params - if !_.isEmpty(params[attribute.name]) - - selectorExists = false - for key, meta of params[attribute.name] - selectorExists = true - operator = meta.operator - value = meta.value + if _.isEmpty(params[attribute.name]) + item.append(@placeholder(item, attribute, params, groups)) + return item - # get selector rows - elementFirst = item.find('.js-filterElement').first() - elementLast = item.find('.js-filterElement').last() + for key, meta of params[attribute.name] + operator = meta.operator + value = meta.value - # clone, rebuild and append - elementClone = elementFirst.clone(true) - @rebuildAttributeSelectors(item, elementClone, key, attribute) - @buildValue(item, elementClone, key, groups, value, operator, attribute) - elementLast.after(elementClone) + # build and append + element = @placeholder(item, attribute, params, groups) + @rebuildAttributeSelectors(item, element, key, attribute) + @buildValue(item, element, key, groups, value, operator, attribute) - # remove first dummy row - if selectorExists - item.find('.js-filterElement').first().remove() + item.append(element) item @@ -197,7 +194,15 @@ class App.UiElement.postmaster_set item = App.UiElement[config.tag].render(config, {}) elementRow.find('.js-value').html(item) - @buildAttributeSelector: (groups, attribute) -> + @buildAttributeSelector: (elementFull, groups, attribute) -> + + # find first possible attribute + selectedValue = '' + elementFull.find('.js-attributeSelector select option').each(-> + if !selectedValue && !$(@).prop('disabled') + selectedValue = $(@).val() + ) + selection = $('') for groupKey, groupMeta of groups displayName = App.i18n.translateInline(groupMeta.name) @@ -205,7 +210,10 @@ class App.UiElement.postmaster_set optgroup = selection.find("optgroup.js-#{groupKey}") for entry in groupMeta.options displayName = App.i18n.translateInline(entry.name) - optgroup.append("") + selected = '' + if entry.value is selectedValue + selected = 'selected="selected"' + optgroup.append("") selection @rebuildAttributeSelectors: (elementFull, elementRow, key, attribute) -> @@ -240,11 +248,11 @@ class App.UiElement.postmaster_set selection = $("") attributeConfig = elements[groupAndAttribute] - if !attributeConfig.operator + if !attributeConfig || !attributeConfig.operator elementRow.find('.js-operator').addClass('hide') else elementRow.find('.js-operator').removeClass('hide') - if attributeConfig.operator + if attributeConfig && attributeConfig.operator for operator in attributeConfig.operator operatorName = App.i18n.translateInline(operator) selected = '' diff --git a/app/assets/javascripts/app/controllers/_ui_element/richtext.coffee b/app/assets/javascripts/app/controllers/_ui_element/richtext.coffee index 387a35a8f1d2..b43483c3190b 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/richtext.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/richtext.coffee @@ -73,12 +73,14 @@ class App.UiElement.richtext @attachmentPlaceholder.addClass('hide') @attachmentUpload.removeClass('hide') @cancelContainer.removeClass('hide') + item.find('[contenteditable]').trigger('fileUploadStart') App.Log.debug 'UiElement.richtext', 'upload start' onAborted: => @attachmentPlaceholder.removeClass('hide') @attachmentUpload.addClass('hide') item.find('input').val('') + item.find('[contenteditable]').trigger('fileUploadStop', ['aborted']) # Called after received response from the server onCompleted: (response) => @@ -93,7 +95,7 @@ class App.UiElement.richtext renderFile(response.data) item.find('input').val('') - + item.find('[contenteditable]').trigger('fileUploadStop', ['completed']) App.Log.debug 'UiElement.richtext', 'upload complete', response.data # Called during upload progress, first parameter diff --git a/app/assets/javascripts/app/controllers/_ui_element/select.coffee b/app/assets/javascripts/app/controllers/_ui_element/select.coffee index da812722e4fb..e8dbdf1b38c5 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/select.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/select.coffee @@ -8,6 +8,9 @@ class App.UiElement.select extends App.UiElement.ApplicationUiElement else attribute.multiple = '' + # add deleted historical options if required + @addDeletedOptions(attribute, params) + # build options list based on config @getConfigOptionList(attribute, params) @@ -31,3 +34,20 @@ class App.UiElement.select extends App.UiElement.ApplicationUiElement # return item $( App.view('generic/select')(attribute: attribute) ) + + # 1. If attribute.value is not among the current options, then search within historical options + # 2. If attribute.value is not among current and historical options, then add the value itself as an option + @addDeletedOptions: (attribute) -> + return if !_.isEmpty(attribute.relation) # do not apply for attributes with relation, relations will fill options automatically + value = attribute.value + return if !value + return if _.isArray(value) + return if !attribute.options + return if !_.isObject(attribute.options) + return if value of attribute.options + return if value in (temp for own prop, temp of attribute.options) + + if attribute.historical_options && value of attribute.historical_options + attribute.options[value] = attribute.historical_options[value] + else + attribute.options[value] = value diff --git a/app/assets/javascripts/app/controllers/_ui_element/select_organization.coffee b/app/assets/javascripts/app/controllers/_ui_element/select_organization.coffee new file mode 100644 index 000000000000..6f8f4ea760ee --- /dev/null +++ b/app/assets/javascripts/app/controllers/_ui_element/select_organization.coffee @@ -0,0 +1,5 @@ +class App.UiElement.select_organization extends App.UiElement.select + @render: (attribute, params) -> + if attribute['default'] == 0 + attribute['default'] = attribute['filter']&[0] + super(attribute, params) \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/_ui_element/ticket_perform_action.coffee b/app/assets/javascripts/app/controllers/_ui_element/ticket_perform_action.coffee index 8ca71006a923..f9ac78d3e5c5 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/ticket_perform_action.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/ticket_perform_action.coffee @@ -16,7 +16,7 @@ class App.UiElement.ticket_perform_action # megre config elements = {} for groupKey, groupMeta of groups - if !App[groupMeta.model] + if !groupMeta.model || !App[groupMeta.model] elements["#{groupKey}.email"] = { name: 'email', display: 'Email' } else @@ -45,92 +45,82 @@ class App.UiElement.ticket_perform_action [defaults, groups, elements] + @placeholder: (elementFull, attribute, params, groups, elements) -> + item = $( App.view('generic/ticket_perform_action/row')( attribute: attribute ) ) + selector = @buildAttributeSelector(elementFull, groups, elements) + item.find('.js-attributeSelector').prepend(selector) + item + @render: (attribute, params = {}) -> [defaults, groups, elements] = @defaults(attribute) - selector = @buildAttributeSelector(groups, elements) - # return item item = $( App.view('generic/ticket_perform_action/index')( attribute: attribute ) ) - item.find('.js-attributeSelector').prepend(selector) # add filter - item.find('.js-add').bind('click', (e) => + item.on('click', '.js-add', (e) => element = $(e.target).closest('.js-filterElement') - elementClone = element.clone(true) - element.after(elementClone) - elementClone.find('.js-attributeSelector select').trigger('change') + placeholder = @placeholder(item, attribute, params, groups, elements) + if element.get(0) + element.after(placeholder) + else + item.append(placeholder) + placeholder.find('.js-attributeSelector select').trigger('change') @updateAttributeSelectors(item) ) # remove filter - item.find('.js-remove').bind('click', (e) => + item.on('click', '.js-remove', (e) => return if $(e.currentTarget).hasClass('is-disabled') $(e.target).closest('.js-filterElement').remove() @updateAttributeSelectors(item) ) # change attribute selector - item.find('.js-attributeSelector select').bind('change', (e) => + item.on('change', '.js-attributeSelector select', (e) => elementRow = $(e.target).closest('.js-filterElement') groupAndAttribute = elementRow.find('.js-attributeSelector option:selected').attr('value') @rebuildAttributeSelectors(item, elementRow, groupAndAttribute, elements, {}, attribute) @updateAttributeSelectors(item) ) - # build inital params - if !_.isEmpty(params[attribute.name]) - - selectorExists = false - for groupAndAttribute, meta of params[attribute.name] - selectorExists = true - - # get selector rows - elementFirst = item.find('.js-filterElement').first() - elementLast = item.find('.js-filterElement').last() - - # clone, rebuild and append - elementClone = elementFirst.clone(true) - @rebuildAttributeSelectors(item, elementClone, groupAndAttribute, elements, meta, attribute) - elementLast.after(elementClone) + # change operator selector + item.on('change', '.js-operator select', (e) => + elementRow = $(e.target).closest('.js-filterElement') + groupAndAttribute = elementRow.find('.js-attributeSelector option:selected').attr('value') + @buildOperator(item, elementRow, groupAndAttribute, elements, {}, attribute) + ) - # remove first dummy row - if selectorExists - item.find('.js-filterElement').first().remove() + # build inital params + if _.isEmpty(params[attribute.name]) - else for groupAndAttribute in defaults - # get selector rows - elementFirst = item.find('.js-filterElement').first() - elementLast = item.find('.js-filterElement').last() + # build and append + element = @placeholder(item, attribute, params, groups, elements) + item.append(element) + @rebuildAttributeSelectors(item, element, groupAndAttribute, elements, {}, attribute) - # clone, rebuild and append - elementClone = elementFirst.clone(true) - @rebuildAttributeSelectors(item, elementClone, groupAndAttribute, elements, {}, attribute) + return item - elementLast.after(elementClone) - item.find('.js-filterElement').first().remove() + for groupAndAttribute, meta of params[attribute.name] - # change attribute selector - item.find('.js-attributeSelector select').bind('change', (e) => - elementRow = $(e.target).closest('.js-filterElement') - groupAndAttribute = elementRow.find('.js-attributeSelector option:selected').attr('value') - @rebuildAttributeSelectors(item, elementRow, groupAndAttribute, elements, {}, attribute) - @updateAttributeSelectors(item) - ) + # build and append + element = @placeholder(item, attribute, params, groups, elements) + @rebuildAttributeSelectors(item, element, groupAndAttribute, elements, meta, attribute) + item.append(element) + item - # change operator selector - item.on('change', '.js-operator select', (e) => - elementRow = $(e.target).closest('.js-filterElement') - groupAndAttribute = elementRow.find('.js-attributeSelector option:selected').attr('value') - @buildOperator(item, elementRow, groupAndAttribute, elements, {}, attribute) - ) + @buildAttributeSelector: (elementFull, groups, elements) -> - item + # find first possible attribute + selectedValue = '' + elementFull.find('.js-attributeSelector select option').each(-> + if !selectedValue && !$(@).prop('disabled') + selectedValue = $(@).val() + ) - @buildAttributeSelector: (groups, elements) -> selection = $('') for groupKey, groupMeta of groups displayName = App.i18n.translateInline(groupMeta.name) @@ -141,7 +131,11 @@ class App.UiElement.ticket_perform_action if spacer[0] is groupKey attributeConfig = elements[elementKey] displayName = App.i18n.translateInline(attributeConfig.display) - optgroup.append("") + + selected = '' + if elementKey is selectedValue + selected = 'selected="selected"' + optgroup.append("") selection @updateAttributeSelectors: (elementFull) -> @@ -191,11 +185,11 @@ class App.UiElement.ticket_perform_action selection = $("") attributeConfig = elements[groupAndAttribute] - if !attributeConfig.operator + if !attributeConfig || !attributeConfig.operator elementRow.find('.js-operator').addClass('hide') else elementRow.find('.js-operator').removeClass('hide') - if attributeConfig.operator + if attributeConfig && attributeConfig.operator for operator in attributeConfig.operator operatorName = App.i18n.translateInline(operator) selected = '' diff --git a/app/assets/javascripts/app/controllers/agent_ticket_create.coffee b/app/assets/javascripts/app/controllers/agent_ticket_create.coffee index fc202802db2b..d16d113d1e80 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_create.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_create.coffee @@ -256,6 +256,8 @@ class App.TicketCreate extends App.Controller params = template.options else if App.TaskManager.get(@taskKey) && !_.isEmpty(App.TaskManager.get(@taskKey).state) params = App.TaskManager.get(@taskKey).state + params.attachments = App.TaskManager.get(@taskKey).attachments + if !_.isEmpty(params['form_id']) @formId = params['form_id'] @@ -308,6 +310,9 @@ class App.TicketCreate extends App.Controller form_id: @formId model: App.TicketArticle screen: 'create_top' + events: + 'fileUploadStart .richtext': => @submitDisable() + 'fileUploadStop .richtext': => @submitEnable() params: params taskKey: @taskKey ) @@ -503,8 +508,12 @@ class App.TicketCreate extends App.Controller if !confirm(App.i18n.translateContent('You use %s in text but no attachment is attached. Do you want to continue?', matchingWord)) return + # add sidebar params + if @sidebarWidget && @sidebarWidget.postParams + @sidebarWidget.postParams(ticket: ticket) + # disable form - @formDisable(e) + @submitDisable(e) ui = @ ticket.save( done: -> @@ -536,7 +545,7 @@ class App.TicketCreate extends App.Controller fail: (settings, details) -> ui.log 'errors', details - ui.formEnable(e) + ui.submitEnable(e) ui.notify( type: 'error' msg: App.i18n.translateContent(details.error_human || details.error || 'Unable to create object!') @@ -544,6 +553,18 @@ class App.TicketCreate extends App.Controller ) ) + submitDisable: (e) => + if e + @formDisable(e) + return + @formDisable(@$('.js-submit'), 'button') + + submitEnable: (e) => + if e + @formEnable(e) + return + @formEnable(@$('.js-submit'), 'button') + class Router extends App.ControllerPermanent requiredPermission: 'ticket.agent' constructor: (params) -> diff --git a/app/assets/javascripts/app/controllers/agent_ticket_create/sidebar.coffee b/app/assets/javascripts/app/controllers/agent_ticket_create/sidebar.coffee index 66f811ee3d9c..550467ebeb9e 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_create/sidebar.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_create/sidebar.coffee @@ -13,6 +13,11 @@ class App.TicketCreateSidebar extends App.Controller if backend && backend.commit backend.commit(args) + postParams: (args) => + for key, backend of @sidebarBackends + if backend && backend.postParams + backend.postParams(args) + render: (params) => if params @params = params diff --git a/app/assets/javascripts/app/controllers/cti.coffee b/app/assets/javascripts/app/controllers/cti.coffee index a637ad7e00ea..5ae318b38480 100644 --- a/app/assets/javascripts/app/controllers/cti.coffee +++ b/app/assets/javascripts/app/controllers/cti.coffee @@ -1,4 +1,7 @@ class App.CTI extends App.Controller + @extend App.PopoverProvidable + @registerPopovers 'User' + elements: '.js-callerLog': 'callerLog' events: @@ -25,6 +28,13 @@ class App.CTI extends App.Controller @delay(delay, 500, 'cti_list_push_render') 'cti_list_push' ) + @bind('cti_event', (data) => + return if data.state isnt 'newCall' + return if data.direction isnt 'in' + return if @switch() isnt true + @notify(data) + 'cti_event' + ) @bind('auth', (data) => @meta.counter = 0 ) @@ -71,6 +81,7 @@ class App.CTI extends App.Controller # render new caller list if data.list @list = data.list + @updateNavMenu() if @renderDone @renderCallerLog() return @@ -145,16 +156,17 @@ class App.CTI extends App.Controller if item.comment item.state_human += ", #{item.comment}" - if item.start && item.end - item.duration = format((Date.parse(item.end) - Date.parse(item.start))/1000) + if item.start_at && item.end_at + item.duration = format((Date.parse(item.end_at) - Date.parse(item.start_at))/1000) diff_in_min = ((Date.now() - Date.parse(item.created_at)) / 1000) / 60 if diff_in_min > 1 item.disabled = false - @userPopupsDestroy() + @removePopovers() @callerLog.html( App.view('cti/caller_log')(list: @list)) - @userPopups() + @renderPopovers() + @updateNavMenu() done: (e) => @@ -198,9 +210,9 @@ class App.CTI extends App.Controller counter: => count = 0 for item in @list - if item.state is 'hangup' && !item.done + if !item.done count++ - @meta.counter + count + @meta.counter = count switch: (state = undefined) => diff --git a/app/assets/javascripts/app/controllers/customer_ticket_create.coffee b/app/assets/javascripts/app/controllers/customer_ticket_create.coffee index d3ab6240d482..245454af6844 100644 --- a/app/assets/javascripts/app/controllers/customer_ticket_create.coffee +++ b/app/assets/javascripts/app/controllers/customer_ticket_create.coffee @@ -60,6 +60,9 @@ class Index extends App.ControllerContent form_id: @form_id model: App.TicketArticle screen: 'create_top' + events: + 'fileUploadStart .richtext': => @submitDisable() + 'fileUploadStop .richtext': => @submitEnable() filter: @formMeta.filter formMeta: @formMeta params: defaults @@ -141,6 +144,7 @@ class Index extends App.ControllerContent sender_id: sender.id form_id: @form_id content_type: 'text/html' + organization_id: params.organization_id } ticket.load(params) @@ -177,7 +181,7 @@ class Index extends App.ControllerContent else # disable form - @formDisable(e) + @submitDisable(e) ui = @ ticket.save( done: -> @@ -187,7 +191,7 @@ class Index extends App.ControllerContent fail: (settings, details) -> ui.log 'errors', details - ui.formEnable(e) + ui.submitEnable(e) ui.notify( type: 'error' msg: App.i18n.translateContent(details.error_human || details.error || 'Unable to create object!') @@ -195,5 +199,17 @@ class Index extends App.ControllerContent ) ) + submitDisable: (e) => + if e + @formDisable(e) + return + @formDisable(@$('.js-submit'), 'button') + + submitEnable: (e) => + if e + @formEnable(e) + return + @formEnable(@$('.js-submit'), 'button') + App.Config.set('customer_ticket_new', Index, 'Routes') App.Config.set('CustomerTicketNew', { prio: 8003, parent: '#new', name: 'New Ticket', translate: true, target: '#customer_ticket_new', permission: ['ticket.customer'], setting: ['customer_ticket_create'], divider: true }, 'NavBarRight') diff --git a/app/assets/javascripts/app/controllers/idoit_object_selector.coffee b/app/assets/javascripts/app/controllers/idoit_object_selector.coffee index 2a7053e5079f..d50519ba68ba 100644 --- a/app/assets/javascripts/app/controllers/idoit_object_selector.coffee +++ b/app/assets/javascripts/app/controllers/idoit_object_selector.coffee @@ -22,11 +22,11 @@ class App.IdoitObjectSelector extends App.ControllerModal @contentInline.find('.js-typeSelect').html(@renderTypeSelector(result)) - @contentInline.filter('.js-search').on('change', 'select, input', (e) => + @contentInline.on('change', 'input.js-shadow', (e) => params = @formParam(e.target) @search(params) ) - @contentInline.filter('.js-search').on('keyup', 'input', (e) => + @contentInline.on('keyup', 'input.js-searchField', (e) => params = @formParam(e.target) @search(params) ) diff --git a/app/assets/javascripts/app/controllers/navigation.coffee b/app/assets/javascripts/app/controllers/navigation.coffee index 55ad1234ceef..d3b0efbe69d7 100644 --- a/app/assets/javascripts/app/controllers/navigation.coffee +++ b/app/assets/javascripts/app/controllers/navigation.coffee @@ -1,4 +1,7 @@ class App.Navigation extends App.ControllerWidgetPermanent + @extend App.PopoverProvidable + @registerAllPopovers() + className: 'navigation vertical' elements: @@ -157,6 +160,7 @@ class App.Navigation extends App.ControllerWidgetPermanent ) renderResult: (result = []) => + @removePopovers() # remove result if not result exists if _.isEmpty(result) @@ -174,14 +178,7 @@ class App.Navigation extends App.ControllerWidgetPermanent # show result list @searchContainer.addClass('open') - # start ticket popups - @ticketPopups() - - # start user popups - @userPopups() - - # start oorganization popups - @organizationPopups() + @renderPopovers() render: -> @@ -206,7 +203,7 @@ class App.Navigation extends App.ControllerWidgetPermanent searchFocus: (e) => @query = '' # reset query cache @searchContainer.addClass('focused') - @anyPopoversDestroy() + App.PopoverProvidable.anyPopoversDestroy() @search() searchBlur: (e) => @@ -288,14 +285,14 @@ class App.Navigation extends App.ControllerWidgetPermanent @searchContainer.removeClass('filled').removeClass('open').removeClass('focused') @globalSearch.close() - # remove not needed popovers - @delay(@anyPopoversDestroy, 100, 'removePopovers') + @delayedRemoveAnyPopover() andClose: => @searchInput.blur() @searchContainer.removeClass('open') @globalSearch.close() - @delay(@anyPopoversDestroy, 100, 'removePopovers') + + @delayedRemoveAnyPopover() search: => query = @searchInput.val().trim() diff --git a/app/assets/javascripts/app/controllers/organization_profile.coffee b/app/assets/javascripts/app/controllers/organization_profile.coffee index d3ed34840b00..b4c5f59e3faa 100644 --- a/app/assets/javascripts/app/controllers/organization_profile.coffee +++ b/app/assets/javascripts/app/controllers/organization_profile.coffee @@ -195,6 +195,7 @@ class Member extends App.ObserverController lastname: true login: true email: true + active: true globalRerender: false render: (user) => diff --git a/app/assets/javascripts/app/controllers/report.coffee b/app/assets/javascripts/app/controllers/report.coffee index c8cc04620de7..51d9704cfb6c 100644 --- a/app/assets/javascripts/app/controllers/report.coffee +++ b/app/assets/javascripts/app/controllers/report.coffee @@ -550,9 +550,8 @@ class Sidebar extends App.Controller @render() render: => - metrics = @config.metric - profiles = App.ReportProfile.all() + profiles = App.ReportProfile.search(filter: { active: true }) @html App.view('report/sidebar')( metrics: metrics params: @params diff --git a/app/assets/javascripts/app/controllers/search.coffee b/app/assets/javascripts/app/controllers/search.coffee index 4c66dcf2f13e..acd4b492fbb9 100644 --- a/app/assets/javascripts/app/controllers/search.coffee +++ b/app/assets/javascripts/app/controllers/search.coffee @@ -1,4 +1,6 @@ class App.Search extends App.Controller + @extend App.PopoverProvidable + elements: '.js-search': 'searchInput' @@ -112,8 +114,7 @@ class App.Search extends App.Controller @updateFilledClass() @updateTask() - # remove not needed popovers - @delay(@anyPopoversDestroy, 100, 'removePopovers') + @delayedRemoveAnyPopover() search: (force = false) => query = @searchInput.val().trim() diff --git a/app/assets/javascripts/app/controllers/test.coffee b/app/assets/javascripts/app/controllers/test.coffee index 64fe57aeb692..c1886ff7926c 100644 --- a/app/assets/javascripts/app/controllers/test.coffee +++ b/app/assets/javascripts/app/controllers/test.coffee @@ -1,9 +1,10 @@ class App.TestController1 extends App.Controller constructor: -> super - @showState = false - @hideState = false - @activeState = false + @showState = false + @hideState = false + @activeState = false + @changedState ||= false @render() meta: -> @@ -21,6 +22,9 @@ class App.TestController1 extends App.Controller @activeState = state @render() + changed: => + @changedState + render: -> @html "#{selected}
#{quote_header}
#{selected}
|
@@ -51,24 +57,30 @@
<% for caller_id in item.preferences.to: %>
<% if caller_id.user_id && App.User.exists(caller_id.user_id): %>
<% shown = true %>
- <% user = App.User.find(caller_id.user_id) %>
+ <% user = App.User.fullLocal(caller_id.user_id) %>
+ <% classes = ['user-popover'] %>
+ <% classes.push('is-inactive') if !user.active %>
<% if caller_id.level isnt 'known': %><%- @T('maybe') %> <% end %>
- <%= user.displayNameLong() %> - <% else if caller_id.comment: %> + <%= user.displayNameLong() %> + <% else if !_.isEmpty(caller_id.comment): %> <% shown = true %> <%- @T('maybe') %> <%= caller_id.comment %> <% end %> <% end %> <% end %> - <% if !shown && item.to_comment: %> + <% if !shown && !_.isEmpty(item.to_comment): %> <% shown = true %> - <% if item.to_comment: %><%= item.to_comment %><% end %> + <%= item.to_comment %> <% end %> <% if shown: %> <%= item.to_pretty %> <% else: %> - <%= item.to_pretty %> + <% if !_.isEmpty(item.to_pretty): %> + <%= item.to_pretty %> + <% else: %> + <%= item.to %> + <% end %> <% end %> |
diff --git a/app/assets/javascripts/app/views/generic/attachment.jst.eco b/app/assets/javascripts/app/views/generic/attachment.jst.eco index 9b9328a01a07..827312ade3fa 100644 --- a/app/assets/javascripts/app/views/generic/attachment.jst.eco +++ b/app/assets/javascripts/app/views/generic/attachment.jst.eco @@ -2,8 +2,11 @@ |