sage-rails 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/views/sage/queries/_statement_box.html.erb +6 -0
- data/app/views/sage/queries/new.html.erb +25 -42
- data/lib/sage/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 67929c1b7b67545a01d0d4a1b5445e5b11238616030bbb503d246101413a0602
         | 
| 4 | 
            +
              data.tar.gz: 8297beca0b69df3128c763913e4b029a92f4727308e5030629b10c99da92d144
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: c38e867b5658bcb82382460cdfcb2f6365c39aa1f8630b4703cb7f6731f43d04930c9d64bcdc91c58e1e609a40ceacbc2ce59ee4736926a6ad881057ba754e18
         | 
| 7 | 
            +
              data.tar.gz: 0d59430c80f25acaceb6f7f26c48f35762cc127bddd56ac571eeecbf0e2c1dc5da61360342f1ca0c04cea9e7c7502711ab98cc7802415c1d43fbb5ee981b8f06
         | 
| @@ -26,6 +26,12 @@ | |
| 26 26 | 
             
                outline: 2px solid rgba(66, 165, 245, 1);
         | 
| 27 27 | 
             
                outline-offset: 2px;
         | 
| 28 28 | 
             
              }
         | 
| 29 | 
            +
             | 
| 30 | 
            +
              /* ACE Editor cursor styling - sharp vertical line */
         | 
| 31 | 
            +
              .ace_cursor {
         | 
| 32 | 
            +
                border-left: 2px solid !important;
         | 
| 33 | 
            +
                border-radius: 0 !important;
         | 
| 34 | 
            +
              }
         | 
| 29 35 | 
             
            </style>
         | 
| 30 36 |  | 
| 31 37 | 
             
            <div id=<%= dom_id(query, 'statement-box') %> class='' style="position: relative; border-radius: 10px;">
         | 
| @@ -198,6 +198,12 @@ | |
| 198 198 | 
             
                text-overflow: ellipsis;
         | 
| 199 199 | 
             
                margin-bottom: 10px;
         | 
| 200 200 | 
             
              }
         | 
| 201 | 
            +
             | 
| 202 | 
            +
              /* ACE Editor cursor styling - sharp vertical line */
         | 
| 203 | 
            +
              .ace_cursor {
         | 
| 204 | 
            +
                border-left: 2px solid !important;
         | 
| 205 | 
            +
                border-radius: 0 !important;
         | 
| 206 | 
            +
              }
         | 
| 201 207 | 
             
            </style>
         | 
| 202 208 |  | 
| 203 209 | 
             
            <script>
         | 
| @@ -251,12 +257,16 @@ | |
| 251 257 | 
             
                }
         | 
| 252 258 | 
             
              }
         | 
| 253 259 |  | 
| 254 | 
            -
               | 
| 260 | 
            +
              let tabsInitialized = false;
         | 
| 261 | 
            +
             | 
| 262 | 
            +
              function setupTabSwitching() {
         | 
| 255 263 | 
             
                const promptTab = document.getElementById('prompt-tab');
         | 
| 256 264 | 
             
                const sqlTab = document.getElementById('sql-tab');
         | 
| 257 265 | 
             
                const promptPage = document.getElementById('prompt-page');
         | 
| 258 266 | 
             
                const sqlPage = document.getElementById('sql-page');
         | 
| 259 267 |  | 
| 268 | 
            +
                if (!promptTab || !sqlTab || !promptPage || !sqlPage) return;
         | 
| 269 | 
            +
             | 
| 260 270 | 
             
                function switchToPromptMode() {
         | 
| 261 271 | 
             
                  promptTab.classList.add('active');
         | 
| 262 272 | 
             
                  sqlTab.classList.remove('active');
         | 
| @@ -269,32 +279,29 @@ | |
| 269 279 | 
             
                  promptTab.classList.remove('active');
         | 
| 270 280 | 
             
                  sqlPage.classList.add('active');
         | 
| 271 281 | 
             
                  promptPage.classList.remove('active');
         | 
| 282 | 
            +
             | 
| 283 | 
            +
                  // Initialize ACE editor when switching to SQL mode
         | 
| 284 | 
            +
                  setTimeout(() => {
         | 
| 285 | 
            +
                    initializeAceEditor();
         | 
| 286 | 
            +
                  }, 100);
         | 
| 272 287 | 
             
                }
         | 
| 273 288 |  | 
| 274 | 
            -
                 | 
| 275 | 
            -
                 | 
| 289 | 
            +
                // Only attach listeners once
         | 
| 290 | 
            +
                if (!tabsInitialized) {
         | 
| 291 | 
            +
                  promptTab.addEventListener('click', switchToPromptMode);
         | 
| 292 | 
            +
                  sqlTab.addEventListener('click', switchToSqlMode);
         | 
| 293 | 
            +
                  tabsInitialized = true;
         | 
| 294 | 
            +
                }
         | 
| 276 295 |  | 
| 277 296 | 
             
                // If we have fork parameters, automatically switch to SQL mode
         | 
| 278 297 | 
             
                const urlParams = new URLSearchParams(window.location.search);
         | 
| 279 298 | 
             
                if (urlParams.get('fork_query_id') || urlParams.get('name')) {
         | 
| 280 | 
            -
                  console.log('Fork detected, switching to SQL mode');
         | 
| 281 299 | 
             
                  switchToSqlMode();
         | 
| 282 | 
            -
                  // Initialize ACE editor immediately for forks
         | 
| 283 | 
            -
                  setTimeout(() => {
         | 
| 284 | 
            -
                    console.log('Initializing ACE editor for fork');
         | 
| 285 | 
            -
                    initializeAceEditor();
         | 
| 286 | 
            -
                  }, 200);
         | 
| 287 300 | 
             
                }
         | 
| 288 | 
            -
              } | 
