Fixes #3214 - link_template for ticket no longer shows a button after update to 3.5.

This commit is contained in:
Rolf Schmidt 2020-10-15 10:58:45 +02:00 committed by Martin Edenhofer
parent 835787ee69
commit 45f56b0d7c
5 changed files with 25 additions and 10 deletions

View file

@ -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)

View file

@ -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 },

View file

@ -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

View file

@ -20,9 +20,9 @@
</h2>
<p class="help-text"><% if @attribute.help: %><%- @T(@attribute.help) %><% end %><%- @attribute.helpLink %></p>
<% end %>
<div class="controls <% if !_.isEmpty(@attribute.linktemplate) && !_.isEmpty(@placeholderObjects): %>controls--button<% end %>">
<% if !_.isEmpty(@attribute.linktemplate) && !_.isEmpty(@placeholderObjects): %>
<a href="<%- @replacePlaceholder(@attribute.linktemplate, @placeholderObjects, true) %>" class="controls-button" target="_blank" rel="nofollow">
<div class="controls <% if ( @attribute.type is 'url' || !_.isEmpty(@attribute.linktemplate) ) && !_.isEmpty(@placeholderObjects): %>controls-button<% end %>">
<% if ( @attribute.type is 'url' || !_.isEmpty(@attribute.linktemplate) ) && !_.isEmpty(@placeholderObjects): %>
<a href="<% if @attribute.type is 'url': %><%= @placeholderObjects[@className.toLowerCase()][@attribute.name] %><% else: %><%- @replacePlaceholder(@attribute.linktemplate, @placeholderObjects, true) %><% end %>" class="controls-button" target="_blank" rel="nofollow">
<span class="controls-button-inner"><%- @Icon('external') %></span>
</a>
<% end %>

View file

@ -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;