work towards database drive stylesheet configurability
parent
259e3850c4
commit
eac8ab5bd5
|
@ -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()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
|
@ -92,6 +92,9 @@ class Questionnaire(models.Model):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class DBStylesheet(models.Model):
|
||||||
|
content = models.TextField()
|
||||||
|
|
||||||
class QuestionSet(models.Model):
|
class QuestionSet(models.Model):
|
||||||
__metaclass__ = TransMeta
|
__metaclass__ = TransMeta
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
{% block headextra %}
|
{% block headextra %}
|
||||||
<script type="text/javascript" src="{% static 'jquery-1.7.1.min.js' %}"></script>
|
<script type="text/javascript" src="{% static 'jquery-1.7.1.min.js' %}"></script>
|
||||||
<script type="text/javascript" src="{% static 'questionset.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 %}
|
{% for x in jsinclude %}
|
||||||
<script type="text/javascript" src="{{ x }}"></script>
|
<script type="text/javascript" src="{{ x }}"></script>
|
||||||
|
@ -32,6 +33,7 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
{% if progress %}
|
{% if progress %}
|
||||||
|
{% questionset.questionnaire.name|add:"Progress"|getAssociatedStylesheets }}
|
||||||
<div id="progress_bar" class="ui-progress-bar ui-container">
|
<div id="progress_bar" class="ui-progress-bar ui-container">
|
||||||
<div class="ui-progress" style="width: {{progress}}%;">
|
<div class="ui-progress" style="width: {{progress}}%;">
|
||||||
<span class="ui-label"><b class="value">{{progress}}%</b></span>
|
<span class="ui-label"><b class="value">{{progress}}%</b></span>
|
||||||
|
@ -67,6 +69,7 @@
|
||||||
<input type="hidden" name="questionset_id" value="{{ questionset.id }}">
|
<input type="hidden" name="questionset_id" value="{{ questionset.id }}">
|
||||||
|
|
||||||
{% for question, qdict in qlist %}
|
{% for question, qdict in qlist %}
|
||||||
|
{{question.id|getAssociatedStylesheets}}
|
||||||
{% with errors|dictget:question.number as error %}
|
{% 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}}">
|
<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}}">
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
from django import template
|
||||||
|
|
||||||
|
register = template.Library()
|
||||||
|
|
||||||
|
|
||||||
|
@register(name="getAssociatedStylesheets")
|
||||||
|
def getAssociatedStylesheets(inclusionTag):
|
||||||
|
|
||||||
|
return "smiley"
|
Loading…
Reference in New Issue