Improved logo upload.

This commit is contained in:
Martin Edenhofer 2014-11-20 08:44:50 +01:00
parent 9a40983bb1
commit f22386484a
3 changed files with 18 additions and 7 deletions

View file

@ -37,14 +37,20 @@ class App.ImageService
context.drawImage( imageObject, 0, 0, x, y ) context.drawImage( imageObject, 0, 0, x, y )
@canvas @canvas
checkUrl: =>
ignore = /\.svg$/i
ignore.test( @orgDataURL )
toDataURL: (type, quallity = 1) => toDataURL: (type, quallity = 1) =>
#@resize() #@resize()
@canvas.toDataURL( type, quallity ) @canvas.toDataURL( type, quallity )
toDataURLForAvatar: ( x, y ) => toDataURLForAvatar: ( x, y ) =>
return if @checkUrl()
@resize( x * 2, y * 2 ) @resize( x * 2, y * 2 )
@toDataURL( 'image/jpeg', 0.7 ) @toDataURL( 'image/jpeg', 0.7 )
toDataURLForApp: ( x, y ) => toDataURLForApp: ( x, y ) =>
return if @checkUrl()
@resize( x * 2, y * 2 ) @resize( x * 2, y * 2 )
@toDataURL( 'image/png', 0.7 ) @toDataURL( 'image/png', 0.7 )

View file

@ -52,7 +52,16 @@ module StaticAssets
# read image # read image
def self.read def self.read
# use reduced dimensions
list = Store.list( :object => 'System::Logo', :o_id => 2 ) list = Store.list( :object => 'System::Logo', :o_id => 2 )
# as fallback use 1:1
if !list || !list[0]
list = Store.list( :object => 'System::Logo', :o_id => 1 )
end
# store hash in config
if list && list[0] if list && list[0]
file = Store.find( list[0] ) file = Store.find( list[0] )
hash = Digest::MD5.hexdigest( file.content ) hash = Digest::MD5.hexdigest( file.content )

View file

@ -59,13 +59,9 @@ class AaaGettingStartedTest < TestCase
:css => '.js-admin .btn--success', :css => '.js-admin .btn--success',
}, },
{ {
:execute => 'wait', :execute => 'watch_for',
:value => 3, :area => '.js-base h2',
}, :value => 'Organization',
{
:execute => 'check',
:element => :url,
:result => '#getting_started',
}, },
], ],
}, },