| 301 | 
            +
              }
         | 
| 289 302 |  | 
| 290 | 
            -
               | 
| 291 | 
            -
              document.addEventListener(' | 
| 292 | 
            -
                if (e.target.id === 'sql-tab') {
         | 
| 293 | 
            -
                  setTimeout(() => {
         | 
| 294 | 
            -
                    initializeAceEditor();
         | 
| 295 | 
            -
                  }, 100);
         | 
| 296 | 
            -
                }
         | 
| 297 | 
            -
              });
         | 
| 303 | 
            +
              document.addEventListener('DOMContentLoaded', setupTabSwitching);
         | 
| 304 | 
            +
              document.addEventListener('turbo:load', setupTabSwitching);
         | 
| 298 305 |  | 
| 299 306 | 
             
              // Ensure form submission captures the editor value
         | 
| 300 307 | 
             
              document.addEventListener('submit', function(e) {
         | 
| @@ -305,28 +312,4 @@ | |
| 305 312 | 
             
                  }
         | 
| 306 313 | 
             
                }
         | 
| 307 314 | 
             
              });
         | 
| 308 | 
            -
             | 
| 309 | 
            -
              // Handle Turbo navigation for fork detection
         | 
| 310 | 
            -
              document.addEventListener('turbo:load', function() {
         | 
| 311 | 
            -
                const urlParams = new URLSearchParams(window.location.search);
         | 
| 312 | 
            -
                if (urlParams.get('fork_query_id') || urlParams.get('name')) {
         | 
| 313 | 
            -
                  console.log('Fork detected via turbo:load, switching to SQL mode');
         | 
| 314 | 
            -
                  const promptTab = document.getElementById('prompt-tab');
         | 
| 315 | 
            -
                  const sqlTab = document.getElementById('sql-tab');
         | 
| 316 | 
            -
                  const promptPage = document.getElementById('prompt-page');
         | 
| 317 | 
            -
                  const sqlPage = document.getElementById('sql-page');
         | 
| 318 | 
            -
                  
         | 
| 319 | 
            -
                  if (sqlTab && promptTab && sqlPage && promptPage) {
         | 
| 320 | 
            -
                    sqlTab.classList.add('active');
         | 
| 321 | 
            -
                    promptTab.classList.remove('active');
         | 
| 322 | 
            -
                    sqlPage.classList.add('active');
         | 
| 323 | 
            -
                    promptPage.classList.remove('active');
         | 
| 324 | 
            -
                    
         | 
| 325 | 
            -
                    setTimeout(() => {
         | 
| 326 | 
            -
                      console.log('Initializing ACE editor for fork via turbo:load');
         | 
| 327 | 
            -
                      initializeAceEditor();
         | 
| 328 | 
            -
                    }, 200);
         | 
| 329 | 
            -
                  }
         | 
| 330 | 
            -
                }
         | 
| 331 | 
            -
              });
         | 
| 332 315 | 
             
            </script>
         | 
    
        data/lib/sage/version.rb
    CHANGED