<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="88949" data-post-id="88949">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="antalvarenga" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/antalvarenga/120/6049_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  antalvarenga
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>only a .drab version yes. Could it be related to the fact that I’m not using brunch but npm scripts?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="88949" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/drab-remote-controlled-frontend-framework-for-phoenix/3277/373">Post #372</a>
	                </div>
	            </div>
              <div id="likers-container-88949" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="88949"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #372"></div>
  </section>
</div>
    <div class="postbit" id="88950" data-post-id="88950">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="grych" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/grych/120/5610_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  grych
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Drab</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="antalvarenga" data-post="371" data-topic="3277">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/antalvarenga/48/6049_2.png" class="avatar"> antalvarenga:</div>
<blockquote>
<p>But nothing changes in the template.</p>
</blockquote>
</aside>
<p>I assume you mean that nothing change in the rendered page, as you are viewing the page source?</p>
<p>Do you have the PageCommander? You may generate it with</p>
<pre><code>mix drab.gen.commander Page
</code></pre>
<p>Drab only starts on pages, which has the corresponding commander. <code>PageController</code> → <code>PageCommander</code>. Even if you only debug it with <code>iex</code>, it needs an “empty” commander.</p>
<p>This is because Drab JS it quite heavy, and should not be included to the pages which does not need it.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="88950" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/drab-remote-controlled-frontend-framework-for-phoenix/3277/374">Post #373</a>
	                </div>
	            </div>
              <div id="likers-container-88950" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="88950"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #373"></div>
  </section>
</div>
    <div class="postbit" id="88951" data-post-id="88951">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="antalvarenga" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/antalvarenga/120/6049_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  antalvarenga
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>This is the PageCommander</p>
<pre><code>defmodule RiskWeb.PageCommander do
  use Drab.Commander
  # Place your event handlers here
  #
  # defhandler button_clicked(socket, sender) do
  #   set_prop socket, "#output_div", innerHTML: "Clicked the button!"
  # end
  #
  defhandler uppercase(socket, sender) do
    text = sender.params["text_to_uppercase"]
    poke(socket, text: String.upcase(text))
  end

  # Place you callbacks here
  #
  onload(:page_loaded)

  def page_loaded(socket) do
    poke(socket, msg: "This page has been drabbed")
    set_prop(socket, "div.jumbotron p.lead", innerText: "This page has been drabbed")
  end
end
</code></pre>
<p>This is the PageController</p>
<pre><code>defmodule RiskWeb.PageController do
  use RiskWeb, :controller
  plug(:put_layout, {RiskWeb.LayoutView, "home.html"})

  def index(conn, _params) do
    render(conn, "index.html", msg: "hello", text: "helloworld")
  end
end
</code></pre>
<p>And these are the pieces in the index.html.drab template</p>
<pre><code> &lt;p&gt; &lt;%= @msg %&gt; &lt;/p&gt;

&lt;form&gt;
  &lt;input name="text_to_uppercase" value="&lt;%= @text %&gt;"&gt;
  &lt;button drab="click:uppercase"&gt;Upcase&lt;/button&gt;
  &lt;button drab="click:downcase"&gt;Downcase&lt;/button&gt;
&lt;/form&gt;
</code></pre>
<p>I assume the <span class="mention">@msg</span> shown should be “This page has been drabbed” when the page loads and when clicking on the Upcase button the input text should transform</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="88951" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/drab-remote-controlled-frontend-framework-for-phoenix/3277/375">Post #374</a>
	                </div>
	            </div>
              <div id="likers-container-88951" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="88951"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #374"></div>
  </section>
</div>
    <div class="postbit" id="88952" data-post-id="88952">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="grych" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/grych/120/5610_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  grych
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Drab</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group quote-modified" data-username="antalvarenga" data-post="375" data-topic="3277">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/antalvarenga/48/6049_2.png" class="avatar"> antalvarenga:</div>
<blockquote>
<p>plug(:put_layout, {RiskWeb.LayoutView, “home.html”})</p>
</blockquote>
</aside>
<p>This is where the issue may origin. Installer (and manual installation procedure) assumes you inject Drab to “app.html.eex”.</p>
<p>Can you see Drab’s javascripts when you check the generated page sources?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="88952" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/drab-remote-controlled-frontend-framework-for-phoenix/3277/376">Post #375</a>
	                </div>
	            </div>
              <div id="likers-container-88952" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="88952"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #375"></div>
  </section>
