Make common
inheritence unconditional and simplify theming code
This commit is contained in:
parent
dee57982f1
commit
93cdc66e64
1 changed files with 2 additions and 8 deletions
|
@ -24,7 +24,6 @@ module ThemingConcern
|
||||||
|
|
||||||
def nil_pack(data)
|
def nil_pack(data)
|
||||||
{
|
{
|
||||||
use_common: true,
|
|
||||||
flavour: data['name'],
|
flavour: data['name'],
|
||||||
pack: nil,
|
pack: nil,
|
||||||
preload: nil,
|
preload: nil,
|
||||||
|
@ -35,7 +34,6 @@ module ThemingConcern
|
||||||
|
|
||||||
def pack(data, pack_name, skin)
|
def pack(data, pack_name, skin)
|
||||||
pack_data = {
|
pack_data = {
|
||||||
use_common: true,
|
|
||||||
flavour: data['name'],
|
flavour: data['name'],
|
||||||
pack: pack_name,
|
pack: pack_name,
|
||||||
preload: nil,
|
preload: nil,
|
||||||
|
@ -45,7 +43,6 @@ module ThemingConcern
|
||||||
|
|
||||||
return pack_data unless data['pack'][pack_name].is_a?(Hash)
|
return pack_data unless data['pack'][pack_name].is_a?(Hash)
|
||||||
|
|
||||||
pack_data[:use_common] = false if data['pack'][pack_name]['use_common'] == false
|
|
||||||
pack_data[:pack] = nil unless data['pack'][pack_name]['filename']
|
pack_data[:pack] = nil unless data['pack'][pack_name]['filename']
|
||||||
|
|
||||||
preloads = data['pack'][pack_name]['preload']
|
preloads = data['pack'][pack_name]['preload']
|
||||||
|
@ -62,15 +59,12 @@ module ThemingConcern
|
||||||
end
|
end
|
||||||
|
|
||||||
def resolve_pack(data, pack_name, skin)
|
def resolve_pack(data, pack_name, skin)
|
||||||
return pack(data, pack_name, skin) if valid_pack_data?(data, pack_name)
|
pack(data, pack_name, skin) if valid_pack_data?(data, pack_name)
|
||||||
return if data['name'].blank?
|
|
||||||
|
|
||||||
nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def resolve_pack_with_common(data, pack_name, skin = 'default')
|
def resolve_pack_with_common(data, pack_name, skin = 'default')
|
||||||
result = resolve_pack(data, pack_name, skin) || nil_pack(data)
|
result = resolve_pack(data, pack_name, skin) || nil_pack(data)
|
||||||
result[:common] = resolve_pack(data, 'common', skin) if result.delete(:use_common)
|
result[:common] = resolve_pack(data, 'common', skin)
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue