On Fri, Sep 18, 2015 at 4:07 PM, Mads Kiilerich <[email protected]> wrote:
> On 09/18/2015 08:12 PM, Christian Oyarzun wrote: > > # HG changeset patch > # User Christian Oyarzun <[email protected]> > # Date 1442599888 14400 > # Fri Sep 18 14:11:28 2015 -0400 > # Node ID 3033e182787ede6bda4a6ad87e9795dbd2e82a2f > # Parent 889ff0f436c8b57f5962e204e699cbabc6d33aac > codemirror: fix model when using proxy prefix issue #160 > > diff --git a/kallithea/config/routing.py b/kallithea/config/routing.py > --- a/kallithea/config/routing.py > +++ b/kallithea/config/routing.py > @@ -99,6 +99,7 @@ > > #========================================================================== > > #MAIN PAGE > + rmap.connect('static_files', '/', _static=True) > > > Why does _static mean here? Why is it needed for this but not for others? > I may be using _static incorrectly, but produces the correct url with pyroutes.url. Similar to using h.url_for('/css/source.css') http://pylonsbook.com/en/1.1/urls-routing-and-dispatch.html#internal-static-routes Using rmap.connect('static_files', '/', controller='home') also works. Which is better / more correct? > > > rmap.connect('home', '/', controller='home', action='index') > rmap.connect('about', '/about', controller='home', action='about') > rmap.connect('repo_switcher_data', '/_repos', controller='home', > diff --git a/kallithea/public/js/base.js b/kallithea/public/js/base.js > --- a/kallithea/public/js/base.js > +++ b/kallithea/public/js/base.js > @@ -903,7 +903,7 @@ > indentUnit: 4, > autofocus: true > }); > - CodeMirror.modeURL = "/codemirror/mode/%N/%N.js"; > + CodeMirror.modeURL = pyroutes.url('static_files') + > "codemirror/mode/%N/%N.js"; > > $('#reset').click(function(e){ > window.location=resetUrl; > diff --git a/kallithea/templates/admin/gists/edit.html > b/kallithea/templates/admin/gists/edit.html > --- a/kallithea/templates/admin/gists/edit.html > +++ b/kallithea/templates/admin/gists/edit.html > @@ -81,6 +81,7 @@ > > ## dynamic edit box. > <script type="text/javascript"> > + pyroutes.register('static_files', > "${h.url('static_files')}", []); > > > Why not put it in root.html with (most) other pyroutes registrations? > > 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 a $(document).ready(function() block fixes that. --CO > /Mads > >
_______________________________________________ kallithea-general mailing list [email protected] http://lists.sfconservancy.org/mailman/listinfo/kallithea-general
