Skip to content

Home Information - Your home, your data, organized.

Python

Added non-edit mode plumbing for clickining entity/collection.

Anthony Cassandra4572f8e83930
diff --git a/src/hi/apps/collection/edit/async_views.py b/src/hi/apps/collection/edit/async_views.py
index 50a1c15a..e9fe2994 100644
--- a/src/hi/apps/collection/edit/async_views.py
+++ b/src/hi/apps/collection/edit/async_views.py
@@ -180,7 +180,7 @@ class CollectionEntityToggleView( View, CollectionViewMixin, EntityViewMixin ):
context = {
'collection_data': collection_data,
}
- template = get_template( 'collection/collection_view.html' )
+ template = get_template( 'collection/panes/collection_view.html' )
collection_content = template.render( context, request = request )
return antinode.response(
diff --git a/src/hi/apps/collection/templates/collection/collection_buttons.html b/src/hi/apps/collection/templates/collection/panes/collection_buttons.html
similarity index 100%
rename from src/hi/apps/collection/templates/collection/collection_buttons.html
rename to src/hi/apps/collection/templates/collection/panes/collection_buttons.html
diff --git a/src/hi/apps/collection/templates/collection/collection_view.html b/src/hi/apps/collection/templates/collection/panes/collection_view.html
similarity index 52%
rename from src/hi/apps/collection/templates/collection/collection_view.html
rename to src/hi/apps/collection/templates/collection/panes/collection_view.html
index 6340b00c..51baad0b 100644
--- a/src/hi/apps/collection/templates/collection/collection_view.html
+++ b/src/hi/apps/collection/templates/collection/panes/collection_view.html
@@ -6,14 +6,27 @@
class="{% if request.is_editing %}draggable{% endif %}"
{% if request.is_editing %}draggable="true"{% endif %}
>
- {% if request.is_editing %}
- <a href="{% url 'entity_details' entity_id=entity.id %}"
- data-async="true">
- {{ entity.name }}
- </a>
- {% else %}
- {{ entity.name }}
- {% endif %}
+ <div class="d-flex justify-content-start">
+ <div>
+ {% if request.is_editing %}
+ <a href="{% url 'entity_details' entity_id=entity.id %}"
+ data-async="true">
+ {{ entity.name }}
+ </a>
+ {% else %}
+ <a href="{% url 'entity_info' entity_id=entity.id %}"
+ data-async="true">
+ {{ entity.name }}
+ </a>
+ {% endif %}
+ </div>
+ <div>
+ Controls
+ </div>
+ <div>
+ States
+ </div>
+ </div>
</div>
{% empty %}
<div><em>No entities in collection.</em></div>
diff --git a/src/hi/apps/collection/views.py b/src/hi/apps/collection/views.py
index 1e50b735..368e66ba 100644
--- a/src/hi/apps/collection/views.py
+++ b/src/hi/apps/collection/views.py
@@ -43,7 +43,7 @@ class CollectionViewDefaultView( View ):
class CollectionViewView( HiGridView, CollectionViewMixin ):
def get_main_template_name( self ) -> str:
- return 'collection/collection_view.html'
+ return 'collection/panes/collection_view.html'
def get_template_context( self, request, *args, **kwargs ):
collection = self.get_collection( request, *args, **kwargs )
diff --git a/src/hi/apps/common/svg_models.py b/src/hi/apps/common/svg_models.py
index 23627462..f1201313 100644
--- a/src/hi/apps/common/svg_models.py
+++ b/src/hi/apps/common/svg_models.py
@@ -141,6 +141,7 @@ class SvgPathItem:
stroke_color : str
stroke_width : float
fill_color : str
+ fill_opacity : float
class SvgDecimalField( models.DecimalField ):
diff --git a/src/hi/apps/entity/async_views.py b/src/hi/apps/entity/async_views.py
index 768acdcc..16ad79a0 100644
--- a/src/hi/apps/entity/async_views.py
+++ b/src/hi/apps/entity/async_views.py
@@ -2,7 +2,7 @@ import logging
from hi.apps.location.location_manager import LocationManager
-from hi.hi_async_view import HiSideView
+from hi.hi_async_view import HiModalView, HiSideView
from .entity_manager import EntityManager
from .view_mixin import EntityViewMixin
@@ -10,6 +10,22 @@ from .view_mixin import EntityViewMixin
logger = logging.getLogger(__name__)
+class EntityInfoView( HiModalView, EntityViewMixin ):
+
+ def get_template_name( self ) -> str:
+ return 'entity/modals/entity_info.html'
+
+ def get( self, request, *args, **kwargs ):
+ entity = self.get_entity( request, *args, **kwargs )
+
+ entity_info_data = EntityManager().get_entity_info_data(
+ entity = entity,
+ is_editing = request.is_editing,
+ )
+ context = entity_info_data.to_template_context()
+ return self.modal_response( request, context )
+
+
class EntityDetailsView( HiSideView, EntityViewMixin ):
def get_template_name( self ) -> str:
diff --git a/src/hi/apps/entity/edit/async_views.py b/src/hi/apps/entity/edit/async_views.py
index 9458ab08..2e2eab5e 100644
--- a/src/hi/apps/entity/edit/async_views.py
+++ b/src/hi/apps/entity/edit/async_views.py
@@ -59,7 +59,6 @@ class EntityEditView( View, EntityViewMixin ):
)
-@method_decorator( edit_required, name='dispatch' )
class EntityAttributeUploadView( View, EntityViewMixin ):
def post( self, request, *args, **kwargs ):
diff --git a/src/hi/apps/entity/entity_manager.py b/src/hi/apps/entity/entity_manager.py
index 4a1c9e11..e5c2854f 100644
--- a/src/hi/apps/entity/entity_manager.py
+++ b/src/hi/apps/entity/entity_manager.py
@@ -20,6 +20,7 @@ from .models import (
)
from .transient_models import (
EntityDetailsData,
+ EntityInfoData,
EntityEditData,
EntityViewGroup,
EntityViewItem,
@@ -31,6 +32,26 @@ class EntityManager(Singleton):
def __init_singleton__(self):
return
+ def get_entity_info_data( self,
+ entity : Entity,
+ is_editing : bool ) -> EntityDetailsData:
+ entity_edit_data = EntityEditData( entity = entity )
+ entity_state_list = list(
+ entity.states.all()
+ )
+ entity_state_delegation_list = list(
+ entity.entity_state_delegations.select_related('entity_state', 'entity_state__entity').all()
+ )
+ principal_state_list = [ x.entity_state for x in entity_state_delegation_list ]
+ principal_entity_list = list({ x.entity for x in principal_state_list }) # de-dupe
+
+ return EntityInfoData(
+ entity_edit_data = entity_edit_data,
+ entity_state_list = entity_state_list,
+ principal_state_list = principal_state_list,
+ principal_entity_list = principal_entity_list,
+ )
+
def get_entity_details_data( self,
entity : Entity,
location_view : LocationView,
diff --git a/src/hi/apps/entity/enums.py b/src/hi/apps/entity/enums.py
index 19b48912..05fec088 100644
--- a/src/hi/apps/entity/enums.py
+++ b/src/hi/apps/entity/enums.py
@@ -57,7 +57,7 @@ class EntityType(LabeledEnum):
TOOL = ( 'Tool', '' )
VIDEO_PLAYER = ( 'Video Player', '' )
WALL_SWITCH = ( 'Wall Switch', '' )
- WASTE_PIPE = ( 'Waste Pipe', '' )
+ WASTE_PIPE = ( 'Waste Pipe', '' )
WATER_HEATER = ( 'Water Heater', '' )
WATER_LINE = ( 'Water Line', '' )
WATER_METER = ( 'Water Meter', '' )
diff --git a/src/hi/apps/entity/templates/entity/modals/entity_edit.html b/src/hi/apps/entity/templates/entity/modals/entity_edit.html
new file mode 100644
index 00000000..93ce3766
--- /dev/null
+++ b/src/hi/apps/entity/templates/entity/modals/entity_edit.html
@@ -0,0 +1,13 @@
+{% extends "modals/action_done.html" %}
+
+{% block title_text %}
+{{ entity.name }}
+{% endblock %}
+
+{% block body %}
+
+<div>
+ {% include "entity/edit/panes/entity_edit.html" %}
+</div>
+
+{% endblock %}
diff --git a/src/hi/apps/entity/templates/entity/modals/entity_info.html b/src/hi/apps/entity/templates/entity/modals/entity_info.html
new file mode 100644
index 00000000..d269cadf
--- /dev/null
+++ b/src/hi/apps/entity/templates/entity/modals/entity_info.html
@@ -0,0 +1,26 @@
+{% extends "modals/action_done.html" %}
+
+{% block title_text %}
+{{ entity.name }}
+{% endblock %}
+
+{% block body %}
+
+<h5>Principal Entities</h5>
+<ul>
+ {% for principal_entity in principal_entity_list %}
+ <li>{{ principal_entity.name }}</li>
+ {% empty %}
+ <em>No principals</em>
+ {% endfor %}
+</ul>
+
+{% include "entity/panes/entity_state_info_list.html" with entity_state_list=entity_state_list title='States'%}
+
+{% include "entity/panes/entity_state_info_list.html" with entity_state_list=principal_state_list title='Principle States'%}
+
+<div>
+ {% include "entity/edit/panes/entity_edit.html" %}
+</div>
+
+{% endblock %}
diff --git a/src/hi/apps/entity/templates/entity/panes/entity_state_info_list.html b/src/hi/apps/entity/templates/entity/panes/entity_state_info_list.html
new file mode 100644
index 00000000..ecb34d71
--- /dev/null
+++ b/src/hi/apps/entity/templates/entity/panes/entity_state_info_list.html
@@ -0,0 +1,34 @@
+<div>
+ <h4>{{ title }}</h4>
+ <ul>
+ {% for entity_state in entity_state_list %}
+ <li>
+ {{ entity_state.name }}
+ <ul>
+ <li>
+ Sensors
+ <ul>
+ {% for sensor in entity_state.sensors.all %}
+ <li>{{ sensor.name }}</li>
+ {% empty %}
+ <em>No sensors</em>
+ {% endfor %}
+ </ul>
+ </li>
+ <li>
+ Controllers
+ <ul>
+ {% for controller in entity_state.controllers.all %}
+ <li>{{ controller.name }}</li>
+ {% empty %}
+ <em>No controllers</em>
+ {% endfor %}
+ </ul>
+ </li>
+ </ul>
+ </li>
+ {% empty %}
+ <em>No states</em>
+ {% endfor %}
+ </ul>
+</div>
diff --git a/src/hi/apps/entity/transient_models.py b/src/hi/apps/entity/transient_models.py
index 33deea9d..c3924f6f 100644
--- a/src/hi/apps/entity/transient_models.py
+++ b/src/hi/apps/entity/transient_models.py
@@ -10,7 +10,7 @@ from hi.apps.entity.edit.forms import (
from hi.apps.location.models import LocationView
from .enums import EntityType
-from .models import Entity
+from .models import Entity, EntityState
@dataclass
@@ -66,6 +66,26 @@ class EntityEditData:
}
+@dataclass
+class EntityInfoData:
+ """ All the data needed to render the Entity info modal. """
+
+ entity_edit_data : EntityEditData
+ entity_state_list : List[ EntityState ]
+ principal_state_list : List[ EntityState ]
+ principal_entity_list : List[ Entity ]
+
+ def to_template_context(self):
+ context = {
+ 'entity': self.entity_edit_data.entity,
+ 'entity_state_list': self.entity_state_list,
+ 'principal_state_list': self.principal_state_list,
+ 'principal_entity_list': self.principal_entity_list,
+ }
+ context.update( self.entity_edit_data.to_template_context() )
+ return context
+
+
@dataclass
class EntityDetailsData:
""" All the data needed to render the Entity details pane. """
diff --git a/src/hi/apps/entity/urls.py b/src/hi/apps/entity/urls.py
index 643c0d56..68385d58 100644
--- a/src/hi/apps/entity/urls.py
+++ b/src/hi/apps/entity/urls.py
@@ -5,6 +5,10 @@ from . import async_views
urlpatterns = [
+ re_path( r'^info/(?P<entity_id>\d+)$',
+ async_views.EntityInfoView.as_view(),
+ name='entity_info' ),
+
re_path( r'^details/(?P<entity_id>\d+)$',
async_views.EntityDetailsView.as_view(),
name='entity_details' ),
diff --git a/src/hi/apps/entity/view_mixin.py b/src/hi/apps/entity/view_mixin.py
index 3a2c8f5e..93a322f9 100644
--- a/src/hi/apps/entity/view_mixin.py
+++ b/src/hi/apps/entity/view_mixin.py
@@ -26,14 +26,18 @@ class EntityViewMixin:
request : HttpRequest,
entity_edit_data : EntityEditData,
status_code : int = 200 ):
-
context = entity_edit_data.to_template_context()
- template = get_template( 'entity/edit/panes/entity_edit.html' )
- content = template.render( context, request = request )
- return antinode.response(
- insert_map = {
- DIVID['ENTITY_EDIT_PANE']: content,
- },
- status = status_code,
+ if request.is_editing:
+ template = get_template( 'entity/edit/panes/entity_edit.html' )
+ content = template.render( context, request = request )
+ return antinode.response(
+ insert_map = {
+ DIVID['ENTITY_EDIT_PANE']: content,
+ },
+ status = status_code,
+ )
+ return antinode.modal_from_template(
+ request = request,
+ template_name = 'entity/modals/entity_edit.html',
+ context = context,
)
-
diff --git a/src/hi/apps/location/async_views.py b/src/hi/apps/location/async_views.py
index b1495960..5e688bd1 100644
--- a/src/hi/apps/location/async_views.py
+++ b/src/hi/apps/location/async_views.py
@@ -39,35 +39,25 @@ class LocationViewDetailsView( HiSideView, LocationViewMixin ):
return context
-class LocationItemDetailsViewNEW( HiSideView ):
+class LocationItemInfoView( View ):
- def dispatch( self, request, *args, **kwargs ):
+ def get(self, request, *args, **kwargs):
try:
- self._item_type, self._item_id = ItemType.parse_from_dict( kwargs )
- if self._item_type == ItemType.ENTITY:
- self._view = EntityDetailsView()
- self._kwargs = { 'entity_id': self._item_id }
- elif self._item_type == ItemType.COLLECTION:
- self._view = CollectionDetailsView()
- self._kwargs = { 'collection_id': self._item_id }
- else:
- raise BadRequest( 'Unsupported item type.' )
-
+ ( item_type, item_id ) = ItemType.parse_from_dict( kwargs )
except ValueError:
- raise BadRequest( 'Bad item id.' )
+ raise BadRequest( request, message = 'Bad item id.' )
- return super().dispatch( request, *args, **kwargs )
-
- def get_template_name( self ) -> str:
- return self._view.get_template_name()
-
- def should_push_url( self ):
- return True
+ if item_type == ItemType.ENTITY:
+ redirect_url = reverse( 'entity_info', kwargs = { 'entity_id': item_id } )
+ return HttpResponseRedirect( redirect_url )
- def get_template_context( self, request, *args, **kwargs ):
- return self._view.get_template_context( request, **self._kwargs )
+ if item_type == ItemType.COLLECTION:
+ redirect_url = reverse( 'collection_view', kwargs = { 'collection_id': item_id } )
+ return HttpResponseRedirect( redirect_url )
+
+ raise BadRequest( 'Unknown item type "{item_type}".' )
+
-
class LocationItemDetailsView( View ):
def get(self, request, *args, **kwargs):
@@ -79,22 +69,9 @@ class LocationItemDetailsView( View ):
if item_type == ItemType.ENTITY:
redirect_url = reverse( 'entity_details', kwargs = { 'entity_id': item_id } )
return HttpResponseRedirect( redirect_url )
- return EntityDetailsView().get(
- request = request,
- entity_id = item_id,
- )
if item_type == ItemType.COLLECTION:
redirect_url = reverse( 'collection_details', kwargs = { 'collection_id': item_id } )
return HttpResponseRedirect( redirect_url )
- return CollectionDetailsView().get(
- request = request,
- collection_id = item_id,
- )
raise BadRequest( 'Unknown item type "{item_type}".' )
-
-
-
-
-
diff --git a/src/hi/apps/location/edit/async_views.py b/src/hi/apps/location/edit/async_views.py
index 1f7711c7..26edac88 100644
--- a/src/hi/apps/location/edit/async_views.py
+++ b/src/hi/apps/location/edit/async_views.py
@@ -81,7 +81,6 @@ class LocationEditView( View, LocationViewMixin ):
)
-@method_decorator( edit_required, name='dispatch' )
class LocationAttributeUploadView( View, LocationViewMixin ):
def post( self, request, *args, **kwargs ):
diff --git a/src/hi/apps/location/svg_item_factory.py b/src/hi/apps/location/svg_item_factory.py
index 90410b36..fd73b9c0 100644
--- a/src/hi/apps/location/svg_item_factory.py
+++ b/src/hi/apps/location/svg_item_factory.py
@@ -1,6 +1,5 @@
from hi.apps.common.singleton import Singleton
from hi.apps.common.svg_models import SvgIconItem, SvgPathItem, SvgViewBox
-from hi.apps.collection.enums import CollectionType
from hi.apps.collection.models import Collection
from hi.apps.entity.enums import EntityType
from hi.apps.entity.models import Entity
@@ -41,7 +40,8 @@ class SvgItemFactory( Singleton ):
svg_path = path.svg_path,
stroke_color = '#40f040',
stroke_width = 5.0,
- fill_color = 'none',
+ fill_color = 'yellow',
+ fill_opacity = 0.5,
)
def get_svg_item_type( self, obj ) -> SvgItemType:
diff --git a/src/hi/apps/location/templates/location/panes/svg_path_item.html b/src/hi/apps/location/templates/location/panes/svg_path_item.html
index 04aba4ba..eb3f5928 100644
--- a/src/hi/apps/location/templates/location/panes/svg_path_item.html
+++ b/src/hi/apps/location/templates/location/panes/svg_path_item.html
@@ -1,5 +1,6 @@
<g id="{{ svg_path_item.html_id }}" class="selectable" data-type="svg-path">
<path fill="{{ svg_path_item.fill_color }}"
+ fill-opacity="{{ svg_path_item.fill_opacity }}"
stroke="{{ svg_path_item.stroke_color }}"
stroke-width="{{ svg_path_item.stroke_width }}"
vector-effect="non-scaling-stroke"
diff --git a/src/hi/apps/location/urls.py b/src/hi/apps/location/urls.py
index bff22960..878d4d1b 100644
--- a/src/hi/apps/location/urls.py
+++ b/src/hi/apps/location/urls.py
@@ -22,6 +22,10 @@ urlpatterns = [
views.LocationViewDefaultView.as_view(),
name='location_view_default'),
+ re_path( r'^item/info/(?P<html_id>[\w\-]+)$',
+ async_views.LocationItemInfoView.as_view(),
+ name='location_item_info' ),
+
re_path( r'^item/details/(?P<html_id>[\w\-]+)$',
async_views.LocationItemDetailsView.as_view(),
name='location_item_details' ),
diff --git a/src/hi/settings/base.py b/src/hi/settings/base.py
index f6e7f23b..519b5973 100644
--- a/src/hi/settings/base.py
+++ b/src/hi/settings/base.py
@@ -286,8 +286,8 @@ PIPELINE = {
'js/main.js',
'js/edit.js',
'js/edit-dragdrop.js',
- 'js/edit-svg-icon.js',
- 'js/edit-svg-path.js',
+ 'js/svg-icon.js',
+ 'js/svg-path.js',
'js/svg-location.js', # Should come last: edit event handlers should be registered first.
),
'output_filename': 'js/js_after_content_custom.js',
diff --git a/src/hi/static/js/main.js b/src/hi/static/js/main.js
index f7b7281c..3e7ccb52 100644
--- a/src/hi/static/js/main.js
+++ b/src/hi/static/js/main.js
@@ -17,6 +17,7 @@
DATA_TYPE_PATH_VALUE: 'svg-path',
API_LOCATION_ITEM_DETAILS_URL: '/location/item/details',
+ API_LOCATION_ITEM_INFO_URL: '/location/item/info',
generateUniqueId: function() {
return _generateUniqueId();
diff --git a/src/hi/static/js/edit-svg-icon.js b/src/hi/static/js/svg-icon.js
similarity index 96%
rename from src/hi/static/js/edit-svg-icon.js
rename to src/hi/static/js/svg-icon.js
index 1bcf69e8..b89f92d1 100644
--- a/src/hi/static/js/edit-svg-icon.js
+++ b/src/hi/static/js/svg-icon.js
@@ -77,7 +77,6 @@
handleMouseWheel( event );
});
$(document).on('click', function(event) {
- if ( ! Hi.isEditMode ) { return; }
handleClick( event );
});
$(document).on('keydown', function(event) {
@@ -221,12 +220,12 @@
const enclosingSvgGroup = $(event.target).closest('g');
if ( enclosingSvgGroup.length > 0 ) {
- console.log( `Click [${MODULE_NAME}]`, event );
- if ( Hi.DEBUG ) { console.log( 'SVG Target Element', enclosingSvgGroup ); }
let svgDataType = $(enclosingSvgGroup).attr( Hi.DATA_TYPE_ATTR );
const isSvgIcon = ( svgDataType == Hi.DATA_TYPE_ICON_VALUE );
const svgItemId = enclosingSvgGroup.attr('id');
if ( isSvgIcon && svgItemId ) {
+ console.log( `Click [${MODULE_NAME}]`, event );
+ if ( Hi.DEBUG ) { console.log( 'SVG Target Element', enclosingSvgGroup ); }
handleSvgIconClick( event, enclosingSvgGroup );
event.preventDefault();
event.stopImmediatePropagation();
@@ -240,6 +239,9 @@
if ( $(event.target).is('input, textarea') ) {
return;
}
+ if ($(event.target).closest('.modal').length > 0) {
+ return;
+ }
if ( gSelectedIconSvgGroup ) {
const targetArea = $(Hi.LOCATION_VIEW_AREA_SELECTOR);
const targetOffset = targetArea.offset();
@@ -290,14 +292,20 @@
function handleSvgIconClick( event, enclosingSvgGroup ) {
const svgItemId = $(enclosingSvgGroup).attr('id');
- clearSelectedIconSvgGroup();
- gSelectedIconSvgGroup = enclosingSvgGroup;
- $(enclosingSvgGroup).addClass( Hi.HIGHLIGHTED_CLASS );
- let data = {
- moduleName: MODULE_NAME,
- };
- Hi.edit.eventBus.emit( Hi.edit.SELECTION_MADE_EVENT_NAME, data );
- AN.get( `${Hi.API_LOCATION_ITEM_DETAILS_URL}/${svgItemId}` );
+
+ if ( Hi.isEditMode ) {
+ clearSelectedIconSvgGroup();
+ gSelectedIconSvgGroup = enclosingSvgGroup;
+ $(enclosingSvgGroup).addClass( Hi.HIGHLIGHTED_CLASS );
+ let data = {
+ moduleName: MODULE_NAME,
+ };
+ Hi.edit.eventBus.emit( Hi.edit.SELECTION_MADE_EVENT_NAME, data );
+ AN.get( `${Hi.API_LOCATION_ITEM_DETAILS_URL}/${svgItemId}` );
+
+ } else {
+ AN.get( `${Hi.API_LOCATION_ITEM_INFO_URL}/${svgItemId}` );
+ }
}
function clearSelectedIconSvgGroup() {
diff --git a/src/hi/static/js/svg-location.js b/src/hi/static/js/svg-location.js
index f7592b9f..255bb810 100644
--- a/src/hi/static/js/svg-location.js
+++ b/src/hi/static/js/svg-location.js
@@ -190,19 +190,14 @@
}
function isEventInLocationArea( event ) {
+
if ( $(event.target).is('input, textarea') ) {
return false;
}
-
- const targetArea = $(Hi.LOCATION_VIEW_AREA_SELECTOR);
- const targetOffset = targetArea.offset();
- const targetWidth = targetArea.outerWidth();
- const targetHeight = targetArea.outerHeight();
-
- return (( gLastMousePosition.x >= targetOffset.left )
- && ( gLastMousePosition.x <= ( targetOffset.left + targetWidth ))
- && ( gLastMousePosition.y >= targetOffset.top )
- && ( gLastMousePosition.y <= ( targetOffset.top + targetHeight )));
+ if ($(event.target).closest('.modal').length > 0) {
+ return false;
+ }
+ return $(event.target).closest(Hi.LOCATION_VIEW_AREA_SELECTOR).length > 0;
}
function handleKeyDown( event ) {
diff --git a/src/hi/static/js/edit-svg-path.js b/src/hi/static/js/svg-path.js
similarity index 98%
rename from src/hi/static/js/edit-svg-path.js
rename to src/hi/static/js/svg-path.js
index c26b68f6..98954533 100644
--- a/src/hi/static/js/edit-svg-path.js
+++ b/src/hi/static/js/svg-path.js
@@ -96,7 +96,6 @@
$(document).ready(function() {
$(document).on('click', function(event) {
- if ( ! Hi.isEditMode ) { return; }
handleClick( event );
});
$(document).on('keydown', function(event) {
@@ -210,14 +209,19 @@
function handleSvgPathClick( event, enclosingSvgGroup ) {
const svgItemId = $(enclosingSvgGroup).attr('id');
- clearSelectedPathSvgGroup();
- gSelectedPathSvgGroup = enclosingSvgGroup;
- expandSvgPath( enclosingSvgGroup );
- let data = {
- moduleName: MODULE_NAME,
- };
- Hi.edit.eventBus.emit( Hi.edit.SELECTION_MADE_EVENT_NAME, data );
- AN.get( `${Hi.API_LOCATION_ITEM_DETAILS_URL}/${svgItemId}` );
+
+ if ( Hi.isEditMode ) {
+ clearSelectedPathSvgGroup();
+ gSelectedPathSvgGroup = enclosingSvgGroup;
+ expandSvgPath( enclosingSvgGroup );
+ let data = {
+ moduleName: MODULE_NAME,
+ };
+ Hi.edit.eventBus.emit( Hi.edit.SELECTION_MADE_EVENT_NAME, data );
+ AN.get( `${Hi.API_LOCATION_ITEM_DETAILS_URL}/${svgItemId}` );
+ } else {
+ AN.get( `${Hi.API_LOCATION_ITEM_INFO_URL}/${svgItemId}` );
+ }
}
function clearSelectedPathSvgGroup() {
diff --git a/src/hi/templates/panes/bottom_buttons.html b/src/hi/templates/panes/bottom_buttons.html
index d476bcad..f8aa219f 100644
--- a/src/hi/templates/panes/bottom_buttons.html
+++ b/src/hi/templates/panes/bottom_buttons.html
@@ -1,6 +1,6 @@
<div class="bg-white p-1">
<div class="d-flex justify-content-between">
- {% include "collection/collection_buttons.html" %}
+ {% include "collection/panes/collection_buttons.html" %}
<div>
<a href="{% url 'config_settings' %}"
class="btn btn-tertiary btn-control" role="button"