- fixed problem causing failure to start if no tags or action providers
- replaced 'no cards go to settings' with a tap target
This commit is contained in:
parent
62191b21b8
commit
0b37598508
@ -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",
|
||||
|
@ -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")
|
||||
|
@ -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")
|
||||
|
@ -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');
|
||||
});
|
@ -35,15 +35,13 @@
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<a href="#">
|
||||
<div class="col s12 m6 l3">
|
||||
<div class="card theme-surface-transparent">
|
||||
<div class="card-action center-align">
|
||||
<h5>No apps yet, go to settings.</h5>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Tap Target Structure -->
|
||||
<div id="add-new-app-tap-target" class="tap-target theme-primary" data-target="card-editor-add-from-home-btn">
|
||||
<div class="tap-target-content">
|
||||
<h5 class="theme-on-primary-text">No apps yet</h5>
|
||||
<p class="theme-on-primary-text">Click here to add an app.</p>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
|
@ -12,20 +12,20 @@
|
||||
{% block content %}
|
||||
<div id="main" class="main-full">
|
||||
<div class="container">
|
||||
{% if access_group.can_access_card_editor == "True" and access_group.can_see_sidenav == "True" %}
|
||||
<div class="fixed-action-btn">
|
||||
<a href="#" data-target="card-editor-sidenav" class="btn-floating theme-primary card-editor-add-from-home-btn sidenav-trigger">
|
||||
<i class="material-icons-outlined theme-on-primary-text">add</i>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{{ ActionBar(tags, location="home") }}
|
||||
<div id="home-cards-container"
|
||||
data-url="{{ url_for('main.load_apps', home="true") }}"
|
||||
class="row">
|
||||
{{ HomeCards(apps, tags) }}
|
||||
</div>
|
||||
|
||||
{% if access_group.can_access_card_editor == "True" and access_group.can_see_sidenav == "True" %}
|
||||
<div class="fixed-action-btn">
|
||||
<a id="card-editor-add-from-home-btn" href="#" data-target="card-editor-sidenav" class="btn-floating theme-primary card-editor-add-from-home-btn sidenav-trigger">
|
||||
<i class="material-icons-outlined theme-on-primary-text">add</i>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user