Compare commits

..
4 Commits
7 changed files with 96 additions and 9 deletions
+13 -1
View File
@@ -8,4 +8,16 @@ DB_USER=django
DB_PASSWORD=postgres DB_PASSWORD=postgres
DB_PORT=5432 DB_PORT=5432
MEMCACHE_HOST=cache MEMCACHE_HOST=cache
# DEV-specific vars used by rad/settings_local.py
DEV_USE_POSTGRES=1
DEV_DB_NAME=${DB_NAME}
DEV_DB_USER=${DB_USER}
DEV_DB_PASSWORD=${DB_PASSWORD}
DEV_DB_HOST=${DB_HOST}
DEV_DB_PORT=${DB_PORT}
# pgAdmin creds
PGADMIN_DEFAULT_EMAIL=admin@example.com
PGADMIN_DEFAULT_PASSWORD=admin
+15 -5
View File
@@ -7,13 +7,13 @@ services:
- ./redis/redis.conf:/usr/local/etc/redis/redis.conf - ./redis/redis.conf:/usr/local/etc/redis/redis.conf
command: ["redis-server", "/usr/local/etc/redis/redis.conf"] command: ["redis-server", "/usr/local/etc/redis/redis.conf"]
web: web:
build: ./rad build:
context: ..
dockerfile: rad/Dockerfile
command: python manage.py runserver 0.0.0.0:8000 command: python manage.py runserver 0.0.0.0:8000
#command: pip install -r requirements.txt #command: pip install -r requirements.txt
volumes: volumes:
- ./rad/:/usr/src/rad/ - ../:/usr/src/app # mount the whole repo into the container
- ../rts/:/usr/src/rad/rts
- ../Viewers/platform/app/dist/:/usr/src/rad/viewer
- ./backups:/usr/src/backups - ./backups:/usr/src/backups
- ./media:/usr/src/media - ./media:/usr/src/media
- ./static:/usr/src/static - ./static:/usr/src/static
@@ -30,10 +30,20 @@ services:
- POSTGRES_USER=django - POSTGRES_USER=django
- POSTGRES_PASSWORD=postgres - POSTGRES_PASSWORD=postgres
- POSTGRES_DB=rad - POSTGRES_DB=rad
pgadmin:
image: dpage/pgadmin4:7.2
environment:
- PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL:-admin@local}
- PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD:-admin}
ports:
- 8080:80
volumes:
- pgadmin_data:/var/lib/pgadmin
cache: cache:
image: memcached image: memcached
ports: ports:
- 11211:11211 - 11211:11211
volumes: volumes:
postgres_data: postgres_data:
pgadmin_data:
@@ -12,6 +12,7 @@
{% with current_status=form.status.value %} {% with current_status=form.status.value %}
{% for radio in form.status %} {% for radio in form.status %}
{% comment %} Render colored button for each choice by checking value {% endcomment %} {% comment %} Render colored button for each choice by checking value {% endcomment %}
{{ radio.tag }}
<label class="btn btn-outline-primary me-1 mb-1{% if radio.choice_value == current_status %} active{% endif %}" for="{{ radio.id_for_label }}">{{ radio.choice_label }}</label> <label class="btn btn-outline-primary me-1 mb-1{% if radio.choice_value == current_status %} active{% endif %}" for="{{ radio.id_for_label }}">{{ radio.choice_label }}</label>
{% endfor %} {% endfor %}
{% endwith %} {% endwith %}
+6 -2
View File
@@ -2998,8 +2998,12 @@ class GenericViewBase:
status=form.cleaned_data["status"], status=form.cleaned_data["status"],
comment=form.cleaned_data.get("comment", ""), comment=form.cleaned_data.get("comment", ""),
) )
# Render the updated review block and include an HX-Trigger so the client
return render(request, "generic/partials/question_review_block.html", {"review": review, "question": question, "app_name": self.app_name}) # can close the modal (HTMX will dispatch the event named below).
resp = render(request, "generic/partials/question_review_block.html", {"review": review, "question": question, "app_name": self.app_name})
# Trigger a client-side event; base template will listen for this and hide the modal
resp["HX-Trigger"] = "reviewSaved"
return resp
# Default: render the block (latest if exists, otherwise form) # Default: render the block (latest if exists, otherwise form)
if latest: if latest:
+34
View File
@@ -0,0 +1,34 @@
FROM python:3.14-slim
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Install packages needed to build common Python packages and Postgres client
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
gcc \
git \
libpq-dev \
pkg-config \
libcairo2-dev \
libgdk-pixbuf-xlib-2.0-0 \
libgdk-pixbuf-xlib-2.0-dev \
libjpeg-dev \
zlib1g-dev \
wget \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /usr/src/app
# Install Python deps first for better caching
COPY requirements.txt /usr/src/app/
RUN pip install --upgrade pip setuptools wheel && \
pip install --no-cache-dir -r requirements.txt
# Copy project (will be shadowed by volume in development)
COPY . /usr/src/app
WORKDIR /usr/src/app
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
+1 -1
View File
@@ -90,7 +90,7 @@
{% if question.e_feedback %}<div class="small text-muted mt-1">Feedback: <em>{{ question.e_feedback|safe }}</em></div>{% endif %} {% if question.e_feedback %}<div class="small text-muted mt-1">Feedback: <em>{{ question.e_feedback|safe }}</em></div>{% endif %}
</li> </li>
</ol> </ol>
<div class="mt-2">Correct: <span class="badge bg-success text-white fs-5 py-2 px-3 rounded-pill">{{ question.get_correct_answer_stripped }}</span></div> <div class="mt-2">Correct: <span class="badge bg-success text-white fs-5 py-2 px-3 rounded-pill correct-badge">{{ question.get_correct_answer_stripped }}</span></div>
{% endautoescape %} {% endautoescape %}
</div> </div>
+26
View File
@@ -85,6 +85,13 @@
.dropdown-item { .dropdown-item {
color: lightblue; color: lightblue;
} }
/* Allow the correct-answer badge to wrap if the text is long */
.correct-badge {
white-space: normal !important;
display: inline-block;
word-break: break-word;
max-width: 100%;
}
</style> </style>
{% block css %} {% block css %}
{% endblock %} {% endblock %}
@@ -194,6 +201,25 @@
<li class="ms-3"><a class="text-muted" href="{% url 'about' %}">About</a></li> <li class="ms-3"><a class="text-muted" href="{% url 'about' %}">About</a></li>
</ul> </ul>
</footer> </footer>
<!-- Close review modal after HTMX reviewSaved trigger -->
<script>
document.body.addEventListener('reviewSaved', function () {
try {
var modalEl = document.getElementById('reviewModal');
if (!modalEl) return;
var modal = bootstrap.Modal.getInstance(modalEl);
if (modal) {
modal.hide();
} else {
// If no instance exists, create one and hide it
var m = new bootstrap.Modal(modalEl);
m.hide();
}
} catch (err) {
console.error('Error hiding review modal', err);
}
});
</script>
</body> </body>
</html> </html>