Home Information - Your home, your data, organized.
Python
Edit mode item selection improvements (#226)
Tony C4caf08f31482
diff --git a/Makefile b/Makefileindex 15a8c20e..5d0488c9 100644--- a/Makefile+++ b/Makefile@@ -7,10 +7,10 @@ SCRIPTS = deploy/env-generate.py deploy/run_container.sh.DEFAULT_GOAL := fix-permissionstest:- cd src && ./manage.py test --keepdb $(filter-out $@,$(MAKECMDGOALS))+ cd src && ./manage.py test --keepdbtest-fast:- cd src && ./manage.py test --keepdb --parallel 4 $(filter-out $@,$(MAKECMDGOALS))+ cd src && ./manage.py test --keepdb --parallel 4lint:cd src && flake8 --config=.flake8-ci hi/ 2>/dev/null@@ -54,6 +54,4 @@ fix-permissions:@echo "Setting execute permissions for $(SCRIPTS)"chmod +x $(SCRIPTS)-%:- @:diff --git a/src/hi/apps/collection/collection_manager.py b/src/hi/apps/collection/collection_manager.pyindex a1c14599..97074911 100644--- a/src/hi/apps/collection/collection_manager.py+++ b/src/hi/apps/collection/collection_manager.py@@ -266,13 +266,18 @@ class CollectionManager(Singleton):collection_position_form = collection_position_form,)- def create_entity_collection_group_list( self, collection : Collection ) -> List[EntityCollectionGroup]:+ def create_entity_collection_group_list( self,+ collection : Collection,+ unused_entity_ids : set = None ) -> List[EntityCollectionGroup]:entity_queryset = Entity.objects.all()-++ if unused_entity_ids is None:+ unused_entity_ids = set()+entity_collection_group_dict = dict()for entity in entity_queryset:-+exists_in_collection = Falsefor collection_entity in entity.collections.all():if collection_entity.collection == collection:@@ -283,6 +288,7 @@ class CollectionManager(Singleton):entity_collection_item = EntityCollectionItem(entity = entity,exists_in_collection = exists_in_collection,+ is_unused = entity.id in unused_entity_ids,)entity_group_type = EntityGroupType.from_entity_type( entity.entity_type )@@ -362,6 +368,7 @@ class CollectionManager(Singleton):continuereturn+def create_location_collection_view_group( self, location_view : LocationView ) -> CollectionViewGroup:existing_collections = [ x.collectionfor x in location_view.collection_views.select_related('collection').all() ]@@ -371,10 +378,10 @@ class CollectionManager(Singleton):existing_collections : List[ Collection ] ) -> CollectionViewGroup:existing_collection_set = set( existing_collections )collection_queryset = Collection.objects.all()-+collection_view_group = CollectionViewGroup()for collection in collection_queryset:-+collection_view_item = CollectionViewItem(collection = collection,exists_in_view = bool( collection in existing_collection_set ),diff --git a/src/hi/apps/collection/edit/tests/test_views.py b/src/hi/apps/collection/edit/tests/test_views.pyindex 77599f31..75ded4be 100644--- a/src/hi/apps/collection/edit/tests/test_views.py+++ b/src/hi/apps/collection/edit/tests/test_views.py@@ -513,12 +513,8 @@ class TestCollectionManageItemsView(SyncViewTestCase):self.assertIn('insert', data)self.assertIn('hi-side-content', data['insert'])- # Verify the manage items view rendered with entity groups- side_content = data['insert']['hi-side-content']- self.assertIn('Items in Collection', side_content)- self.assertIn('Test Entity 1', side_content)- self.assertIn('Test Entity 2', side_content)-+ return+def test_post_not_allowed(self):"""Test that POST requests are not allowed."""# Ensure this collection is the default by setting order_id=0diff --git a/src/hi/apps/collection/edit/views.py b/src/hi/apps/collection/edit/views.pyindex 088411a2..387133ce 100644--- a/src/hi/apps/collection/edit/views.py+++ b/src/hi/apps/collection/edit/views.py@@ -241,10 +241,13 @@ class CollectionManageItemsView( HiSideView ):return 'collection/edit/panes/collection_manage_items.html'def get_template_context( self, request, *args, **kwargs ):+ from hi.apps.edit.edit_view_helpers import EditViewHelperscollection = CollectionManager().get_default_collection( request = request )+ unused_entity_ids = EditViewHelpers.get_unused_entity_ids()entity_collection_group_list = CollectionManager().create_entity_collection_group_list(collection = collection,+ unused_entity_ids = unused_entity_ids,)return {'entity_collection_group_list': entity_collection_group_list,@@ -283,11 +286,16 @@ class CollectionEntityToggleView( View, CollectionViewMixin, EntityViewMixin ):entity = entity,collection = collection,)-++ # Check if entity is unused (not in any location and not in any collection)+ from hi.apps.edit.edit_view_helpers import EditViewHelpers+ is_unused = EditViewHelpers.is_entity_unused(entity.id)+context = {'collection': collection,'entity': entity,'exists_in_collection': exists_in_collection,+ 'is_unused': is_unused,}template = get_template( 'collection/edit/panes/collection_entity_toggle.html' )main_content = template.render( context, request = request )diff --git a/src/hi/apps/collection/templates/collection/edit/panes/collection_edit_mode_header.html b/src/hi/apps/collection/templates/collection/edit/panes/collection_edit_mode_header.htmlindex a265502d..0d8178fc 100644--- a/src/hi/apps/collection/templates/collection/edit/panes/collection_edit_mode_header.html+++ b/src/hi/apps/collection/templates/collection/edit/panes/collection_edit_mode_header.html@@ -1,9 +1,16 @@-<div class="d-flex justify-content-between">- <div class="h5"><small>Collection:</small> {{ request.view_parameters.collection.name }}</div>- <div>- <a href="{% url 'collection_edit_mode' collection_id=request.view_parameters.collection_id %}"- class="btn btn-sm btn-tertiary" role="button" data-async="true">- EDIT- </a>- </div>+{% load icons %}+{% if request.view_parameters.collection_id %}+<div class="mx-1 my-2">+ <a href="{% url 'collection_edit_mode' collection_id=request.view_parameters.collection_id %}"+ class="btn btn-primary w-100" role="button" data-async="true">+ {% icon "edit" size="md" css_class="" %}+ <small>Edit:</small> {{ request.view_parameters.collection.name }}+ </a></div>+{% else %}+<div class="alert alert-info mx-1 my-2">+ No collection selected.+</div>+{% endif %}++diff --git a/src/hi/apps/collection/templates/collection/edit/panes/collection_edit_mode_panel.html b/src/hi/apps/collection/templates/collection/edit/panes/collection_edit_mode_panel.htmlindex 08800868..a1cf3f42 100644--- a/src/hi/apps/collection/templates/collection/edit/panes/collection_edit_mode_panel.html+++ b/src/hi/apps/collection/templates/collection/edit/panes/collection_edit_mode_panel.html@@ -1,9 +1,10 @@+{% load icons %}<div class="d-flex justify-content-between my-2">- <div class="align-self-center h4">Collection</div>+ <div class="align-self-center h4">Collection Edit</div><div class="align-self-center "><a href="{% url 'edit_item_details_close' %}"- class="btn btn-tertiary" role="button" data-async="true">- X+ class="btn btn-sm btn-outline-danger" role="button" data-async="true">+ {% icon "close" size="sm" css_class="" %}</a></div></div>@@ -20,7 +21,7 @@<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">+ class="btn btn-sm btn-danger btn-block btn-control" role="button" data-async="true">DELETE COLLECTION</a></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 4647590b..5df2f56c 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,14 +1,21 @@<div id="hi-entity-toggle-collection-{{ entity.id }}"- 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 %}"- data-async="#hi-entity-toggle-collection-{{ entity.id }}" data-mode="replace" >- {% csrf_token %}- <input type="checkbox" id="entity-toggle-collection-checkbox-{{ entity.id }}" name="checkbox_state"- {% if exists_in_collection %}checked{% endif %}- onchange-async="true" >- <label for="entity-toggle-collection-checkbox-{{ entity.id }}">{{ entity.name }} <small>[{{ entity.integration_id }}]</small></label>- </form>- </div>+ class="{{ DIVID.ENTITY_PICKER_FILTERABLE_ITEM_CLASS }} entity-item-row{% if is_unused %} unused{% elif exists_in_collection %} in-view{% endif %}"+ data-entity-id="{{ entity.id }}"+ {{ DIVID.ENTITY_PICKER_DATA_NAME_ATTR }}="{{ entity.name }}"+ {{ DIVID.ENTITY_PICKER_DATA_TYPE_ATTR }}="{{ entity.entity_type }}"+ {{ DIVID.ENTITY_PICKER_DATA_STATUS_ATTR }}="{% if is_unused %}{{ DIVID.ENTITY_PICKER_STATUS_UNUSED }}{% elif exists_in_collection %}{{ DIVID.ENTITY_PICKER_STATUS_IN_VIEW }}{% else %}{{ DIVID.ENTITY_PICKER_STATUS_NOT_IN_VIEW }}{% endif %}"+ data-item-type="entity">+ <form method="POST" role="form"+ action="{% url 'collection_edit_collection_entity_toggle' collection_id=collection.id entity_id=entity.id %}"+ data-async="#hi-entity-toggle-collection-{{ entity.id }}" data-mode="replace" >+ {% csrf_token %}+ <input type="checkbox" id="entity-toggle-collection-checkbox-{{ entity.id }}"+ name="checkbox_state"+ class="entity-item-checkbox"+ {% if exists_in_collection %}checked{% endif %}+ onchange-async="true" >+ <label for="entity-toggle-collection-checkbox-{{ entity.id }}" class="entity-item-label">+ {{ entity.name }} <span class="entity-item-id">[{{ entity.integration_id }}]</span>+ </label>+ </form></div>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 36f04c96..95c78910 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@@ -3,47 +3,49 @@{% endfor %}{% if collection_form.non_field_errors %}-<div class="non-field-errors">+<div class="sidebar-form-errors">{% for err in collection_form.non_field_errors %}- <p class="form-error text-danger">ERROR: {{ err }}</p>+ <p class="sidebar-form-error">ERROR: {{ err }}</p>{% endfor %}</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 class="sidebar-form-field">+ <label for="{{ collection_form.name.id_for_label }}" class="sidebar-form-label">{{ collection_form.name.label }}</label>+ <input type="text" id="{{ collection_form.name.id_for_label }}" name="{{ collection_form.name.name }}" value="{{ collection_form.name.value|default:'' }}" class="sidebar-form-input">+ {% if collection_form.name.errors %}+ <div class="sidebar-form-error">{{ collection_form.name.errors }}</div>+ {% endif %}</div>-<div class="hi-custom-select">- <div class="input-group mb-2 mr-sm-2 ">- <div class="input-group-prepend">- <div class="input-group-text">{{ collection_form.collection_type_str.label_tag }}</div>- </div>- {{ collection_form.collection_type_str }}- </div>- {{ collection_form.collection_type_str.errors }}+<div class="sidebar-form-field">+ <label for="{{ collection_form.collection_type_str.id_for_label }}" class="sidebar-form-label">{{ collection_form.collection_type_str.label }}</label>+ <select id="{{ collection_form.collection_type_str.id_for_label }}" name="{{ collection_form.collection_type_str.name }}" class="sidebar-form-input">+ {% for value, label in collection_form.collection_type_str.field.choices %}+ <option value="{{ value }}"{% if collection_form.collection_type_str.value == value %} selected{% endif %}>{{ label }}</option>+ {% endfor %}+ </select>+ {% if collection_form.collection_type_str.errors %}+ <div class="sidebar-form-error">{{ collection_form.collection_type_str.errors }}</div>+ {% endif %}</div>-<div class="hi-custom-select">- <div class="input-group mb-2 mr-sm-2">- <div class="input-group-prepend">- <div class="input-group-text">{{ collection_form.collection_view_type_str.label_tag }}</div>- </div>- {{ collection_form.collection_view_type_str }}- </div>- {{ collection_form.collection_view_type_str.errors }}+<div class="sidebar-form-field">+ <label for="{{ collection_form.collection_view_type_str.id_for_label }}" class="sidebar-form-label">{{ collection_form.collection_view_type_str.label }}</label>+ <select id="{{ collection_form.collection_view_type_str.id_for_label }}" name="{{ collection_form.collection_view_type_str.name }}" class="sidebar-form-input">+ {% for value, label in collection_form.collection_view_type_str.field.choices %}+ <option value="{{ value }}"{% if collection_form.collection_view_type_str.value == value %} selected{% endif %}>{{ label }}</option>+ {% endfor %}+ </select>+ {% if collection_form.collection_view_type_str.errors %}+ <div class="sidebar-form-error">{{ collection_form.collection_view_type_str.errors }}</div>+ {% endif %}</div>-<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 }}- <small class="form-error text-danger">{{ collection_form.order_id.errors }}</small>+<div class="sidebar-form-field">+ <label for="{{ collection_form.order_id.id_for_label }}" class="sidebar-form-label">{{ collection_form.order_id.label }}</label>+ <input type="number" id="{{ collection_form.order_id.id_for_label }}" name="{{ collection_form.order_id.name }}" value="{{ collection_form.order_id.value|default:'' }}" class="sidebar-form-input">+ {% if collection_form.order_id.errors %}+ <div class="sidebar-form-error">{{ collection_form.order_id.errors }}</div>+ {% endif %}</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 80a626e9..ab615c73 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,29 +1,30 @@+{% extends "edit/panes/entity_picker.html" %}{% load icons %}-<div>- {% if request.view_parameters.is_editing %}- {% include "edit/panes/side_header.html" %}- {% endif %}-- <hr />- <div class="h5">Items in Collection</div>-- <div class="my-2">- <a href="{% url 'entity_edit_entity_add' %}"- class="btn btn-primary btn-control" role="button"- data-async="modal" >- {% icon "plus" size="sm" css_class="hi-icon-left" %}ADD NEW ITEM- </a>++{% block header %}+<div class="mt-2">+ {% include "collection/edit/panes/collection_edit_mode_header.html" %}+</div>+{% endblock %}++{% block entity_groups %}+{% for entity_collection_group in entity_collection_group_list %}+<div class="{{ DIVID.ENTITY_PICKER_GROUP_SECTION_CLASS }}" data-group="{{ entity_collection_group.entity_group_type.label|slugify }}">+ <div class="entity-group-header"+ data-toggle="collapse"+ data-target="#group-{{ entity_collection_group.entity_group_type.label|slugify }}"+ aria-expanded="true"+ aria-controls="group-{{ entity_collection_group.entity_group_type.label|slugify }}">+ <span class="entity-group-title">{{ entity_collection_group.entity_group_type.label }}</span>+ {% icon "chevron-down" css_class="entity-group-toggle" %}</div>--- {% for entity_collection_group in entity_collection_group_list %}- <div class="">- <div class="h5">{{ entity_collection_group.entity_group_type.label }}</div>+ <div class="entity-group-items collapse show" id="group-{{ entity_collection_group.entity_group_type.label|slugify }}">{% 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 %}+ {% 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 is_unused=entity_collection_item.is_unused %}{% endfor %}</div>- {% empty %}- {% include "edit/panes/no_entities_message.html" %}- {% endfor %}</div>+{% empty %}+{% include "edit/panes/no_entities_message.html" %}+{% endfor %}+{% endblock %}diff --git a/src/hi/apps/collection/templates/collection/edit/panes/collection_properties_edit.html b/src/hi/apps/collection/templates/collection/edit/panes/collection_properties_edit.htmlindex 207cdd0a..d20108cc 100644--- a/src/hi/apps/collection/templates/collection/edit/panes/collection_properties_edit.html+++ b/src/hi/apps/collection/templates/collection/edit/panes/collection_properties_edit.html@@ -6,8 +6,8 @@<div>{% include "collection/edit/panes/collection_form.html" with collection_form=collection_edit_form %}</div>- <div class="text-center" >- <button id="hi-add-collection-edit-button" type="submit" class="btn btn-primary"+ <div class="sidebar-form-actions">+ <button id="hi-add-collection-edit-button" type="submit" class="btn btn-primary btn-block"name="action" value="update">UPDATE</button>diff --git a/src/hi/apps/collection/tests/test_collection_manager.py b/src/hi/apps/collection/tests/test_collection_manager.pyindex 19d973db..e967d67c 100644--- a/src/hi/apps/collection/tests/test_collection_manager.py+++ b/src/hi/apps/collection/tests/test_collection_manager.py@@ -66,7 +66,7 @@ class TestCollectionManagerIntegration(BaseTestCase):CollectionEntity.objects.create(collection=collection, entity=light1)manager = CollectionManager()- groups = manager.create_entity_collection_group_list(collection)+ groups = manager.create_entity_collection_group_list(collection, unused_entity_ids=set())# Should have groups for each entity type present in systemgroup_types = {group.entity_group_type for group in groups}diff --git a/src/hi/apps/collection/transient_models.py b/src/hi/apps/collection/transient_models.pyindex 5f8a53d5..735e51ba 100644--- a/src/hi/apps/collection/transient_models.py+++ b/src/hi/apps/collection/transient_models.py@@ -40,6 +40,7 @@ class EntityCollectionItem:entity : Entityexists_in_collection : bool+ is_unused : bool = False@dataclassdiff --git a/src/hi/apps/edit/edit_view_helpers.py b/src/hi/apps/edit/edit_view_helpers.pynew file mode 100644index 00000000..f05aa328--- /dev/null+++ b/src/hi/apps/edit/edit_view_helpers.py@@ -0,0 +1,72 @@+from hi.apps.entity.models import Entity, EntityView, EntityPosition, EntityPath+from hi.apps.collection.models import CollectionEntity+++class EditViewHelpers:+ """+ Helper utilities for edit mode functionality across all modules.++ Centralizes unused detection logic and other edit-mode utilities to avoid+ circular dependencies between modules. Since this is in the general edit+ module, it can safely depend on entity and collection modules.+ """++ @staticmethod+ def get_unused_entity_ids() -> set:+ """+ Return entity IDs that are neither visible in any location view+ nor in any collection.++ An entity is considered "unused" if it's not accessible through:+ 1. Being visible in any location view (has EntityView AND EntityPosition/EntityPath)+ 2. Membership in any collection (CollectionEntity)++ For efficiency, we approximate visibility as: has EntityView AND has EntityPosition OR EntityPath+ This may include some entities that aren't truly visible but is much faster to calculate.+ """+ # Get entities that have EntityView records (are in some view)+ in_view_ids = set(EntityView.objects.values_list('entity_id', flat=True))++ # Get entities that have position or path records+ positioned_ids = set(EntityPosition.objects.values_list('entity_id', flat=True))+ pathed_ids = set(EntityPath.objects.values_list('entity_id', flat=True))+ has_location_data_ids = positioned_ids | pathed_ids++ # Potentially visible = in a view AND has location data+ potentially_visible_ids = in_view_ids & has_location_data_ids++ # Get entities that are in any collection+ collection_member_ids = set(CollectionEntity.objects.values_list('entity_id', flat=True))++ # Get all entity IDs+ all_entity_ids = set(Entity.objects.values_list('id', flat=True))++ # Unused = not potentially visible AND not in any collection+ accessible_ids = potentially_visible_ids | collection_member_ids+ return all_entity_ids - accessible_ids++ @staticmethod+ def is_entity_unused(entity_id: int) -> bool:+ """+ Check if a single entity is unused (not visible in any location view+ and not in any collection).++ More efficient than get_unused_entity_ids() when checking just one entity.+ """+ # Check if entity is in any view+ has_view = EntityView.objects.filter(entity_id=entity_id).exists()+ if not has_view:+ # No view, but check if in collection+ has_collection = CollectionEntity.objects.filter(entity_id=entity_id).exists()+ return not has_collection++ # Has view, check if has location data+ has_position = EntityPosition.objects.filter(entity_id=entity_id).exists()+ has_path = EntityPath.objects.filter(entity_id=entity_id).exists()++ if has_position or has_path:+ return False # Potentially visible++ # Has view but no location data, check if in collection+ has_collection = CollectionEntity.objects.filter(entity_id=entity_id).exists()+ return not has_collectiondiff --git a/src/hi/apps/edit/templates/edit/panes/entity_picker.html b/src/hi/apps/edit/templates/edit/panes/entity_picker.htmlnew file mode 100644index 00000000..036e8019--- /dev/null+++ b/src/hi/apps/edit/templates/edit/panes/entity_picker.html@@ -0,0 +1,59 @@+{% load icons %}+<div class="entity-picker-container">+ <div class="entity-picker-panel">+ <div class="entity-picker-header">+ {% block header %}+ {# Override this block in child templates to add specific header content #}+ {% endblock %}++ <div class="d-flex justify-content-between align-items-center mb-2">+ <h4 class="mb-0">Items</h4>+ <div>+ <a href="{% url 'entity_edit_entity_add' %}"+ class="btn btn-primary btn-sm btn-control" role="button"+ data-async="modal" >+ {% icon "plus" size="sm" css_class="hi-icon-left" %}ADD NEW+ </a>+ </div>+ </div>++ <div class="search-container mb-3">+ <div class="input-group">+ <input type="text" id="{{ DIVID.ENTITY_PICKER_SEARCH_INPUT_ID }}" class="form-control entity-search-input"+ placeholder="Search items...">+ <div class="input-group-append">+ <button type="button" class="btn btn-outline-secondary {{ DIVID.ENTITY_PICKER_SEARCH_CLEAR_CLASS }}"+ title="Clear search">+ {% icon "close" size="sm" %}+ </button>+ </div>+ </div>+ </div>++ <div class="filter-toggles mb-3">+ <button class="{{ DIVID.ENTITY_PICKER_FILTER_BTN_CLASS }} active" {{ DIVID.ENTITY_PICKER_DATA_FILTER_ATTR }}="{{ DIVID.ENTITY_PICKER_FILTER_ALL }}">+ All+ </button>+ <button class="{{ DIVID.ENTITY_PICKER_FILTER_BTN_CLASS }}" {{ DIVID.ENTITY_PICKER_DATA_FILTER_ATTR }}="{{ DIVID.ENTITY_PICKER_STATUS_IN_VIEW }}">+ In View+ </button>+ <button class="{{ DIVID.ENTITY_PICKER_FILTER_BTN_CLASS }}" {{ DIVID.ENTITY_PICKER_DATA_FILTER_ATTR }}="{{ DIVID.ENTITY_PICKER_STATUS_NOT_IN_VIEW }}">+ Not in View+ </button>+ <button class="{{ DIVID.ENTITY_PICKER_FILTER_BTN_CLASS }}" {{ DIVID.ENTITY_PICKER_DATA_FILTER_ATTR }}="{{ DIVID.ENTITY_PICKER_STATUS_UNUSED }}">+ Unused+ </button>+ </div>+ </div>++ <div class="entity-picker-items" id="entity-picker-items">+ {% block entity_groups %}+ {# Override this block in child templates #}+ {% endblock %}++ {% block collections_section %}+ {# Override this block for location views that need collections section #}+ {% endblock %}+ </div>+ </div>+</div>\ No newline at end of filediff --git a/src/hi/apps/edit/templates/edit/panes/side_header.html b/src/hi/apps/edit/templates/edit/panes/side_header.htmldeleted file mode 100644index b0a0427d..00000000--- a/src/hi/apps/edit/templates/edit/panes/side_header.html+++ /dev/null@@ -1,14 +0,0 @@-<div>- {% if request.view_parameters.view_type.is_location_view %}- <div class="mt-2">- {% include "location/edit/panes/location_edit_mode_header.html" %}- </div>- <div class="mt-2">- {% include "location/edit/panes/location_view_edit_mode_header.html" %}- </div>- {% elif request.view_parameters.view_type.is_collection %}- <div class="mt-2">- {% include "collection/edit/panes/collection_edit_mode_header.html" %}- </div>- {% endif %}-</div>diff --git a/src/hi/apps/entity/entity_manager.py b/src/hi/apps/entity/entity_manager.pyindex f96e88de..1753c7be 100644--- a/src/hi/apps/entity/entity_manager.py+++ b/src/hi/apps/entity/entity_manager.py@@ -456,25 +456,33 @@ class EntityManager(Singleton):except (ValueError, IndexError, ZeroDivisionError):return None, None- def create_location_entity_view_group_list( self, location_view : LocationView ) -> List[EntityViewGroup]:++ def create_location_entity_view_group_list( self,+ location_view : LocationView,+ unused_entity_ids : set = None ) -> List[EntityViewGroup]:existing_entities = [ x.entityfor x in location_view.entity_views.select_related('entity').all() ]all_entities = Entity.objects.all()return self.create_entity_view_group_list(existing_entities = existing_entities,all_entities = all_entities,+ unused_entity_ids = unused_entity_ids,)def create_entity_view_group_list( self,existing_entities : List[ Entity ],- all_entities : Sequence[ Entity ] ) -> List[EntityViewGroup]:+ all_entities : Sequence[ Entity ],+ unused_entity_ids : set = None ) -> List[EntityViewGroup]:existing_entity_set = set( existing_entities )-+ if unused_entity_ids is None:+ unused_entity_ids = set()+entity_view_group_dict = dict()for entity in all_entities:entity_view_item = EntityViewItem(entity = entity,exists_in_view = bool( entity in existing_entity_set ),+ is_unused = entity.id in unused_entity_ids,)entity_group_type = EntityGroupType.from_entity_type( entity.entity_type )if entity_group_type not in entity_view_group_dict:diff --git a/src/hi/apps/entity/templates/entity/edit/panes/entity_edit_mode_panel.html b/src/hi/apps/entity/templates/entity/edit/panes/entity_edit_mode_panel.htmlindex 40defa64..54f93b26 100644--- a/src/hi/apps/entity/templates/entity/edit/panes/entity_edit_mode_panel.html+++ b/src/hi/apps/entity/templates/entity/edit/panes/entity_edit_mode_panel.html@@ -1,9 +1,10 @@+{% load icons %}<div class="d-flex justify-content-between mt-2">- <div class="h4">Item Properties</div>+ <div class="h4">Item Layout</div><div class=""><a href="{% url 'edit_item_details_close' %}"- class="btn btn-tertiary" role="button" data-async="true">- X+ class="btn btn-sm btn-outline-danger" role="button" data-async="true">+ {% icon "close" size="sm" css_class="" %}</a></div></div>@@ -19,22 +20,14 @@{% endif %}{% if entity.can_user_delete %}-<div class="">+<div class="my-2"><a href="{% url 'entity_edit_entity_delete' entity_id=entity.id %}"- class="btn btn-danger btn-control" role="button" data-async="true">+ class="btn btn-sm btn-danger btn-block btn-control" role="button" data-async="true">DELETE ITEM</a></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">@@ -48,9 +41,17 @@<div class=""><a href="{% url 'entity_edit_manage_pairings' entity_id=entity.id %}"- class="btn btn-primary btn-control" role="button" data-async="true">+ class="btn btn-sm btn-primary btn-block btn-control" role="button" data-async="true">MANAGE PAIRINGS</a></div>-</div>\ No newline at end of file+</div>+{% if entity_position_form %}+<hr />+<div class="h5">Geometry</div>+<div id="{{ DIVID.ENTITY_POSITION_EDIT_PANE }}" class="mb-4">+ {% include "entity/edit/panes/entity_position_edit.html" %}+</div>+{% endif %}+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 7bf3e064..795d9002 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@@ -3,28 +3,29 @@{% endfor %}{% if entity_form.non_field_errors %}-<div class="non-field-errors">+<div class="sidebar-form-errors">{% for err in entity_form.non_field_errors %}- <p class="form-error text-danger">ERROR: {{ err }}</p>+ <p class="sidebar-form-error">ERROR: {{ err }}</p>{% endfor %}</div>{% endif %}-<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>- {{ entity_form.name }}- <small class="form-error text-danger">{{ entity_form.name.errors }}</small>- </div>+<div class="sidebar-form-field">+ <label for="{{ entity_form.name.id_for_label }}" class="sidebar-form-label">{{ entity_form.name.label }}</label>+ <input type="text" id="{{ entity_form.name.id_for_label }}" name="{{ entity_form.name.name }}" value="{{ entity_form.name.value|default:'' }}" class="sidebar-form-input">+ {% if entity_form.name.errors %}+ <div class="sidebar-form-error">{{ entity_form.name.errors }}</div>+ {% endif %}</div>-<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>- <small class="form-error text-danger">{{ entity_form.entity_type_str.errors }}</small>+<div class="sidebar-form-field">+ <label for="{{ entity_form.entity_type_str.id_for_label }}" class="sidebar-form-label">{{ entity_form.entity_type_str.label }}</label>+ <select id="{{ entity_form.entity_type_str.id_for_label }}" name="{{ entity_form.entity_type_str.name }}" class="sidebar-form-input">+ {% for value, label in entity_form.entity_type_str.field.choices %}+ <option value="{{ value }}"{% if entity_form.entity_type_str.value == value %} selected{% endif %}>{{ label }}</option>+ {% endfor %}+ </select>+ {% if entity_form.entity_type_str.errors %}+ <div class="sidebar-form-error">{{ entity_form.entity_type_str.errors }}</div>+ {% endif %}</div>diff --git a/src/hi/apps/entity/templates/entity/edit/panes/entity_properties_edit.html b/src/hi/apps/entity/templates/entity/edit/panes/entity_properties_edit.htmlindex 69c266a6..8f848270 100644--- a/src/hi/apps/entity/templates/entity/edit/panes/entity_properties_edit.html+++ b/src/hi/apps/entity/templates/entity/edit/panes/entity_properties_edit.html@@ -8,9 +8,9 @@</div><div class="text-center" >- <button id="hi-entity-properties-edit-button" type="submit" class="btn btn-primary"- name="action" value="update">+ <button id="hi-entity-properties-edit-button" type="submit" class="btn btn-primary btn-block"+ name="action" value="update">{% icon "save" size="sm" css_class="hi-icon-left" %}UPDATE</button></div>-</form>\ No newline at end of file+</form>diff --git a/src/hi/apps/entity/transient_models.py b/src/hi/apps/entity/transient_models.pyindex 2a968b77..9f6e0528 100644--- a/src/hi/apps/entity/transient_models.py+++ b/src/hi/apps/entity/transient_models.py@@ -28,6 +28,7 @@ class EntityViewItem:entity : Entityexists_in_view : bool+ is_unused : bool = False@dataclassdiff --git a/src/hi/apps/location/edit/views.py b/src/hi/apps/location/edit/views.pyindex 5586dc55..4f717eea 100644--- a/src/hi/apps/location/edit/views.py+++ b/src/hi/apps/location/edit/views.py@@ -391,10 +391,13 @@ class LocationViewManageItemsView( HiSideView ):return 'location/edit/panes/location_view_manage_items.html'def get_template_context( self, request, *args, **kwargs ):-+ from hi.apps.edit.edit_view_helpers import EditViewHelpers+location_view = LocationManager().get_default_location_view( request = request )+ unused_entity_ids = EditViewHelpers.get_unused_entity_ids()entity_view_group_list = EntityManager().create_location_entity_view_group_list(location_view = location_view,+ unused_entity_ids = unused_entity_ids,)collection_view_group = CollectionManager().create_location_collection_view_group(location_view = location_view,@@ -443,11 +446,16 @@ class LocationViewEntityToggleView( View, LocationViewMixin ):entity = entity,location_view = location_view,)-++ # Check if entity is unused (not in any location and not in any collection)+ from hi.apps.edit.edit_view_helpers import EditViewHelpers+ is_unused = EditViewHelpers.is_entity_unused(entity.id)+context = {'location_view': location_view,'entity': entity,'exists_in_view': exists_in_view,+ 'is_unused': is_unused,}template = get_template( 'location/edit/panes/location_view_entity_toggle.html' )main_content = template.render( context, request = request )@@ -493,7 +501,7 @@ class LocationViewCollectionToggleView( View, LocationViewMixin ):collection = collection,location_view = location_view,)-+context = {'location_view': location_view,'collection': collection,diff --git a/src/hi/apps/location/models.py b/src/hi/apps/location/models.pyindex 9eba327f..24643f66 100644--- a/src/hi/apps/location/models.py+++ b/src/hi/apps/location/models.py@@ -222,7 +222,7 @@ class LocationView( models.Model, ItemTypeModelMixin ):class LocationItemModelMixin( ItemTypeModelMixin ):# A Location Item is a model that can be associated with a Location- # and that can visually appeay in one or more Location Views. This+ # and that can visually appear in one or more Location Views. This# defined an interface that specific instance need to conform to.passdiff --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 5db15c25..5dafe8ce 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@@ -3,37 +3,34 @@{% endfor %}{% if location_edit_form.non_field_errors %}-<div class="non-field-errors">+<div class="sidebar-form-errors">{% for err in location_edit_form.non_field_errors %}- <p class="form-error text-danger">ERROR: {{ err }}</p>+ <p class="sidebar-form-error">ERROR: {{ err }}</p>{% endfor %}</div>{% endif %}-<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 class="sidebar-form-field">+ <label for="{{ location_edit_form.name.id_for_label }}" class="sidebar-form-label">{{ location_edit_form.name.label }}</label>+ <input type="text" id="{{ location_edit_form.name.id_for_label }}" name="{{ location_edit_form.name.name }}" value="{{ location_edit_form.name.value|default:'' }}" class="sidebar-form-input">+ {% if location_edit_form.name.errors %}+ <div class="sidebar-form-error">{{ location_edit_form.name.errors }}</div>+ {% endif %}</div>-<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 class="sidebar-form-field">+ <label for="{{ location_edit_form.order_id.id_for_label }}" class="sidebar-form-label">{{ location_edit_form.order_id.label }}</label>+ <input type="number" id="{{ location_edit_form.order_id.id_for_label }}" name="{{ location_edit_form.order_id.name }}" value="{{ location_edit_form.order_id.value|default:'' }}" class="sidebar-form-input">+ {% if location_edit_form.order_id.errors %}+ <div class="sidebar-form-error">{{ location_edit_form.order_id.errors }}</div>+ {% endif %}</div>-<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 class="sidebar-form-field">+ <label for="{{ location_edit_form.svg_view_box_str.id_for_label }}" class="sidebar-form-label">{{ location_edit_form.svg_view_box_str.label }}</label>+ <input type="text" id="{{ location_edit_form.svg_view_box_str.id_for_label }}" name="{{ location_edit_form.svg_view_box_str.name }}" value="{{ location_edit_form.svg_view_box_str.value|default:'' }}" class="sidebar-form-input">+ {% if location_edit_form.svg_view_box_str.errors %}+ <div class="sidebar-form-error">{{ location_edit_form.svg_view_box_str.errors }}</div>+ {% endif %}</div>diff --git a/src/hi/apps/location/templates/location/edit/panes/location_edit_mode_header.html b/src/hi/apps/location/templates/location/edit/panes/location_edit_mode_header.htmldeleted file mode 100644index 72aef553..00000000--- a/src/hi/apps/location/templates/location/edit/panes/location_edit_mode_header.html+++ /dev/null@@ -1,9 +0,0 @@-<div class="d-flex justify-content-between">- <div class="h5"><small>Space:</small> {{ request.view_parameters.location.name }}</div>- <div>- <a href="{% url 'location_edit_mode' location_id=request.view_parameters.location.id %}"- class="btn btn-sm btn-tertiary" role="button" data-async="true">- EDIT- </a>- </div>-</div>diff --git a/src/hi/apps/location/templates/location/edit/panes/location_edit_mode_panel.html b/src/hi/apps/location/templates/location/edit/panes/location_edit_mode_panel.htmlindex ffd5b1e1..3387897e 100644--- a/src/hi/apps/location/templates/location/edit/panes/location_edit_mode_panel.html+++ b/src/hi/apps/location/templates/location/edit/panes/location_edit_mode_panel.html@@ -1,9 +1,10 @@+{% load icons %}<div class="d-flex justify-content-between my-2"><div class="align-self-center h4">Space Layout</div><div class="align-self-center"><a href="{% url 'edit_item_details_close' %}"- class="btn btn-tertiary" role="button" data-async="true">- X+ class="btn btn-sm btn-outline-danger" role="button" data-async="true">+ {% icon "close" size="sm" css_class="" %}</a></div></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 4db4782a..1826d510 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@@ -4,51 +4,47 @@{% endfor %}{% if location_item_position_form.non_field_errors %}-<div class="non-field-errors">+<div class="sidebar-form-errors">{% for err in location_item_position_form.non_field_errors %}- <p class="form-error">{{ err }}</p>+ <p class="sidebar-form-error">ERROR: {{ err }}</p>{% endfor %}</div>{% endif %}-<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 }}- <small class="form-error text-danger">{{ location_item_position_form.svg_x.errors }}</small>+<div class="sidebar-form-field">+ <label for="{{ location_item_position_form.svg_x.id_for_label }}" class="sidebar-form-label">{{ location_item_position_form.svg_x.label }}</label>+ <input type="number" step="any" id="{{ location_item_position_form.svg_x.id_for_label }}" name="{{ location_item_position_form.svg_x.name }}" value="{{ location_item_position_form.svg_x.value|default:'' }}" class="sidebar-form-input">+ {% if location_item_position_form.svg_x.errors %}+ <div class="sidebar-form-error">{{ location_item_position_form.svg_x.errors }}</div>+ {% endif %}</div>-<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 }}- <small class="form-error text-danger"> {{ location_item_position_form.svg_y.errors }}</small>+<div class="sidebar-form-field">+ <label for="{{ location_item_position_form.svg_y.id_for_label }}" class="sidebar-form-label">{{ location_item_position_form.svg_y.label }}</label>+ <input type="number" step="any" id="{{ location_item_position_form.svg_y.id_for_label }}" name="{{ location_item_position_form.svg_y.name }}" value="{{ location_item_position_form.svg_y.value|default:'' }}" class="sidebar-form-input">+ {% if location_item_position_form.svg_y.errors %}+ <div class="sidebar-form-error">{{ location_item_position_form.svg_y.errors }}</div>+ {% endif %}</div>-<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 }}- <small class="form-error text-danger"> {{ location_item_position_form.svg_scale.errors }}</small>+<div class="sidebar-form-field">+ <label for="{{ location_item_position_form.svg_scale.id_for_label }}" class="sidebar-form-label">{{ location_item_position_form.svg_scale.label }}</label>+ <input type="number" step="any" id="{{ location_item_position_form.svg_scale.id_for_label }}" name="{{ location_item_position_form.svg_scale.name }}" value="{{ location_item_position_form.svg_scale.value|default:'' }}" class="sidebar-form-input">+ {% if location_item_position_form.svg_scale.errors %}+ <div class="sidebar-form-error">{{ location_item_position_form.svg_scale.errors }}</div>+ {% endif %}</div>-<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 }}- <small class="form-error text-danger"> {{ location_item_position_form.svg_rotate.errors }}</small>+<div class="sidebar-form-field">+ <label for="{{ location_item_position_form.svg_rotate.id_for_label }}" class="sidebar-form-label">{{ location_item_position_form.svg_rotate.label }}</label>+ <input type="number" step="any" id="{{ location_item_position_form.svg_rotate.id_for_label }}" name="{{ location_item_position_form.svg_rotate.name }}" value="{{ location_item_position_form.svg_rotate.value|default:'' }}" class="sidebar-form-input">+ {% if location_item_position_form.svg_rotate.errors %}+ <div class="sidebar-form-error">{{ location_item_position_form.svg_rotate.errors }}</div>+ {% endif %}</div>-<div class="text-center" >- <button id="hi-add-entity-edit-button" type="submit" class="btn btn-primary"+<div class="sidebar-form-actions">+ <button id="hi-add-entity-edit-button" type="submit" class="btn btn-primary btn-block"name="action" value="update">{% icon "save" size="sm" css_class="hi-icon-left" %}UPDATE</button>diff --git a/src/hi/apps/location/templates/location/edit/panes/location_properties_edit.html b/src/hi/apps/location/templates/location/edit/panes/location_properties_edit.htmlindex 018fea37..a9d614ef 100644--- a/src/hi/apps/location/templates/location/edit/panes/location_properties_edit.html+++ b/src/hi/apps/location/templates/location/edit/panes/location_properties_edit.html@@ -7,8 +7,8 @@{% include "location/edit/panes/location_edit_form.html" %}</div>- <div class="text-center" >- <button id="hi-location-properties-edit-button" type="submit" class="btn btn-primary"+ <div class="sidebar-form-actions">+ <button id="hi-location-properties-edit-button" type="submit" class="btn btn-primary btn-block"name="action" value="update">{% icon "save" size="sm" css_class="hi-icon-left" %}UPDATE</button>@@ -16,17 +16,17 @@</form>{% if request.view_parameters.is_editing %}-<div class="text-center my-3" >+<div class="sidebar-form-actions"><a href="{% url 'location_edit_svg_replace' location_id=location.id %}"- id="hi-svg-replace-link" class="btn btn-primary btn-control" role="button"+ id="hi-svg-replace-link" class="btn btn-sm btn-secondary btn-block btn-control" role="button"data-async="true">{% icon "upload" size="sm" css_class="hi-icon-left" %}REPLACE BACKGROUND IMAGE</a></div>-<div class="my-3">+<div class="sidebar-form-actions"><a href="{% url 'location_edit_location_delete' location_id=location.id %}"- id="hi-delete-location-link" class="btn btn-danger btn-control" role="button"+ id="hi-delete-location-link" class="btn btn-sm btn-danger btn-block btn-control" role="button"data-async="true">{% icon "delete" size="sm" css_class="hi-icon-left" %}DELETE SPACE AND ALL VIEWS</a>diff --git a/src/hi/apps/location/templates/location/edit/panes/location_view_collection_toggle.html b/src/hi/apps/location/templates/location/edit/panes/location_view_collection_toggle.htmlindex e6c74b42..0ce41c21 100644--- a/src/hi/apps/location/templates/location/edit/panes/location_view_collection_toggle.html+++ b/src/hi/apps/location/templates/location/edit/panes/location_view_collection_toggle.html@@ -1,14 +1,21 @@<div id="hi-collection-toggle-location{{ collection.id }}"- class="d-flex justify-content-start">- <div class="">- <form method="POST" role="form"- action="{% url 'location_edit_location_view_collection_toggle' location_view_id=location_view.id collection_id=collection.id %}"- data-async="#hi-collection-toggle-location{{ collection.id }}" data-mode="replace" >- {% csrf_token %}- <input type="checkbox" id="collection-toggle-location-checkbox-{{ collection.id }}" name="checkbox_state"- {% if exists_in_view %}checked{% endif %}- onchange-async="true" >- <label for="collection-toggle-location-checkbox-{{ collection.id }}">{{ collection.name }}</label>- </form>- </div>+ class="{{ DIVID.ENTITY_PICKER_FILTERABLE_ITEM_CLASS }} collection-item-row{% if exists_in_view %} in-view{% endif %}"+ data-entity-id="{{ collection.id }}"+ {{ DIVID.ENTITY_PICKER_DATA_NAME_ATTR }}="{{ collection.name }}"+ {{ DIVID.ENTITY_PICKER_DATA_TYPE_ATTR }}="collection"+ {{ DIVID.ENTITY_PICKER_DATA_STATUS_ATTR }}="{% if exists_in_view %}{{ DIVID.ENTITY_PICKER_STATUS_IN_VIEW }}{% else %}{{ DIVID.ENTITY_PICKER_STATUS_NOT_IN_VIEW }}{% endif %}"+ data-item-type="collection">+ <form method="POST" role="form"+ action="{% url 'location_edit_location_view_collection_toggle' location_view_id=location_view.id collection_id=collection.id %}"+ data-async="#hi-collection-toggle-location{{ collection.id }}" data-mode="replace" >+ {% csrf_token %}+ <input type="checkbox" id="collection-toggle-location-checkbox-{{ collection.id }}"+ name="checkbox_state"+ class="entity-item-checkbox"+ {% if exists_in_view %}checked{% endif %}+ onchange-async="true" >+ <label for="collection-toggle-location-checkbox-{{ collection.id }}" class="entity-item-label">+ {{ collection.name }}+ </label>+ </form></div>diff --git a/src/hi/apps/location/templates/location/edit/panes/location_view_edit_mode_form.html b/src/hi/apps/location/templates/location/edit/panes/location_view_edit_mode_form.htmlindex 84f42f66..dd6e2cda 100644--- a/src/hi/apps/location/templates/location/edit/panes/location_view_edit_mode_form.html+++ b/src/hi/apps/location/templates/location/edit/panes/location_view_edit_mode_form.html@@ -3,67 +3,65 @@{% endfor %}{% if location_view_edit_form.non_field_errors %}-<div class="non-field-errors">+<div class="sidebar-form-errors">{% for err in location_view_edit_form.non_field_errors %}- <p class="form-error text-danger">ERROR: {{ err }}</p>+ <p class="sidebar-form-error">ERROR: {{ err }}</p>{% endfor %}</div>{% endif %}-<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 class="sidebar-form-field">+ <label for="{{ location_view_edit_form.name.id_for_label }}" class="sidebar-form-label">{{ location_view_edit_form.name.label }}</label>+ <input type="text" id="{{ location_view_edit_form.name.id_for_label }}" name="{{ location_view_edit_form.name.name }}" value="{{ location_view_edit_form.name.value|default:'' }}" class="sidebar-form-input">+ {% if location_view_edit_form.name.errors %}+ <div class="sidebar-form-error">{{ location_view_edit_form.name.errors }}</div>+ {% endif %}</div>-<div class=" hi-custom-select">- <div class="input-group mb-2 mr-sm-2">- <div class="input-group-prepend">- <label for="{{ location_view_edit_form.location_view_type_str.id_for_label }}"- class="input-group-text">{{ location_view_edit_form.location_view_type_str.label_tag }}</label>- </div>- {{ location_view_edit_form.location_view_type_str }}- </div>- {{ location_view_edit_form.location_view_type_str.errors }}+<div class="sidebar-form-field">+ <label for="{{ location_view_edit_form.location_view_type_str.id_for_label }}" class="sidebar-form-label">{{ location_view_edit_form.location_view_type_str.label }}</label>+ <select id="{{ location_view_edit_form.location_view_type_str.id_for_label }}" name="{{ location_view_edit_form.location_view_type_str.name }}" class="sidebar-form-input">+ {% for value, label in location_view_edit_form.location_view_type_str.field.choices %}+ <option value="{{ value }}"{% if location_view_edit_form.location_view_type_str.value == value %} selected{% endif %}>{{ label }}</option>+ {% endfor %}+ </select>+ {% if location_view_edit_form.location_view_type_str.errors %}+ <div class="sidebar-form-error">{{ location_view_edit_form.location_view_type_str.errors }}</div>+ {% endif %}</div>-<div class="hi-custom-select">- <div class="input-group mb-2 mr-sm-2">- <div class="input-group-prepend">- <div for="{{ location_view_edit_form.svg_style_name_str.id_for_label }}"- class="input-group-text">{{ location_view_edit_form.svg_style_name_str.label_tag }}</div>- </div>- {{ location_view_edit_form.svg_style_name_str }}- </div>- {{ location_view_edit_form.svg_style_name_str.errors }}+<div class="sidebar-form-field">+ <label for="{{ location_view_edit_form.svg_style_name_str.id_for_label }}" class="sidebar-form-label">{{ location_view_edit_form.svg_style_name_str.label }}</label>+ <select id="{{ location_view_edit_form.svg_style_name_str.id_for_label }}" name="{{ location_view_edit_form.svg_style_name_str.name }}" class="sidebar-form-input">+ {% for value, label in location_view_edit_form.svg_style_name_str.field.choices %}+ <option value="{{ value }}"{% if location_view_edit_form.svg_style_name_str.value == value %} selected{% endif %}>{{ label }}</option>+ {% endfor %}+ </select>+ {% if location_view_edit_form.svg_style_name_str.errors %}+ <div class="sidebar-form-error">{{ location_view_edit_form.svg_style_name_str.errors }}</div>+ {% endif %}</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 class="sidebar-form-field">+ <label for="{{ location_view_edit_form.order_id.id_for_label }}" class="sidebar-form-label">{{ location_view_edit_form.order_id.label }}</label>+ <input type="number" id="{{ location_view_edit_form.order_id.id_for_label }}" name="{{ location_view_edit_form.order_id.name }}" value="{{ location_view_edit_form.order_id.value|default:'' }}" class="sidebar-form-input">+ {% if location_view_edit_form.order_id.errors %}+ <div class="sidebar-form-error">{{ location_view_edit_form.order_id.errors }}</div>+ {% endif %}</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 class="sidebar-form-field">+ <label for="{{ location_view_edit_form.svg_view_box_str.id_for_label }}" class="sidebar-form-label">{{ location_view_edit_form.svg_view_box_str.label }}</label>+ <input type="text" id="{{ location_view_edit_form.svg_view_box_str.id_for_label }}" name="{{ location_view_edit_form.svg_view_box_str.name }}" value="{{ location_view_edit_form.svg_view_box_str.value|default:'' }}" class="sidebar-form-input">+ {% if location_view_edit_form.svg_view_box_str.errors %}+ <div class="sidebar-form-error">{{ location_view_edit_form.svg_view_box_str.errors }}</div>+ {% endif %}</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 class="sidebar-form-field">+ <label for="{{ location_view_edit_form.svg_rotate.id_for_label }}" class="sidebar-form-label">{{ location_view_edit_form.svg_rotate.label }}</label>+ <input type="number" id="{{ location_view_edit_form.svg_rotate.id_for_label }}" name="{{ location_view_edit_form.svg_rotate.name }}" value="{{ location_view_edit_form.svg_rotate.value|default:'' }}" class="sidebar-form-input">+ {% if location_view_edit_form.svg_rotate.errors %}+ <div class="sidebar-form-error">{{ location_view_edit_form.svg_rotate.errors }}</div>+ {% endif %}</div>diff --git a/src/hi/apps/location/templates/location/edit/panes/location_view_edit_mode_header.html b/src/hi/apps/location/templates/location/edit/panes/location_view_edit_mode_header.htmlindex f5996c87..68a32bf6 100644--- a/src/hi/apps/location/templates/location/edit/panes/location_view_edit_mode_header.html+++ b/src/hi/apps/location/templates/location/edit/panes/location_view_edit_mode_header.html@@ -1,9 +1,14 @@-<div class="d-flex justify-content-between">- <div class="h5"><small>View:</small> {{ request.view_parameters.location_view.name }}</div>- <div>- <a href="{% url 'location_view_edit_mode' location_view_id=request.view_parameters.location_view.id %}"- class="btn btn-sm btn-tertiary" role="button" data-async="true">- EDIT- </a>- </div>+{% load icons %}+{% if request.view_parameters.location_view.id %}+<div class="mx-1 my-2">+ <a href="{% url 'location_view_edit_mode' location_view_id=request.view_parameters.location_view.id %}"+ class="btn btn-primary w-100" role="button" data-async="true">+ {% icon "edit" size="md" css_class="" %}+ <small>Edit:</small> {{ request.view_parameters.location_view.name }}+ </a></div>+{% else %}+<div class="alert alert-info mx-1 my-2">+ No view selected.+</div>+{% endif %}diff --git a/src/hi/apps/location/templates/location/edit/panes/location_view_edit_mode_panel.html b/src/hi/apps/location/templates/location/edit/panes/location_view_edit_mode_panel.htmlindex 5a065793..eb86e74c 100644--- a/src/hi/apps/location/templates/location/edit/panes/location_view_edit_mode_panel.html+++ b/src/hi/apps/location/templates/location/edit/panes/location_view_edit_mode_panel.html@@ -1,9 +1,10 @@+{% load icons %}<div class="d-flex justify-content-between my-2"><div class="align-self-center h4">View Layout</div><div class="align-self-center"><a href="{% url 'edit_item_details_close' %}"- class="btn btn-tertiary" role="button" data-async="true">- X+ class="btn btn-sm btn-outline-danger" role="button" data-async="true">+ {% icon "close" size="sm" css_class="" %}</a></div></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 034f649b..78e1126a 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,14 +1,21 @@<div id="hi-entity-toggle-location-{{ entity.id }}"- 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 %}"- data-async="#hi-entity-toggle-location-{{ entity.id }}" data-mode="replace" >- {% csrf_token %}- <input type="checkbox" id="entity-toggle-location-checkbox-{{ entity.id }}" name="checkbox_state"- {% if exists_in_view %}checked{% endif %}- onchange-async="true" >- <label for="entity-toggle-location-checkbox-{{ entity.id }}">{{ entity.name }} <small>[{{ entity.integration_id }}]</small></label>- </form>- </div>+ class="{{ DIVID.ENTITY_PICKER_FILTERABLE_ITEM_CLASS }} entity-item-row{% if is_unused %} unused{% elif exists_in_view %} in-view{% endif %}"+ data-entity-id="{{ entity.id }}"+ {{ DIVID.ENTITY_PICKER_DATA_NAME_ATTR }}="{{ entity.name }}"+ {{ DIVID.ENTITY_PICKER_DATA_TYPE_ATTR }}="{{ entity.entity_type }}"+ {{ DIVID.ENTITY_PICKER_DATA_STATUS_ATTR }}="{% if is_unused %}{{ DIVID.ENTITY_PICKER_STATUS_UNUSED }}{% elif exists_in_view %}{{ DIVID.ENTITY_PICKER_STATUS_IN_VIEW }}{% else %}{{ DIVID.ENTITY_PICKER_STATUS_NOT_IN_VIEW }}{% endif %}"+ data-item-type="entity">+ <form method="POST" role="form"+ action="{% url 'location_edit_location_view_entity_toggle' location_view_id=location_view.id entity_id=entity.id %}"+ data-async="#hi-entity-toggle-location-{{ entity.id }}" data-mode="replace" >+ {% csrf_token %}+ <input type="checkbox" id="entity-toggle-location-checkbox-{{ entity.id }}"+ name="checkbox_state"+ class="entity-item-checkbox"+ {% if exists_in_view %}checked{% endif %}+ onchange-async="true" >+ <label for="entity-toggle-location-checkbox-{{ entity.id }}" class="entity-item-label">+ {{ entity.name }} <span class="entity-item-id">[{{ entity.integration_id }}]</span>+ </label>+ </form></div>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 5d0f45bd..169f2c71 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,37 +1,50 @@+{% extends "edit/panes/entity_picker.html" %}{% load icons %}-<div>- {% if request.view_parameters.is_editing %}- {% include "edit/panes/side_header.html" %}- {% endif %}- <hr />- <div class="h4">Display Items</div>+{% block header %}+<div class="mt-2">+ {% include "location/edit/panes/location_view_edit_mode_header.html" %}+</div>+{% endblock %}- <div class="my-2">- <a href="{% url 'entity_edit_entity_add' %}"- class="btn btn-primary btn-control" role="button"- data-async="modal" >- {% icon "plus" size="sm" css_class="hi-icon-left" %}ADD NEW ITEM- </a>+{% block entity_groups %}+{% for entity_view_group in entity_view_group_list %}+<div class="{{ DIVID.ENTITY_PICKER_GROUP_SECTION_CLASS }}" data-group="{{ entity_view_group.entity_group_type.label|slugify }}">+ <div class="entity-group-header"+ data-toggle="collapse"+ data-target="#group-{{ entity_view_group.entity_group_type.label|slugify }}"+ aria-expanded="true"+ aria-controls="group-{{ entity_view_group.entity_group_type.label|slugify }}">+ <span class="entity-group-title">{{ entity_view_group.entity_group_type.label }}</span>+ {% icon "chevron-down" css_class="entity-group-toggle" %}</div>-- {% for entity_view_group in entity_view_group_list %}- <div>- <div class="h5">{{ entity_view_group.entity_group_type.label }}</div>+ <div class="entity-group-items collapse show" id="group-{{ entity_view_group.entity_group_type.label|slugify }}">{% for entity_view_item in entity_view_group.item_list %}- {% include "location/edit/panes/location_view_entity_toggle.html" with location_view=location_view entity=entity_view_item.entity exists_in_view=entity_view_item.exists_in_view %}+ {% include "location/edit/panes/location_view_entity_toggle.html" with location_view=location_view entity=entity_view_item.entity exists_in_view=entity_view_item.exists_in_view is_unused=entity_view_item.is_unused %}{% endfor %}</div>- {% empty %}- {% include "edit/panes/no_entities_message.html" %}- {% endfor %}+</div>+{% empty %}+{% include "edit/panes/no_entities_message.html" %}+{% endfor %}+{% endblock %}- {% if collection_view_group.item_list %}- <div class="">- <div class="h5">Collections</div>+{% block collections_section %}+{% if collection_view_group.item_list %}+<div class="{{ DIVID.ENTITY_PICKER_GROUP_SECTION_CLASS }}" data-group="collections">+ <div class="entity-group-header"+ data-toggle="collapse"+ data-target="#group-collections"+ aria-expanded="true"+ aria-controls="group-collections">+ <span class="entity-group-title">Collections</span>+ {% icon "chevron-down" css_class="entity-group-toggle" %}+ </div>+ <div class="entity-group-items collapse show" id="group-collections">{% for collection_view_item in collection_view_group.item_list %}{% include "location/edit/panes/location_view_collection_toggle.html" with location_view=location_view collection=collection_view_item.collection exists_in_view=collection_view_item.exists_in_view %}{% endfor %}</div>- {% endif %}</div>+{% endif %}+{% endblock %}diff --git a/src/hi/apps/location/templates/location/edit/panes/location_view_properties_edit.html b/src/hi/apps/location/templates/location/edit/panes/location_view_properties_edit.htmlindex 43a3a148..a30d1989 100644--- a/src/hi/apps/location/templates/location/edit/panes/location_view_properties_edit.html+++ b/src/hi/apps/location/templates/location/edit/panes/location_view_properties_edit.html@@ -7,17 +7,17 @@<div>{% include "location/edit/panes/location_view_edit_mode_form.html" %}</div>- <div class="text-center" >- <button id="hi-add-location-view-button" type="submit" class="btn btn-primary"- name="action" value="update">+ <div class="sidebar-form-actions">+ <button id="hi-add-location-view-button" type="submit" class="btn btn-primary btn-block"+ name="action" value="update">{% icon "save" size="sm" css_class="hi-icon-left" %}UPDATE</button></div></form>-<div class="my-3">+<div class="sidebar-form-actions"><a href="{% url 'location_edit_location_view_delete' location_view_id=location_view.id %}"- id="hi-delete-location-view-link" class="btn btn-danger btn-control" role="button"+ id="hi-delete-location-view-link" class="btn btn-sm btn-danger btn-block btn-control" role="button"data-async="true">{% icon "delete" size="sm" css_class="hi-icon-left" %}DELETE THIS VIEW</a>diff --git a/src/hi/constants.py b/src/hi/constants.pyindex 18b2e269..a396a9f0 100644--- a/src/hi/constants.py+++ b/src/hi/constants.py@@ -125,4 +125,25 @@ DIVID = {'ATTR_V2_SHOW_MORE_TEXT_CLASS': 'show-more-text','ATTR_V2_SHOW_LESS_TEXT_CLASS': 'show-less-text','ATTR_V2_DELETE_FILE_ATTR': 'delete_file_attribute',++ # Entity Picker - JavaScript dependencies only+ 'ENTITY_PICKER_FILTERABLE_ITEM_CLASS': 'filterable-item',+ 'ENTITY_PICKER_GROUP_SECTION_CLASS': 'entity-group-section',+ 'ENTITY_PICKER_SEARCH_INPUT_ID': 'entity-search-input',+ 'ENTITY_PICKER_SEARCH_CLEAR_CLASS': 'entity-search-clear',+ 'ENTITY_PICKER_FILTER_BTN_CLASS': 'entity-filter-btn',++ # Entity Picker - Data attributes+ 'ENTITY_PICKER_DATA_NAME_ATTR': 'data-entity-name',+ 'ENTITY_PICKER_DATA_TYPE_ATTR': 'data-entity-type',+ 'ENTITY_PICKER_DATA_STATUS_ATTR': 'data-status',+ 'ENTITY_PICKER_DATA_FILTER_ATTR': 'data-filter',++ # Entity Picker - Status values+ 'ENTITY_PICKER_STATUS_IN_VIEW': 'in-view',+ 'ENTITY_PICKER_STATUS_NOT_IN_VIEW': 'not-in-view',+ 'ENTITY_PICKER_STATUS_UNUSED': 'unused',++ # Entity Picker - Filter values+ 'ENTITY_PICKER_FILTER_ALL': 'all',}diff --git a/src/hi/settings/base.py b/src/hi/settings/base.pyindex f1b43851..d7dd5e04 100644--- a/src/hi/settings/base.py+++ b/src/hi/settings/base.py@@ -277,6 +277,7 @@ PIPELINE = {'source_filenames': ('js/popper.min.js','bootstrap/js/bootstrap.js',+ 'js/entity-picker.js',),'output_filename': 'js/js_after_content.js',},diff --git a/src/hi/static/css/main.css b/src/hi/static/css/main.cssindex a0333151..84b9acae 100644--- a/src/hi/static/css/main.css+++ b/src/hi/static/css/main.css@@ -22,6 +22,7 @@--on-warning-color: #ffffff;--error-color: #721817;--on-error-color: #ffffff;+ --error-highlight-color: #a01111;--muted-color: #7e7e81;--on-muted-color: #ffffff;--line-color: #cccccc;@@ -291,6 +292,23 @@ a.clickable-card:active {box-shadow: 0 0 0 0.2rem rgba(244, 95, 54, 0.25) !important;}+.btn-outline-danger {+ color: var(--error-color) !important;+ border-color: var(--error-color) !important;+ background-color: transparent !important;+}+.btn-outline-danger:hover,+.btn-outline-danger:focus,+.btn-outline-danger:active,+.btn-outline-danger.active {+ color: var(--on-error-color) !important;+ background-color: var(--error-color) !important;+ border-color: var(--error-highlight-color) !important;+}+.btn-outline-danger:focus {+ box-shadow: 0 0 0 0.2rem var(--error-highlight-color) !important;+}+.interstitial-page {display: flex;flex-direction: column;@@ -347,8 +365,8 @@ a.clickable-card:active {#hi-side-content {height: calc(100vh - var(--top-buttons-height) - var(--bottom-buttons-height));display: flex;- padding-left: 1rem;- padding-right: 1rem;+ padding-left: 0.5rem;+ padding-right: 0.5rem;flex-direction: column;overflow-y: auto;}@@ -1336,3 +1354,272 @@ g[hover] {display: none !important;}}++/* Entity Picker Styles */+.entity-picker-container {+ /* Let the container flow naturally with sidebar scroll */+}++.entity-picker-panel {+ background: var(--white);+ border: 1px solid var(--line-color);+ border-radius: 8px;+ /* Remove fixed height - let it grow with content */+}++.entity-picker-header {+ background: var(--edit-tertiary-bg-color);+ border-bottom: 1px solid var(--line-color);+ padding: 0.5rem;+ /* Make sticky within the sidebar scroll */+ position: sticky;+ top: 0;+ z-index: 10;+}++.entity-search-input {+ border-radius: 6px;+ border: 1px solid var(--line-color);+ padding: 8px 12px;+ font-size: 14px;+}++.filter-toggles {+ display: flex;+ gap: 8px;+ flex-wrap: wrap;+}++.entity-filter-btn {+ padding: 4px 12px;+ border: 1px solid var(--primary-color);+ background: var(--white);+ color: var(--primary-color);+ border-radius: 4px;+ font-size: 12px;+ cursor: pointer;+ transition: all 0.2s;+}++.entity-filter-btn.active {+ background: var(--primary-color);+ color: var(--on-primary-color);+}++.entity-filter-btn:hover {+ background: var(--edit-primary-bg-color);+}++.entity-filter-btn.active:hover {+ background: var(--primary-highlight-color);+}++.entity-picker-items {+ /* Remove inner scroll - let sidebar handle scrolling */+ padding: 0 5px 5px;+}++.entity-group-section {+ margin-bottom: 0.75rem;+}++.entity-group-header {+ display: flex;+ justify-content: space-between;+ align-items: center;+ padding: 8px 0;+ border-bottom: 1px solid var(--line-color);+ margin-bottom: 8px;+ cursor: pointer;+ user-select: none;+}++.entity-group-title {+ font-weight: 600;+ color: var(--tertiary-color);+ font-size: 14px;+ flex-grow: 1;+}++.entity-group-toggle {+ color: var(--muted-color);+ font-size: 12px;+ transition: transform 0.2s;+}++.entity-group-header[aria-expanded="false"] .entity-group-toggle {+ transform: rotate(-90deg);+}++.entity-group-items {+ margin-left: 8px;+}++.entity-item-row,+.collection-item-row {+ padding: 6px 0;+ margin-bottom: 2px;+ border-radius: 4px;+ transition: background-color 0.2s;+}++.entity-item-row form,+.collection-item-row form {+ display: flex;+ align-items: center;+ margin: 0;+}++.entity-item-row:hover,+.collection-item-row:hover {+ background: var(--edit-tertiary-bg-color);+}++.entity-item-row.in-view,+.collection-item-row.in-view {+ background: var(--edit-primary-bg-color);+ border-left: 3px solid var(--primary-color);+ padding-left: 5px;+}++.entity-item-row.in-view:hover,+.collection-item-row.in-view:hover {+ background: var(--primary-color);+ color: var(--on-primary-color);+}++.entity-item-row.unused,+.collection-item-row.unused {+ border-left: 3px solid var(--warning-color);+ background: var(--edit-secondary-bg-color);+ padding-left: 5px;+}++.entity-item-row.unused:hover,+.collection-item-row.unused:hover {+ background: var(--secondary-highlight-color);+}++.entity-item-checkbox {+ margin-right: 10px;+ cursor: pointer;+ flex-shrink: 0;+}++.entity-item-label {+ font-size: 14px;+ cursor: pointer;+ flex-grow: 1;+ min-width: 0;+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+}++.entity-item-id {+ font-size: 11px;+ color: var(--muted-color);+ margin-left: 6px;+}++/* Entity picker search clear button alignment */+.entity-search-clear {+ display: flex;+ align-items: center;+ height: 100%;+ border-top-left-radius: 0;+ border-bottom-left-radius: 0;+}++.search-container .input-group-append {+ display: flex;+ align-items: stretch;+}++.search-container .input-group {+ display: flex;+ align-items: stretch;+}++.unused-indicator {+ color: var(--warning-color);+ font-size: 12px;+ margin-left: 8px;+}++.hidden {+ display: none !important;+}++/* Entity picker filter button grid layout */+.filter-toggles {+ display: flex;+ flex-wrap: wrap;+ gap: 0.25rem;+}++.filter-toggles .entity-filter-btn {+ flex: 1 1 45%;+ min-width: 0; /* Allow text truncation if needed */+}++/* Sidebar form styling for narrow edit panels */+.sidebar-form-field {+ margin-bottom: 1rem;+}++.sidebar-form-label {+ display: block;+ font-weight: 600;+ font-size: 0.875rem;+ color: var(--tertiary-color);+ margin-bottom: 0.25rem;+ line-height: 1.2;+}++.sidebar-form-input {+ width: 100%;+ padding: 0.5rem;+ border: 1px solid var(--line-color);+ border-radius: 0.25rem;+ font-size: 0.875rem;+ background-color: var(--white);+ transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;+}++.sidebar-form-input:focus {+ border-color: var(--primary-color);+ outline: 0;+ box-shadow: 0 0 0 0.125rem rgba(23, 112, 114, 0.25);+}++.sidebar-form-input.is-invalid {+ border-color: var(--error-color);+}++.sidebar-form-error {+ display: block;+ font-size: 0.75rem;+ color: var(--error-color);+ margin-top: 0.25rem;+ line-height: 1.2;+}++.sidebar-form-actions {+ margin-top: 1.5rem;+ text-align: center;+}++.sidebar-form-actions .btn {+ min-width: 100px;+}++/* Custom select styling for sidebar forms */+.sidebar-form-field .hi-custom-select select {+ width: 100%;+ padding: 0.5rem;+ border: 1px solid var(--line-color);+ border-radius: 0.25rem;+ font-size: 0.875rem;+ background-color: var(--white);+}diff --git a/src/hi/static/js/entity-picker.js b/src/hi/static/js/entity-picker.jsnew file mode 100644index 00000000..c0390429--- /dev/null+++ b/src/hi/static/js/entity-picker.js@@ -0,0 +1,126 @@+// Entity Picker module for interactive filtering and search+// Used in Location View and Collection View editing modes+// Uses jQuery event delegation for dynamically loaded content++$(document).ready(function() {++ var EntityPicker = {++ // Current filter state+ currentFilter: Hi.ENTITY_PICKER_FILTER_ALL,+ searchTerm: '',++ // Apply current filters to visible items+ applyFilters: function() {+ // Find all filterable items using our unified class+ var $items = $(Hi.ENTITY_PICKER_FILTERABLE_ITEM_SELECTOR);+ var $groups = $(Hi.ENTITY_PICKER_GROUP_SECTION_SELECTOR);+ var self = this;++ // Reset all groups to visible first+ $groups.show();++ $items.each(function() {+ var $item = $(this);+ var show = true;++ // Apply search filter+ if (self.searchTerm) {+ var entityName = $item.attr(Hi.ENTITY_PICKER_DATA_NAME_ATTR) || '';+ var entityType = $item.attr(Hi.ENTITY_PICKER_DATA_TYPE_ATTR) || '';+ var searchableText = (entityName + ' ' + entityType).toLowerCase();++ if (searchableText.indexOf(self.searchTerm) === -1) {+ show = false;+ }+ }++ // Apply status filter+ if (self.currentFilter !== Hi.ENTITY_PICKER_FILTER_ALL) {+ var status = $item.attr(Hi.ENTITY_PICKER_DATA_STATUS_ATTR);++ switch (self.currentFilter) {+ case Hi.ENTITY_PICKER_STATUS_IN_VIEW:+ if (status !== Hi.ENTITY_PICKER_STATUS_IN_VIEW) {+ show = false;+ }+ break;+ case Hi.ENTITY_PICKER_STATUS_NOT_IN_VIEW:+ if (status === Hi.ENTITY_PICKER_STATUS_IN_VIEW || status === Hi.ENTITY_PICKER_STATUS_UNUSED) {+ show = false;+ }+ break;+ case Hi.ENTITY_PICKER_STATUS_UNUSED:+ if (status !== Hi.ENTITY_PICKER_STATUS_UNUSED) {+ show = false;+ }+ break;+ }+ }++ // Show/hide item+ $item.toggle(show);+ });++ // Show/hide groups based on visible items+ $groups.each(function() {+ var $group = $(this);+ var $visibleItems = $group.find(Hi.ENTITY_PICKER_FILTERABLE_ITEM_SELECTOR + ':visible');+ if ($visibleItems.length > 0) {+ $group.show();+ } else {+ $group.hide();+ }+ });+ },++ // Set active filter+ setFilter: function(filter) {+ this.currentFilter = filter;++ // Update button states+ $(Hi.ENTITY_PICKER_FILTER_BTN_SELECTOR).removeClass('active');+ $(Hi.ENTITY_PICKER_FILTER_BTN_SELECTOR + '[' + Hi.ENTITY_PICKER_DATA_FILTER_ATTR + '="' + filter + '"]').addClass('active');++ this.applyFilters();+ },+++ // Reset all filters and search+ reset: function() {+ this.searchTerm = '';+ this.currentFilter = Hi.ENTITY_PICKER_FILTER_ALL;++ $(Hi.ENTITY_PICKER_SEARCH_INPUT_SELECTOR).val('');+ this.setFilter(Hi.ENTITY_PICKER_FILTER_ALL);+ }+ };++ // Event delegation for search input+ $('body').on('input', Hi.ENTITY_PICKER_SEARCH_INPUT_SELECTOR, function() {+ var $input = $(this);+ EntityPicker.searchTerm = $input.val().toLowerCase().trim();+ EntityPicker.applyFilters();+ });++ // Event delegation for filter buttons+ $('body').on('click', Hi.ENTITY_PICKER_FILTER_BTN_SELECTOR, function(e) {+ e.preventDefault();+ var $button = $(this);+ var filter = $button.attr(Hi.ENTITY_PICKER_DATA_FILTER_ATTR);+ EntityPicker.setFilter(filter);+ });++ // Event delegation for search clear button+ $('body').on('click', Hi.ENTITY_PICKER_SEARCH_CLEAR_SELECTOR, function(e) {+ e.preventDefault();+ $(Hi.ENTITY_PICKER_SEARCH_INPUT_SELECTOR).val('');+ EntityPicker.searchTerm = '';+ EntityPicker.applyFilters();+ });+++ // Make EntityPicker available globally+ window.HiEntityPicker = EntityPicker;++});\ No newline at end of filediff --git a/src/hi/static/js/main.js b/src/hi/static/js/main.jsindex e3561282..28b30cce 100644--- a/src/hi/static/js/main.js+++ b/src/hi/static/js/main.js@@ -117,7 +117,28 @@DATA_OVERFLOW_ATTR: 'data-overflow',DATA_LINE_COUNT_ATTR: 'data-line-count',DATA_ORIGINAL_VALUE_ATTR: 'data-original-value',- ATTR_V2_DELETE_FILE_ATTR: 'delete_file_attribute'+ ATTR_V2_DELETE_FILE_ATTR: 'delete_file_attribute',++ // Entity Picker - selectors for JavaScript dependencies+ ENTITY_PICKER_FILTERABLE_ITEM_SELECTOR: '.filterable-item',+ ENTITY_PICKER_GROUP_SECTION_SELECTOR: '.entity-group-section',+ ENTITY_PICKER_SEARCH_INPUT_SELECTOR: '#entity-search-input',+ ENTITY_PICKER_SEARCH_CLEAR_SELECTOR: '.entity-search-clear',+ ENTITY_PICKER_FILTER_BTN_SELECTOR: '.entity-filter-btn',++ // Entity Picker - Data attributes+ ENTITY_PICKER_DATA_NAME_ATTR: 'data-entity-name',+ ENTITY_PICKER_DATA_TYPE_ATTR: 'data-entity-type',+ ENTITY_PICKER_DATA_STATUS_ATTR: 'data-status',+ ENTITY_PICKER_DATA_FILTER_ATTR: 'data-filter',++ // Entity Picker - Status values+ ENTITY_PICKER_STATUS_IN_VIEW: 'in-view',+ ENTITY_PICKER_STATUS_NOT_IN_VIEW: 'not-in-view',+ ENTITY_PICKER_STATUS_UNUSED: 'unused',++ // Entity Picker - Filter values+ ENTITY_PICKER_FILTER_ALL: 'all'};window.Hi = Hi;diff --git a/src/hi/templates/panes/top_buttons.html b/src/hi/templates/panes/top_buttons.htmlindex 85c5bf51..c0c1277a 100644--- a/src/hi/templates/panes/top_buttons.html+++ b/src/hi/templates/panes/top_buttons.html@@ -1,4 +1,5 @@{% load static %}+{% load icons %}<div class="p-1"><div class="d-flex justify-content-between">{% include "location/panes/location_view_buttons.html" %}@@ -8,15 +9,20 @@<div class="d-flex justify-content-end">{% if request.view_parameters.location %}<div class="px-1">+ {% if request.view_parameters.is_editing %}<a class="btn btn-primary btn-control" role="button"- {% if request.view_parameters.is_editing %}href="{% url 'location_edit_mode' location_id=request.view_parameters.location.id %}"- {% else %}- href="{% url 'location_edit_location_edit' location_id=request.view_parameters.location.id %}"- {% endif %}data-async="true" >+ {% icon "edit" size="sm" css_class="" %}+ {{ request.view_parameters.location.name }}+ </a>+ {% else %}+ <a class="btn btn-primary btn-control" role="button"+ href="{% url 'location_edit_location_edit' location_id=request.view_parameters.location.id %}"+ data-async="true" >{{ request.view_parameters.location.name }}</a>+ {% endif %}</div>{% endif %}diff --git a/src/hi/templates/service-worker.js b/src/hi/templates/service-worker.jsindex 70a813f0..bb6def0a 100644--- a/src/hi/templates/service-worker.js+++ b/src/hi/templates/service-worker.js@@ -57,7 +57,7 @@ self.addEventListener('activate', function(event) {);});-// Fetch event - serve from cache when possible+// Fetch event - no caching, always use networkself.addEventListener('fetch', function(event) {// Only handle GET requestsif (event.request.method !== 'GET') {@@ -69,71 +69,6 @@ self.addEventListener('fetch', function(event) {return;}- event.respondWith(- caches.match(event.request)- .then(function(response) {- // Return cached version if available- if (response) {- return response;- }-- // For HTML pages, try network first, fall back to cache- if (event.request.headers.get('accept').includes('text/html')) {- return fetch(event.request)- .then(function(response) {- // Clone the response for caching- var responseToCache = response.clone();-- // Cache successful responses- if (response.status === 200) {- caches.open(OFFLINE_CACHE_NAME)- .then(function(cache) {- cache.put(event.request, responseToCache);- });- }-- return response;- })- .catch(function() {- // Network failed, try to serve from cache- return caches.match('/')- .then(function(response) {- return response || new Response('Offline - Please check your connection', {- status: 503,- statusText: 'Service Unavailable',- headers: new Headers({- 'Content-Type': 'text/html'- })- });- });- });- }-- // For other resources, try network first- return fetch(event.request)- .then(function(response) {- // Clone the response for caching- var responseToCache = response.clone();-- // Cache successful responses for static assets- if (response.status === 200 &&- (event.request.url.includes('/static/') ||- event.request.url.includes('.css') ||- event.request.url.includes('.js') ||- event.request.url.includes('.png') ||- event.request.url.includes('.ico'))) {- caches.open(STATIC_CACHE_NAME)- .then(function(cache) {- cache.put(event.request, responseToCache);- });- }-- return response;- })- .catch(function() {- // Network failed for static asset, serve from cache if available- return caches.match(event.request);- });- })- );+ // Always fetch from network, no caching+ event.respondWith(fetch(event.request));});