|
|
@ -84,9 +84,10 @@ class ThemeStudio(http.Controller): |
|
|
|
def save_styles(self, changed_styles, object_class, hover=False): |
|
|
|
"""Create Dynamic Styles css file""" |
|
|
|
changed_styles = json.loads(changed_styles) |
|
|
|
working_dir = os.path.dirname(os.path.realpath(__file__)) |
|
|
|
working_dir = working_dir.replace('/controllers', '') |
|
|
|
file_path = working_dir + '/static/src/css/dynamic_styles.css' |
|
|
|
file_path = get_module_resource( |
|
|
|
'backend_theme_infinito', |
|
|
|
'static', 'src', 'css', 'dynamic_styles.css' |
|
|
|
) |
|
|
|
style_file = open(file_path, 'a') |
|
|
|
if os.stat(file_path).st_size == 0: |
|
|
|
style_file.write('/* This file is generated automatically by ' |
|
|
@ -104,9 +105,10 @@ class ThemeStudio(http.Controller): |
|
|
|
|
|
|
|
@http.route(['/theme_studio/get_current_style'], type="json") |
|
|
|
def get_current_style(self, selector): |
|
|
|
working_dir = os.path.dirname(os.path.realpath(__file__)) |
|
|
|
file_path = working_dir.replace('controllers', |
|
|
|
'static/src/css/dynamic_styles.css') |
|
|
|
file_path = get_module_resource( |
|
|
|
'backend_theme_infinito', |
|
|
|
'static', 'src', 'css', 'dynamic_styles.css' |
|
|
|
) |
|
|
|
style_file = open(file_path, 'r') |
|
|
|
css = style_file.read() |
|
|
|
css = re.sub(r'/\*[\s\S]*?\*/', "", css) |
|
|
@ -132,9 +134,10 @@ class ThemeStudio(http.Controller): |
|
|
|
|
|
|
|
@http.route(['/theme_studio/reset_to_default'], type="json") |
|
|
|
def reset_to_default(self): |
|
|
|
working_dir = os.path.dirname(os.path.realpath(__file__)) |
|
|
|
file_path = working_dir.replace('controllers', |
|
|
|
'static/src/css/dynamic_styles.css') |
|
|
|
file_path = get_module_resource( |
|
|
|
'backend_theme_infinito', |
|
|
|
'static', 'src', 'css', 'dynamic_styles.css' |
|
|
|
) |
|
|
|
style_file = open(file_path, 'w') |
|
|
|
style_file.write('') |
|
|
|
return True |
|
|
|