diff --git a/.gitlab/ci/integration/otrs.yml b/.gitlab/ci/integration/otrs.yml index 5c0a94841..353289a4f 100644 --- a/.gitlab/ci/integration/otrs.yml +++ b/.gitlab/ci/integration/otrs.yml @@ -7,11 +7,11 @@ - echo -e "\\e[0Ksection_end:`date +%s`:zammad_db_unseeded\\r\\e[0K" - bundle exec rails test test/integration/otrs_import_test.rb variables: - FF_NETWORK_PER_BUILD: 1 # https://docs.gitlab.com/runner/configuration/feature-flags.html - IMPORT_OTRS_ENDPOINT: "http://zammad-ci-otrsimport-app/otrs/public.pl?Action=ZammadMigrator" - TZ: "Europe/Berlin" # Required for the zammad-ci-otrsimport-app containers + FF_NETWORK_PER_BUILD: 1 # https://docs.gitlab.com/runner/configuration/feature-flags.html + IMPORT_OTRS_ENDPOINT: 'http://zammad-ci-otrsimport-app/otrs/public.pl?Action=ZammadMigrator' + TZ: 'Europe/Berlin' # Required for the zammad-ci-otrsimport-app containers -"minitest:integration:otrs:6": +'minitest:integration:otrs:6': <<: *template_integration_otrs services: - name: $CI_REGISTRY/docker/zammad-mysql:stable @@ -23,7 +23,7 @@ - name: $CI_REGISTRY/docker/zammad-ci-otrsimport-app:otrs6 alias: zammad-ci-otrsimport-app -"minitest:integration:otrs:5": +'minitest:integration:otrs:5': <<: *template_integration_otrs services: - name: $CI_REGISTRY/docker/zammad-mysql:stable @@ -35,7 +35,7 @@ - name: $CI_REGISTRY/docker/zammad-ci-otrsimport-app:otrs5 alias: zammad-ci-otrsimport-app -"minitest:integration:otrs:4": +'minitest:integration:otrs:4': <<: *template_integration_otrs services: - name: $CI_REGISTRY/docker/zammad-mysql:stable @@ -47,7 +47,7 @@ - name: $CI_REGISTRY/docker/zammad-ci-otrsimport-app:otrs4 alias: zammad-ci-otrsimport-app -"minitest:integration:otrs:33": +'minitest:integration:otrs:33': <<: *template_integration_otrs services: - name: $CI_REGISTRY/docker/zammad-mysql:stable @@ -59,7 +59,7 @@ - name: $CI_REGISTRY/docker/zammad-ci-otrsimport-app:otrs33 alias: zammad-ci-otrsimport-app -"minitest:integration:otrs:32": +'minitest:integration:otrs:32': <<: *template_integration_otrs services: - name: $CI_REGISTRY/docker/zammad-mysql:stable @@ -71,7 +71,7 @@ - name: $CI_REGISTRY/docker/zammad-ci-otrsimport-app:otrs32 alias: zammad-ci-otrsimport-app -"minitest:integration:otrs:31": +'minitest:integration:otrs:31': <<: *template_integration_otrs services: - name: $CI_REGISTRY/docker/zammad-mysql:stable diff --git a/.rubocop/todo.rspec.yml b/.rubocop/todo.rspec.yml index 71ba50ab6..bcdf0e662 100644 --- a/.rubocop/todo.rspec.yml +++ b/.rubocop/todo.rspec.yml @@ -412,16 +412,6 @@ RSpec/MessageSpies: - 'spec/lib/import/otrs/ticket_spec.rb' - 'spec/lib/import/otrs/user_factory_spec.rb' - 'spec/lib/import/otrs/user_spec.rb' - - 'spec/lib/import/zendesk/object_attribute/base_examples.rb' - - 'spec/lib/import/zendesk/object_attribute/checkbox_spec.rb' - - 'spec/lib/import/zendesk/object_attribute/date_spec.rb' - - 'spec/lib/import/zendesk/object_attribute/decimal_spec.rb' - - 'spec/lib/import/zendesk/object_attribute/dropdown_spec.rb' - - 'spec/lib/import/zendesk/object_attribute/integer_spec.rb' - - 'spec/lib/import/zendesk/object_attribute/regexp_spec.rb' - - 'spec/lib/import/zendesk/object_attribute/tagger_spec.rb' - - 'spec/lib/import/zendesk/object_attribute/text_spec.rb' - - 'spec/lib/import/zendesk/object_attribute/textarea_spec.rb' - 'spec/lib/ldap/group_spec.rb' - 'spec/lib/ldap/guid_spec.rb' - 'spec/lib/ldap/user_spec.rb' @@ -483,16 +473,6 @@ RSpec/MultipleExpectations: - 'spec/lib/import/otrs/priority_factory_spec.rb' - 'spec/lib/import/otrs/requester_spec.rb' - 'spec/lib/import/otrs/state_factory_spec.rb' - - 'spec/lib/import/zendesk/object_attribute/base_examples.rb' - - 'spec/lib/import/zendesk/object_attribute/checkbox_spec.rb' - - 'spec/lib/import/zendesk/object_attribute/date_spec.rb' - - 'spec/lib/import/zendesk/object_attribute/decimal_spec.rb' - - 'spec/lib/import/zendesk/object_attribute/dropdown_spec.rb' - - 'spec/lib/import/zendesk/object_attribute/integer_spec.rb' - - 'spec/lib/import/zendesk/object_attribute/regexp_spec.rb' - - 'spec/lib/import/zendesk/object_attribute/tagger_spec.rb' - - 'spec/lib/import/zendesk/object_attribute/text_spec.rb' - - 'spec/lib/import/zendesk/object_attribute/textarea_spec.rb' - 'spec/lib/ldap/group_spec.rb' - 'spec/lib/ldap/guid_spec.rb' - 'spec/lib/ldap/user_spec.rb' @@ -660,16 +640,6 @@ RSpec/VerifiedDoubles: - 'spec/db/migrate/issue_2460_fix_corrupted_twitter_ids_spec.rb' - 'spec/jobs/communicate_twitter_job_spec.rb' - 'spec/lib/external_sync_spec.rb' - - 'spec/lib/import/zendesk/object_attribute/base_examples.rb' - - 'spec/lib/import/zendesk/object_attribute/checkbox_spec.rb' - - 'spec/lib/import/zendesk/object_attribute/date_spec.rb' - - 'spec/lib/import/zendesk/object_attribute/decimal_spec.rb' - - 'spec/lib/import/zendesk/object_attribute/dropdown_spec.rb' - - 'spec/lib/import/zendesk/object_attribute/integer_spec.rb' - - 'spec/lib/import/zendesk/object_attribute/regexp_spec.rb' - - 'spec/lib/import/zendesk/object_attribute/tagger_spec.rb' - - 'spec/lib/import/zendesk/object_attribute/text_spec.rb' - - 'spec/lib/import/zendesk/object_attribute/textarea_spec.rb' - 'spec/lib/ldap_spec.rb' - 'spec/lib/sequencer/sequence/import/ldap/users_spec.rb' - 'spec/lib/sequencer/unit/import/zendesk/sub_sequence/base_examples.rb' diff --git a/.stylelintrc.json b/.stylelintrc.json index d37395dae..e2795e66a 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -36,6 +36,7 @@ }, "ignoreFiles": [ "public/assets/*.css", + "public/assets/chat/chat.css", "public/assets/doorkeeper/**", "**/reset*.css", "**/bootstrap*.css", diff --git a/CHANGELOG.md b/CHANGELOG.md index 97443ef22..a4c279d6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,39 @@ # Change Log +## [5.1.1](https://github.com/zammad/zammad/tree/5.1.1) (2022-04-20) +[Full Changelog](https://github.com/zammad/zammad/compare/5.1.0...5.1.1) + +**Implemented enhancements:** + +- Allow reauthentication of Google / Microsoft 365 accounts [3240](https://github.com/zammad/zammad/issues/3240) [[enhancement](https://github.com/zammad/zammad/labels/enhancement)] [[channel](https://github.com/zammad/zammad/labels/channel)] + +**Fixed bugs:** + +- Error on second migration of an microsoft365 channel undefined method `options' for nil:NilClass [4060](https://github.com/zammad/zammad/issues/4060) [[bug](https://github.com/zammad/zammad/labels/bug)] [[channel](https://github.com/zammad/zammad/labels/channel)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised%20by%20payment)] +- Freshdesk migration which doesn't support time entries runs in unwanted behaviour [4052](https://github.com/zammad/zammad/issues/4052) [[bug](https://github.com/zammad/zammad/labels/bug)] [[import](https://github.com/zammad/zammad/labels/import)] +- Freshdesk-Migration does not like no Companies / Organisations within the source [4051](https://github.com/zammad/zammad/issues/4051) [[bug](https://github.com/zammad/zammad/labels/bug)] [[import](https://github.com/zammad/zammad/labels/import)] +- Cannot encrypt if multiple S/MIME certificates exist and one is expired [4029](https://github.com/zammad/zammad/issues/4029) [[bug](https://github.com/zammad/zammad/labels/bug)] +- Core Workflow: Does show wrong field list if you only have admin permissions and not ticket.agent permissions [4035](https://github.com/zammad/zammad/issues/4035) [[bug](https://github.com/zammad/zammad/labels/bug)] [[admin area](https://github.com/zammad/zammad/labels/admin%20area)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised%20by%20payment)] +- Can't delete smime certificate - ERROR: duplicate key value violates unique constraint [4049](https://github.com/zammad/zammad/issues/4049) [[bug](https://github.com/zammad/zammad/labels/bug)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised%20by%20payment)] +- Knowledge Base on-the-fly updating does not work [4026](https://github.com/zammad/zammad/issues/4026) [[bug](https://github.com/zammad/zammad/labels/bug)] +- Core Workflow - Unable to select "has changed" logic when creating new workflow. It is also replaced with "is" in previously created workflows. [4046](https://github.com/zammad/zammad/issues/4046) [[bug](https://github.com/zammad/zammad/labels/bug)] +- undefined method `to_hash` on editing select fields in the admin interface after migration to 5.1 [4027](https://github.com/zammad/zammad/issues/4027) [[bug](https://github.com/zammad/zammad/labels/bug)] +- KB Public menus scroll bar positioning incorrect [4008](https://github.com/zammad/zammad/issues/4008) [[bug](https://github.com/zammad/zammad/labels/bug)] [[UX/UI](https://github.com/zammad/zammad/labels/UX%2FUI)] [[knowledge base](https://github.com/zammad/zammad/labels/knowledge%20base)] +- Problems with duplicate records in Translations table [4020](https://github.com/zammad/zammad/issues/4020) [[bug](https://github.com/zammad/zammad/labels/bug)] [[translation](https://github.com/zammad/zammad/labels/translation)] +- Tree select value cannot be set to "-" (empty) with Trigger/Scheduler/Core workflow [4024](https://github.com/zammad/zammad/issues/4024) [[bug](https://github.com/zammad/zammad/labels/bug)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised%20by%20payment)] +- Admin macros are not usable with admin permissions only [4032](https://github.com/zammad/zammad/issues/4032) [[bug](https://github.com/zammad/zammad/labels/bug)] [[admin area](https://github.com/zammad/zammad/labels/admin%20area)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised%20by%20payment)] +- Admin SLA index view does not show update time if "for agent respond" is selected [4033](https://github.com/zammad/zammad/issues/4033) [[bug](https://github.com/zammad/zammad/labels/bug)] [[admin area](https://github.com/zammad/zammad/labels/admin%20area)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised%20by%20payment)] +- Core Workflow: Stop after match is not saved [4034](https://github.com/zammad/zammad/issues/4034) [[bug](https://github.com/zammad/zammad/labels/bug)] [[admin area](https://github.com/zammad/zammad/labels/admin%20area)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised%20by%20payment)] [[core workflows](https://github.com/zammad/zammad/labels/core%20workflows)] +- Freshdesk import error when a inline image source attribute contains no clean url [4028](https://github.com/zammad/zammad/issues/4028) [[bug](https://github.com/zammad/zammad/labels/bug)] [[import](https://github.com/zammad/zammad/labels/import)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised%20by%20payment)] +- Mention history does not show properly who got added [3984](https://github.com/zammad/zammad/issues/3984) [[bug](https://github.com/zammad/zammad/labels/bug)] [[UX/UI](https://github.com/zammad/zammad/labels/UX%2FUI)] [[history](https://github.com/zammad/zammad/labels/history)] +- Obsolete notice field in admin calendar view [4023](https://github.com/zammad/zammad/issues/4023) [[bug](https://github.com/zammad/zammad/labels/bug)] [[admin area](https://github.com/zammad/zammad/labels/admin%20area)] +- Error “customer_id required” on Macro execution [4022](https://github.com/zammad/zammad/issues/4022) [[bug](https://github.com/zammad/zammad/labels/bug)] [[UX/UI](https://github.com/zammad/zammad/labels/UX%2FUI)] [[macros](https://github.com/zammad/zammad/labels/macros)] +- Translations are not available in API after syncing [4016](https://github.com/zammad/zammad/issues/4016) [[bug](https://github.com/zammad/zammad/labels/bug)] +- Upgraded to 5.1.0: pending time doesn’t show a date [4018](https://github.com/zammad/zammad/issues/4018) [[bug](https://github.com/zammad/zammad/labels/bug)] [[translation](https://github.com/zammad/zammad/labels/translation)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised%20by%20payment)] +- UI is not updated right after importing users csv file [3919](https://github.com/zammad/zammad/issues/3919) [[bug](https://github.com/zammad/zammad/labels/bug)] +- LDAP with many groups (<5k) and group role relation (>50) will crash in frontend [3994](https://github.com/zammad/zammad/issues/3994) [[bug](https://github.com/zammad/zammad/labels/bug)] [[UX/UI](https://github.com/zammad/zammad/labels/UX%2FUI)] [[LDAP](https://github.com/zammad/zammad/labels/LDAP)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised%20by%20payment)] + + ## [5.1.0](https://github.com/zammad/zammad/tree/5.1.0) (2022-03-14) [Full Changelog](https://github.com/zammad/zammad/compare/5.0.0...5.1.0) diff --git a/Gemfile b/Gemfile index 42b401bf4..a26357fa1 100644 --- a/Gemfile +++ b/Gemfile @@ -94,6 +94,9 @@ gem 'omniauth-saml' gem 'omniauth-twitter' gem 'omniauth-weibo-oauth2' +# Rate limiting +gem 'rack-attack' + # channels gem 'gmail_xoauth' gem 'koala' diff --git a/Gemfile.lock b/Gemfile.lock index 293230919..8b1de6730 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -23,50 +23,50 @@ GEM simple_po_parser (~> 1.1.6) aasm (5.2.0) concurrent-ruby (~> 1.0) - actioncable (6.0.4.7) - actionpack (= 6.0.4.7) + actioncable (6.0.4.8) + actionpack (= 6.0.4.8) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.0.4.7) - actionpack (= 6.0.4.7) - activejob (= 6.0.4.7) - activerecord (= 6.0.4.7) - activestorage (= 6.0.4.7) - activesupport (= 6.0.4.7) + actionmailbox (6.0.4.8) + actionpack (= 6.0.4.8) + activejob (= 6.0.4.8) + activerecord (= 6.0.4.8) + activestorage (= 6.0.4.8) + activesupport (= 6.0.4.8) mail (>= 2.7.1) - actionmailer (6.0.4.7) - actionpack (= 6.0.4.7) - actionview (= 6.0.4.7) - activejob (= 6.0.4.7) + actionmailer (6.0.4.8) + actionpack (= 6.0.4.8) + actionview (= 6.0.4.8) + activejob (= 6.0.4.8) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.0.4.7) - actionview (= 6.0.4.7) - activesupport (= 6.0.4.7) + actionpack (6.0.4.8) + actionview (= 6.0.4.8) + activesupport (= 6.0.4.8) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.0.4.7) - actionpack (= 6.0.4.7) - activerecord (= 6.0.4.7) - activestorage (= 6.0.4.7) - activesupport (= 6.0.4.7) + actiontext (6.0.4.8) + actionpack (= 6.0.4.8) + activerecord (= 6.0.4.8) + activestorage (= 6.0.4.8) + activesupport (= 6.0.4.8) nokogiri (>= 1.8.5) - actionview (6.0.4.7) - activesupport (= 6.0.4.7) + actionview (6.0.4.8) + activesupport (= 6.0.4.8) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.0.4.7) - activesupport (= 6.0.4.7) + activejob (6.0.4.8) + activesupport (= 6.0.4.8) globalid (>= 0.3.6) - activemodel (6.0.4.7) - activesupport (= 6.0.4.7) - activerecord (6.0.4.7) - activemodel (= 6.0.4.7) - activesupport (= 6.0.4.7) + activemodel (6.0.4.8) + activesupport (= 6.0.4.8) + activerecord (6.0.4.8) + activemodel (= 6.0.4.8) + activesupport (= 6.0.4.8) activerecord-import (1.3.0) activerecord (>= 4.2) activerecord-nulldb-adapter (0.8.0) @@ -77,12 +77,12 @@ GEM multi_json (~> 1.11, >= 1.11.2) rack (>= 2.0.8, < 3) railties (>= 5.2.4.1) - activestorage (6.0.4.7) - actionpack (= 6.0.4.7) - activejob (= 6.0.4.7) - activerecord (= 6.0.4.7) + activestorage (6.0.4.8) + actionpack (= 6.0.4.8) + activejob (= 6.0.4.8) + activerecord (= 6.0.4.8) marcel (~> 1.0.0) - activesupport (6.0.4.7) + activesupport (6.0.4.8) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -144,7 +144,7 @@ GEM json composite_primary_keys (12.0.10) activerecord (~> 6.0.0) - concurrent-ruby (1.1.9) + concurrent-ruby (1.1.10) crack (0.4.5) rexml crass (1.0.6) @@ -297,7 +297,7 @@ GEM activesupport (>= 4) railties (>= 4) request_store (~> 1.0) - loofah (2.14.0) + loofah (2.16.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) lumberjack (1.2.8) @@ -423,24 +423,26 @@ GEM racc (1.6.0) racc (1.6.0-x86_64-linux-musl) rack (2.2.3) + rack-attack (6.6.0) + rack (>= 1.0, < 3) rack-livereload (0.3.17) rack rack-test (1.1.0) rack (>= 1.0, < 3) - rails (6.0.4.7) - actioncable (= 6.0.4.7) - actionmailbox (= 6.0.4.7) - actionmailer (= 6.0.4.7) - actionpack (= 6.0.4.7) - actiontext (= 6.0.4.7) - actionview (= 6.0.4.7) - activejob (= 6.0.4.7) - activemodel (= 6.0.4.7) - activerecord (= 6.0.4.7) - activestorage (= 6.0.4.7) - activesupport (= 6.0.4.7) + rails (6.0.4.8) + actioncable (= 6.0.4.8) + actionmailbox (= 6.0.4.8) + actionmailer (= 6.0.4.8) + actionpack (= 6.0.4.8) + actiontext (= 6.0.4.8) + actionview (= 6.0.4.8) + activejob (= 6.0.4.8) + activemodel (= 6.0.4.8) + activerecord (= 6.0.4.8) + activestorage (= 6.0.4.8) + activesupport (= 6.0.4.8) bundler (>= 1.3.0) - railties (= 6.0.4.7) + railties (= 6.0.4.8) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) @@ -451,9 +453,9 @@ GEM nokogiri (>= 1.6) rails-html-sanitizer (1.4.2) loofah (~> 2.3) - railties (6.0.4.7) - actionpack (= 6.0.4.7) - activesupport (= 6.0.4.7) + railties (6.0.4.8) + actionpack (= 6.0.4.8) + activesupport (= 6.0.4.8) method_source rake (>= 0.8.7) thor (>= 0.20.3, < 2.0) @@ -709,6 +711,7 @@ DEPENDENCIES puma (~> 4) pundit pundit-matchers + rack-attack rack-livereload rails (~> 6.0.0) rails-controller-testing diff --git a/app/assets/javascripts/app/controllers/_channel/microsoft365.coffee b/app/assets/javascripts/app/controllers/_channel/microsoft365.coffee index 596737922..a02990222 100644 --- a/app/assets/javascripts/app/controllers/_channel/microsoft365.coffee +++ b/app/assets/javascripts/app/controllers/_channel/microsoft365.coffee @@ -95,10 +95,14 @@ class ChannelAccountOverview extends App.ControllerSubContent channels.push channel - # auto redirect to gmail account linking if we have no account - if @channel_id && channels.length < 1 - @new() - return + # on a channel migration we need to auto redirect + # the user to the "Add Account" functionality after + # the filled up the external credentials + if @channel_id + item = App.Channel.find(@channel_id) + if item && item.area != 'Microsoft365::Account' + @new() + return # get all unlinked email addresses not_used_email_addresses = [] @@ -111,9 +115,14 @@ class ChannelAccountOverview extends App.ControllerSubContent not_used_email_addresses: not_used_email_addresses ) + # on a channel creation we will auto open the edit + # dialog after the redirect back to zammad to optional + # change the inbound configuration, but not for + # migrated channel because we guess that the inbound configuration + # is already correct for them. if @channel_id item = App.Channel.find(@channel_id) - if item && item.options && item.options.backup_imap_classic is undefined + if item && item.area == 'Microsoft365::Account' && item.options && item.options.backup_imap_classic is undefined @editInbound(undefined, @channel_id, true) @channel_id = undefined diff --git a/app/assets/javascripts/app/controllers/_profile/password.coffee b/app/assets/javascripts/app/controllers/_profile/password.coffee index 9bde885bc..37c8cf2c1 100644 --- a/app/assets/javascripts/app/controllers/_profile/password.coffee +++ b/app/assets/javascripts/app/controllers/_profile/password.coffee @@ -56,26 +56,32 @@ class ProfilePassword extends App.ControllerSubContent data: JSON.stringify(params) processData: true success: @success + error: @error ) - success: (data) => - if data.message is 'ok' - @render() - @notify( - type: 'success' - msg: App.i18n.translateContent( 'Password changed successfully!' ) - ) - else - if data.notice - @notify - type: 'error' - msg: App.i18n.translateContent( data.notice[0], data.notice[1] ) - removeAll: true - else - @notify - type: 'error' - msg: __('The password could not be set. Please contact your administrator.') - removeAll: true - @formEnable( @$('form') ) + success: => + @render() + + @notify( + type: 'success' + msg: App.i18n.translateContent( 'Password changed successfully!' ) + ) + + error: (xhr, status, error) => + return if xhr.status != 422 + + data = xhr.responseJSON + + message = if data.notice + App.i18n.translateContent( data.notice[0], data.notice[1] ) + else + __('The password could not be set. Please contact your administrator.') + + @notify + type: 'error' + msg: message + removeAll: true + + @formEnable( @$('form') ) App.Config.set('Password', { prio: 2000, name: __('Password'), parent: '#profile', target: '#profile/password', controller: ProfilePassword, permission: ['user_preferences.password'] }, 'NavBarProfile') diff --git a/app/assets/javascripts/app/controllers/_ui_element/active.coffee b/app/assets/javascripts/app/controllers/_ui_element/active.coffee index 698449bd0..3609c179b 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/active.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/active.coffee @@ -1,6 +1,7 @@ # coffeelint: disable=camel_case_classes class App.UiElement.active extends App.UiElement.ApplicationUiElement - @render: (attribute, params) -> + @render: (attributeConfig, params) -> + attribute = $.extend(true, {}, attributeConfig) # set attributes attribute.null = false diff --git a/app/assets/javascripts/app/controllers/_ui_element/auth_provider.coffee b/app/assets/javascripts/app/controllers/_ui_element/auth_provider.coffee index 07900dedd..ad190b670 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/auth_provider.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/auth_provider.coffee @@ -1,6 +1,8 @@ # coffeelint: disable=camel_case_classes class App.UiElement.auth_provider - @render: (attribute) -> + @render: (attributeConfig) -> + attribute = $.extend(true, {}, attributeConfig) + for key, value of App.Config.get('auth_provider_all') continue if value.config isnt attribute.provider attribute.value = "#{App.Config.get('http_type')}://#{App.Config.get('fqdn')}#{value.url}/callback" diff --git a/app/assets/javascripts/app/controllers/_ui_element/autocompletion.coffee b/app/assets/javascripts/app/controllers/_ui_element/autocompletion.coffee index da49e3eaa..676146fa0 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/autocompletion.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/autocompletion.coffee @@ -1,6 +1,7 @@ # coffeelint: disable=camel_case_classes,no_interpolation_in_single_quotes class App.UiElement.autocompletion - @render: (attribute, params = {}) -> + @render: (attributeConfig, params = {}) -> + attribute = $.extend(true, {}, attributeConfig) if params[ attribute.name + '_autocompletion_value_shown' ] attribute.valueShown = params[ attribute.name + '_autocompletion_value_shown' ] diff --git a/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax.coffee b/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax.coffee index 31d3cf9a0..afd3bb88c 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax.coffee @@ -15,7 +15,7 @@ class App.UiElement.autocompletion_ajax id: params.organization_id || attribute.id placeholder: App.i18n.translateInline('Search…') limit: 40 - object: attribute.relation + relation: attribute.relation ajax: true multiple: attribute.multiple ) diff --git a/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax_search.coffee b/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax_search.coffee index cd588e9b7..3207cddd5 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax_search.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax_search.coffee @@ -1,6 +1,7 @@ # coffeelint: disable=camel_case_classes class App.UiElement.autocompletion_ajax_search extends App.UiElement.autocompletion_ajax - @render: (attributeOrig, params = {}, form) -> - attribute = _.clone(attributeOrig) + @render: (attributeConfig, params = {}, form) -> + attribute = $.extend(true, {}, attributeConfig) + attribute.multiple = true super(attribute, params = {}, form) diff --git a/app/assets/javascripts/app/controllers/_ui_element/basedate.coffee b/app/assets/javascripts/app/controllers/_ui_element/basedate.coffee index 9abbd84cd..abfcfb448 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/basedate.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/basedate.coffee @@ -4,8 +4,9 @@ class App.UiElement.basedate @templateName: -> throw 'Must override in a subclass' - @render: (attributeOrig) -> - attribute = _.clone(attributeOrig) + @render: (attributeConfig) -> + attribute = $.extend(true, {}, attributeConfig) + attribute.nameRaw = attribute.name attribute.name = "{#{@templateName()}}#{attribute.name}" diff --git a/app/assets/javascripts/app/controllers/_ui_element/boolean.coffee b/app/assets/javascripts/app/controllers/_ui_element/boolean.coffee index fa84c7b38..c0e143a45 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/boolean.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/boolean.coffee @@ -1,6 +1,7 @@ # coffeelint: disable=camel_case_classes class App.UiElement.boolean extends App.UiElement.ApplicationUiElement - @render: (attribute, params) -> + @render: (attributeConfig, params) -> + attribute = $.extend(true, {}, attributeConfig) # build options list if _.isEmpty(attribute.options) diff --git a/app/assets/javascripts/app/controllers/_ui_element/business_hours.coffee b/app/assets/javascripts/app/controllers/_ui_element/business_hours.coffee index c83d9a9b0..054b0525a 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/business_hours.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/business_hours.coffee @@ -1,8 +1,8 @@ # coffeelint: disable=camel_case_classes class App.UiElement.business_hours - @render: (attributeOrig) -> + @render: (attributeConfig) -> + attribute = $.extend(true, {}, attributeConfig) - attribute = _.clone(attributeOrig) attribute.nameRaw = attribute.name attribute.name = "{business_hours}#{attribute.name}" diff --git a/app/assets/javascripts/app/controllers/_ui_element/checkbox.coffee b/app/assets/javascripts/app/controllers/_ui_element/checkbox.coffee index 099f37e1b..87bba235e 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/checkbox.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/checkbox.coffee @@ -1,6 +1,7 @@ # coffeelint: disable=camel_case_classes class App.UiElement.checkbox extends App.UiElement.ApplicationUiElement - @render: (attribute, params) -> + @render: (attributeConfig, params) -> + attribute = $.extend(true, {}, attributeConfig) # build options list based on config @getConfigOptionList( attribute, params ) diff --git a/app/assets/javascripts/app/controllers/_ui_element/checkboxTicketAttributes.coffee b/app/assets/javascripts/app/controllers/_ui_element/checkboxTicketAttributes.coffee index 865018749..7b14f4230 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/checkboxTicketAttributes.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/checkboxTicketAttributes.coffee @@ -1,6 +1,7 @@ # coffeelint: disable=camel_case_classes class App.UiElement.checkboxTicketAttributes extends App.UiElement.ApplicationUiElement - @render: (attribute, params) -> + @render: (attributeConfig, params) -> + attribute = $.extend(true, {}, attributeConfig) attributeOptionsArray = [] for name, row of App.Ticket.attributesGet() diff --git a/app/assets/javascripts/app/controllers/_ui_element/column_select.coffee b/app/assets/javascripts/app/controllers/_ui_element/column_select.coffee index 6741b3946..1fa9f8304 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/column_select.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/column_select.coffee @@ -1,6 +1,7 @@ # coffeelint: disable=camel_case_classes class App.UiElement.column_select extends App.UiElement.ApplicationUiElement - @render: (attribute, params) -> + @render: (attributeConfig, params) -> + attribute = $.extend(true, {}, attributeConfig) # set multiple option attribute.multiple = 'multiple' diff --git a/app/assets/javascripts/app/controllers/_ui_element/datetime_search.coffee b/app/assets/javascripts/app/controllers/_ui_element/datetime_search.coffee index 825488467..fce97d504 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/datetime_search.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/datetime_search.coffee @@ -1,7 +1,8 @@ # coffeelint: disable=camel_case_classes class App.UiElement.datetime_search - @render: (attributeOrig) -> - attribute = _.clone(attributeOrig) + @render: (attributeConfig, params) -> + attribute = $.extend(true, {}, attributeConfig) + attribute.disable_feature = true attribute.null = false App.UiElement.datetime.render(attribute) diff --git a/app/assets/javascripts/app/controllers/_ui_element/integer.coffee b/app/assets/javascripts/app/controllers/_ui_element/integer.coffee index a155c5512..eed83158f 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/integer.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/integer.coffee @@ -1,6 +1,8 @@ # coffeelint: disable=camel_case_classes class App.UiElement.integer - @render: (attribute) -> + @render: (attributeConfig) -> + attribute = $.extend(true, {}, attributeConfig) + attribute.type = 'number' attribute.step = '1' item = $( App.view('generic/input')(attribute: attribute) ) diff --git a/app/assets/javascripts/app/controllers/_ui_element/multiselect.coffee b/app/assets/javascripts/app/controllers/_ui_element/multiselect.coffee index f8be70484..6510c03ff 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/multiselect.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/multiselect.coffee @@ -1,6 +1,7 @@ # coffeelint: disable=camel_case_classes class App.UiElement.multiselect extends App.UiElement.ApplicationUiElement - @render: (attribute, params, form = {}) -> + @render: (attributeConfig, params, form = {}) -> + attribute = $.extend(true, {}, attributeConfig) # set multiple option attribute.multiple = 'multiple' diff --git a/app/assets/javascripts/app/controllers/_ui_element/multiselect_search.coffee b/app/assets/javascripts/app/controllers/_ui_element/multiselect_search.coffee index 02aefad66..194e2162f 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/multiselect_search.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/multiselect_search.coffee @@ -1,6 +1,7 @@ # coffeelint: disable=camel_case_classes class App.UiElement.multiselect_search extends App.UiElement.ApplicationUiElement - @render: (attribute, params) -> + @render: (attributeConfig, params) -> + attribute = $.extend(true, {}, attributeConfig) # set multiple option if attribute.multiple diff --git a/app/assets/javascripts/app/controllers/_ui_element/radio.coffee b/app/assets/javascripts/app/controllers/_ui_element/radio.coffee index 337d6764e..c3071975e 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/radio.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/radio.coffee @@ -2,7 +2,8 @@ class App.UiElement.radio extends App.UiElement.ApplicationUiElement @template_name: 'radio' - @render: (attribute, params) -> + @render: (attributeConfig, params) -> + attribute = $.extend(true, {}, attributeConfig) # build options list based on config @getConfigOptionList(attribute, params) diff --git a/app/assets/javascripts/app/controllers/_ui_element/richtext.coffee b/app/assets/javascripts/app/controllers/_ui_element/richtext.coffee index aafeb949c..ced9ba920 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/richtext.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/richtext.coffee @@ -1,6 +1,8 @@ # coffeelint: disable=camel_case_classes class App.UiElement.richtext - @render: (attribute, params, form) -> + @render: (attributeConfig, params, form) -> + attribute = $.extend(true, {}, attributeConfig) + if _.isObject(attribute.value) attribute.attachments = attribute.value.attachments attribute.value = attribute.value.text diff --git a/app/assets/javascripts/app/controllers/_ui_element/searchable_select.coffee b/app/assets/javascripts/app/controllers/_ui_element/searchable_select.coffee index d2b8f3664..4dbe18398 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/searchable_select.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/searchable_select.coffee @@ -1,6 +1,7 @@ # coffeelint: disable=camel_case_classes class App.UiElement.searchable_select extends App.UiElement.ApplicationUiElement - @render: (attribute, params) -> + @render: (attributeConfig, params) -> + attribute = $.extend(true, {}, attributeConfig) # set multiple option if attribute.multiple diff --git a/app/assets/javascripts/app/controllers/_ui_element/select.coffee b/app/assets/javascripts/app/controllers/_ui_element/select.coffee index d50dafd9a..bd7bc77a6 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/select.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/select.coffee @@ -1,6 +1,7 @@ # coffeelint: disable=camel_case_classes class App.UiElement.select extends App.UiElement.ApplicationUiElement - @render: (attribute, params, form = {}) -> + @render: (attributeConfig, params, form = {}) -> + attribute = $.extend(true, {}, attributeConfig) # set multiple option if attribute.multiple diff --git a/app/assets/javascripts/app/controllers/_ui_element/selectTicketAttributes.coffee b/app/assets/javascripts/app/controllers/_ui_element/selectTicketAttributes.coffee index 3a2276746..4ea2b06fe 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/selectTicketAttributes.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/selectTicketAttributes.coffee @@ -1,6 +1,7 @@ # coffeelint: disable=camel_case_classes class App.UiElement.selectTicketAttributes extends App.UiElement.ApplicationUiElement - @render: (attribute, params) -> + @render: (attributeConfig, params) -> + attribute = $.extend(true, {}, attributeConfig) attributeOptionsArray = [] for name, row of App.Ticket.attributesGet() diff --git a/app/assets/javascripts/app/controllers/_ui_element/select_search.coffee b/app/assets/javascripts/app/controllers/_ui_element/select_search.coffee index ba5a324db..c3decb0ef 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/select_search.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/select_search.coffee @@ -1,6 +1,7 @@ # coffeelint: disable=camel_case_classes class App.UiElement.select_search extends App.UiElement.ApplicationUiElement - @render: (attribute, params) -> + @render: (attributeConfig, params) -> + attribute = $.extend(true, {}, attributeConfig) # set multiple option if attribute.multiple diff --git a/app/assets/javascripts/app/controllers/_ui_element/tag.coffee b/app/assets/javascripts/app/controllers/_ui_element/tag.coffee index 3889d9263..20b7fb851 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/tag.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/tag.coffee @@ -1,6 +1,7 @@ # coffeelint: disable=camel_case_classes class App.UiElement.tag - @render: (attribute) -> + @render: (attributeConfig) -> + attribute = $.extend(true, {}, attributeConfig) if !attribute.id attribute.id = 'tag-' + new Date().getTime() + '-' + Math.floor(Math.random() * 999999) item = $( App.view('generic/input')(attribute: attribute) ) @@ -11,7 +12,7 @@ class App.UiElement.tag createTokensOnBlur: true autocomplete: { source: source - minLength: 2 + minLength: 1 response: (e, ui) -> return if !ui return if !ui.content 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 1b8cfb7fc..9c2d4da33 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 @@ -64,7 +64,8 @@ class App.UiElement.ticket_perform_action item.find('.js-attributeSelector').prepend(selector) item - @render: (attribute, params = {}) -> + @render: (attributeConfig, params = {}) -> + attribute = $.extend(true, {}, attributeConfig) [defaults, groups, elements] = @defaults(attribute) @@ -452,7 +453,7 @@ class App.UiElement.ticket_perform_action name: "#{name}::internal" multiple: false null: false - options: { true: 'internal', false: 'public' } + options: { true: __('internal'), false: __('public') } value: meta.internal || 'false' translate: true ) diff --git a/app/assets/javascripts/app/controllers/_ui_element/time_range.coffee b/app/assets/javascripts/app/controllers/_ui_element/time_range.coffee index e831fab05..230be4f5c 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/time_range.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/time_range.coffee @@ -1,6 +1,8 @@ # coffeelint: disable=camel_case_classes class App.UiElement.time_range - @render: (attribute) -> + @render: (attributeConfig, params) -> + attribute = $.extend(true, {}, attributeConfig) + ranges = minute: __('Minute(s)') hour: __('Hour(s)') diff --git a/app/assets/javascripts/app/controllers/_ui_element/timer.coffee b/app/assets/javascripts/app/controllers/_ui_element/timer.coffee index cc6a4a7e6..bc0c513ba 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/timer.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/timer.coffee @@ -1,6 +1,8 @@ # coffeelint: disable=camel_case_classes class App.UiElement.timer - @render: (attribute) -> + @render: (attributeConfig, params) -> + attribute = $.extend(true, {}, attributeConfig) + days = Mon: __('Monday') Tue: __('Tuesday') diff --git a/app/assets/javascripts/app/controllers/_ui_element/timezone.coffee b/app/assets/javascripts/app/controllers/_ui_element/timezone.coffee index 919219cde..0ce26f130 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/timezone.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/timezone.coffee @@ -1,6 +1,7 @@ # coffeelint: disable=camel_case_classes class App.UiElement.timezone extends App.UiElement.ApplicationUiElement - @render: (attribute, params) -> + @render: (attributeConfig, params) -> + attribute = $.extend(true, {}, attributeConfig) attribute.options = [] timezones = App.Config.get('timezones') diff --git a/app/assets/javascripts/app/controllers/_ui_element/tree_select.coffee b/app/assets/javascripts/app/controllers/_ui_element/tree_select.coffee index 1c5a23d23..8745bb6f8 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/tree_select.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/tree_select.coffee @@ -1,6 +1,7 @@ # coffeelint: disable=camel_case_classes class App.UiElement.tree_select extends App.UiElement.ApplicationUiElement - @render: (attribute, params) -> + @render: (attributeConfig, params) -> + attribute = $.extend(true, {}, attributeConfig) # set multiple option if attribute.multiple diff --git a/app/assets/javascripts/app/controllers/_ui_element/tree_select_search.coffee b/app/assets/javascripts/app/controllers/_ui_element/tree_select_search.coffee index ff35e0274..9879a2d6b 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/tree_select_search.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/tree_select_search.coffee @@ -1,15 +1,10 @@ # coffeelint: disable=camel_case_classes class App.UiElement.tree_select_search extends App.UiElement.ApplicationUiElement - @render: (localAttribute, params) -> - - # clone original attribute - attribute = clone(localAttribute) + @render: (attributeConfig, params) -> + attribute = $.extend(true, {}, attributeConfig) # set multiple option - if attribute.multiple - attribute.multiple = 'multiple' - else - attribute.multiple = '' + attribute.multiple = 'multiple' # add null selection if needed @addNullOption(attribute, params) diff --git a/app/assets/javascripts/app/controllers/layout_ref.coffee b/app/assets/javascripts/app/controllers/layout_ref.coffee index 12a204fad..f795e7275 100644 --- a/app/assets/javascripts/app/controllers/layout_ref.coffee +++ b/app/assets/javascripts/app/controllers/layout_ref.coffee @@ -1502,7 +1502,7 @@ class InputsRef extends App.ControllerAppContent id: 'user-123' placeholder: __('Enter User') limt: 10 - object: 'User' + relation: 'User' @$('.searchableAjaxSelectPlaceholder').replaceWith( searchableAjaxSelectObject.element() ) diff --git a/app/assets/javascripts/app/controllers/ticket_overview.coffee b/app/assets/javascripts/app/controllers/ticket_overview.coffee index 25ae2a04b..e222558c0 100644 --- a/app/assets/javascripts/app/controllers/ticket_overview.coffee +++ b/app/assets/javascripts/app/controllers/ticket_overview.coffee @@ -1355,8 +1355,8 @@ class App.OverviewSettings extends App.ControllerModal null: false translate: true options: - ASC: 'up' - DESC: 'down' + ASC: __('up') + DESC: __('down') }, { name: 'group_by' @@ -1376,8 +1376,8 @@ class App.OverviewSettings extends App.ControllerModal null: false translate: true options: - ASC: 'up' - DESC: 'down' + ASC: __('up') + DESC: __('down') },) controller = new App.ControllerForm( diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee index de76f2f04..e4a8ccd7e 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee @@ -483,6 +483,10 @@ class ArticleViewItem extends App.ControllerObserver @el.remove() imageView: (e) -> + # take care of images surrounded by a link + if e.target && e.target.parentNode && e.target.parentNode.nodeName.toLowerCase() == 'a' + return false + e.preventDefault() e.stopPropagation() new App.TicketZoomArticleImageView(image: $(e.target).get(0).outerHTML, parentElement: $(e.currentTarget)) diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/attribute_bar.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/attribute_bar.coffee index 2c2b3e3c6..b114671ac 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/attribute_bar.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/attribute_bar.coffee @@ -18,8 +18,6 @@ class App.TicketZoomAttributeBar extends App.Controller constructor: -> super - @secondaryAction = @getAction() - @subscribeId = App.Macro.subscribe(@checkMacroChanges) @render() @@ -97,7 +95,7 @@ class App.TicketZoomAttributeBar extends App.Controller sharedDraftButtonShown: sharedDraftButtonShown )) - @setSecondaryAction(@secondaryAction, localeEl) + @setSecondaryAction(@getAction(), localeEl) if @ticket.currentView() is 'agent' @taskbarWatcher = new App.TaskbarWatcher( diff --git a/app/assets/javascripts/app/controllers/widget/link/kb_answer.coffee b/app/assets/javascripts/app/controllers/widget/link/kb_answer.coffee index be93dca6b..15f62b4ed 100644 --- a/app/assets/javascripts/app/controllers/widget/link/kb_answer.coffee +++ b/app/assets/javascripts/app/controllers/widget/link/kb_answer.coffee @@ -52,7 +52,7 @@ class App.WidgetLinkKbAnswer extends App.WidgetLink name: 'input' placeholder: App.i18n.translateInline('Search…') limit: 40 - object: 'KnowledgeBaseAnswerTranslation' + relation: 'KnowledgeBaseAnswerTranslation' ajax: true ).element()) diff --git a/app/assets/javascripts/app/controllers/widget/tag.coffee b/app/assets/javascripts/app/controllers/widget/tag.coffee index 38d1f39d6..c3e528172 100644 --- a/app/assets/javascripts/app/controllers/widget/tag.coffee +++ b/app/assets/javascripts/app/controllers/widget/tag.coffee @@ -57,7 +57,7 @@ class App.WidgetTag extends App.Controller source = "#{App.Config.get('api_path')}/tag_search" @$('.js-newTagInput').autocomplete( source: source - minLength: 0 + minLength: 1 response: (e, ui) => return if !ui return if !ui.content diff --git a/app/assets/javascripts/app/lib/app_post/multi_locales_row.coffee b/app/assets/javascripts/app/lib/app_post/multi_locales_row.coffee index 091d4d1ec..41e5d238d 100644 --- a/app/assets/javascripts/app/lib/app_post/multi_locales_row.coffee +++ b/app/assets/javascripts/app/lib/app_post/multi_locales_row.coffee @@ -34,7 +34,8 @@ class App.MultiLocalesRow extends App.Controller name: name value: value null: false - placeholder: __('Select locale…') + translate: true + placeholder: App.i18n.translatePlain('Select locale…') options: [] #formattedLocales class: 'form-control--small' ) diff --git a/app/assets/javascripts/app/lib/app_post/searchable_select.coffee b/app/assets/javascripts/app/lib/app_post/searchable_select.coffee index 9307739d9..6077db761 100644 --- a/app/assets/javascripts/app/lib/app_post/searchable_select.coffee +++ b/app/assets/javascripts/app/lib/app_post/searchable_select.coffee @@ -41,7 +41,7 @@ class App.SearchableSelect extends Spine.Controller tokens = '' if @attribute.multiple && @attribute.value - object = @attribute.object + relation = @attribute.relation # fallback for if the value is not an array if typeof @attribute.value isnt 'object' @@ -50,8 +50,8 @@ class App.SearchableSelect extends Spine.Controller # create tokens and attribute values values = [] for dataId in @attribute.value - if App[object].exists dataId - name = App[object].find(dataId).displayName() + if App[relation] && App[relation].exists(dataId) + name = App[relation].find(dataId).displayName() value = dataId values.push({name: name, value: value}) tokens += App.view('generic/token')( @@ -160,6 +160,8 @@ class App.SearchableSelect extends Spine.Controller if !@input.val() && !@attribute.multiple @updateAttributeValueName() @input.val(@attribute.valueName) + @input.trigger('change') + @shadowInput.trigger('change') onKeyUp: => return if @input.val().trim() isnt '' || @attribute.multiple @@ -278,9 +280,7 @@ class App.SearchableSelect extends Spine.Controller @addValueToShadowInput(currentText, dataId) else @input.val currentText - @input.trigger('change') @shadowInput.val dataId - @shadowInput.trigger('change') navigateIn: (event) -> event.stopPropagation() diff --git a/app/assets/javascripts/app/lib/app_post/z_searchable_ajax_select.coffee b/app/assets/javascripts/app/lib/app_post/z_searchable_ajax_select.coffee index 4513a0a3d..5b23e8780 100644 --- a/app/assets/javascripts/app/lib/app_post/z_searchable_ajax_select.coffee +++ b/app/assets/javascripts/app/lib/app_post/z_searchable_ajax_select.coffee @@ -10,7 +10,7 @@ class App.SearchableAjaxSelect extends App.SearchableSelect # convert requested object # e.g. Ticket to ticket or AnotherObject to another_object - objectString = underscored(@options.attribute.object) + objectString = underscored(@options.attribute.relation) query = @input.val() diff --git a/app/assets/javascripts/app/models/group.coffee b/app/assets/javascripts/app/models/group.coffee index 9929c8396..063b8c6e7 100644 --- a/app/assets/javascripts/app/models/group.coffee +++ b/app/assets/javascripts/app/models/group.coffee @@ -39,11 +39,11 @@ class App.Group extends App.Model cssClass: cssClass.join(' ') @accesses: -> - read: 'Read' - create: 'Create' - change: 'Change' - overview: 'Overview' - full: 'Full' + read: __('Read') + create: __('Create') + change: __('Change') + overview: __('Overview') + full: __('Full') signature_id_is_display_warning: (signature_id) -> !App.Signature.find(signature_id).active diff --git a/app/assets/javascripts/app/models/macro.coffee b/app/assets/javascripts/app/models/macro.coffee index f1cc1e3c4..77d103611 100644 --- a/app/assets/javascripts/app/models/macro.coffee +++ b/app/assets/javascripts/app/models/macro.coffee @@ -6,7 +6,7 @@ class App.Macro extends App.Model { name: 'name', display: __('Name'), tag: 'input', type: 'text', limit: 100, null: false }, { name: 'perform', display: __('Actions'), tag: 'ticket_perform_action', null: true }, - { name: 'ux_flow_next_up', display: __('Once completed…'), tag: 'select', default: 'none', options: { + { name: 'ux_flow_next_up', display: __('Once completed…'), tag: 'select', default: 'none', translate: true, options: { none: __('Stay on tab'), next_task: __('Close tab'), next_task_on_close: __('Close tab on ticket close'), next_from_overview: __('Advance to next ticket from overview') } }, diff --git a/app/assets/javascripts/app/models/overview.coffee b/app/assets/javascripts/app/models/overview.coffee index 3fa9879be..ab6e6876a 100644 --- a/app/assets/javascripts/app/models/overview.coffee +++ b/app/assets/javascripts/app/models/overview.coffee @@ -35,8 +35,8 @@ class App.Overview extends App.Model null: false translate: true options: - ASC: 'up' - DESC: 'down' + ASC: __('up') + DESC: __('down') }, { name: 'group_by' @@ -61,8 +61,8 @@ class App.Overview extends App.Model null: false translate: true options: - ASC: 'up' - DESC: 'down' + ASC: __('up') + DESC: __('down') }, { name: 'active', display: __('Active'), tag: 'active', default: true }, { name: 'created_by_id', display: __('Created by'), relation: 'User', readonly: 1 }, diff --git a/app/assets/javascripts/app/models/webhook.coffee b/app/assets/javascripts/app/models/webhook.coffee index 42737f5d5..a1cd28c16 100644 --- a/app/assets/javascripts/app/models/webhook.coffee +++ b/app/assets/javascripts/app/models/webhook.coffee @@ -6,7 +6,7 @@ class App.Webhook extends App.Model { name: 'name', display: __('Name'), tag: 'input', type: 'text', limit: 100, null: false }, { name: 'endpoint', display: __('Endpoint'), tag: 'input', type: 'text', limit: 300, null: false, placeholder: 'https://target.example.com/webhook' }, { name: 'signature_token', display: __('HMAC SHA1 Signature Token'), tag: 'input', type: 'text', limit: 100, null: true }, - { name: 'ssl_verify', display: __('SSL Verify'), tag: 'boolean', null: true, options: { true: 'yes', false: 'no' }, default: true }, + { name: 'ssl_verify', display: __('SSL Verify'), tag: 'boolean', null: true, translate: true, options: { true: 'yes', false: 'no' }, default: true }, { name: 'note', display: __('Note'), tag: 'textarea', note: '', limit: 250, null: true }, { name: 'active', display: __('Active'), tag: 'active', default: true }, { name: 'updated_at', display: __('Updated'), tag: 'datetime', readonly: 1 }, diff --git a/app/assets/javascripts/app/views/ticket_zoom/attribute_bar.jst.eco b/app/assets/javascripts/app/views/ticket_zoom/attribute_bar.jst.eco index c7cb66bca..dc86fee81 100644 --- a/app/assets/javascripts/app/views/ticket_zoom/attribute_bar.jst.eco +++ b/app/assets/javascripts/app/views/ticket_zoom/attribute_bar.jst.eco @@ -62,16 +62,13 @@