Merge branch 'develop' of github.com:martini/zammad into develop

This commit is contained in:
Felix Niklas 2015-08-04 12:43:25 +02:00
commit 7b15f669d4
5 changed files with 59 additions and 34 deletions

View file

@ -2093,6 +2093,9 @@ class App.ControllerForm extends App.Controller
# sort attribute.options # sort attribute.options
_sortOptions: (attribute) -> _sortOptions: (attribute) ->
# skip sorting if it is disabled by config
return if attribute.sortBy == null
return if !attribute.options return if !attribute.options
if _.isArray( attribute.options ) if _.isArray( attribute.options )

View file

@ -114,6 +114,9 @@ class App.Utils
# htmlOnlyWithRichtext = App.Utils.htmlRemoveRichtext( html ) # htmlOnlyWithRichtext = App.Utils.htmlRemoveRichtext( html )
@htmlRemoveRichtext: (html) -> @htmlRemoveRichtext: (html) ->
# remove comments
@_removeComments( html )
# remove style and class # remove style and class
@_removeAttributes( html ) @_removeAttributes( html )
@ -130,6 +133,9 @@ class App.Utils
# cleanHtmlWithRichText = App.Utils.htmlCleanup( html ) # cleanHtmlWithRichText = App.Utils.htmlCleanup( html )
@htmlCleanup: (html) -> @htmlCleanup: (html) ->
# remove comments
@_removeComments( html )
# remove style and class # remove style and class
@_removeAttributes( html ) @_removeAttributes( html )
@ -169,6 +175,13 @@ class App.Utils
.removeAttr( 'title' ) .removeAttr( 'title' )
html html
@_removeComments: (html) ->
html.contents().each( ->
if @nodeType == 8
$(@).remove()
)
html
# signatureNeeded = App.Utils.signatureCheck( message, signature ) # signatureNeeded = App.Utils.signatureCheck( message, signature )
@signatureCheck: (message, signature) -> @signatureCheck: (message, signature) ->
messageText = $( '<div>' + message + '</div>' ).text().trim() messageText = $( '<div>' + message + '</div>' ).text().trim()

View file

@ -15,7 +15,8 @@ load translations from online
=end =end
def self.load def self.load
url = 'https://i18n.zammad.com/api/v1/translations' Locale.where(active: true).each {|locale|
url = "https://i18n.zammad.com/api/v1/translations/#{locale.locale}"
if !UserInfo.current_user_id if !UserInfo.current_user_id
UserInfo.current_user_id = 1 UserInfo.current_user_id = 1
end end
@ -49,6 +50,7 @@ load translations from online
end end
} }
end end
}
true true
end end

View file

@ -56,7 +56,7 @@ returns
=begin =begin
find organization image suggestion find organization image suggestion and store it as app logo
result = Service::Image.organization_suggest('edenhofer.de') result = Service::Image.organization_suggest('edenhofer.de')
@ -72,7 +72,14 @@ returns
backend = load_adapter_by_setting( 'image_backend' ) backend = load_adapter_by_setting( 'image_backend' )
return if !backend return if !backend
backend.organization_suggest(domain) result = backend.organization_suggest(domain)
# sync logo to assets folder
if result
StaticAssets.sync
end
result
end end
end end

View file

@ -256,7 +256,7 @@ test( "htmlRemoveTags", function() {
// htmlRemoveRichtext // htmlRemoveRichtext
test( "htmlRemoveRichtext", function() { test( "htmlRemoveRichtext", function() {
var source = "<div><a href=\"test\">test</a></div>" var source = "<div><!--test comment--><a href=\"test\">test</a></div>"
var should = "test" var should = "test"
var result = App.Utils.htmlRemoveRichtext( $(source) ) var result = App.Utils.htmlRemoveRichtext( $(source) )
equal( result.html(), should, source ) equal( result.html(), should, source )
@ -330,7 +330,7 @@ test( "htmlRemoveRichtext", function() {
// htmlCleanup // htmlCleanup
test( "htmlCleanup", function() { test( "htmlCleanup", function() {
var source = "<div><a href=\"test\">test</a></div>" var source = "<div><!--test comment--><a href=\"test\">test</a></div>"
var should = "test" var should = "test"
var result = App.Utils.htmlCleanup( $(source) ) var result = App.Utils.htmlCleanup( $(source) )
equal( result.html(), should, source ) equal( result.html(), should, source )