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 return item
else else
placeholderObjects = {} 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 = { attribute: attribute, session: App.Session.get(), config: App.Config.all() }
placeholderObjects[@model.className.toLowerCase()] = @params placeholderObjects[@model.className.toLowerCase()] = @params
fullItem = $( fullItem = $(
App.view('generic/attribute')( App.view('generic/attribute')(
attribute: attribute, attribute: attribute,
item: '', item: '',
bookmarkable: @bookmarkable bookmarkable: @bookmarkable
placeholderObjects: placeholderObjects placeholderObjects: placeholderObjects
className: @model.className
) )
) )
fullItem.find('.controls').prepend(item) 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-inputMaxlength').html(inputMaxlength.form)
item.find('.js-inputLinkTemplate').html(inputLinkTemplate.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) -> @datetime: (item, localParams, params) ->
configureAttributes = [ configureAttributes = [
{ name: 'data_option::future', display: 'Allow future', tag: 'boolean', null: false, default: true }, { 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' @permissionCheck('admin') || ticket.currentView() is 'agent'
new App.ControllerForm( new App.ControllerForm(
elReplace: @el 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' screen: 'edit'
handlersConfig: handlers handlersConfig: handlers
filter: @formMeta.filter filter: @formMeta.filter

View file

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

View file

@ -2014,6 +2014,10 @@ input[type=url] {
min-width: 400px; min-width: 400px;
} }
.sidebar-content input[type=url] {
min-width: inherit;
}
.user-select.form-control { .user-select.form-control {
padding-right: 35px; padding-right: 35px;
min-width: 300px; min-width: 300px;
@ -9478,7 +9482,7 @@ output {
flex-wrap: wrap; flex-wrap: wrap;
padding: 10px; padding: 10px;
margin-bottom: 17px; margin-bottom: 17px;
&.is-inactive { &.is-inactive {
background: none; background: none;
box-shadow: none; box-shadow: none;
@ -10069,10 +10073,10 @@ output {
.browser { .browser {
margin: 0 0 20px; margin: 0 0 20px;
position: relative; position: relative;
&[data-size] { &[data-size] {
padding-bottom: 65%; // 16:10 aspect ratio; padding-bottom: 65%; // 16:10 aspect ratio;
.browser-ratio { .browser-ratio {
width: 100%; width: 100%;
height: 100%; height: 100%;
@ -10088,11 +10092,11 @@ output {
padding: 0; padding: 0;
} }
} }
&[data-size="mobile"] .browser-ratio { &[data-size="mobile"] .browser-ratio {
width: 375px; width: 375px;
} }
&-ratio { &-ratio {
border: 1px solid hsl(0,0%,90%); border: 1px solid hsl(0,0%,90%);
border-radius: 5px; border-radius: 5px;