Skip to content

Commit

Permalink
ui: Optimize admin interface for editing question items and question …
Browse files Browse the repository at this point in the history
…scales.
  • Loading branch information
Nico-AP committed Dec 5, 2024
1 parent ff955e7 commit aea17df
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 13 deletions.
23 changes: 22 additions & 1 deletion ddm/core/static/ddm_core/css/research-interface-base.css
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,27 @@
color: lightgray;
}

.item-set-table input[type="text"]{
.item-set-table input[type="text"],
.item-set-table input[type="number"] {
width: 100%;
}

.item-set-table .num-input-col {
width: 5%;
min-width: 80px;
}

.item-set-table .check-input-col {
width: 8%;
min-width: 80px;
text-align: center;
}

.item-set-table td {
vertical-align: middle;
text-align: center;
}

.item-set-table .checkmark {
display: inline-block;
}
2 changes: 1 addition & 1 deletion ddm/questionnaire/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ class Meta:
'QuestionBase',
on_delete=models.CASCADE
)
index = models.IntegerField()
label = models.CharField(
max_length=255,
null=True,
Expand All @@ -418,7 +419,6 @@ class Meta:
blank=True,
verbose_name="Label Right"
)
index = models.IntegerField()
value = models.IntegerField()
randomize = models.BooleanField(default=False)

Expand Down
8 changes: 4 additions & 4 deletions ddm/questionnaire/templates/ddm_questionnaire/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,26 @@
{% if forloop.first %}
<thead>
<tr>
<th>Index</th>
{% if object.question_type == "semantic_diff" %}
<th>Label</th>
<th>Label Right</th>
{% else %}
<th>Label</th>
{% endif %}
<th>Index</th>
<th>Value</th>
<th>Randomize</th>
</tr>
</thead>
{% endif %}
<tr>
<td>{{ item.index }}</td>
{% if object.question_type == "semantic_diff" %}
<td>{{ item.label }}</td>
<td>{{ item.label_alt }}</td>
{% else %}
<td>{{ item.label }}</td>
{% endif %}
<td>{{ item.index }}</td>
<td>{{ item.value }}</td>
<td>{{ item.randomize }}</td>
</tr>
Expand All @@ -86,15 +86,15 @@
{% if forloop.first %}
<thead>
<tr>
<th>Label</th>
<th>Index</th>
<th>Label</th>
<th>Value</th>
</tr>
</thead>
{% endif %}
<tr>
<td>{{ point.label }}</td>
<td>{{ point.index }}</td>
<td>{{ point.label }}</td>
<td>{{ point.value }}</td>
</tr>
{% empty %}
Expand Down
18 changes: 13 additions & 5 deletions ddm/questionnaire/templates/ddm_questionnaire/edit_set.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'ddm_core/page_with_form.html' %}
{% extends "ddm_core/page_with_form.html" %}

{% block page_title %}Edit {{ context_title }}{% endblock %}

Expand All @@ -8,14 +8,22 @@
<form method="post">
{% csrf_token %}
{{ formset.management_form }}
<table class="table mt-4 item-set-table">
<table class="table mt-4 item-set-table border-bottom">

{% for form in formset.forms %}

{% if forloop.first %}
<thead>
<tr>
{% for field in form.visible_fields %}<th>{{ field.label }}</th>{% endfor %}
{% for field in form.visible_fields %}
<th
{% if field.label in "Index,Value" %}
class="num-input-col"
{% elif field.label in "Randomize,Löschen,Add border,Delete" or field.label == "Löschen" %}
class="check-input-col"
{% endif %}
>{{ field.label }}</th>
{% endfor %}
</tr>
</thead>
{% endif %}
Expand All @@ -24,9 +32,9 @@
<tr><td class="border-bottom-0">{{ form.non_field_errors }}</td></tr>
{% endif %}

<tr>
<tr class="border-bottom-0">
{% for field in form.visible_fields %}
<td>
<td class="border-bottom-0">
{% if forloop.first %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ For Single Choice Questions, Multiple Choice Questions, Matrix Questions and Sem
participants answer in relation to question items. To configure question items, the following
settings are available:

Index:: Defines the order in which the items are displayed.

Label:: The label/text of the item that is displayed to participants related to an item.
For semantic differential questions, this is the label displayed on the left-hand side of the scale.

Label Right:: Only for semantic differential questions. The label displayed on the
right-hand side of the scale.

Index:: Defines the order in which the items are displayed.

Value:: Is (_a_) the identifier of an item and (_b_) used to indicate which
item(s) has or have been selected in the data export (only for Single and Multi
Choice Questions).
Expand Down

0 comments on commit aea17df

Please sign in to comment.