|
|
@ -138,7 +138,7 @@ def RenderDistribusiTemplate(current_distribusi): |
|
|
|
def RenderEditorTemplate(editorform, current_distribusi): |
|
|
|
htmlplaceholder = HtmlPlaceholder() |
|
|
|
|
|
|
|
cssplaceholder = CssPlaceholder() |
|
|
|
cssplaceholder = CssPlaceholder(current_distribusi) |
|
|
|
editorform.css.data = cssplaceholder |
|
|
|
|
|
|
|
files_uploaded = IsZipUploaded(current_distribusi) |
|
|
@ -153,8 +153,14 @@ def RenderEditorTemplate(editorform, current_distribusi): |
|
|
|
return template |
|
|
|
|
|
|
|
|
|
|
|
def CssPlaceholder(): |
|
|
|
def CssPlaceholder(current_distribusi): |
|
|
|
cssplaceholder = "Try out your CSS here" |
|
|
|
distribusi = Distribusis.query.filter_by( |
|
|
|
distribusiname=current_distribusi |
|
|
|
).first() |
|
|
|
if distribusi is not None: |
|
|
|
cssplaceholder = GetPublicCssFile(distribusi) |
|
|
|
else: |
|
|
|
with open("themes/editor/placeholder.css") as f: |
|
|
|
cssplaceholder = f.read() |
|
|
|
return cssplaceholder |
|
|
@ -165,3 +171,16 @@ def HtmlPlaceholder(): |
|
|
|
with open("themes/editor/placeholder.html") as f: |
|
|
|
htmlplaceholder = f.read() |
|
|
|
return htmlplaceholder |
|
|
|
|
|
|
|
|
|
|
|
def GetPublicCssFile(distribusi): |
|
|
|
cssplaceholder = "" |
|
|
|
publicthemefolder = os.path.join( |
|
|
|
"themes/publicthemes", distribusi.distribusiname |
|
|
|
) |
|
|
|
for filename in os.listdir(publicthemefolder): |
|
|
|
if filename.endswith(".css"): |
|
|
|
cssfile = os.path.join(publicthemefolder, filename) |
|
|
|
with open(cssfile) as f: |
|
|
|
cssplaceholder = f.read() |
|
|
|
return cssplaceholder |
|
|
|