Class: Avo::ManualFrameComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/avo/manual_frame_component.rb

Overview

Renders a <turbo-frame> with NO src that defers loading until the user clicks the "Load" button. Used by manual (loading: :manual) tabs and associations on Show pages.

The frame carries the deferred URL in data-manual-frame-url-value for the manual-frame Stimulus controller, which sets the frame src on click and renders an inline error + Retry on failure. It is marked data-manual-frame as an identifying hook.

States (single component, three states):

  • placeholder: title + a "Load " button</li> <li>loading: <code>Avo::LoadingComponent</code> spinner while the request is in flight</li> <li>error: inline message + Retry</li> </ul> </div> </div> <div class="tags"> </div> <h2> Instance Method Summary <small><a href="#" class="summary_toggle">collapse</a></small> </h2> <ul class="summary"> <li class="public "> <span class="summary_signature"> <a href="#dev_details_note-instance_method" title="#dev_details_note (instance method)">#<strong>dev_details_note</strong> ⇒ Object </a> </span> <span class="summary_desc"><div class='inline'><p>In development only, a link straight to the deferred URL so a developer can open the failing frame on its own and read the real error / stack trace (the inline error state otherwise swallows the response).</p></div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#label-instance_method" title="#label (instance method)">#<strong>label</strong> ⇒ Object </a> </span> <span class="summary_desc"><div class='inline'><p>The display label.</p></div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#load_label-instance_method" title="#load_label (instance method)">#<strong>load_label</strong> ⇒ Object </a> </span> <span class="summary_desc"><div class='inline'><p>"Load <title>", interpolated so the full phrase is translatable, matching the codebase's <code>attach_item</code>/<code>create_new_item</code> convention.</p></div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#retry_label-instance_method" title="#retry_label (instance method)">#<strong>retry_label</strong> ⇒ Object </a> </span> <span class="summary_desc"><div class='inline'><p>The Retry button's aria-label: "Retry <title>" (the visible copy is just "Retry"; the aria-label scopes it to this frame for screen readers).</p></div></span> </li> </ul> <div id="instance_method_details" class="method_details_list"> <h2>Instance Method Details</h2> <div class="method_details first"> <h3 class="signature first" id="dev_details_note-instance_method"> #<strong>dev_details_note</strong> ⇒ <tt>Object</tt> </h3><div class="docstring"> <div class="discussion"> <p>In development only, a link straight to the deferred URL so a developer can open the failing frame on its own and read the real error / stack trace (the inline error state otherwise swallows the response). Mirrors the dev-only link in <code>avo/home/failed_to_load.html.erb</code>. Returns nil elsewhere.</p> </div> </div> <div class="tags"> </div><table class="source_code"> <tr> <td> <pre class="lines"> 62 63 64 65 66 67 68 69 70 71 72</pre> </td> <td> <pre class="code"><span class="info file"># File 'app/components/avo/manual_frame_component.rb', line 62</span> <span class='kw'>def</span> <span class='id identifier rubyid_dev_details_note'>dev_details_note</span> <span class='kw'>return</span> <span class='kw'>unless</span> <span class='const'><span class='object_link'><a href="../Rails.html" title="Rails (module)">Rails</a></span></span><span class='period'>.</span><span class='id identifier rubyid_env'>env</span><span class='period'>.</span><span class='id identifier rubyid_development?'>development?</span> <span class='op'>&&</span> <span class='ivar'>@deferred_url</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='id identifier rubyid_helpers'>helpers</span><span class='period'>.</span><span class='id identifier rubyid_tag'>tag</span><span class='period'>.</span><span class='id identifier rubyid_p'>p</span><span class='lparen'>(</span><span class='label'>class:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>manual-frame__error-note</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='id identifier rubyid_helpers'>helpers</span><span class='period'>.</span><span class='id identifier rubyid_safe_join'>safe_join</span><span class='lparen'>(</span><span class='lbracket'>[</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Follow </span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_helpers'>helpers</span><span class='period'>.</span><span class='id identifier rubyid_link_to'>link_to</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>this link</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='ivar'>@deferred_url</span><span class='comma'>,</span> <span class='label'>target:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>_blank</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>rel:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>noopener</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>class:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>manual-frame__error-link</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> for more details about the issue and how to fix it.</span><span class='tstring_end'>"</span></span> <span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>end</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="label-instance_method"> #<strong>label</strong> ⇒ <tt>Object</tt> </h3><div class="docstring"> <div class="discussion"> <p>The display label. Callers already hand us presentation-ready, translated text (field name / tab title), so we use it as-is. Never <code>humanize</code>, which would mangle custom or translated names ("Order Items" -> "Order items").</p> </div> </div> <div class="tags"> </div><table class="source_code"> <tr> <td> <pre class="lines"> 42 43 44</pre> </td> <td> <pre class="code"><span class="info file"># File 'app/components/avo/manual_frame_component.rb', line 42</span> <span class='kw'>def</span> <span class='id identifier rubyid_label'>label</span> <span class='ivar'>@title</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="load_label-instance_method"> #<strong>load_label</strong> ⇒ <tt>Object</tt> </h3><div class="docstring"> <div class="discussion"> <p>"Load <title>", interpolated so the full phrase is translatable, matching the codebase's <code>attach_item</code>/<code>create_new_item</code> convention.</p> </div> </div> <div class="tags"> </div><table class="source_code"> <tr> <td> <pre class="lines"> 48 49 50</pre> </td> <td> <pre class="code"><span class="info file"># File 'app/components/avo/manual_frame_component.rb', line 48</span> <span class='kw'>def</span> <span class='id identifier rubyid_load_label'>load_label</span> <span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>avo.load_item</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>item:</span> <span class='id identifier rubyid_label'>label</span><span class='rparen'>)</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="retry_label-instance_method"> #<strong>retry_label</strong> ⇒ <tt>Object</tt> </h3><div class="docstring"> <div class="discussion"> <p>The Retry button's aria-label: "Retry <title>" (the visible copy is just "Retry"; the aria-label scopes it to this frame for screen readers).</p> </div> </div> <div class="tags"> </div><table class="source_code"> <tr> <td> <pre class="lines"> 54 55 56</pre> </td> <td> <pre class="code"><span class="info file"># File 'app/components/avo/manual_frame_component.rb', line 54</span> <span class='kw'>def</span> <span class='id identifier rubyid_retry_label'>retry_label</span> <span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>avo.retry_item</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>item:</span> <span class='id identifier rubyid_label'>label</span><span class='rparen'>)</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> </div> </div> <div id="footer"> Generated on Mon Jul 6 09:40:25 2026 by <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> 0.9.44 (ruby-4.0.2). </div> </div> </body> </html>