diff --git a/dashmachine/main/read_config.py b/dashmachine/main/read_config.py index d1caca8..276835d 100644 --- a/dashmachine/main/read_config.py +++ b/dashmachine/main/read_config.py @@ -187,14 +187,15 @@ def create_settings(config): settings.tags_expanded = config["Settings"].get("tags_expanded", "True") settings.tags = config["Settings"].get("tags", None) - error = validate_json_csv(settings.tags) - if error: - return ( - None, - { - "msg": f"{config_restored_msg} Invalid Json for settings - tags: {error}." - }, - ) + if settings.tags: + error = validate_json_csv(settings.tags) + if error: + return ( + None, + { + "msg": f"{config_restored_msg} Invalid Json for settings - tags: {error}." + }, + ) settings.action_providers = config["Settings"].get( "action_providers", diff --git a/dashmachine/main/utils.py b/dashmachine/main/utils.py index eb1022c..96e3631 100755 --- a/dashmachine/main/utils.py +++ b/dashmachine/main/utils.py @@ -88,6 +88,7 @@ def dashmachine_init(): def get_access_group(user, page=None): access_groups = [] + access_group = None if user.is_authenticated: access_group = AccessGroups() @@ -101,7 +102,7 @@ def get_access_group(user, page=None): if key.startswith("can_") and value == "True": setattr(access_group, key, value) - else: + if not access_group: access_group = AccessGroups.query.filter_by(name="public_users").first() redirect_url = url_for("error_pages.unauthorized") diff --git a/dashmachine/static/js/main/card-editor.js b/dashmachine/static/js/main/card-editor.js index 43e7e5f..0e490b4 100644 --- a/dashmachine/static/js/main/card-editor.js +++ b/dashmachine/static/js/main/card-editor.js @@ -32,17 +32,6 @@ $("#card-editor-data-source-add-btn").dropdown({ } }); -$(".card-editor-add-from-home-btn").on('click', function(e) { - $("#card-editor-data-sources-form-container").addClass('hide'); - $("#card-editor-data-sources-table").addClass('hide'); - $("#card-editor-form-container").removeClass('hide'); - $("#card-editor-cards-table").removeClass('hide'); - - sleep(250).then(() => { - $("#card-editor-add-btn").dropdown('open'); - }); -}); - $(".card-editor-app-row").on('click', function(e) { var form = $("#card-editor-form-container") var table = $("#card-editor-cards-table") diff --git a/dashmachine/static/js/main/home.js b/dashmachine/static/js/main/home.js index f34d494..b9fc9c3 100644 --- a/dashmachine/static/js/main/home.js +++ b/dashmachine/static/js/main/home.js @@ -42,4 +42,21 @@ $( document ).ready(function() { init_home_cards(); + $(".card-editor-add-from-home-btn").on('mouseenter', function(e) { + $('body')[0].click(); + }); + + $(".card-editor-add-from-home-btn").on('click', function(e) { + $("#card-editor-data-sources-form-container").addClass('hide'); + $("#card-editor-data-sources-table").addClass('hide'); + $("#card-editor-form-container").removeClass('hide'); + $("#card-editor-cards-table").removeClass('hide'); + + sleep(250).then(() => { + $("#card-editor-add-btn").dropdown('open'); + }); + }); + + $('#add-new-app-tap-target').tapTarget(); + $('#add-new-app-tap-target').tapTarget('open'); }); \ No newline at end of file diff --git a/dashmachine/templates/main/cards.html b/dashmachine/templates/main/cards.html index 85424bb..7b22139 100644 --- a/dashmachine/templates/main/cards.html +++ b/dashmachine/templates/main/cards.html @@ -35,15 +35,13 @@ {% endfor %} {% else %} - -
-
-
-
No apps yet, go to settings.
-
-
+ +
+
+
No apps yet
+

Click here to add an app.

-
+
{% endif %} {% endmacro %} diff --git a/dashmachine/templates/main/home.html b/dashmachine/templates/main/home.html index ad7800a..09d3d97 100644 --- a/dashmachine/templates/main/home.html +++ b/dashmachine/templates/main/home.html @@ -12,20 +12,20 @@ {% block content %}
- {% if access_group.can_access_card_editor == "True" and access_group.can_see_sidenav == "True" %} - - {% endif %} - {{ ActionBar(tags, location="home") }}
{{ HomeCards(apps, tags) }}
+ + {% if access_group.can_access_card_editor == "True" and access_group.can_see_sidenav == "True" %} + + {% endif %}
{% endblock content %}