diff options
author | Bryan Newbold <bnewbold@animus.robocracy.org> | 2008-08-11 20:50:44 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@animus.robocracy.org> | 2008-08-11 20:50:44 -0700 |
commit | cc014f1d0b102bf9222fd7961546e3968fb46961 (patch) | |
tree | d5f972191930f906e59cdc8d73b590d6723dabdb /equations | |
parent | f3c85569f394b2019fcd56a55bf2d6aacb67e5a5 (diff) | |
parent | 7903b16c1cfa93e2683e140019afabdd86a6f34a (diff) | |
download | equator-cc014f1d0b102bf9222fd7961546e3968fb46961.tar.gz equator-cc014f1d0b102bf9222fd7961546e3968fb46961.zip |
Merge branch 'master' of /srv/git/equator
Diffstat (limited to 'equations')
-rw-r--r-- | equations/models.py | 2 | ||||
-rw-r--r-- | equations/templates/equations/variable_detail.html | 2 | ||||
-rw-r--r-- | equations/views.py | 16 |
3 files changed, 17 insertions, 3 deletions
diff --git a/equations/models.py b/equations/models.py index b34a93c..e644a37 100644 --- a/equations/models.py +++ b/equations/models.py @@ -33,6 +33,8 @@ class Symbol(models.Model): self.render = self.renderdir + "%s.png" % self.id super(Symbol, self).save() +dispatcher.connect(update_render, signal=signals.pre_save, sender=Symbol) + def update_generic_variable(sender, instance, signal, *args, **kwargs): """Checks if there is a generic variable associated with this symbol; create one if there isn't""" diff --git a/equations/templates/equations/variable_detail.html b/equations/templates/equations/variable_detail.html index ceec48c..63ca233 100644 --- a/equations/templates/equations/variable_detail.html +++ b/equations/templates/equations/variable_detail.html @@ -14,7 +14,7 @@ <tr><td><b>Reference:</b></td><td> <a href="{{ object.reference }}">{{ object.reference }}</a></td></tr> {% endif %} - <tr><td><b>Raw LaTeX:</b></td><td><pre>{{ object.latex }}</pre></td></tr> + <tr><td width="25%"><b>Raw LaTeX:</b></td><td><pre>{{ object.latex }}</pre></td></tr> {% if object.unicode %} <tr><td><b>Unicode:</b></td><td>{{ object.unicode }}</td></tr> {% endif %} diff --git a/equations/views.py b/equations/views.py index 9ef1081..41309c1 100644 --- a/equations/views.py +++ b/equations/views.py @@ -2,11 +2,11 @@ from django.core import serializers from models import Equation, Variable, Symbol from django.http import HttpResponse -def all_vars(request): +def all_variables(request): data = serializers.serialize("json", Variable.objects.all()) return HttpResponse(data, mimetype="text/javascript") -def all_symbs(request): +def all_symbols(request): data = serializers.serialize("json", Symbol.objects.all()) return HttpResponse(data, mimetype="text/javascript") @@ -27,3 +27,15 @@ def equs_by_vars(request, whichvars): data = serializers.serialize("json", returnables) return HttpResponse(data, mimetype="text/javascript") + + +def vars_by_symbs(request, which_symbols): + vars = which_symbols.split(',') + if len(vars) < 1 or which_symbols == '': + return HttpResponse('[]', mimetype="text/javascript") + if vars[-1] == '/' or vars[-1] == '': + vars = vars[:-1] + returnables = Variable.objects.filter(symbol=vars[0]) + + data = serializers.serialize("json", returnables) + return HttpResponse(data, mimetype="text/javascript") |