[PATCH v2] codemirror: fix model when using proxy prefix issue #160

Christian Oyarzun oyarzun at gmail.com
Fri Sep 18 18:12:48 UTC 2015


# HG changeset patch
# User Christian Oyarzun <oyarzun at gmail.com>
# 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)
     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')}", []);
                 var myCodeMirror =
initCodeMirror("editor_${h.FID('f',file.path)}", '');

                 //inject new modes
diff --git a/kallithea/templates/admin/gists/new.html
b/kallithea/templates/admin/gists/new.html
--- a/kallithea/templates/admin/gists/new.html
+++ b/kallithea/templates/admin/gists/new.html
@@ -59,6 +59,7 @@
             </div>
           ${h.end_form()}
           <script type="text/javascript">
+            pyroutes.register('static_files', "${h.url('static_files')}",
[]);
             var myCodeMirror = initCodeMirror('editor', '');

             //inject new modes
diff --git a/kallithea/templates/files/files_add.html
b/kallithea/templates/files/files_add.html
--- a/kallithea/templates/files/files_add.html
+++ b/kallithea/templates/files/files_add.html
@@ -67,6 +67,7 @@
             ${h.end_form()}
             <script type="text/javascript">
             var reset_url =
"${h.url('files_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path)}";
+            pyroutes.register('static_files', "${h.url('static_files')}",
[]);
             var myCodeMirror = initCodeMirror('editor',reset_url);

             //inject new modes, based on codeMirrors modeInfo object
diff --git a/kallithea/templates/files/files_edit.html
b/kallithea/templates/files/files_edit.html
--- a/kallithea/templates/files/files_edit.html
+++ b/kallithea/templates/files/files_edit.html
@@ -75,6 +75,7 @@
 <script type="text/javascript">
 $(document).ready(function(){
     var reset_url =
"${h.url('files_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.file.path)}";
+    pyroutes.register('static_files', "${h.url('static_files')}", []);
     var myCodeMirror = initCodeMirror('editor',reset_url);

    //inject new modes, based on codeMirrors modeInfo object
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sfconservancy.org/pipermail/kallithea-general/attachments/20150918/fe8c2356/attachment.html>


More information about the kallithea-general mailing list