Improved logo upload.
This commit is contained in:
parent
9a40983bb1
commit
f22386484a
3 changed files with 18 additions and 7 deletions
|
@ -37,14 +37,20 @@ class App.ImageService
|
|||
context.drawImage( imageObject, 0, 0, x, y )
|
||||
@canvas
|
||||
|
||||
checkUrl: =>
|
||||
ignore = /\.svg$/i
|
||||
ignore.test( @orgDataURL )
|
||||
|
||||
toDataURL: (type, quallity = 1) =>
|
||||
#@resize()
|
||||
@canvas.toDataURL( type, quallity )
|
||||
|
||||
toDataURLForAvatar: ( x, y ) =>
|
||||
return if @checkUrl()
|
||||
@resize( x * 2, y * 2 )
|
||||
@toDataURL( 'image/jpeg', 0.7 )
|
||||
|
||||
toDataURLForApp: ( x, y ) =>
|
||||
return if @checkUrl()
|
||||
@resize( x * 2, y * 2 )
|
||||
@toDataURL( 'image/png', 0.7 )
|
||||
|
|
|
@ -52,7 +52,16 @@ module StaticAssets
|
|||
|
||||
# read image
|
||||
def self.read
|
||||
|
||||
# use reduced dimensions
|
||||
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]
|
||||
file = Store.find( list[0] )
|
||||
hash = Digest::MD5.hexdigest( file.content )
|
||||
|
|
|
@ -59,13 +59,9 @@ class AaaGettingStartedTest < TestCase
|
|||
:css => '.js-admin .btn--success',
|
||||
},
|
||||
{
|
||||
:execute => 'wait',
|
||||
:value => 3,
|
||||
},
|
||||
{
|
||||
:execute => 'check',
|
||||
:element => :url,
|
||||
:result => '#getting_started',
|
||||
:execute => 'watch_for',
|
||||
:area => '.js-base h2',
|
||||
:value => 'Organization',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue