Skip to content
This repository has been archived by the owner on Dec 21, 2022. It is now read-only.

Commit

Permalink
Refactor theme selection logic on web ui.
Browse files Browse the repository at this point in the history
  • Loading branch information
emre committed Jun 28, 2016
1 parent 8c156c9 commit 9743af7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion storm/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def backup(target_file, config=None):

@command('web')
@arg('port', nargs='?', default=9002, type=int)
@arg('theme', nargs='?', default="modern")
@arg('theme', nargs='?', default="modern", choices=['modern', 'black', 'storm'])
@arg('debug', action='store_true', default=False)
def web(port, debug=False, theme="modern", ssh_config=None):
"""Starts the web UI."""
Expand Down
5 changes: 2 additions & 3 deletions storm/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@
app = Flask(__name__)
__THEME__ = "modern"


def render(template, theme):
static_dir = os.path.dirname(os.path.abspath(__file__))
path = os.path.join(static_dir, 'templates', template)
with open(path) as fobj:
content = fobj.read()

if 'theme' in request.args:
theme = request.args.get('theme')
content = content.replace('__THEME__', request.args.get('theme', theme))

content = content.replace("__THEME__", theme)
return make_response(content)


Expand Down

0 comments on commit 9743af7

Please sign in to comment.