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="/gems/avo/Avo/ManualFrameComponent#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="/gems/avo/Avo/ManualFrameComponent#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="/gems/avo/Avo/ManualFrameComponent#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="/gems/avo/Avo/ManualFrameComponent#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><script> document.getElementById("dev_details_note-instance_method").insertAdjacentHTML( "afterbegin", '<a class="permalink" href="/gems/avo/Avo%2FManualFrameComponent:dev_details_note">permalink</a>' ); </script> <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='rubyid_def def kw'>def</span> <span class='rubyid_dev_details_note identifier id'>dev_details_note</span> <span class='rubyid_return return kw'>return</span> <span class='rubyid_unless unless_mod kw'>unless</span> <span class='rubyid_Rails constant id'>Rails</span><span class='dot token'>.</span><span class='rubyid_env identifier id'>env</span><span class='dot token'>.</span><span class='rubyid_development? fid id'>development?</span> <span class='andop op'>&&</span> <span class='rubyid_@deferred_url ivar id'>@deferred_url</span><span class='dot token'>.</span><span class='rubyid_present? fid id'>present?</span> <span class='rubyid_helpers identifier id'>helpers</span><span class='dot token'>.</span><span class='rubyid_tag identifier id'>tag</span><span class='dot token'>.</span><span class='rubyid_p identifier id'>p</span><span class='lparen token'>(</span><span class='rubyid_class class kw'>class</span><span class='colon op'>:</span> <span class='string val'>"manual-frame__error-note"</span><span class='rparen token'>)</span> <span class='rubyid_do do kw'>do</span> <span class='rubyid_helpers identifier id'>helpers</span><span class='dot token'>.</span><span class='rubyid_safe_join identifier id'>safe_join</span><span class='lparen token'>(</span><span class='lbrack token'>[</span> <span class='string val'>"Follow "</span><span class='comma token'>,</span> <span class='rubyid_helpers identifier id'>helpers</span><span class='dot token'>.</span><span class='rubyid_link_to identifier id'>link_to</span><span class='lparen token'>(</span><span class='string val'>"this link"</span><span class='comma token'>,</span> <span class='rubyid_@deferred_url ivar id'>@deferred_url</span><span class='comma token'>,</span> <span class='label val'>target:</span> <span class='string val'>"_blank"</span><span class='comma token'>,</span> <span class='label val'>rel:</span> <span class='string val'>"noopener"</span><span class='comma token'>,</span> <span class='rubyid_class class kw'>class</span><span class='colon op'>:</span> <span class='string val'>"manual-frame__error-link"</span><span class='rparen token'>)</span><span class='comma token'>,</span> <span class='string val'>" for more details about the issue and how to fix it."</span> <span class='rbrack token'>]</span><span class='rparen token'>)</span> <span class='rubyid_end end kw'>end</span> <span class='rubyid_end end 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><script> document.getElementById("label-instance_method").insertAdjacentHTML( "afterbegin", '<a class="permalink" href="/gems/avo/Avo%2FManualFrameComponent:label">permalink</a>' ); </script> <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='rubyid_def def kw'>def</span> <span class='rubyid_label identifier id'>label</span> <span class='rubyid_@title ivar id'>@title</span><span class='dot token'>.</span><span class='rubyid_to_s identifier id'>to_s</span> <span class='rubyid_end end 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><script> document.getElementById("load_label-instance_method").insertAdjacentHTML( "afterbegin", '<a class="permalink" href="/gems/avo/Avo%2FManualFrameComponent:load_label">permalink</a>' ); </script> <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='rubyid_def def kw'>def</span> <span class='rubyid_load_label identifier id'>load_label</span> <span class='rubyid_t identifier id'>t</span><span class='lparen token'>(</span><span class='string val'>"avo.load_item"</span><span class='comma token'>,</span> <span class='label val'>item:</span> <span class='rubyid_label identifier id'>label</span><span class='rparen token'>)</span> <span class='rubyid_end end 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><script> document.getElementById("retry_label-instance_method").insertAdjacentHTML( "afterbegin", '<a class="permalink" href="/gems/avo/Avo%2FManualFrameComponent:retry_label">permalink</a>' ); </script> <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='rubyid_def def kw'>def</span> <span class='rubyid_retry_label identifier id'>retry_label</span> <span class='rubyid_t identifier id'>t</span><span class='lparen token'>(</span><span class='string val'>"avo.retry_item"</span><span class='comma token'>,</span> <span class='label val'>item:</span> <span class='rubyid_label identifier id'>label</span><span class='rparen token'>)</span> <span class='rubyid_end end kw'>end</span> </pre> </td> </tr> </table> </div> </div> </div> <div id="footer"> Generated on Fri Aug 28 18:47:44 2026 by <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> 0.9.45 (ruby-4.0.6). </div> </div> </body> </html>