forked from platypush/platypush
Handling dashboards widget configuration as a list instead of a hash to preserve the order of the widgets
This commit is contained in:
parent
339d1eb132
commit
7a80cd08ce
2 changed files with 15 additions and 10 deletions
|
@ -103,17 +103,22 @@ class HttpBackend(Backend):
|
||||||
dashboard:
|
dashboard:
|
||||||
background_image: https://site/image.png
|
background_image: https://site/image.png
|
||||||
widgets: # Each row of the dashboard will have 6 columns
|
widgets: # Each row of the dashboard will have 6 columns
|
||||||
calendar: # Calendar widget
|
-
|
||||||
|
widget: calendar # Calendar widget
|
||||||
columns: 6
|
columns: 6
|
||||||
music: # Music widget
|
-
|
||||||
|
widget: music # Music widget
|
||||||
columns: 3
|
columns: 3
|
||||||
date-time-weather: # Date, time and weather widget
|
-
|
||||||
|
widget: date-time-weather # Date, time and weather widget
|
||||||
columns: 3
|
columns: 3
|
||||||
image-carousel: # Image carousel
|
-
|
||||||
|
widget: image-carousel # Image carousel
|
||||||
columns: 6
|
columns: 6
|
||||||
images_path: ~/Dropbox/Photos/carousel # Absolute path (valid as long as it's a subdirectory of one of the available `resource_dirs`)
|
images_path: ~/Dropbox/Photos/carousel # Absolute path (valid as long as it's a subdirectory of one of the available `resource_dirs`)
|
||||||
refresh_seconds: 15
|
refresh_seconds: 15
|
||||||
rss-news: # RSS feeds widget
|
-
|
||||||
|
widget: rss-news # RSS feeds widget
|
||||||
# Requires backend.http.poll to be enabled with some RSS sources and write them to sqlite db
|
# Requires backend.http.poll to be enabled with some RSS sources and write them to sqlite db
|
||||||
columns: 6
|
columns: 6
|
||||||
limit: 25
|
limit: 25
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
window.config = {{ config | safe }};
|
window.config = {{ config | safe }};
|
||||||
window.widgets = {{ config['widgets'] | safe }};
|
window.widgets = {{ config['widgets'] | safe }}.reduce(function(map, w) { map[w.widget] = w; return map }, {})
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
@ -44,16 +44,16 @@
|
||||||
|
|
||||||
<div id="widgets-container">
|
<div id="widgets-container">
|
||||||
{% set used_columns = [0] %}
|
{% set used_columns = [0] %}
|
||||||
{% for widget_name, widget in config['widgets'].items() %}
|
{% for widget in config['widgets'] %}
|
||||||
{% if used_columns[0] % 12 == 0 %}
|
{% if used_columns[0] % 12 == 0 %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="widget {% print(utils.widget_columns_to_html_class(widget['columns'])) %}
|
<div class="widget {% print(utils.widget_columns_to_html_class(widget['columns'])) %}
|
||||||
{% print(widget_name) %}"
|
{% print(widget['widget']) %}"
|
||||||
id="{% print(widget['id'] if 'id' in widget else widget_name) %}">
|
id="{% print(widget['id'] if 'id' in widget else widget['widget']) %}">
|
||||||
{% with properties=widget %}
|
{% with properties=widget %}
|
||||||
{% include 'widgets/' + widget_name + '.html' %}
|
{% include 'widgets/' + widget['widget'] + '.html' %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue