Commit a19d435b authored by vertighel's avatar vertighel
Browse files

refactor pointing inputs to widget_input; add type/autocomplete support



Convert AltAz and RaDec fieldsets in control.html to widget_input macros.
Add type and autocomplete options to widget_input input config.
Update control.js ID references accordingly.

Co-Authored-By: default avatarClaude Sonnet 4.6 <noreply@anthropic.com>
parent ae12eb47
Loading
Loading
Loading
Loading
Loading
+43 −1
Original line number Diff line number Diff line
@@ -13,6 +13,46 @@

      <section>      


  <nav>
    <ul class="nav nav-tabs" role="tablist" id="pointing-tabs">
      <li class="nav-item" role="presentation">
        <button class="nav-link active" data-bs-toggle="tab"
                data-bs-target="#tab-radec" type="button"
                role="tab">Radec / ID</button>
      </li>
      <li class="nav-item" role="presentation">
        <button class="nav-link py-1-active" data-bs-toggle="tab"
                data-bs-target="#tab-altaz" type="button"
                role="tab">Alt Az</button>
      </li>
    </ul>
  </nav>

    <!-- AltAz Tab -->
    <div class="tab-pane fade" id="tab-altaz">
      {{ w.widget_input({
          "label": "AltAz",
          "inputs": [
              {"placeholder": "45.0"},
              {"placeholder": "180.0"}
          ],
          "unit": "°",
          "buttons": [],
      }) }}
    </div>

    <!-- RaDec Tab -->
    <div class="tab-pane fade show active" id="tab-radec">
      {{ w.widget_input({
          "label": "RaDec",
          "inputs": [{"type": "text", "placeholder": "Object name or HH MM SS ±DD MM SS", "autocomplete": "off"}],
          "unit": "hms ±dms / id",
          "buttons": [],
      }) }}
    </div>

        
        {{ ctrl.mount_pointing() }}

        {{ w.widget_input({
@@ -46,7 +86,7 @@
        "buttons": [{"label": "Go", "endpoint": "/stage/position", "method": "PUT"}],
        }) }}
        
        {{ ctrl.stage_control() }}
        {{ ctrl.stage_relative() }}

        {{ w.widget_toggle({
        "label": "Is init?",
@@ -67,7 +107,9 @@
      
    </article>

    
    <!-- CENTER: Mode selector + per-mode framing & observation forms -->
    
    <article class="col-xl-3 col-lg-6">
      
        {{ ctrl.observing_mode_selector() }}
+5 −4
Original line number Diff line number Diff line
@@ -76,9 +76,10 @@
      
      {% for inp in config.inputs %}
      <input class="col-md form-control bg-black" id="val{{ loop.index }}-{{ safe_id }}"
             type="number"
             value="{{ inp.value | default(0) }}"
             placeholder="{{ inp.placeholder | default('') }}">
             type="{{ inp.type | default('number') }}"
             value="{{ inp.value | default('') }}"
             placeholder="{{ inp.placeholder | default('') }}"
             {% if inp.autocomplete is defined %}autocomplete="{{ inp.autocomplete }}"{% endif %}>
      {% endfor %}
      
      {% if config.unit %}
+2 −2
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ document.addEventListener('DOMContentLoaded', () => {
    // -----------------------------------------------------------------------
    // CHECK target — resolve name/coords and update input
    // -----------------------------------------------------------------------
    const inputRadec = document.getElementById('in-radec');
    const inputRadec = document.getElementById('val1-radec');
    const btnCheck   = document.getElementById('btn-check-target');

    btnCheck?.addEventListener('click', async () => {
@@ -90,7 +90,7 @@ document.addEventListener('DOMContentLoaded', () => {
        const isAltAz = e.target.dataset.bsTarget === '#tab-altaz';
        btnSlew.dataset.url    = isAltAz ? '/telescope/coordinates/movement/altaz'
                                         : '/telescope/coordinates/movement/radec';
        btnSlew.dataset.inputs = isAltAz ? 'in-alt,in-az' : 'in-radec';
        btnSlew.dataset.inputs = isAltAz ? 'val1-altaz,val2-altaz' : 'val1-radec';
    });

    // -----------------------------------------------------------------------