Modify font awesome navbar menu logo's and remove default config file

This commit is contained in:
wez3 2017-01-07 00:06:48 +01:00
parent 0b322dc131
commit c585648d80
3 changed files with 20 additions and 32 deletions

View File

@ -11,34 +11,19 @@
time = False # True/False: show time in top bar
google_maps_api_key = X # Google Maps Embed API key
# Add Navbar items here
# Add Navbar items here. The key is the navbar link name. The first value is the URI name, second value can be any font awesome logo to be displayed.
[navbar]
[[menu]]
Dashboard = dashboard
Woonkamer = woonkamer
Slaapkamer = slaapkamer
Badkamer = badkamer
Auto = auto
Tuin = tuin
Security = security
Verkeer = verkeer
Flitsers = flitsers
Statistics = statistics
Server = server
Instellingen = instellingen
[[icons]]
dashboard = dashboard
woonkamer = home
slaapkamer = bed
badkamer = bath
auto = automobile
tuin = bug
security = shield
verkeer = road
flitsers = camera
statistics = line-chart
server = desktop
instellingen = wrench
Dashboard = dashboard, dashboard
Woonkamer = woonkamer, home
Slaapkamer = slaapkamer, bed
Werkkamer = werkkamer, home
Auto = auto, automobile
Tuin = tuin, bug
Verkeer = verkeer, road
Flitsers = flitsers, camera
Server = server, desktop
Instellingen = instellingen, wrench
# Each navbar item needs a section. Components specify which components are displayed on the page. Other subsections contain names, Domoticz IDX's and options of the components displayed.
[dashboard]

View File

@ -8,9 +8,6 @@ import hashlib, configobj, json, sys, os
import modules.api as api
import modules.security as security
# Modify config file name:
configfile = "example.conf"
app = Flask(__name__)
@app.before_request
@ -32,7 +29,6 @@ def generatePage():
blockArray = []
configValues = {}
configValues["navbar"] = config["navbar"]["menu"]
configValues["navbar_icons"] = config["navbar"]["icons"]
configValues["server_location"] = config["general_settings"]["server"].get("url")
configValues["flask_server_location"] = config["general_settings"]["server"].get("flask_url")
configValues["domoboard"] = config["general_settings"]["domoboard"]
@ -141,6 +137,8 @@ if __name__ == '__main__':
args = parser.parse_args()
if args.configfile:
configfile = args.configfile
else:
sys.exit("Please specify a config file with the -c parameter.")
if os.path.isfile(configfile):
unsanitizedConfig = configobj.ConfigObj(configfile)
else:
@ -161,7 +159,8 @@ if __name__ == '__main__':
app.secret_key = config["general_settings"]["server"]["secret_key"]
app.add_url_rule('/', 'index', index)
for k, v in config["navbar"]["menu"].iteritems():
app.add_url_rule('/' + v.lower(), v.lower(), generatePage, methods=['GET'])
v = strToList(v)
app.add_url_rule('/' + v[0].lower(), v[0].lower(), generatePage, methods=['GET'])
app.add_url_rule('/settings', 'settings', generatePage, methods=['GET'])
app.add_url_rule('/log', 'log', generatePage, methods=['GET'])
app.add_url_rule('/logout/', 'logout', logout_view, methods=['GET'])

View File

@ -20,7 +20,11 @@
<div class="menu_section">
<ul class="nav side-menu">
{% for k, v in configValues["navbar"].iteritems() %}
<li><a href="{{v}}"><i class="fa fa-{{configValues["navbar_icons"][v]}} fa-fw" aria-hidden="true"></i>{{k}}</a></li>
{% if v is not string %}
<li><a href="{{v[0]}}"> <i class="fa fa-{{v[1]}} fa-fw" aria-hidden="true"></i> {{k}}</a></li>
{% else %}
<li><a href="{{v}}">{{k}}</a></li>
{% endif %}
{% endfor %}
</ul>