<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 18, 2015 at 4:07 PM, Mads Kiilerich <span dir="ltr"><<a href="mailto:mads@kiilerich.com" target="_blank">mads@kiilerich.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF"><span>
    <div>On 09/18/2015 08:12 PM, Christian
      Oyarzun wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">
        <div># HG changeset patch</div>
        <div># User Christian Oyarzun <<a href="mailto:oyarzun@gmail.com" target="_blank">oyarzun@gmail.com</a>></div>
        <div># Date 1442599888 14400</div>
        <div>#      Fri Sep 18 14:11:28 2015 -0400</div>
        <div># Node ID 3033e182787ede6bda4a6ad87e9795dbd2e82a2f</div>
        <div># Parent  889ff0f436c8b57f5962e204e699cbabc6d33aac</div>
        <div>codemirror: fix model when using proxy prefix issue #160</div>
        <div><br>
        </div>
        <div>diff --git a/kallithea/config/routing.py
          b/kallithea/config/routing.py</div>
        <div>--- a/kallithea/config/routing.py</div>
        <div>+++ b/kallithea/config/routing.py</div>
        <div>@@ -99,6 +99,7 @@</div>
        <div>   
 #==========================================================================</div>
        <div> </div>
        <div>     #MAIN PAGE</div>
        <div>+    rmap.connect('static_files', '/', _static=True)</div>
      </div>
    </blockquote>
    <br></span>
    Why does _static mean here? Why is it needed for this but not for
    others?</div></blockquote><div>I may be using _static incorrectly, but produces the correct url with pyroutes.url. Similar to using </div><div>h.url_for('/css/source.css')  <a href="http://pylonsbook.com/en/1.1/urls-routing-and-dispatch.html#internal-static-routes" target="_blank">http://pylonsbook.com/en/1.1/urls-routing-and-dispatch.html#internal-static-routes</a></div><div><br></div><div>Using rmap.connect('static_files', '/', controller='home') also works. Which is better / more correct?</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF"><span><br>
    <br>
    <blockquote type="cite">
      <div dir="ltr">
        <div>     rmap.connect('home', '/', controller='home',
          action='index')</div>
        <div>     rmap.connect('about', '/about', controller='home',
          action='about')</div>
        <div>     rmap.connect('repo_switcher_data', '/_repos',
          controller='home',</div>
        <div>diff --git a/kallithea/public/js/base.js
          b/kallithea/public/js/base.js</div>
        <div>--- a/kallithea/public/js/base.js</div>
        <div>+++ b/kallithea/public/js/base.js</div>
        <div>@@ -903,7 +903,7 @@</div>
        <div>             indentUnit: 4,</div>
        <div>             autofocus: true</div>
        <div>         });</div>
        <div>-    CodeMirror.modeURL = "/codemirror/mode/%N/%N.js";</div>
        <div>+    CodeMirror.modeURL = pyroutes.url('static_files') +
          "codemirror/mode/%N/%N.js";</div>
        <div> </div>
        <div>     $('#reset').click(function(e){</div>
        <div>             window.location=resetUrl;</div>
        <div>diff --git a/kallithea/templates/admin/gists/edit.html
          b/kallithea/templates/admin/gists/edit.html</div>
        <div>--- a/kallithea/templates/admin/gists/edit.html</div>
        <div>+++ b/kallithea/templates/admin/gists/edit.html</div>
        <div>@@ -81,6 +81,7 @@</div>
        <div> </div>
        <div>                 ## dynamic edit box.</div>
        <div>                 <script type="text/javascript"></div>
        <div>+                pyroutes.register('static_files',
          "${h.url('static_files')}", []);</div>
      </div>
    </blockquote>
    <br></span>
    Why not put it in root.html with (most) other pyroutes
    registrations?<span><font color="#888888"><br>
    <br></font></span></div></blockquote><div>This did not work on my initial test. That turned out to be because initCodeMirror was called before the routes were registered. The pyroutes registrations in root.html are in a $(document).ready(function() block. Moving the calls to initCodeMirror inside</div><div>a $(document).ready(function() block fixes that.</div><div><br></div><div>--CO</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF"><span><font color="#888888">
    /Mads<br>
    <br>
  </font></span></div>

</blockquote></div><br></div></div>