work towards database drive stylesheet configurability

dj111py38
Jamie Campbell 2015-12-14 01:26:02 -06:00
parent 259e3850c4
commit eac8ab5bd5
4 changed files with 39 additions and 1 deletions

View File

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('questionnaire', '0007_auto_20151207_1045'),
]
operations = [
migrations.CreateModel(
name='DBStylesheet',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('content', models.TextField()),
],
),
]

View File

@ -92,6 +92,9 @@ class Questionnaire(models.Model):
)
class DBStylesheet(models.Model):
content = models.TextField()
class QuestionSet(models.Model):
__metaclass__ = TransMeta

View File

@ -5,7 +5,8 @@
{% block headextra %}
<script type="text/javascript" src="{% static 'jquery-1.7.1.min.js' %}"></script>
<script type="text/javascript" src="{% static 'questionset.js' %}"></script>
<link rel="stylesheet" href="{% static 'progressbar.css' %}"/>
<!-- <link rel="stylesheet" href="{% static 'progressbar.css' %}"/>-->
{{ questionset.questionnaire.name|add:":"|questionset.heading|getAssociatedStylesheets }}
{% for x in jsinclude %}
<script type="text/javascript" src="{{ x }}"></script>
@ -32,6 +33,7 @@
{% block content %}
{% if progress %}
{% questionset.questionnaire.name|add:"Progress"|getAssociatedStylesheets }}
<div id="progress_bar" class="ui-progress-bar ui-container">
<div class="ui-progress" style="width: {{progress}}%;">
<span class="ui-label"><b class="value">{{progress}}%</b></span>
@ -67,6 +69,7 @@
<input type="hidden" name="questionset_id" value="{{ questionset.id }}">
{% for question, qdict in qlist %}
{{question.id|getAssociatedStylesheets}}
{% with errors|dictget:question.number as error %}
<div class="question type_{{ qdict.qtype }} {% if error %} error prepend-top{% endif %}{{ qdict.qnum_class }}{{ qdict.qalpha_class }}" id="qc_{{ question.number }}" {{qdict.checkstring|safe}} style="{{qdict.css_style}}">

View File

@ -0,0 +1,11 @@
#!/usr/bin/python
from django import template
register = template.Library()
@register(name="getAssociatedStylesheets")
def getAssociatedStylesheets(inclusionTag):
return "smiley"