Added html quoting, text2html and linkify.

This commit is contained in:
Martin Edenhofer 2015-01-02 11:31:52 +01:00
parent 69420df8a5
commit 3a44804c96
3 changed files with 66 additions and 44 deletions

View file

@ -489,15 +489,15 @@ class App.ControllerModal extends App.Controller
@button = 'Submit'
@html App.view('modal')
head: @head
message: @message
detail: @detail
close: @close
cancel: @cancel
button: @button
buttonClass: @buttonClass
centerButtons:@centerButtons
content: content
head: @head
message: @message
detail: @detail
close: @close
cancel: @cancel
button: @button
buttonClass: @buttonClass
centerButtons: @centerButtons
content: content
if @content
@body.html @content
@ -507,8 +507,8 @@ class App.ControllerModal extends App.Controller
show: true
backdrop: @backdrop
.on
'show.bs.modal': @onShow
'shown.bs.modal': @onShown
'show.bs.modal': @onShow
'shown.bs.modal': @onShown
'hidden.bs.modal': =>
@onHide()
# remove modal from dom
@ -543,7 +543,7 @@ class App.ErrorModal extends App.ControllerModal
class App.SessionMessage extends App.ControllerModal
constructor: ->
super
@show()
@show(@content)
# reload page on modal hidden
onHide: (e) =>

View file

@ -16,9 +16,13 @@ class Widget extends App.Controller
@disconnectClient()
button = 'Reload application'
# convert to html and linkify
message.message = App.Utils.textCleanup( message.message )
message.message = App.Utils.text2html( message.message )
new App.SessionMessage(
head: message.head
message: message.message
content: message.message
keyboard: true
backdrop: true
close: true

View file

@ -3,8 +3,12 @@ require 'browser_test_helper'
class MaintenanceMessageTest < TestCase
def test_websocket
message = 'message 1äöüß ' + rand(99999999999999999).to_s
tests = [
string = rand(99999999999999999).to_s
title_html = "test <b>#{string}</b>"
title_text = "test <b>#{string}<\/b>"
message_html = "message <b>1äöüß</b> #{string}\n\n\nhttp://zammad.org"
message_text = "message <b>1äöüß<\/b> #{string}\n\nhttp:\/\/zammad.org"
tests = [
{
:name => 'check #1',
:instance1 => browser_instance,
@ -33,13 +37,13 @@ class MaintenanceMessageTest < TestCase
:where => :instance1,
:execute => 'set',
:css => '#content input[name="head"]',
:value => message,
:value => title_html,
},
{
:where => :instance1,
:execute => 'set',
:css => '#content textarea[name="message"]',
:value => message,
:value => message_html,
},
{
:where => :instance1,
@ -50,19 +54,25 @@ class MaintenanceMessageTest < TestCase
:execute => 'wait',
:value => 5,
},
{
:where => :instance2,
:execute => 'watch_for',
:area => '.modal',
:value => title_text,
},
{
:where => :instance2,
:execute => 'watch_for',
:area => '.modal',
:value => message_text,
},
{
:where => :instance1,
:execute => 'match',
:css => 'body',
:value => message,
:value => message_text,
:match_result => false,
},
{
:where => :instance2,
:execute => 'watch_for',
:area => '.modal',
:value => message,
},
{
:where => :instance2,
:execute => 'click',
@ -91,13 +101,13 @@ class MaintenanceMessageTest < TestCase
:where => :instance1,
:execute => 'set',
:css => '#content input[name="head"]',
:value => message + ' #2',
:value => title_html + ' #2',
},
{
:where => :instance1,
:execute => 'set',
:css => '#content textarea[name="message"]',
:value => message + ' #2',
:value => message_html + ' #2',
},
{
:where => :instance1,
@ -105,22 +115,24 @@ class MaintenanceMessageTest < TestCase
:css => '#content button[type="submit"]',
},
{
:execute => 'wait',
:value => 5,
:where => :instance2,
:execute => 'watch_for',
:area => '.modal',
:value => title_text,
},
{
:where => :instance2,
:execute => 'watch_for',
:area => '.modal',
:value => message_text + ' #2',
},
{
:where => :instance1,
:execute => 'match',
:css => 'body',
:value => message + ' #2',
:value => message_text + ' #2',
:match_result => false,
},
{
:where => :instance2,
:execute => 'watch_for',
:area => '.modal',
:value => message + ' #2',
},
{
:where => :instance2,
:execute => 'click',
@ -149,13 +161,13 @@ class MaintenanceMessageTest < TestCase
:where => :instance1,
:execute => 'set',
:css => '#content input[name="head"]',
:value => message + ' #3' ,
:value => title_html + ' #3' ,
},
{
:where => :instance1,
:execute => 'set',
:css => '#content textarea[name="message"]',
:value => message + ' #3',
:value => message_html + ' #3',
},
{
:where => :instance1,
@ -178,17 +190,23 @@ class MaintenanceMessageTest < TestCase
:result => false,
},
{
:where => :instance1,
:execute => 'match',
:css => 'body',
:value => message + ' #3',
:match_result => false,
:where => :instance2,
:execute => 'watch_for',
:area => '.modal',
:value => title_text,
},
{
:where => :instance2,
:execute => 'watch_for',
:area => '.modal',
:value => message + ' #3',
:value => message_text + ' #3',
},
{
:where => :instance1,
:execute => 'match',
:css => 'body',
:value => message_text + ' #3',
:match_result => false,
},
{
:where => :instance2,
@ -201,4 +219,4 @@ class MaintenanceMessageTest < TestCase
]
browser_double_test(tests)
end
end
end