</div>
    <div class="postbit" id="88953" data-post-id="88953">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="OvermindDL1" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/OvermindDL1/120/2677_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  OvermindDL1
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group quote-modified" data-username="antalvarenga" data-post="375" data-topic="3277">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/antalvarenga/48/6049_2.png" class="avatar"> antalvarenga:</div>
<blockquote>
<p>plug(:put_layout, {RiskWeb.LayoutView, “home.html”})</p>
</blockquote>
</aside>
<p>What is the home.html template and does it have the Drab client run call in it?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="88953" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/drab-remote-controlled-frontend-framework-for-phoenix/3277/377">Post #376</a>
	                </div>
	            </div>
              <div id="likers-container-88953" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="88953"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #376"></div>
  </section>
</div>
    <div class="postbit" id="88986" data-post-id="88986">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="antalvarenga" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/antalvarenga/120/6049_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  antalvarenga
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>home.html is the layout for the home page. Yeah that was definitely one problem, there was no Drab call in that layout template.<br>
Now I tried with a controller that uses the app.html template and I get the following errors in the console:</p>
<pre><code>Uncaught ReferenceError: require is not defined
        at Object.create (evaluations:229)
        at evaluations:1203
        at evaluations:1207
</code></pre>
<p>Which are</p>
<pre><code>  window.Drab = {
    create: function (drab_return_token, drab_session_token, broadcast_topic) {
      this.Socket = require("phoenix").Socket; &lt;-------------

      this.drab_return_token = drab_return_token;
</code></pre>
<p>and</p>
<pre><code>  Drab.create('SFMyNTY.g3QAAAACZAAEZGF0YWwAAAAFaAJkAAxfX2NvbnRyb2xsZXJkACNFbGl4aXIuUmlza1dlYi5FdmFsdWF0aW9uQ29udHJvbGxlcmgCZAALX19jb21tYW5kZXJkACJFbGl4aXIuUmlza1dlYi5FdmFsdWF0aW9uQ29tbWFuZGVyaAJkAAZfX3ZpZXdkAB1FbGl4aXIuUmlza1dlYi5FdmFsdWF0aW9uVmlld2gCZAAIX19hY3Rpb25kAAVpbmRleGgCZAAJX19hc3NpZ25zampkAAZzaWduZWRuBgBZh9a0ZAE.bVBSJrPdCwG3HvemM8d99yMZ3iNpy4OjGAG21O5FS08', 'QTEyOEdDTQ.FiF0kbVXbsSjWYIL0rs2ZynwnJhd_nUcQOzZQlGtdSbYcPD-cNeg-08kRC0.m1HmEJ5NUBJExlq5.vdxfgTut.9QL16o9CC5vHzjwlgFKHtg', '__drab:same_path:/evaluations');
  
    Drab.connect();
  
})();
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="88986" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/drab-remote-controlled-frontend-framework-for-phoenix/3277/378">Post #377</a>
	                </div>
	            </div>
              <div id="likers-container-88986" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="88986"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #377"></div>
  </section>
</div>
    <div class="postbit" id="88988" data-post-id="88988">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="antalvarenga" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/antalvarenga/120/6049_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  antalvarenga
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Solved! I found someone had that issue too here: <a href="https://forum.elixirforum.com/t/drab-webpack-problem-uncaught-referenceerror-require-is-not-defined/14402" class="inline-onebox" rel="nofollow">Drab webpack problem - Uncaught ReferenceError: require is not defined</a>.<br>
In <code>Drab.Client</code> there is the solution to this problem:</p>
<blockquote>
<p>## Custom socket constructor (Webpack “require is not defined” fix)<br>
If you are using JS bundler other than default brunch, the <code>require</code> method may not be availabe<br>
as global. In this case, you might see the error:</p>
<pre><code>  require is not defined
</code></pre>
<p>in the Drab’s javascript, in line:</p>
<pre><code>  this.Socket = require("phoenix").Socket;
</code></pre>
<p>In this case, you must provide it. In the <code>app.js</code> add a global variable, which will be passed<br>
to Drab later:</p>
<pre><code>  window.__socket = require("phoenix").Socket;
</code></pre>
<p>Then, tell Drab to use this instead of default <code>require("phoenix").Socket</code>. Add to <code>config.exs</code>:</p>
<pre><code>  config :drab, MyAppWeb.Endpoint,
    js_socket_constructor: "window.__socket"
