Home Information - Your home, your data, organized.
Python
[Tweaks] Attribute Editing - Title Editing [#163], Textarea clicking [#168] (#178)
Tony C8bf77afb68ad
diff --git a/src/hi/apps/attribute/templates/attribute/components/regular_attribute_card.html b/src/hi/apps/attribute/templates/attribute/components/regular_attribute_card.htmlindex 7447e1e1..b7325cfb 100644--- a/src/hi/apps/attribute/templates/attribute/components/regular_attribute_card.html+++ b/src/hi/apps/attribute/templates/attribute/components/regular_attribute_card.html@@ -23,13 +23,20 @@ Individual attribute attribute card with value editing and actions<!-- Attribute Header --><div class="{{ DIVID.ATTR_V2_ATTRIBUTE_HEADER_CLASS }}">- <h6 class="{{ DIVID.ATTR_V2_ATTRIBUTE_NAME_CLASS }}">- {% if attribute_form.instance.pk %}- {{ attribute_form.instance.name }}- {% else %}+ {% if attribute_form.instance.pk %}+ <div class="{{ DIVID.ATTR_V2_ATTRIBUTE_NAME_CLASS }}">+ <input type="text"+ id="{{ attribute_form.name.id_for_label }}"+ name="{{ attribute_form.name.html_name }}"+ value="{{ attribute_form.instance.name }}"+ class="attr-v2-title-input"+ maxlength="64">+ </div>+ {% else %}+ <h6 class="{{ DIVID.ATTR_V2_ATTRIBUTE_NAME_CLASS }}">{% icon "plus" size="sm" css_class="hi-icon-left" %}Add New- {% endif %}- </h6>+ </h6>+ {% endif %}{% if attribute_form.non_field_errors %}<div class="attr-v2-non-field-errors">@@ -86,13 +93,7 @@ Individual attribute attribute card with value editing and actions<!-- Attribute Value --><div class="{{ DIVID.ATTR_V2_ATTRIBUTE_VALUE_CLASS }}">- {% if attribute_form.instance.pk %}- <!-- Existing attribute - include hidden name field -->- <input type="hidden"- id="{{ attribute_form.name.id_for_label }}"- name="{{ attribute_form.name.html_name }}"- value="{{ attribute_form.instance.name }}" />- {% else %}+ {% if not attribute_form.instance.pk %}<!-- New attribute form --><div class="mb-2">{{ attribute_form.name.label_tag }}diff --git a/src/hi/static/css/attribute.css b/src/hi/static/css/attribute.cssindex 85c636fc..c027b330 100644--- a/src/hi/static/css/attribute.css+++ b/src/hi/static/css/attribute.css@@ -237,6 +237,49 @@background: rgba(0, 0, 0, 0.02);}+/* Attribute title input - styled to appear like text initially */+.attr-v2-title-input {+ font-size: 0.9rem;+ font-weight: 600;+ margin-bottom: 0.5rem;+ word-break: break-word;+ letter-spacing: 0.5px;++ /* Minimal styling - appears like text */+ border: 1px solid transparent;+ background: transparent;+ padding: 2px 4px;+ border-radius: 3px;+ width: 100%;+ transition: all 0.2s ease;++ /* Inherit text color and font */+ color: inherit;+ font-family: inherit;+ line-height: inherit;+}+/* Focused and activated state - stronger input appearance */+.attr-v2-title-input:focus,+.attr-v2-title-input.activated {+ border-color: var(--primary-color, #007bff);+ background: var(--white, #ffffff);+ box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);+ outline: none;+}+/* Hover state - subtle indication it's interactive */+.attr-v2-title-input:hover:not(:focus) {+ border-color: var(--line-color, #dee2e6);+ background: rgba(0, 0, 0, 0.02);+}++/* Truncated textarea styling - indicate it's clickable */+.attr-v2-textarea.truncated[readonly] {+ cursor: pointer;+}+.attr-v2-textarea.truncated[readonly]:hover {+ background-color: rgba(0, 0, 0, 0.02);+}+.attr-v2-file-filename {font-size: 0.75rem;color: var(--muted-color);diff --git a/src/hi/static/js/attr.js b/src/hi/static/js/attr.jsindex d71e3333..38103478 100644--- a/src/hi/static/js/attr.js+++ b/src/hi/static/js/attr.js@@ -989,6 +989,22 @@const wrapper = displayField.closest(Hi.ATTR_V2_TEXT_VALUE_WRAPPER_SELECTOR);const expandControls = wrapper.find(Hi.ATTR_V2_EXPAND_CONTROLS_SELECTOR);expandControls.show();++ // Add click handler to make textarea clickable for expansion+ displayField.off('click.expand').on('click.expand', function(e) {+ // Only expand if textarea is currently in readonly/truncated state+ if ($(this).prop('readonly') && $(this).hasClass('truncated')) {+ e.preventDefault();+ e.stopPropagation();++ // Find the associated "Show more" button and trigger its click+ const expandButton = expandControls.find('button');+ if (expandButton.length > 0) {+ expandButton.click();+ }+ }+ // If not readonly/truncated, let normal textarea behavior happen (cursor placement)+ });}// Legacy function - kept for compatibility with reinitializeTextareas