diff --git a/app/assets/javascripts/app/index.coffee b/app/assets/javascripts/app/index.coffee index 3dab442df..73246f81f 100644 --- a/app/assets/javascripts/app/index.coffee +++ b/app/assets/javascripts/app/index.coffee @@ -115,8 +115,8 @@ class App extends Spine.Controller isHtmlEscape = true resultLocal = App.i18n.translateDate(resultLocal) - linktemplate = @_placeholderReplacement(object, attributeConfig, resultLocal) - if linktemplate && isHtmlEscape is false + linktemplate = @_placeholderReplacement(object, attributeConfig, resultLocal, isHtmlEscape) + if linktemplate resultLocal = linktemplate isHtmlEscape = true @@ -152,7 +152,7 @@ class App extends Spine.Controller result - @_placeholderReplacement: (object, attributeConfig, resultLocal) -> + @_placeholderReplacement: (object, attributeConfig, resultLocal, isHtmlEscape) -> return if !object return if !attributeConfig return if _.isEmpty(attributeConfig.linktemplate) @@ -161,7 +161,12 @@ class App extends Spine.Controller return if _.isEmpty(object[attributeConfig.name]) placeholderObjects = { attribute: attributeConfig, session: App.Session.get(), config: App.Config.all() } placeholderObjects[object.constructor.className.toLowerCase()] = object - "#{App.i18n.translateInline(resultLocal)}" + + value = resultLocal + if !isHtmlEscape + value = App.Utils.htmlEscape(value) + + "#{value}" @view: (name) -> template = (params = {}) -> diff --git a/public/assets/tests/model_ui.js b/public/assets/tests/model_ui.js index bbb463327..49d428618 100644 --- a/public/assets/tests/model_ui.js +++ b/public/assets/tests/model_ui.js @@ -27,6 +27,14 @@ test( "model ui basic tests", function() { name: 'textarea', display: 'textarea 1', tag: 'textarea', null: true }; App.Ticket.configure_attributes.push( attribute2 ) + var attribute3 = { + name: 'link1', display: 'link 1', linktemplate: 'http://zammad.com', tag: 'input', null: true, translate: true + }; + App.Ticket.configure_attributes.push( attribute3 ) + var attribute4 = { + name: 'link2', display: 'link 1', linktemplate: 'http://zammad.com', tag: 'input', null: true + }; + App.Ticket.configure_attributes.push( attribute4 ) var ticket = new App.Ticket() ticket.load({ @@ -35,7 +43,9 @@ test( "model ui basic tests", function() { state_id: 2, updated_at: '2014-11-07T23:43:08.000Z', date: '2015-02-07', - textarea: "some new\nline" + textarea: "some new\nline", + link1: 'closed', + link2: 'closed', }) App.i18n.set('en-us') @@ -47,6 +57,8 @@ test( "model ui basic tests", function() { equal( App.viewPrint( ticket, 'updated_at' ), '') equal( App.viewPrint( ticket, 'date' ), '02/07/2015') equal( App.viewPrint( ticket, 'textarea' ), '
some new
line
') + equal( App.viewPrint( ticket, 'link1' ), 'closed') + equal( App.viewPrint( ticket, 'link2' ), 'closed') App.i18n.set('de-de') @@ -58,6 +70,8 @@ test( "model ui basic tests", function() { equal( App.viewPrint( ticket, 'updated_at' ), '') equal( App.viewPrint( ticket, 'date' ), '07.02.2015') equal( App.viewPrint( ticket, 'textarea' ), '
some new
line
') + equal( App.viewPrint( ticket, 'link1' ), 'geschlossen') + equal( App.viewPrint( ticket, 'link2' ), 'closed') App.i18n.set('en-us')