fix grid composition
This commit is contained in:
parent
6306a88e55
commit
a121a9b7c3
@ -282,6 +282,7 @@ jQuery(document).ready(function ($) {
|
|||||||
if (elements.length < 4) {
|
if (elements.length < 4) {
|
||||||
while (elements.length < 4) {
|
while (elements.length < 4) {
|
||||||
createElement();
|
createElement();
|
||||||
|
elements = $('.element');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -212,7 +212,7 @@ class ContentManager(ModelManager):
|
|||||||
content.location = object_path
|
content.location = object_path
|
||||||
self.set_metadata(content)
|
self.set_metadata(content)
|
||||||
else:
|
else:
|
||||||
content.location = location if location else ContentType.get_empty_location(content.type)
|
content.location = ContentType.get_initial_location(content.type, location)
|
||||||
|
|
||||||
self.add_form(content)
|
self.add_form(content)
|
||||||
return self.get_one_by(query="uuid = '{}'".format(content.uuid))
|
return self.get_one_by(query="uuid = '{}'".format(content.uuid))
|
||||||
|
|||||||
@ -68,7 +68,7 @@ class ContentType(Enum):
|
|||||||
elif value == ContentType.COMPOSITION:
|
elif value == ContentType.COMPOSITION:
|
||||||
return ContentInputType.HIDDEN
|
return ContentInputType.HIDDEN
|
||||||
elif value == ContentType.TEXT:
|
elif value == ContentType.TEXT:
|
||||||
return ContentInputType.HIDDEN
|
return ContentInputType.TEXT
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_fa_icon(value: Union[Enum, str]) -> str:
|
def get_fa_icon(value: Union[Enum, str]) -> str:
|
||||||
@ -115,21 +115,21 @@ class ContentType(Enum):
|
|||||||
return 'neutral'
|
return 'neutral'
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_empty_location(value: Enum) -> str:
|
def get_initial_location(value: Enum, location: Optional[str] = None) -> str:
|
||||||
if isinstance(value, str):
|
if isinstance(value, str):
|
||||||
value = str_to_enum(value, ContentType)
|
value = str_to_enum(value, ContentType)
|
||||||
|
|
||||||
if value == ContentType.COMPOSITION:
|
if value == ContentType.COMPOSITION:
|
||||||
return json.dumps({
|
return json.dumps({
|
||||||
"ratio": '16/9',
|
"ratio": location if location else '16/9',
|
||||||
"layers": {}
|
"layers": {}
|
||||||
})
|
})
|
||||||
elif value == ContentType.TEXT:
|
elif value == ContentType.TEXT:
|
||||||
return json.dumps({
|
return json.dumps({
|
||||||
"text": 'Hello',
|
"textLabel": location if location else 'Hello',
|
||||||
"fontSize": 12,
|
"fontSize": 12,
|
||||||
"color": '#FFFFFF',
|
"color": '#FFFFFF',
|
||||||
"backgroundColor": '#000000',
|
"backgroundColor": '#000000',
|
||||||
})
|
})
|
||||||
|
|
||||||
return ''
|
return location
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user