</code></pre>
<p>This will change the problematic line in Drab’s javascript to:</p>
<pre><code>  this.Socket = window.__socket;
</code></pre>
</blockquote>
<p>Thank you! And great work with Drab!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="88988" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/drab-remote-controlled-frontend-framework-for-phoenix/3277/379">Post #378</a>
	                </div>
	            </div>
              <div id="likers-container-88988" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="88988"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #378"></div>
  </section>
</div>
    <div class="postbit" id="89001" data-post-id="89001">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="grych" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/grych/120/5610_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  grych
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Drab</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="antalvarenga" data-post="378" data-topic="3277">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/antalvarenga/48/6049_2.png" class="avatar"> antalvarenga:</div>
<blockquote>
<p>home.html is the layout for the home page. Yeah that was definitely one problem, there was no Drab call in that layout template.</p>
</blockquote>
</aside>
<p>I have updated README to clearly indicate that you need to do it for all layouts you use. I think it may be good for installer to warn if it finds multiple layouts, or install it in all of them.</p>
<aside class="quote no-group" data-username="antalvarenga" data-post="379" data-topic="3277">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/antalvarenga/48/6049_2.png" class="avatar"> antalvarenga:</div>
<blockquote>
<p>In <code>Drab.Client</code> there is the solution to this problem:</p>
</blockquote>
</aside>
<p>Actually I am not happy with the way how Drab injects its javascripts, and this workaround for the <code>require is not defined</code>. But I could not find a better solution. Javascripts generated by the <code>Drab.Client</code> are not static - for example, token needs to be included.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="89001" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/drab-remote-controlled-frontend-framework-for-phoenix/3277/380">Post #379</a>
	                </div>
	            </div>
              <div id="likers-container-89001" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="89001"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #379"></div>
  </section>
</div>
    <div class="postbit" id="89050" data-post-id="89050">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="OvermindDL1" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/OvermindDL1/120/2677_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  OvermindDL1
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="grych" data-post="380" data-topic="3277">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/grych/48/5610_2.png" class="avatar"> grych:</div>
<blockquote>
<p>token needs to be included.</p>
</blockquote>
</aside>
<p>When it really should be passable via an httponly cookie holding a single-use token…  &gt;.&gt;</p>
<p>Would need a new websocket driver then since Phoenix doesn’t allow that (see other recent thread for the reason which I still don’t understand why it’s used…).</p>
<p>Hmm, you could stuff a single-use token into a javascript-accessible single-request cookie (immediate timeout) that is then pulled out from static javascript that could then be bundled up as normal…</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="89050" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/drab-remote-controlled-frontend-framework-for-phoenix/3277/381">Post #380</a>
	                </div>
	            </div>
              <div id="likers-container-89050" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="89050"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #380"></div>
  </section>
</div>
    <div class="postbit" id="89056" data-post-id="89056">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="grych" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/grych/120/5610_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  grych
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Drab</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="OvermindDL1" data-post="381" data-topic="3277">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>Hmm, you could stuff a single-use token into a javascript-accessible single-request cookie (immediate timeout) that is then pulled out from static javascript that could then be bundled up as normal…</p>
</blockquote>
</aside>
<p>So,</p>
<ol>
<li>create a Drab.Plug to add a cookie, containing token + some config (Drab JS templates depends on config values as well); the question is if I can have a controller name in the plug (from conn)</li>
<li>create an NPM bundle with a static drab JS</li>
</ol>
<p>Like that way, as it will be more transparent (no more adding <code>&lt;%= Drab.Client.run %&gt;</code> to the layout template). Also, there will be normal caching and minimization of the drab JS.</p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="381" data-topic="3277">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>single-use token</p>
</blockquote>
</aside>
<p>How can I ensure that token is a single use only?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="89056" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/drab-remote-controlled-frontend-framework-for-phoenix/3277/382">Post #381</a>
	                </div>
	            </div>
              <div id="likers-container-89056" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="89056"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #381"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/3277/load_more?page=39">Load more posts (108 remaining)</a>
</div></template></turbo-stream>