From 45f56b0d7c8f1a2c543f56c0277bc44d582926b0 Mon Sep 17 00:00:00 2001 From: Rolf Schmidt Date: Thu, 15 Oct 2020 10:58:45 +0200 Subject: [PATCH] Fixes #3214 - link_template for ticket no longer shows a button after update to 3.5. --- .../_application_controller_form.coffee | 4 +++- .../_ui_element/object_manager_attribute.coffee | 9 +++++++++ .../controllers/ticket_zoom/sidebar_ticket.coffee | 2 +- .../app/views/generic/attribute.jst.eco | 6 +++--- app/assets/stylesheets/zammad.scss | 14 +++++++++----- 5 files changed, 25 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_application_controller_form.coffee b/app/assets/javascripts/app/controllers/_application_controller_form.coffee index 522026c97..01ee6f760 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_form.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_form.coffee @@ -366,15 +366,17 @@ class App.ControllerForm extends App.Controller return item else placeholderObjects = {} - if @model.className && @params && !_.isEmpty(attribute.linktemplate) && !_.isEmpty(@params[attribute.name]) + if @model.className && @params && ( attribute.type is 'url' || !_.isEmpty(attribute.linktemplate) ) && !_.isEmpty(@params[attribute.name]) placeholderObjects = { attribute: attribute, session: App.Session.get(), config: App.Config.all() } placeholderObjects[@model.className.toLowerCase()] = @params + fullItem = $( App.view('generic/attribute')( attribute: attribute, item: '', bookmarkable: @bookmarkable placeholderObjects: placeholderObjects + className: @model.className ) ) fullItem.find('.controls').prepend(item) 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 149c78caf..63a49d9b0 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 @@ -210,6 +210,15 @@ class App.UiElement.object_manager_attribute extends App.UiElement.ApplicationUi item.find('.js-inputMaxlength').html(inputMaxlength.form) item.find('.js-inputLinkTemplate').html(inputLinkTemplate.form) + item.find("select[name='data_option::type']").on('change', (e) -> + value = $(e.target).val() + if value is 'url' + item.find('.js-inputLinkTemplate').hide() + else + item.find('.js-inputLinkTemplate').show() + ) + item.find("select[name='data_option::type']").trigger('change') + @datetime: (item, localParams, params) -> configureAttributes = [ { name: 'data_option::future', display: 'Allow future', tag: 'boolean', null: false, default: true }, diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/sidebar_ticket.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/sidebar_ticket.coffee index c06e1fb38..1a0f401ef 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/sidebar_ticket.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/sidebar_ticket.coffee @@ -22,7 +22,7 @@ class Edit extends App.ObserverController @permissionCheck('admin') || ticket.currentView() is 'agent' new App.ControllerForm( elReplace: @el - model: { configure_attributes: @formMeta.configure_attributes || App.Ticket.configure_attributes } + model: { className: 'Ticket', configure_attributes: @formMeta.configure_attributes || App.Ticket.configure_attributes } screen: 'edit' handlersConfig: handlers filter: @formMeta.filter diff --git a/app/assets/javascripts/app/views/generic/attribute.jst.eco b/app/assets/javascripts/app/views/generic/attribute.jst.eco index d039fec18..9cbfa468b 100644 --- a/app/assets/javascripts/app/views/generic/attribute.jst.eco +++ b/app/assets/javascripts/app/views/generic/attribute.jst.eco @@ -20,9 +20,9 @@

<% if @attribute.help: %><%- @T(@attribute.help) %><% end %><%- @attribute.helpLink %>

<% end %> -
- <% if !_.isEmpty(@attribute.linktemplate) && !_.isEmpty(@placeholderObjects): %> - +
+ <% if ( @attribute.type is 'url' || !_.isEmpty(@attribute.linktemplate) ) && !_.isEmpty(@placeholderObjects): %> + <%- @Icon('external') %> <% end %> diff --git a/app/assets/stylesheets/zammad.scss b/app/assets/stylesheets/zammad.scss index 1d22274cf..659a47221 100644 --- a/app/assets/stylesheets/zammad.scss +++ b/app/assets/stylesheets/zammad.scss @@ -2014,6 +2014,10 @@ input[type=url] { min-width: 400px; } +.sidebar-content input[type=url] { + min-width: inherit; +} + .user-select.form-control { padding-right: 35px; min-width: 300px; @@ -9478,7 +9482,7 @@ output { flex-wrap: wrap; padding: 10px; margin-bottom: 17px; - + &.is-inactive { background: none; box-shadow: none; @@ -10069,10 +10073,10 @@ output { .browser { margin: 0 0 20px; position: relative; - + &[data-size] { padding-bottom: 65%; // 16:10 aspect ratio; - + .browser-ratio { width: 100%; height: 100%; @@ -10088,11 +10092,11 @@ output { padding: 0; } } - + &[data-size="mobile"] .browser-ratio { width: 375px; } - + &-ratio { border: 1px solid hsl(0,0%,90%); border-radius: 5px;