Home Information - Your home, your data, organized.
Python
Many styling and layout improvements. WIP
Anthony Cassandra9d57b1511c62
diff --git a/src/hi/apps/alert/templates/alert/panes/alert_banner_content.html b/src/hi/apps/alert/templates/alert/panes/alert_banner_content.htmlindex 411702d1..c0319f58 100644--- a/src/hi/apps/alert/templates/alert/panes/alert_banner_content.html+++ b/src/hi/apps/alert/templates/alert/panes/alert_banner_content.html@@ -4,7 +4,7 @@<div class="hi-alert hi-alarm-level-{{ alert.alarm_level }} row"><div class="col-1"><a href="{% url 'alert_details' alert_id=alert.id %}"- class="btn btn-info" data-async="modal">DETAILS</a>+ class="btn btn-primary" data-async="modal">DETAILS</a></div><div class="col-1">{{ alert.alarm_level.label }}</div><div class="col-6">{{ alert.title }}</div>diff --git a/src/hi/apps/attribute/templates/attribute/panes/attribute_upload_form.html b/src/hi/apps/attribute/templates/attribute/panes/attribute_upload_form.htmlindex 17c0c33a..352b68f5 100644--- a/src/hi/apps/attribute/templates/attribute/panes/attribute_upload_form.html+++ b/src/hi/apps/attribute/templates/attribute/panes/attribute_upload_form.html@@ -1,6 +1,6 @@<label for="{{ attribute_upload_form.file_value.id_for_label }}"- class="btn btn-info btn-control">- ADD FILE+ class="btn btn-primary btn-control">+ UPLOAD FILE</label><input type="file" name="{{ attribute_upload_form.file_value.html_name }}"id="{{ attribute_upload_form.file_value.id_for_label }}"diff --git a/src/hi/apps/collection/edit/forms.py b/src/hi/apps/collection/edit/forms.pyindex 0af4b06b..484528ee 100644--- a/src/hi/apps/collection/edit/forms.py+++ b/src/hi/apps/collection/edit/forms.py@@ -17,7 +17,7 @@ class CollectionForm( forms.ModelForm ):)collection_type_str = forms.ChoiceField(- label = 'Collection Type',+ label = 'Category',choices = CollectionType.choices,initial = CollectionType.default_value(),required = True,@@ -25,7 +25,7 @@ class CollectionForm( forms.ModelForm ):)collection_view_type_str = forms.ChoiceField(- label = 'View Type',+ label = 'Display',choices = CollectionViewType.choices,initial = CollectionViewType.default_value(),required = True,diff --git a/src/hi/apps/collection/templates/collection/edit/modals/collection_delete.html b/src/hi/apps/collection/templates/collection/edit/modals/collection_delete.htmlindex b1da2ac5..656e227f 100644--- a/src/hi/apps/collection/templates/collection/edit/modals/collection_delete.html+++ b/src/hi/apps/collection/templates/collection/edit/modals/collection_delete.html@@ -5,16 +5,15 @@ Delete Collection?{% endblock %}{% block body %}--<div>+<p>Please confirm that you want to delete the collection:<ul>- {{ collection.name }}+ <span class="h4 text-primary">{{ collection.name }}</span></ul>-</div>-<div>+</p>+<p>This action cannot be undone.-</div>+</p>{% endblock %}{% block action_right %}diff --git a/src/hi/apps/collection/templates/collection/edit/panes/collection_edit.html b/src/hi/apps/collection/templates/collection/edit/panes/collection_edit.htmlindex 6f00b60b..b6bd4463 100644--- a/src/hi/apps/collection/templates/collection/edit/panes/collection_edit.html+++ b/src/hi/apps/collection/templates/collection/edit/panes/collection_edit.html@@ -6,9 +6,10 @@<div>{% include "collection/edit/panes/collection_form.html" %}</div>-- <button id="hi-add-collection-edit-button" type="submit" class="btn btn-info"- name="action" value="update">- UPDATE- </button>+ <div class="text-center" >+ <button id="hi-add-collection-edit-button" type="submit" class="btn btn-primary"+ name="action" value="update">+ UPDATE+ </button>+ </div></form>diff --git a/src/hi/apps/collection/templates/collection/edit/panes/collection_edit_header.html b/src/hi/apps/collection/templates/collection/edit/panes/collection_edit_header.htmlnew file mode 100644index 00000000..e231bc69--- /dev/null+++ b/src/hi/apps/collection/templates/collection/edit/panes/collection_edit_header.html@@ -0,0 +1,9 @@+<div class="d-flex justify-content-between">+ <div class="h5"><small>Collection:</small> {{ request.view_parameters.collection.name }}</div>+ <div>+ <a href="{% url 'collection_details' collection_id=request.view_parameters.collection_id %}"+ class="btn btn-sm btn-tertiary" role="button" data-async="true">+ EDIT+ </a>+ </div>+</div>diff --git a/src/hi/apps/collection/templates/collection/edit/panes/collection_entity_toggle.html b/src/hi/apps/collection/templates/collection/edit/panes/collection_entity_toggle.htmlindex 70bd1676..46c67c50 100644--- a/src/hi/apps/collection/templates/collection/edit/panes/collection_entity_toggle.html+++ b/src/hi/apps/collection/templates/collection/edit/panes/collection_entity_toggle.html@@ -1,5 +1,5 @@<div id="hi-entity-toggle-collection-{{ entity.id }}"- class="d-flex justify-content-start">+ class="d-flex justify-content-start ml-1"><div class=""><form method="POST" role="form"action="{% url 'collection_edit_collection_entity_toggle' collection_id=collection.id entity_id=entity.id %}"diff --git a/src/hi/apps/collection/templates/collection/edit/panes/collection_form.html b/src/hi/apps/collection/templates/collection/edit/panes/collection_form.htmlindex 4bf015be..36f04c96 100644--- a/src/hi/apps/collection/templates/collection/edit/panes/collection_form.html+++ b/src/hi/apps/collection/templates/collection/edit/panes/collection_form.html@@ -10,6 +10,15 @@</div>{% endif %}+<div class="input-group mb-2 mr-sm-2 w-100">+ <div class="input-group-prepend">+ <label for="{{ collection_form.name.id_for_label }}"+ class="input-group-text">{{ collection_form.name.label }}</label>+ </div>+ {{ collection_form.name }}+ <small class="form-error text-danger">{{ collection_form.name.errors }}</small>+</div>+<div class="hi-custom-select"><div class="input-group mb-2 mr-sm-2 "><div class="input-group-prepend">@@ -19,7 +28,7 @@</div>{{ collection_form.collection_type_str.errors }}</div>-+<div class="hi-custom-select"><div class="input-group mb-2 mr-sm-2"><div class="input-group-prepend">@@ -30,15 +39,11 @@{{ collection_form.collection_view_type_str.errors }}</div>-<div>- {{ collection_form.name.label }}- {{ collection_form.name }}- {{ collection_form.name.errors }}-</div>--<div>- {{ collection_form.order_id.label }}+<div class="input-group mb-2 mr-sm-2 w-100">+ <div class="input-group-prepend">+ <label for="{{ collection_form.order_id.id_for_label }}"+ class="input-group-text">{{ collection_form.order_id.label }}</label>+ </div>{{ collection_form.order_id }}- {{ collection_form.order_id.errors }}+ <small class="form-error text-danger">{{ collection_form.order_id.errors }}</small></div>-diff --git a/src/hi/apps/collection/templates/collection/edit/panes/collection_manage_items.html b/src/hi/apps/collection/templates/collection/edit/panes/collection_manage_items.htmlindex 144bf76e..83ad6f7a 100644--- a/src/hi/apps/collection/templates/collection/edit/panes/collection_manage_items.html+++ b/src/hi/apps/collection/templates/collection/edit/panes/collection_manage_items.html@@ -1,28 +1,28 @@<div>-{% if request.view_parameters.is_editing %}{% include "edit/panes/side_header.html" %}{% endif %}+ <hr /><div class="h5">Items in Collection</div>- <div class="">+ <div class="my-2"><a href="{% url 'entity_edit_entity_add' %}"class="btn btn-success btn-control" role="button"data-async="modal" >- NEW ITEM+ ADD NEW ITEM</a></div>{% for entity_collection_group in entity_collection_group_list %}<div class="">- <div class="">{{ entity_collection_group.entity_type.label }}</div>+ <div class="h5">{{ entity_collection_group.entity_type.label }}</div>{% for entity_collection_item in entity_collection_group.item_list %}{% include "collection/edit/panes/collection_entity_toggle.html" with collection=entity_collection_group.collection entity=entity_collection_item.entity exists_in_collection=entity_collection_item.exists_in_collection %}{% endfor %}</div>{% empty %}- <div><em>No entities defined.</em></div>+ <div><em>No items defined.</em></div>{% endfor %}</div>diff --git a/src/hi/apps/collection/templates/collection/edit/panes/collection_views.html b/src/hi/apps/collection/templates/collection/edit/panes/collection_views.htmldeleted file mode 100644index bbc7148f..00000000--- a/src/hi/apps/collection/templates/collection/edit/panes/collection_views.html+++ /dev/null@@ -1 +0,0 @@-TBD - VIEWSdiff --git a/src/hi/apps/collection/templates/collection/panes/collection_buttons.html b/src/hi/apps/collection/templates/collection/panes/collection_buttons.htmlindex 4f10d489..e98756e3 100644--- a/src/hi/apps/collection/templates/collection/panes/collection_buttons.html+++ b/src/hi/apps/collection/templates/collection/panes/collection_buttons.html@@ -1,19 +1,20 @@<div class="d-flex justify-content-start draggable-container">{% for collection in collection_list %}<div id="{{ collection.html_id }}-button"- class="{% if request.view_parameters.is_editing %}draggable{% endif %}"+ class="{% if request.view_parameters.is_editing %}draggable{% endif %} mx-1"{% if request.view_parameters.is_editing %}draggable="true"{% endif %}><a href="{% url 'collection_view' collection_id=collection.id %}"- class="btn btn-secondary btn-control"- role="button"- data-async="true" >+ class="btn {% if collection == request.view_parameters.active_collection %}btn-secondary{% else %}btn-primary{% endif %} btn-control"+ role="button" >{{ collection.name }}</a></div>+ {% empty %}+ <div><em>No collections defined.</em></div>{% endfor %}{% if request.view_parameters.is_editing %}- <div class="">+ <div class="ml-3"><a href="{% url 'collection_edit_collection_add' %}"class="btn btn-success btn-control" role="button"data-async="modal" >diff --git a/src/hi/apps/collection/templates/collection/panes/collection_details.html b/src/hi/apps/collection/templates/collection/panes/collection_details.htmlindex 669f801b..81ac972c 100644--- a/src/hi/apps/collection/templates/collection/panes/collection_details.html+++ b/src/hi/apps/collection/templates/collection/panes/collection_details.html@@ -1,10 +1,6 @@-{% if request.view_parameters.is_editing %}-{% include "edit/panes/side_header.html" %}-{% endif %}--<div class="d-flex justify-content-between">- <div class="h5"><small>Collection:</small>{{ collection.name }}</div>- <div class="">+<div class="d-flex justify-content-between my-2">+ <div class="align-self-center h4">Collection</div>+ <div class="align-self-center "><a href="{% url 'edit_item_details_close' %}"class="btn btn-tertiary" role="button" data-async="true">X@@ -22,12 +18,7 @@</div>{% endif %}-<h5>Views</h5>-<div id="hi-edit-collection-views">- {% include "collection/edit/panes/collection_views.html" %}-</div>--<div class="">+<div class="my-3"><a href="{% url 'collection_edit_collection_delete' collection_id=collection.id %}"class="btn btn-danger btn-control" role="button" data-async="true">DELETE COLLECTIONdiff --git a/src/hi/apps/common/svg_forms.py b/src/hi/apps/common/svg_forms.pyindex fc0ae63d..6d95a89f 100644--- a/src/hi/apps/common/svg_forms.py+++ b/src/hi/apps/common/svg_forms.py@@ -1,6 +1,5 @@import loggingimport os-import timeimport xml.etree.ElementTree as ETfrom django import forms@@ -31,9 +30,16 @@ class SvgFileForm(forms.Form):detects and can remove dangerous tags and attributes."""svg_file = forms.FileField(- label = 'SVG file',+ label = 'Select an SVG file',required = False,+ widget=forms.ClearableFileInput(+ attrs={+ 'class': 'custom-file-input',+ 'id': 'svg-file-input',+ }+ ))+remove_dangerous_svg_items = forms.BooleanField(label = 'Remove dangerous SVG items?',widget = forms.CheckboxInput(diff --git a/src/hi/apps/common/templates/common/panes/svg_file_form.html b/src/hi/apps/common/templates/common/panes/svg_file_form.htmlindex 9f56f564..37705ecb 100644--- a/src/hi/apps/common/templates/common/panes/svg_file_form.html+++ b/src/hi/apps/common/templates/common/panes/svg_file_form.html@@ -1,8 +1,12 @@-<p>- <label for="id_svg_file">{{ label }}</label>- <input type="file" name="svg_file" id="id_svg_file">- {{ svg_file_form.svg_file.errors }}-</p>+<div class="form-group">+ <div class="input-group-prepend">+ <div class="custom-file">+ <label class="custom-file-label" for="{{ svg_file_form.svg_file.id_for_label }}">{{ svg_file_form.svg_file.label }}</label>+ {{ svg_file_form.svg_file }}+ </div>+ <small class="form-error text-danger">{{ svg_file_form.svg_file.errors }}</small>+</div>+{% if svg_file_form.show_remove_dangerous_svg_items %}<p><div class="form-check">diff --git a/src/hi/apps/config/templates/config/panes/settings_form.html b/src/hi/apps/config/templates/config/panes/settings_form.htmlindex 933ef8ab..6a61ba32 100644--- a/src/hi/apps/config/templates/config/panes/settings_form.html+++ b/src/hi/apps/config/templates/config/panes/settings_form.html@@ -9,7 +9,7 @@{% include "attribute/panes/attribute_form.html" with attribute_formset=subsystem_attribute_formset %}{% endfor %}- <button id="hi-config-setting-button" type="submit" class="btn btn-info"+ <button id="hi-config-setting-button" type="submit" class="btn btn-primary"name="action" value="update">UPDATE</button>diff --git a/src/hi/apps/console/templates/console/modals/console_unlock.html b/src/hi/apps/console/templates/console/modals/console_unlock.htmlindex 7e60a1ec..2c960995 100644--- a/src/hi/apps/console/templates/console/modals/console_unlock.html+++ b/src/hi/apps/console/templates/console/modals/console_unlock.html@@ -10,8 +10,7 @@{% endblock %}{% block body %}- <label for="hi-console-password">Enter Password:</label>- <input type="password" id="hi-console-password" name="password" required>+ {% include "console/panes/lock_password_form.html" %}{% endblock %}{% block action_center %}diff --git a/src/hi/apps/console/templates/console/modals/set_lock_password.html b/src/hi/apps/console/templates/console/modals/set_lock_password.htmlindex 77175e80..0da76fd8 100644--- a/src/hi/apps/console/templates/console/modals/set_lock_password.html+++ b/src/hi/apps/console/templates/console/modals/set_lock_password.html@@ -13,8 +13,7 @@<p>Please create a password to unlock the console.</p>- <label for="hi-console-password">Enter Password:</label>- <input type="password" id="hi-console-password" name="password" required>+ {% include "console/panes/lock_password_form.html" %}{% endblock %}{% block action_center %}diff --git a/src/hi/apps/console/templates/console/panes/camera_controls.html b/src/hi/apps/console/templates/console/panes/camera_controls.htmlindex cd0e934a..2026ed67 100644--- a/src/hi/apps/console/templates/console/panes/camera_controls.html+++ b/src/hi/apps/console/templates/console/panes/camera_controls.html@@ -1,15 +1,13 @@-{% if video_stream_entity_list %}<div>- <div>CAMERAS</div>+ <div class="h6 text-center">Cameras</div><div class="row">{% for video_stream_entity in video_stream_entity_list %}- <div class="col-6">+ <div class="col-6 my-1"><a href="{% url 'console_sensor_video_stream' sensor_id=video_stream_entity.sensor.id %}"- class="btn btn-info btn-control">+ class="btn btn-primary btn-control">{{ video_stream_entity.name }}</a></div>{% endfor %}</div></div>-{% endif %}diff --git a/src/hi/apps/console/templates/console/panes/hi_grid_side.html b/src/hi/apps/console/templates/console/panes/hi_grid_side.htmlindex b9ae43d2..42c59227 100644--- a/src/hi/apps/console/templates/console/panes/hi_grid_side.html+++ b/src/hi/apps/console/templates/console/panes/hi_grid_side.html@@ -1,32 +1,33 @@-{% if request.view_parameters.location %}-<div>- <a href="{% url 'location_edit_location_edit' location_id=request.view_parameters.location.id %}"- class="btn btn-info btn-control" role="button"- data-async="true" >- {{ request.view_parameters.location.name }} Info- </a>-</div>-{% endif %}-<div id="hi-side-info">- <div class="text-center mt-4 pt-4">- <div>INFO</div>- <div class="pt-2 mb-4 pb-4">Coming Soon.</div>+<div class="d-flex flex-column h-100">+ {% if request.view_parameters.location %}+ <div class="my-2">+ <a href="{% url 'location_edit_location_edit' location_id=request.view_parameters.location.id %}"+ class="btn btn-primary btn-control" role="button"+ data-async="true" >+ {{ request.view_parameters.location.name }} Info+ </a></div>-</div>-<div>-</div>-<div class="row">- <div class="col-6">- {% include "console/panes/camera_controls.html" %}+ {% endif %}++ <div id="hi-side-info" class="flex-grow-1 text-center my-2 bg-muted" >+ <div class="h4" style="padding-top: 8rem;">Coming Soon.</div></div>- <div class="col-6">- {% include "security/panes/security_state_control.html" %}++ <div class="d-flex justify-content-center my-2">+ {% if video_stream_entity_list %}+ <div class="col-6">+ {% include "console/panes/camera_controls.html" %}+ </div>+ {% endif %}+ <div class="col-6">+ {% include "security/panes/security_state_control.html" %}+ </div>+ </div>+ <div class="my-2">+ <a href="{% url 'event_history' %}"+ class="btn btn-primary btn-control" role="button"+ data-async="true" >+ HISTORY+ </a></div>-</div>-<div>- <a href="{% url 'event_history' %}"- class="btn btn-secondary btn-control" role="button"- data-async="true" >- HISTORY- </a></div>diff --git a/src/hi/apps/console/templates/console/panes/lock_password_form.html b/src/hi/apps/console/templates/console/panes/lock_password_form.htmlnew file mode 100644index 00000000..ff3c581c--- /dev/null+++ b/src/hi/apps/console/templates/console/panes/lock_password_form.html@@ -0,0 +1,6 @@+ <div class="input-group mb-2 mr-sm-2">+ <div class="input-group-prepend">+ <label for="hi-console-password" class="input-group-text">Unlock Password</label>+ <input type="password" id="hi-console-password" name="password" required>+ </div>+ </div>diff --git a/src/hi/apps/edit/templates/edit/panes/side_header.html b/src/hi/apps/edit/templates/edit/panes/side_header.htmlindex 1737f4ea..ec8e7d6a 100644--- a/src/hi/apps/edit/templates/edit/panes/side_header.html+++ b/src/hi/apps/edit/templates/edit/panes/side_header.html@@ -7,14 +7,8 @@{% include "location/edit/panes/location_view_edit_header.html" %}</div>{% elif request.view_parameters.view_type.is_collection %}- <div class="d-flex justify-content-between">- <div class="h3"><small>Collection:</small> {{ request.view_parameters.collection.name }}</div>- <div>- <a href="{% url 'collection_details' collection_id=request.view_parameters.collection_id %}"- class="btn btn-tertiary" role="button" data-async="true">- Collection Details- </a>+ <div class="mt-2">+ {% include "collection/edit/panes/collection_edit_header.html" %}</div>- </div>{% endif %}</div>diff --git a/src/hi/apps/entity/delegation_manager.py b/src/hi/apps/entity/delegation_manager.pyindex 21fd8870..3aa8acc4 100644--- a/src/hi/apps/entity/delegation_manager.py+++ b/src/hi/apps/entity/delegation_manager.py@@ -35,7 +35,11 @@ class DelegationManager(Singleton):def get_principal_entities( self, entity : models.Entity ) -> List[ models.Entity ]:principal_entity_list = list()- for entity_state_delegation in entity.entity_state_delegations.all():+ delegation_queryset = entity.entity_state_delegations.select_related(+ 'entity_state',+ 'entity_state__entity'+ ).all()+ for entity_state_delegation in delegation_queryset:principal_entity_list.append( entity_state_delegation.entity_state.entity )continuereturn principal_entity_listdiff --git a/src/hi/apps/entity/entity_manager.py b/src/hi/apps/entity/entity_manager.pyindex 53298cc4..cb463367 100644--- a/src/hi/apps/entity/entity_manager.py+++ b/src/hi/apps/entity/entity_manager.py@@ -14,6 +14,7 @@ from hi.apps.location.svg_item_factory import SvgItemFactoryfrom .delegation_manager import DelegationManagerfrom .enums import (+ EntityPairingType,EntityStateType,)from .models import (@@ -28,6 +29,7 @@ from .models import (from .transient_models import (EntityDetailsData,EntityEditData,+ EntityPairing,EntityViewGroup,EntityViewItem,)@@ -74,15 +76,41 @@ class EntityManager(Singleton):if entity_position:entity_position_form = EntityPositionForm( instance = entity_position )+ entity_pairing_list = self.get_entity_pairing_list( entity = entity )principal_entity_list = self.get_principal_entity_list( entity = entity )entity_edit_data = EntityEditData( entity = entity )return EntityDetailsData(entity_edit_data = entity_edit_data,entity_position_form = entity_position_form,+ entity_pairing_list = entity_pairing_list,principal_entity_list = principal_entity_list,)+ def get_entity_pairing_list( self, entity : Entity ) -> List[ EntityPairing ]:+ delegation_manager = DelegationManager()+ entity_pairing_list = list()++ for principal_entity in delegation_manager.get_principal_entities( entity = entity ):+ entity_pairing = EntityPairing(+ entity = entity,+ paired_entity = principal_entity,+ pairing_type = EntityPairingType.PRINCIPAL,+ )+ entity_pairing_list.append( entity_pairing )+ continue++ for delegate_entity in delegation_manager.get_delegate_entities( entity = entity ):+ entity_pairing = EntityPairing(+ entity = entity,+ paired_entity = delegate_entity,+ pairing_type = EntityPairingType.DELEGATE,+ )+ entity_pairing_list.append( entity_pairing )+ continue++ return entity_pairing_list+def get_principal_entity_list( self, entity : Entity ) -> List[ Entity ]:entity_state_delegation_list = list(entity.entity_state_delegations.select_related('entity_state', 'entity_state__entity').all()diff --git a/src/hi/apps/entity/enums.py b/src/hi/apps/entity/enums.pyindex a97699d1..c58fb334 100644--- a/src/hi/apps/entity/enums.py+++ b/src/hi/apps/entity/enums.py@@ -191,3 +191,10 @@ class HumidityUnit(LabeledEnum):PERCENT = ( 'Percent', '' )GRAMS_PER_CUBIN_METER = ( 'Grams per cubic meter (g/m³)', '' )GRAMS_PER_KILOGRAM = ( 'Grams per kilogram (g/kg)', '' )+++class EntityPairingType(LabeledEnum):++ PRINCIPAL = ( 'Principal', '' )+ DELEGATE = ( 'Delegate', '' )+diff --git a/src/hi/apps/entity/forms.py b/src/hi/apps/entity/forms.pyindex 11402ae3..51bfa6fb 100644--- a/src/hi/apps/entity/forms.py+++ b/src/hi/apps/entity/forms.py@@ -15,7 +15,7 @@ class EntityForm( forms.ModelForm ):)entity_type_str = forms.ChoiceField(- label = 'Item Type',+ label = 'Type',choices = EntityType.choices,initial = EntityType.default_value(),required = True,diff --git a/src/hi/apps/entity/templates/entity/edit/modals/entity_add.html b/src/hi/apps/entity/templates/entity/edit/modals/entity_add.htmlindex e2adcd3c..47f4ab2d 100644--- a/src/hi/apps/entity/templates/entity/edit/modals/entity_add.html+++ b/src/hi/apps/entity/templates/entity/edit/modals/entity_add.html@@ -12,7 +12,7 @@ New Location Item{% block body %}<div>-{% include "entity/edit/panes/entity_form.html" %}+ {% include "entity/edit/panes/entity_form.html" %}</div>{% endblock %}diff --git a/src/hi/apps/entity/templates/entity/edit/modals/entity_delete.html b/src/hi/apps/entity/templates/entity/edit/modals/entity_delete.htmlindex 218e51dd..bc1520fb 100644--- a/src/hi/apps/entity/templates/entity/edit/modals/entity_delete.html+++ b/src/hi/apps/entity/templates/entity/edit/modals/entity_delete.html@@ -1,20 +1,20 @@{% extends "modals/action_with_cancel.html" %}{% block title_text %}-Delete Location Item?+Delete Item?{% endblock %}{% block body %}-<div>+<p>Please confirm that you want to delete this item:<ul>- {{ entity.name }}+ <span class="h4 text-primary">{{ entity.name }}</span></ul>-</div>-<div>+</p>+<p>This action cannot be undone.-</div>+</p>{% endblock %}{% block action_right %}diff --git a/src/hi/apps/entity/templates/entity/edit/panes/entity_details.html b/src/hi/apps/entity/templates/entity/edit/panes/entity_details.htmlindex 3094a36e..7bead685 100644--- a/src/hi/apps/entity/templates/entity/edit/panes/entity_details.html+++ b/src/hi/apps/entity/templates/entity/edit/panes/entity_details.html@@ -1,9 +1,5 @@-{% if request.view_parameters.is_editing %}-{% include "edit/panes/side_header.html" %}-{% endif %}--<div class="d-flex justify-content-between">- <div class="h5"><small>Item</small>: {{ entity.name }}</div>+<div class="d-flex justify-content-between mt-2">+ <div class="h4">Item</div><div class=""><a href="{% url 'edit_item_details_close' %}"class="btn btn-tertiary" role="button" data-async="true">@@ -16,67 +12,43 @@{% include "entity/edit/panes/entity_edit.html" %}</div>-<h5>Principals</h5>+{% if entity.can_user_delete %}+<div class="">+ <a href="{% url 'entity_edit_entity_delete' entity_id=entity.id %}"+ class="btn btn-danger btn-control" role="button" data-async="true">+ DELETE ITEM+ </a>+</div>+{% else %}+<hr />+<div class="h5">Integration</div>+<div>{{ entity.integration_id }} [{{ entity.integration_name }}]</div>+{% endif %}++{% if entity_position_form %}+<hr />+<div class="h5">Geometry</div>+<div id="{{ DIVID.ENTITY_POSITION_EDIT_PANE }}">+ {% include "entity/edit/panes/entity_position_edit.html" %}+</div>+{% endif %}++<hr />+<div class="h5">Paired Items</div><div id="hi-edit-entity-principals"><ul>- {% for principal_entity in principal_entity_list %}- <li>{{ principal_entity.name }}</li>+ {% for entity_pairing in entity_pairing_list %}+ <li>{{ entity_pairing.paired_entity.name }} <small>[{{entity_pairing.pairing_type}}]</small></li>{% empty %}- <em>No principals</em>+ <em>No current pairings.</em>{% endfor %}</ul><div class=""><a href="{% url 'entity_edit_principal_manage' entity_id=entity.id %}"- class="btn btn-success btn-control" role="button" data-async="true">- MANAGE PRINCIPALS+ class="btn btn-primary btn-control" role="button" data-async="true">+ MANAGE PAIRINGS</a></div></div>--{% if entity_position_form %}-<h5>Geometry</h5>-<div id="{{ DIVID.ENTITY_POSITION_EDIT_PANE }}">- {% include "entity/edit/panes/entity_position_edit.html" %}-</div>-{% endif %}--<h5>Delegates</h5>-<div id="hi-edit-entity-delegates">- <div>TBD - DELEGATES</div>-</div>--<h5>States/Sensors/Controllers</h5>-{% for entity_state in entity.states.all %}-<div class="h6">{{ entity_state.name }}</div>-<ul>- {% for sensor in entity_state.sensors.all %}- <li>{{ sensor.name }} [sensor]</li>- {% endfor %}- {% for controller in entity_state.controllers.all %}- <li>{{ controller.name }} [controller]</li>- {% endfor %}-</ul>--{% empty %}-<em>No states</em>-{% endfor %}--<h5>Views</h5>-<div id="hi-edit-entity-views">- {% include "entity/panes/entity_views.html" %}-</div>--{% if entity.can_user_delete %}-<div class="">- <a href="{% url 'entity_edit_entity_delete' entity_id=entity.id %}"- class="btn btn-danger btn-control" role="button" data-async="true">- DELETE ITEM- </a>-</div>-{% else %}-<h5>Integration</h5>-<div>{{ entity.integration_id }} [{{ entity.integration_name }}]</div>--{% endif %}diff --git a/src/hi/apps/entity/templates/entity/edit/panes/entity_edit.html b/src/hi/apps/entity/templates/entity/edit/panes/entity_edit.htmlindex addcccb4..978578da 100644--- a/src/hi/apps/entity/templates/entity/edit/panes/entity_edit.html+++ b/src/hi/apps/entity/templates/entity/edit/panes/entity_edit.html@@ -2,23 +2,30 @@method="post"class="form" data-async="true">{% csrf_token %}-<div>{% include "entity/edit/panes/entity_form.html" %}</div>-- <button id="hi-add-entity-edit-button" type="submit" class="btn btn-info"- name="action" value="update">- UPDATE- </button>-</form>--<form action="{% url 'entity_attribute_upload' entity_id=entity.id %}"- method="post"- class="form" data-async="true">- {% csrf_token %}+ <div class="h5 my-2">Attributes</div><div>- {% include "attribute/panes/attribute_upload_form.html" with attribute_upload_form=entity_attribute_upload_form %}+ {% include "attribute/panes/attribute_form.html" with attribute_formset=entity_attribute_formset %}+ </div>++ <div class="text-center" >+ <button id="hi-add-entity-edit-button" type="submit" class="btn btn-primary"+ name="action" value="update">+ UPDATE+ </button></div></form>+<div class="text-center my-3" >+ <form action="{% url 'entity_attribute_upload' entity_id=entity.id %}"+ method="post"+ class="form" data-async="true">+ {% csrf_token %}+ <div>+ {% include "attribute/panes/attribute_upload_form.html" with attribute_upload_form=entity_attribute_upload_form %}+ </div>+ </form>+</div>+diff --git a/src/hi/apps/entity/templates/entity/edit/panes/entity_form.html b/src/hi/apps/entity/templates/entity/edit/panes/entity_form.htmlindex 37f80628..8708d710 100644--- a/src/hi/apps/entity/templates/entity/edit/panes/entity_form.html+++ b/src/hi/apps/entity/templates/entity/edit/panes/entity_form.html@@ -10,17 +10,7 @@</div>{% endif %}-<div class="hi-custom-select">- <div class="input-group mb-2 mr-sm-2">- <div class="input-group-prepend">- <div class="input-group-text">{{ entity_form.entity_type_str.label_tag }}</div>- </div>- {{ entity_form.entity_type_str }}- </div>- {{ entity_form.entity_type_str.errors }}-</div>--<div class="input-group">+<div class="input-group mb-2 mr-sm-2 w-100"><div class="input-group-prepend"><label for="{{ entity_form.name.id_for_label }}"class="input-group-text">{{ entity_form.name.label }}</label>@@ -29,9 +19,12 @@</div></div>-{% if entity_form.entity.pk %}-<div class="h4">Attributes</div>-<div>- {% include "attribute/panes/attribute_form.html" with attribute_formset=entity_attribute_formset %}+<div class="hi-custom-select">+ <div class="input-group mb-2 mr-sm-2">+ <div class="input-group-prepend">+ <div class="input-group-text">{{ entity_form.entity_type_str.label }}</div>+ </div>+ {{ entity_form.entity_type_str }}+ </div>+ {{ entity_form.entity_type_str.errors }}</div>-{% endif %}diff --git a/src/hi/apps/entity/templates/entity/modals/entity_status.html b/src/hi/apps/entity/templates/entity/modals/entity_status.htmlindex 111b8a3d..2951383f 100644--- a/src/hi/apps/entity/templates/entity/modals/entity_status.html+++ b/src/hi/apps/entity/templates/entity/modals/entity_status.html@@ -10,17 +10,17 @@<div class="d-flex justify-content-between"><div>- <a class="btn btn-info"+ <a class="btn btn-primary"href="{% url 'entity_edit' entity_id=entity.id %}"data-async="modal">- Edit+ EDIT</a></div><div>- <a class="btn btn-info"+ <a class="btn btn-primary"href="{% url 'entity_state_history' entity_id=entity.id %}"data-async="modal">- History+ HISTORY</a></div></div>diff --git a/src/hi/apps/entity/transient_models.py b/src/hi/apps/entity/transient_models.pyindex c5882675..4e9ad0e3 100644--- a/src/hi/apps/entity/transient_models.py+++ b/src/hi/apps/entity/transient_models.py@@ -5,7 +5,7 @@ from hi.apps.control.models import Controller, ControllerHistoryfrom hi.apps.entity.edit.forms import EntityPositionFormfrom hi.apps.sense.models import Sensor, SensorHistory-from .enums import EntityType+from .enums import EntityType, EntityPairingTypefrom .forms import (EntityAttributeFormSet,EntityForm,@@ -28,6 +28,14 @@ class EntityViewGroup:entity_type : EntityTypeitem_list : List[EntityViewItem] = field( default_factory = list )++@dataclass+class EntityPairing:++ entity : Entity+ paired_entity : Entity+ pairing_type : EntityPairingType+@dataclassclass EntityEditData:@@ -74,12 +82,14 @@ class EntityDetailsData:"""entity_edit_data : EntityEditData- entity_position_form : EntityPositionForm = None- principal_entity_list : List[ Entity ] = None+ entity_position_form : EntityPositionForm = None+ entity_pairing_list : List[ EntityPairing ] = None+ principal_entity_list : List[ Entity ] = Nonedef to_template_context(self):context = {'entity_position_form': self.entity_position_form,+ 'entity_pairing_list': self.entity_pairing_list,'principal_entity_list': self.principal_entity_list,}context.update( self.entity_edit_data.to_template_context() )diff --git a/src/hi/apps/event/templates/event/panes/event_definitions.html b/src/hi/apps/event/templates/event/panes/event_definitions.htmlindex 088abb22..dfcfcd4b 100644--- a/src/hi/apps/event/templates/event/panes/event_definitions.html+++ b/src/hi/apps/event/templates/event/panes/event_definitions.html@@ -5,7 +5,7 @@<div class="h3">Event Definitions</div><div>- <a role="button" class="btn btn-info btn-control"+ <a role="button" class="btn btn-primary btn-control"href="{% url 'event_definition_add' %}"data-async="modal" >ADD NEW@@ -24,7 +24,7 @@{% for event_definition in event_definition_list %}<div class="row"><div class="col-1">- <a role="button" class="btn btn-info"+ <a role="button" class="btn btn-primary"href="{% url 'event_definition_edit' id=event_definition.id %}"data-async="modal" >EDITdiff --git a/src/hi/apps/location/edit/forms.py b/src/hi/apps/location/edit/forms.pyindex 0565144c..c756ec2d 100644--- a/src/hi/apps/location/edit/forms.py+++ b/src/hi/apps/location/edit/forms.py@@ -63,10 +63,12 @@ class LocationEditForm( forms.ModelForm ):fields = ('name','order_id',+ 'svg_view_box_str',)widgets = {'name': forms.TextInput( attrs={'class': 'form-control'} ),'order_id': forms.NumberInput( attrs={'class': 'form-control'} ),+ 'svg_view_box_str': forms.TextInput( attrs={'class': 'form-control', 'readonly': True } ),}@@ -96,7 +98,10 @@ class LocationViewAddForm(forms.Form):# N.B. When adding a LocationView, we use limited field options to keep# it simpler.- name = forms.CharField()+ name = forms.CharField(+ label = 'View Name',+ required = True,+ )class LocationViewEditForm( forms.ModelForm ):@@ -107,13 +112,19 @@ class LocationViewEditForm( forms.ModelForm ):'name','location_view_type_str','svg_style_name_str',+ 'svg_view_box_str',+ 'svg_rotate',+ 'order_id',)widgets = {'name': forms.TextInput( attrs={'class': 'form-control'} ),+ 'svg_view_box_str': forms.TextInput( attrs={'class': 'form-control'} ),+ 'svg_rotate': forms.NumberInput( attrs={'class': 'form-control'} ),+ 'order_id': forms.NumberInput( attrs={'class': 'form-control'} ),}location_view_type_str = forms.ChoiceField(- label = 'View Type',+ label = 'Type',choices = LocationViewType.choices,initial = LocationViewType.default_value(),required = True,@@ -154,7 +165,15 @@ class LocationItemPositionForm( forms.ModelForm ):'svg_rotate',)- svg_x = SvgDecimalFormField()- svg_y = SvgDecimalFormField()- svg_scale = SvgDecimalFormField()- svg_rotate = SvgDecimalFormField()+ svg_x = SvgDecimalFormField(+ label = 'X',+ )+ svg_y = SvgDecimalFormField(+ label = 'Y',+ )+ svg_scale = SvgDecimalFormField(+ label = 'Scale',+ )+ svg_rotate = SvgDecimalFormField(+ label = 'Rotate',+ )diff --git a/src/hi/apps/location/edit/urls.py b/src/hi/apps/location/edit/urls.pyindex 51b6a7b3..93d63a41 100644--- a/src/hi/apps/location/edit/urls.py+++ b/src/hi/apps/location/edit/urls.py@@ -5,6 +5,10 @@ from . import viewsurlpatterns = [+ re_path( r'^location/add$',+ views.LocationAddFirstView.as_view(),+ name='location_edit_location_add_first'),+re_path( r'^location/add$',views.LocationAddView.as_view(),name='location_edit_location_add'),diff --git a/src/hi/apps/location/edit/views.py b/src/hi/apps/location/edit/views.pyindex c7e83938..3e178d63 100644--- a/src/hi/apps/location/edit/views.py+++ b/src/hi/apps/location/edit/views.py@@ -72,6 +72,12 @@ class LocationAddView( HiModalView ):return antinode.redirect_response( redirect_url )+class LocationAddFirstView( LocationAddView ):++ def get_template_name( self ) -> str:+ return 'location/edit/modals/location_add_first.html'++@method_decorator( edit_required, name='dispatch' )class LocationSvgReplaceView( HiModalView, LocationViewMixin ):diff --git a/src/hi/apps/location/templates/location/edit/modals/location_add_first.html b/src/hi/apps/location/templates/location/edit/modals/location_add_first.htmlnew file mode 100644index 00000000..04730953--- /dev/null+++ b/src/hi/apps/location/templates/location/edit/modals/location_add_first.html@@ -0,0 +1,28 @@+{% extends "modals/action_with_cancel.html" %}++{% block preamble %}+<form action="{% url 'location_edit_location_add' %}" method="post" enctype="multipart/form-data"+ class="form" data-async="modal">+ {% csrf_token %}+{% endblock %}++{% block title_text %}+Create Your Location+{% endblock %}++{% block body %}+<div>+{% include "location/edit/panes/location_add_form.html" %}+</div>+{% endblock %}++{% block action_right %}+<button id="hi-add-location-button" type="submit" class="btn btn-lg btn-success"+ name="action" value="add">+ CREATE+</button>+{% endblock %}++{% block postamble %}+</form>+{% endblock %}diff --git a/src/hi/apps/location/templates/location/edit/modals/location_delete.html b/src/hi/apps/location/templates/location/edit/modals/location_delete.htmlindex e5e66f67..4f517491 100644--- a/src/hi/apps/location/templates/location/edit/modals/location_delete.html+++ b/src/hi/apps/location/templates/location/edit/modals/location_delete.html@@ -5,15 +5,15 @@ Delete Location?{% endblock %}{% block body %}-<div>+<p>Please confirm that you want to delete the location:<ul>- {{ location.name }}+ <span class="h4 text-primary">{{ location.name }}</span></ul>-</div>-<div>+</p>+<p>This will also delete all views for this location. This action cannot be undone.-</div>+</p>{% endblock %}{% block action_right %}diff --git a/src/hi/apps/location/templates/location/edit/modals/location_view_delete.html b/src/hi/apps/location/templates/location/edit/modals/location_view_delete.htmlindex 315a42a3..6ac7ac24 100644--- a/src/hi/apps/location/templates/location/edit/modals/location_view_delete.html+++ b/src/hi/apps/location/templates/location/edit/modals/location_view_delete.html@@ -5,15 +5,15 @@ Delete Location View?{% endblock %}{% block body %}-<div>+<p>Please confirm that you want to delete the location view:<ul>- {{ location_view.name }}+ <span class="h4 text-primary">{{ location_view.name }}</span></ul>-</div>-<div>+</p>+<p>This action cannot be undone.-</div>+</p>{% endblock %}{% block action_right %}diff --git a/src/hi/apps/location/templates/location/edit/panes/location_add_form.html b/src/hi/apps/location/templates/location/edit/panes/location_add_form.htmlindex e7f6e1ef..563bf431 100644--- a/src/hi/apps/location/templates/location/edit/panes/location_add_form.html+++ b/src/hi/apps/location/templates/location/edit/panes/location_add_form.html@@ -10,13 +10,19 @@</div>{% endif %}-<p>- {{ location_add_form.name.label }}+<div class="input-group mb-2 mr-sm-2">+ <div class="input-group-prepend">+ <label for="{{ location_add_form.name.id_for_label }}"+ class="input-group-text">{{ location_add_form.name.label }}</label>+ </div>{{ location_add_form.name }}- {{ location_add_form.name.errors }}-</p>+ <small class="form-error text-danger">{{ location_add_form.name.errors }}</small>+</div>-<p>- Optionally add an image (SVG format) showing your property and/or house layout. Skip this and we'll uses a predefined image for you. You'll be able to update this image later.+<p class="my-3">+ You may optionally add an image (SVG format) showing your property and/or house layout.+</p>+{% include "common/panes/svg_file_form.html" with svg_file_form=location_add_form %}+<p class="my-2 text-muted">+ If you skip adding an image now, we'll uses a predefined image for you. You can update the location's image at any time.</p>-{% include "common/panes/svg_file_form.html" with svg_file_form=location_add_form label='Select an SVG file:' %}diff --git a/src/hi/apps/location/templates/location/edit/panes/location_edit.html b/src/hi/apps/location/templates/location/edit/panes/location_edit.htmlindex 8c3824be..98a02a94 100644--- a/src/hi/apps/location/templates/location/edit/panes/location_edit.html+++ b/src/hi/apps/location/templates/location/edit/panes/location_edit.html@@ -5,8 +5,12 @@<div>{% include "location/edit/panes/location_edit_form.html" %}</div>+ <div>+ {% include "attribute/panes/attribute_form.html" with attribute_formset=location_attribute_formset %}+ </div>+<div class="text-center" >- <button id="hi-add-location-button" type="submit" class="btn btn-info"+ <button id="hi-add-location-button" type="submit" class="btn btn-primary"name="action" value="update">UPDATE</button>@@ -27,7 +31,7 @@{% if request.view_parameters.is_editing %}<div class="text-center my-3" ><a href="{% url 'location_edit_svg_replace' location_id=location.id %}"- id="hi-svg-replace-link" class="btn btn-info btn-control" role="button"+ id="hi-svg-replace-link" class="btn btn-primary btn-control" role="button"data-async="true">REPLACE BACKGROUND SVG IMAGE</a>diff --git a/src/hi/apps/location/templates/location/edit/panes/location_edit_form.html b/src/hi/apps/location/templates/location/edit/panes/location_edit_form.htmlindex 7f30d432..5db15c25 100644--- a/src/hi/apps/location/templates/location/edit/panes/location_edit_form.html+++ b/src/hi/apps/location/templates/location/edit/panes/location_edit_form.html@@ -10,18 +10,30 @@</div>{% endif %}-<div class="form-group">- <label for="{{ location_edit_form.name.id_for_label }}">{{ location_edit_form.name.label }}</label>+<div class="input-group mb-2 mr-sm-2">+ <div class="input-group-prepend">+ <label for="{{ location_edit_form.name.id_for_label }}"+ class="input-group-text">{{ location_edit_form.name.label }}</label>+ </div>{{ location_edit_form.name }}<small class="form-error text-danger">{{ location_edit_form.name.errors }}</small></div>-<div class="form-group">- <label for="{{ location_edit_form.order_id.id_for_label }}">{{ location_edit_form.order_id.label }}</label>+<div class="input-group mb-2 mr-sm-2">+ <div class="input-group-prepend">+ <label for="{{ location_edit_form.order_id.id_for_label }}"+ class="input-group-text">{{ location_edit_form.order_id.label }}</label>+ </div>{{ location_edit_form.order_id }}<small class="form-error text-danger">{{ location_edit_form.order_id.errors }}</small></div>-<div>- {% include "attribute/panes/attribute_form.html" with attribute_formset=location_attribute_formset %}+<div class="input-group mb-2 mr-sm-2">+ <div class="input-group-prepend">+ <label for="{{ location_edit_form.svg_view_box_str.id_for_label }}"+ class="input-group-text">{{ location_edit_form.svg_view_box_str.label }}</label>+ </div>+ {{ location_edit_form.svg_view_box_str }}+ <small class="form-error text-danger">{{ location_edit_form.svg_view_box_str.errors }}</small></div>+diff --git a/src/hi/apps/location/templates/location/edit/panes/location_edit_header.html b/src/hi/apps/location/templates/location/edit/panes/location_edit_header.htmlindex f898080d..a7899944 100644--- a/src/hi/apps/location/templates/location/edit/panes/location_edit_header.html+++ b/src/hi/apps/location/templates/location/edit/panes/location_edit_header.html@@ -1,8 +1,8 @@<div class="d-flex justify-content-between">- <div class="h4"><small>Location:</small> {{ request.view_parameters.location.name }}</div>+ <div class="h5"><small>Location:</small> {{ request.view_parameters.location.name }}</div><div><a href="{% url 'location_details' location_id=request.view_parameters.location.id %}"- class="btn btn-tertiary" role="button" data-async="true">+ class="btn btn-sm btn-tertiary" role="button" data-async="true">EDIT</a></div>diff --git a/src/hi/apps/location/templates/location/edit/panes/location_item_position_form.html b/src/hi/apps/location/templates/location/edit/panes/location_item_position_form.htmlindex fcd7fc39..300f12f8 100644--- a/src/hi/apps/location/templates/location/edit/panes/location_item_position_form.html+++ b/src/hi/apps/location/templates/location/edit/panes/location_item_position_form.html@@ -6,32 +6,49 @@<div class="non-field-errors">{% for err in location_item_position_form.non_field_errors %}<p class="form-error">{{ err }}</p>- {% endfor %}+ {% endfor %}</div>{% endif %}-<div class="pt-4">- {{ location_item_position_form.svg_x.label }}+<div class="input-group mb-2 mr-sm-2 w-100">+ <div class="input-group-prepend">+ <label for="{{ location_item_position_form.svg_x.id_for_label }}"+ class="input-group-text">{{ location_item_position_form.svg_x.label }}</label>+ </div>{{ location_item_position_form.svg_x }}- {{ location_item_position_form.svg_x.errors }}+ <small class="form-error text-danger">{{ location_item_position_form.svg_x.errors }}</small></div>-<div class="pt-4">- {{ location_item_position_form.svg_y.label }}+<div class="input-group mb-2 mr-sm-2">+ <div class="input-group-prepend">+ <label for="{{ location_item_position_form.svg_y.id_for_label }}"+ class="input-group-text">{{ location_item_position_form.svg_y.label }}</label>+ </div>{{ location_item_position_form.svg_y }}- {{ location_item_position_form.svg_y.errors }}+ <small class="form-error text-danger"> {{ location_item_position_form.svg_y.errors }}</small></div>-<div class="pt-4">- {{ location_item_position_form.svg_scale.label }}+<div class="input-group mb-2 mr-sm-2">+ <div class="input-group-prepend">+ <label for="{{ location_item_position_form.svg_scale.id_for_label }}"+ class="input-group-text">{{ location_item_position_form.svg_scale.label }}</label>+ </div>{{ location_item_position_form.svg_scale }}- {{ location_item_position_form.svg_scale.errors }}+ <small class="form-error text-danger"> {{ location_item_position_form.svg_scale.errors }}</small></div>-<div class="pt-4">- {{ location_item_position_form.svg_rotate.label }}+<div class="input-group mb-2 mr-sm-2">+ <div class="input-group-prepend">+ <label for="{{ location_item_position_form.svg_rotate.id_for_label }}"+ class="input-group-text">{{ location_item_position_form.svg_rotate.label }}</label>+ </div>{{ location_item_position_form.svg_rotate }}- {{ location_item_position_form.svg_rotate.errors }}+ <small class="form-error text-danger"> {{ location_item_position_form.svg_rotate.errors }}</small></div>-<button type="submit" role="button" >SUBMIT</button>+<div class="text-center" >+ <button id="hi-add-entity-edit-button" type="submit" class="btn btn-primary"+ name="action" value="update">+ UPDATE+ </button>+</div>diff --git a/src/hi/apps/location/templates/location/edit/panes/location_svg_replace_form.html b/src/hi/apps/location/templates/location/edit/panes/location_svg_replace_form.htmlindex aa9050da..ac7a8952 100644--- a/src/hi/apps/location/templates/location/edit/panes/location_svg_replace_form.html+++ b/src/hi/apps/location/templates/location/edit/panes/location_svg_replace_form.html@@ -13,4 +13,6 @@<p>Replace the background SVG image for this location.</p>-{% include "common/panes/svg_file_form.html" with svg_file_form=location_svg_file_form label='Select a replacement SVG file:' %}+<p>+{% include "common/panes/svg_file_form.html" with svg_file_form=location_svg_file_form %}+</p>diff --git a/src/hi/apps/location/templates/location/edit/panes/location_view_add_form.html b/src/hi/apps/location/templates/location/edit/panes/location_view_add_form.htmlindex 5a17a978..f0579597 100644--- a/src/hi/apps/location/templates/location/edit/panes/location_view_add_form.html+++ b/src/hi/apps/location/templates/location/edit/panes/location_view_add_form.html@@ -10,8 +10,11 @@</div>{% endif %}-<div>- {{ location_view_add_form.name.label }}+<div class="input-group mb-2 mr-sm-2">+ <div class="input-group-prepend">+ <label for="{{ location_view_add_form.name.id_for_label }}"+ class="input-group-text">{{ location_view_add_form.name.label }}</label>+ </div>{{ location_view_add_form.name }}- {{ location_view_add_form.name.errors }}+ <small class="form-error text-danger"> {{ location_view_add_form.name.errors }}</small></div>diff --git a/src/hi/apps/location/templates/location/edit/panes/location_view_edit.html b/src/hi/apps/location/templates/location/edit/panes/location_view_edit.htmlindex 34ce4b4b..29011b7a 100644--- a/src/hi/apps/location/templates/location/edit/panes/location_view_edit.html+++ b/src/hi/apps/location/templates/location/edit/panes/location_view_edit.html@@ -7,7 +7,7 @@{% include "location/edit/panes/location_view_edit_form.html" %}</div><div class="text-center" >- <button id="hi-add-location-view-button" type="submit" class="btn btn-info"+ <button id="hi-add-location-view-button" type="submit" class="btn btn-primary"name="action" value="update">UPDATE</button>diff --git a/src/hi/apps/location/templates/location/edit/panes/location_view_edit_form.html b/src/hi/apps/location/templates/location/edit/panes/location_view_edit_form.htmlindex 3255451c..84f42f66 100644--- a/src/hi/apps/location/templates/location/edit/panes/location_view_edit_form.html+++ b/src/hi/apps/location/templates/location/edit/panes/location_view_edit_form.html@@ -10,8 +10,11 @@</div>{% endif %}-<div class="form-group">- <label for="{{ location_view_edit_form.name.id_for_label }}">{{ location_view_edit_form.name.label }}</label>+<div class="input-group mb-2 mr-sm-2">+ <div class="input-group-prepend">+ <label for="{{ location_view_edit_form.name.id_for_label }}"+ class="input-group-text">{{ location_view_edit_form.name.label }}</label>+ </div>{{ location_view_edit_form.name }}<small class="form-error text-danger">{{ location_view_edit_form.name.errors }}</small></div>@@ -38,3 +41,29 @@{{ location_view_edit_form.svg_style_name_str.errors }}</div>+<div class="input-group mb-2 mr-sm-2">+ <div class="input-group-prepend">+ <label for="{{ location_view_edit_form.order_id.id_for_label }}"+ class="input-group-text">{{ location_view_edit_form.order_id.label }}</label>+ </div>+ {{ location_view_edit_form.order_id }}+ <small class="form-error text-danger">{{ location_view_edit_form.order_id.errors }}</small>+</div>++<div class="input-group mb-2 mr-sm-2">+ <div class="input-group-prepend">+ <label for="{{ location_view_edit_form.svg_view_box_str.id_for_label }}"+ class="input-group-text">{{ location_view_edit_form.svg_view_box_str.label }}</label>+ </div>+ {{ location_view_edit_form.svg_view_box_str }}+ <small class="form-error text-danger">{{ location_view_edit_form.svg_view_box_str.errors }}</small>+</div>++<div class="input-group mb-2 mr-sm-2">+ <div class="input-group-prepend">+ <label for="{{ location_view_edit_form.svg_rotate.id_for_label }}"+ class="input-group-text">{{ location_view_edit_form.svg_rotate.label }}</label>+ </div>+ {{ location_view_edit_form.svg_rotate }}+ <small class="form-error text-danger">{{ location_view_edit_form.svg_rotate.errors }}</small>+</div>diff --git a/src/hi/apps/location/templates/location/edit/panes/location_view_edit_header.html b/src/hi/apps/location/templates/location/edit/panes/location_view_edit_header.htmlindex 17d0ca4f..6415aa66 100644--- a/src/hi/apps/location/templates/location/edit/panes/location_view_edit_header.html+++ b/src/hi/apps/location/templates/location/edit/panes/location_view_edit_header.html@@ -1,8 +1,8 @@<div class="d-flex justify-content-between">- <div class="h4"><small>View:</small> {{ request.view_parameters.location_view.name }}</div>+ <div class="h5"><small>View:</small> {{ request.view_parameters.location_view.name }}</div><div><a href="{% url 'location_view_details' location_view_id=request.view_parameters.location_view.id %}"- class="btn btn-tertiary" role="button" data-async="true">+ class="btn btn-sm btn-tertiary" role="button" data-async="true">EDIT</a></div>diff --git a/src/hi/apps/location/templates/location/edit/panes/location_view_entity_toggle.html b/src/hi/apps/location/templates/location/edit/panes/location_view_entity_toggle.htmlindex 89f3f44c..b4d1af80 100644--- a/src/hi/apps/location/templates/location/edit/panes/location_view_entity_toggle.html+++ b/src/hi/apps/location/templates/location/edit/panes/location_view_entity_toggle.html@@ -1,5 +1,5 @@<div id="hi-entity-toggle-location-{{ entity.id }}"- class="d-flex justify-content-start">+ class="d-flex justify-content-start ml-1"><div class=""><form method="POST" role="form"action="{% url 'location_edit_location_view_entity_toggle' location_view_id=location_view.id entity_id=entity.id %}"diff --git a/src/hi/apps/location/templates/location/edit/panes/location_view_manage_items.html b/src/hi/apps/location/templates/location/edit/panes/location_view_manage_items.htmlindex f55d3155..4f18ad33 100644--- a/src/hi/apps/location/templates/location/edit/panes/location_view_manage_items.html+++ b/src/hi/apps/location/templates/location/edit/panes/location_view_manage_items.html@@ -1,5 +1,4 @@<div>-{% if request.view_parameters.is_editing %}{% include "edit/panes/side_header.html" %}{% endif %}@@ -7,7 +6,7 @@<hr /><div class="h4">Display Items</div>- <div class="">+ <div class="my-2"><a href="{% url 'entity_edit_entity_add' %}"class="btn btn-success btn-control" role="button"data-async="modal" >diff --git a/src/hi/apps/location/templates/location/panes/location_details.html b/src/hi/apps/location/templates/location/panes/location_details.htmlindex 1613df7f..09a7edc2 100644--- a/src/hi/apps/location/templates/location/panes/location_details.html+++ b/src/hi/apps/location/templates/location/panes/location_details.html@@ -1,5 +1,5 @@<div class="d-flex justify-content-between my-2">- <div class="align-self-center h4">Location</h5></div>+ <div class="align-self-center h4">Location</div><div class="align-self-center"><a href="{% url 'edit_item_details_close' %}"class="btn btn-tertiary" role="button" data-async="true">diff --git a/src/hi/apps/location/templates/location/panes/location_view_buttons.html b/src/hi/apps/location/templates/location/panes/location_view_buttons.htmlindex 4e5e3012..ac7c39d4 100644--- a/src/hi/apps/location/templates/location/panes/location_view_buttons.html+++ b/src/hi/apps/location/templates/location/panes/location_view_buttons.html@@ -1,18 +1,18 @@<div class="d-flex justify-content-start draggable-container">{% for location_view in location_view_list %}<div id="{{ location_view.html_id }}-button"- class="{% if request.view_parameters.is_editing %}draggable{% endif %}"+ class="{% if request.view_parameters.is_editing %}draggable{% endif %} mx-1"{% if request.view_parameters.is_editing %}draggable="true"{% endif %}><a href="{% url 'location_view' location_view_id=location_view.id %}"- class="btn {% if location_view == request.view_parameters.location_view %}btn-primary{% else %}btn-info{% endif %} btn-control"+ class="btn {% if location_view == request.view_parameters.active_location_view %}btn-secondary{% else %}btn-primary{% endif %} btn-control"role="button" >{{ location_view.name }}</a></div>{% endfor %}{% if request.view_parameters.is_editing %}- <div class="">+ <div class="ml-3"><a href="{% url 'location_edit_location_view_add' %}"class="btn btn-success btn-control" role="button"data-async="modal" >diff --git a/src/hi/apps/security/templates/security/panes/security_state_control.html b/src/hi/apps/security/templates/security/panes/security_state_control.htmlindex 6de894d2..51b94079 100644--- a/src/hi/apps/security/templates/security/panes/security_state_control.html+++ b/src/hi/apps/security/templates/security/panes/security_state_control.html@@ -1,15 +1,17 @@<div id="{{ DIVID.SECURITY_STATE_CONTROL }}">- <div>SECURITY STATE</div>+ <div class="h6 text-center">Security State</div>{% for action_value, action_label in security_status_data.security_state_action_choices %}- <a class="btn {% if action_value == security_status_data.current_action_value %}btn-primary{% else %}btn-info{% endif %} btn-control"- href="{% url 'security_state_action' action=action_value %} "- data-async="#{{ DIVID.SECURITY_STATE_CONTROL }}" data-mode="replace">- {% if action_value == security_status_data.current_action_value %}- {{ security_status_data.current_action_label }}- {% else %}- {{ action_label }}- {% endif %}- </a>+ <div class="my-1">+ <a class="btn {% if action_value == security_status_data.current_action_value %}btn-secondary{% else %}btn-primary{% endif %} btn-control"+ href="{% url 'security_state_action' action=action_value %} "+ data-async="#{{ DIVID.SECURITY_STATE_CONTROL }}" data-mode="replace">+ {% if action_value == security_status_data.current_action_value %}+ {{ security_status_data.current_action_label }}+ {% else %}+ {{ action_label }}+ {% endif %}+ </a>+ </div>{% empty %}<div class="dropdown-item alert alert-secondary text-center"><em>No security states.</em>diff --git a/src/hi/integrations/templates/integrations/pages/integration_manage.html b/src/hi/integrations/templates/integrations/pages/integration_manage.htmlindex b75fe960..288f46ac 100644--- a/src/hi/integrations/templates/integrations/pages/integration_manage.html+++ b/src/hi/integrations/templates/integrations/pages/integration_manage.html@@ -16,7 +16,7 @@<div class="d-flex justify-content-between"><div class="h3">{{ core.integration_data.label }}</div><div>- <a class="btn btn-info" role="button"+ <a class="btn btn-primary" role="button"href="{% url 'integrations_select' %}"data-async="modal">SELECT INTEGRATIONSdiff --git a/src/hi/integrations/templates/integrations/pages/no_integrations.html b/src/hi/integrations/templates/integrations/pages/no_integrations.htmlindex fe9abe4b..12757adf 100644--- a/src/hi/integrations/templates/integrations/pages/no_integrations.html+++ b/src/hi/integrations/templates/integrations/pages/no_integrations.html@@ -4,7 +4,7 @@There are no integrations currently registered.</div><div>- <a class="btn btn-info" role="button"+ <a class="btn btn-primary" role="button"href="{% url 'integrations_select' %}"data-async="modal">ADD INTEGRATIONSdiff --git a/src/hi/services/hass/templates/hass/panes/hass_settings.html b/src/hi/services/hass/templates/hass/panes/hass_settings.htmlindex 07ded564..04f5246a 100644--- a/src/hi/services/hass/templates/hass/panes/hass_settings.html+++ b/src/hi/services/hass/templates/hass/panes/hass_settings.html@@ -9,7 +9,7 @@{% include "attribute/panes/attribute_form.html" with attribute_formset=integration_attribute_formset %}</div>- <button id="hi-hass-setting-button" type="submit" class="btn btn-info"+ <button id="hi-hass-setting-button" type="submit" class="btn btn-primary"name="action" value="update">UPDATE</button>diff --git a/src/hi/services/zoneminder/templates/zoneminder/panes/zm_settings.html b/src/hi/services/zoneminder/templates/zoneminder/panes/zm_settings.htmlindex f54b59f7..40f68576 100644--- a/src/hi/services/zoneminder/templates/zoneminder/panes/zm_settings.html+++ b/src/hi/services/zoneminder/templates/zoneminder/panes/zm_settings.html@@ -9,7 +9,7 @@{% include "attribute/panes/attribute_form.html" with attribute_formset=integration_attribute_formset %}</div>- <button id="hi-zm-setting-button" type="submit" class="btn btn-info"+ <button id="hi-zm-setting-button" type="submit" class="btn btn-primary"name="action" value="update">UPDATE</button>diff --git a/src/hi/simulator/templates/simulator/panes/sim_entity.html b/src/hi/simulator/templates/simulator/panes/sim_entity.htmlindex 4cef0f8c..527812d2 100644--- a/src/hi/simulator/templates/simulator/panes/sim_entity.html+++ b/src/hi/simulator/templates/simulator/panes/sim_entity.html@@ -11,7 +11,7 @@</div><div class="col-2"><a href="{% url 'simulator_entity_edit' sim_entity_id=sim_entity.id %}"- class="btn btn-info" data-async="modal">EDIT</a>+ class="btn btn-primary" data-async="modal">EDIT</a><a href="{% url 'simulator_entity_delete' sim_entity_id=sim_entity.id %}"class="btn btn-danger" data-async="modal">X</a></div>diff --git a/src/hi/simulator/templates/simulator/panes/sim_profile_header.html b/src/hi/simulator/templates/simulator/panes/sim_profile_header.htmlindex fb6da911..4343db3e 100644--- a/src/hi/simulator/templates/simulator/panes/sim_profile_header.html+++ b/src/hi/simulator/templates/simulator/panes/sim_profile_header.html@@ -9,7 +9,7 @@<small>Profile: </small> {{ current_sim_profile.name }}</div><div class="">- <a role="button" class="btn btn-info"+ <a role="button" class="btn btn-primary"href="{% url 'simulator_profile_edit' profile_id=current_sim_profile.id %}"data-async="modal">RENAME: {{ current_sim_profile.name }}diff --git a/src/hi/static/css/main.css b/src/hi/static/css/main.cssindex e6916b17..ec28fce5 100644--- a/src/hi/static/css/main.css+++ b/src/hi/static/css/main.css@@ -3,8 +3,7 @@All Rights Reserved.*/:root {- --white-fg-color: #fdfdfd;- --white-bg-color: #fdfdfd;+ --white-color: #fdfdfd;--black: #020204;--primary-color: #177072;--on-primary-color: #ffffff;@@ -24,7 +23,10 @@--muted-color: #7e7e81;--on-muted-color: #ffffff;--line-color: #cccccc;- --edit-bg-color: #f9f9ff;+ --edit-bg-color: #ffd0c3;+ --edit-side-bg-color: #dffeff;+ --edit-top-bg-color: #f0f0f0;+ --edit-bottom-bg-color: #f0f0f0;--top-buttons-height: 2.5rem;--bottom-buttons-height: 2.5rem;@@ -60,7 +62,7 @@ html, body {padding: 0;height: 100%;color: #222233;- background-color: var(--white-bg-color);+ background-color: var(--white-color);}a { color: var(--primary-color); }@@ -89,18 +91,18 @@ a.underline:visited {color: var(--on-primary-color) !important;}.text-white {- color: var(--white-fg-color) !important;+ color: var(--white-color) !important;}.text-black {color: var(--black);}-.bg-primary, .btn-primary {+.bg-primary, .bg-info, .btn-primary, .btn-info {color: var(--on-primary-color) !important;background-color: var(--primary-color) !important;border-color: var(--primary-highlight-color) !important;}-.bg-primary a {+.bg-primary a, .bg-info a, .btn-primary a, .btn-info a {color: color: var(--on-primary-color);}.bg-primary a:hover,@@ -123,10 +125,7 @@ a.underline:visited {}.bg-secondary a:hover,.bg-secondary a:focus,-.bg-secondary a:active,-.bg-info a:hover,-.bg-info a:focus,-.bg-info a:active {+.bg-secondary a:active {opacity: 0.65;color: color: var(--on-secondary-color);}@@ -141,14 +140,29 @@ a.underline:visited {}.bg-tertiary a:hover,.bg-tertiary a:focus,-.bg-tertiary a:active,-.bg-info a:hover,-.bg-info a:focus,-.bg-info a:active {+.bg-tertiary a:active {opacity: 0.65;color: color: var(--on-tertiary-color);}+.bg-danger, .btn-error, .btn-danger {+ color: var(--on-error-color) !important;+ background-color: var(--error-color) !important;+ border-color: var(--error-highlight-color) !important;+}+.bg-danger a, .btn-error a, .btn-danger a {+ color: color: var(--on-error-color);+}+.bg-error a:hover,+.bg-error a:focus,+.bg-error a:active,+.bg-danger a:hover,+.bg-danger a:focus,+.bg-danger a:active {+ opacity: 0.65;+ color: color: var(--on-error-color);+}+.bg-muted, .btn-muted {color: var(--on-muted-color) !important;background-color: var(--muted-color) !important;@@ -187,9 +201,36 @@ a.underline:visited {}#hi-top-content img,#hi-bottom-content img {- max-height: 2.25rem;+ max-height: 2rem;width: auto;}+#hi-side-content {+ height: calc(100vh - var(--top-buttons-height) - var(--bottom-buttons-height));+ display: flex;+ flex-direction: column;+ overflow-y: auto;+}++#hi-top-content,+#hi-bottom-content,+.hi-screen {+ background: var(--white-color);+}++#hi-top-content[hi-edit="True"] {+ background: var(--edit-top-bg-color);+}+#hi-bottom-content[hi-edit="True"] {+ background: var(--edit-bottom-bg-color);+}+.hi-screen[hi-edit="True"] {+ background: var(--edit-bg-color);+}+.hi-screen[hi-edit="True"] .hi-side {+ background: var(--edit-side-bg-color);+}++.hi-screen {max-height: 100vh;}@@ -243,8 +284,8 @@ a.underline:visited {}.plus-icon {font-size: 1.5rem;- color: var(--on-status-ok-color);- background-color: var(--status-ok-color);+ color: var(--on-primary-color);+ background-color: var(--primary-color);padding: 0 0.25rem 0 0.25rem;}#hi-server-error-msg {@@ -277,9 +318,6 @@ a.underline:visited {border-bottom-right-radius: 0.8rem;text-align: center;}-.hi-edit-bg {- background: var(--edit-bg-color);-}svg[action-state="move"] {cursor: move;diff --git a/src/hi/templates/pages/hi_grid.html b/src/hi/templates/pages/hi_grid.htmlindex 6754ee98..4d879a83 100644--- a/src/hi/templates/pages/hi_grid.html+++ b/src/hi/templates/pages/hi_grid.html@@ -3,22 +3,22 @@{% block content %}-<div id="{{ DIVID.TOP }}" class="fixed-top">+<div id="{{ DIVID.TOP }}" class="fixed-top" hi-edit="{{ request.view_parameters.is_editing }}">{% include top_template_name %}</div>-<div id="{{ DIVID.BOTTOM }}" class="fixed-bottom">+<div id="{{ DIVID.BOTTOM }}" class="fixed-bottom" hi-edit="{{ request.view_parameters.is_editing }}">{% include bottom_template_name %}</div>-<div class="container-fluid hi-screen">+<div class="container-fluid hi-screen" hi-edit="{{ request.view_parameters.is_editing }}"><div class="row"><div class="col-9 scrollable-column "><div id="{{ DIVID.MAIN }}">{% include main_template_name %}</div></div>- <div class="col-3 fixed-column {% if request.view_parameters.is_editing %}hi-edit-bg{% endif %}">+ <div class="col-3 fixed-column hi-side"><div id="{{ DIVID.SIDE }}">{% include side_template_name %}</div>diff --git a/src/hi/templates/pages/main_default.html b/src/hi/templates/pages/main_default.htmlindex 4491868b..e9323417 100644--- a/src/hi/templates/pages/main_default.html+++ b/src/hi/templates/pages/main_default.html@@ -1,8 +1,16 @@{% extends "pages/base.html" %}-{% load pipeline %}+{% load static %}{% block content %}-<h1>Home Information</h1>--+<div class="container-fluid hi-interstitial-page">++ <div class="hi-interstitial-page-content">+ <div class="">+ <img class="img-fluid" src="{% static 'img/hi-logo-467x200.png' %}" alt="Home Information Logo" />+ </div>+ <div class="">+ <em>Your home, your data, organized.</em>+ </div>+ </div>+</div>{% endblock %}diff --git a/src/hi/templates/pages/start.html b/src/hi/templates/pages/start.htmlindex 7236fe61..65c67e6d 100644--- a/src/hi/templates/pages/start.html+++ b/src/hi/templates/pages/start.html@@ -19,7 +19,7 @@</p><div class=""><a role="button" class="btn btn-primary"- href="{% url 'location_edit_location_add' %}"+ href="{% url 'location_edit_location_add_first' %}"data-async="modal">ADD MY LOCATION</a>diff --git a/src/hi/templates/panes/bottom_buttons.html b/src/hi/templates/panes/bottom_buttons.htmlindex 9f4e25d9..7dc920d6 100644--- a/src/hi/templates/panes/bottom_buttons.html+++ b/src/hi/templates/panes/bottom_buttons.html@@ -1,17 +1,17 @@-<div class="bg-white p-1">+<div class="p-1"><div class="d-flex justify-content-between">{% include "collection/panes/collection_buttons.html" %}<div class="d-flex justify-content-end">- <div>+ <div class="mx-1">{% include "console/panes/audio_control.html" %}</div>- <div>+ <div class="mx-1">{% include "console/panes/sleep_mode_control.html" %}</div>- <div>+ <div class="mx-1">{% include "console/panes/console_lock_button.html" %}</div>- <div>+ <div class="mx-1"><a href="{% url 'config_settings' %}"class="btn btn-tertiary btn-control" role="button"data-async="true" >diff --git a/src/hi/templates/panes/top_buttons.html b/src/hi/templates/panes/top_buttons.htmlindex f8dbd9b0..d7e5d5b5 100644--- a/src/hi/templates/panes/top_buttons.html+++ b/src/hi/templates/panes/top_buttons.html@@ -1,5 +1,5 @@{% load static %}-<div class="bg-white p-1">+<div class="p-1"><div class="d-flex justify-content-between">{% include "location/panes/location_view_buttons.html" %}<div>@@ -7,7 +7,7 @@</div><div class="d-flex justify-content-end">{% include "location/panes/location_dropdown.html" %}- <div>+ <div class="px-1">{% if request.view_parameters.is_editing %}<a href="{% url 'edit_end' %}"class="btn btn-tertiary btn-control" role="button" >diff --git a/src/hi/view_parameters.py b/src/hi/view_parameters.pyindex 98a2810b..b3c416eb 100644--- a/src/hi/view_parameters.py+++ b/src/hi/view_parameters.py@@ -76,7 +76,13 @@ class ViewParameters:self._location_view = location_viewself._location = location_view.locationreturn-++ @property+ def active_location_view(self) -> Collection:+ if self.view_type != ViewType.LOCATION_VIEW:+ return None+ return self.location_view+@propertydef collection(self) -> Collection:if self._collection:@@ -99,6 +105,12 @@ class ViewParameters:self._collection = collectionreturn+ @property+ def active_collection(self) -> Collection:+ if self.view_type != ViewType.COLLECTION:+ return None+ return self.collection+def to_session( self, request : HttpRequest ):if not hasattr( request, 'session' ):return