Ross Mountjoy ff6b2372b3 - reduced the size of app cards, moving description to a pop-open
- broke up config readme into 3 tabs, and 3 .md files
- changed 'app templates' to 'card templates'
- added 'collection' cards
- added 'custom' cards
- added options for setting tag icons and sort position
- removed list view to focus on different card types on /home
- added ability to collapse/expand tags on /home
- added setting for having tags default to collapsed state
- added settings for the default state of the sidebar
- created a public user view with no sidebar
- added sidebar default overrides for users
2020-03-27 08:58:11 -04:00

57 lines
1.5 KiB
Python

import os
import importlib
from markdown2 import markdown
from dashmachine.paths import (
backgrounds_images_folder,
icons_images_folder,
root_folder,
platform_folder,
)
from flask import render_template
def load_files_html():
backgrounds = os.listdir(backgrounds_images_folder)
icons = os.listdir(icons_images_folder)
return render_template(
"settings_system/files.html", backgrounds=backgrounds, icons=icons,
)
def convert_html_to_md(md):
html = markdown(
md,
extras=[
"tables",
"fenced-code-blocks",
"break-on-newline",
"header-ids",
"code-friendly",
],
)
return html
def get_config_html():
with open(os.path.join(root_folder, "readme_settings.md")) as readme_file:
md = readme_file.read()
html = {"settings": convert_html_to_md(md)}
with open(os.path.join(root_folder, "readme_cards.md")) as readme_file:
md = readme_file.read()
html["cards"] = convert_html_to_md(md)
with open(os.path.join(root_folder, "readme_data_sources.md")) as readme_file:
md = readme_file.read()
platforms = os.listdir(platform_folder)
platforms = sorted(platforms)
for platform in platforms:
name, extension = os.path.splitext(platform)
if extension.lower() == ".py":
module = importlib.import_module(f"dashmachine.platform.{name}", ".")
if module.__doc__:
md += module.__doc__
html["data_sources"] = convert_html_to_md(md)
return html