Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f72de6be9 | ||
|
|
9c68c4ff1c | ||
|
|
b26d31b216 | ||
|
|
c2d6cfa78e |
+13
-1
@@ -8,4 +8,16 @@ DB_USER=django
|
||||
DB_PASSWORD=postgres
|
||||
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
|
||||
@@ -7,13 +7,13 @@ services:
|
||||
- ./redis/redis.conf:/usr/local/etc/redis/redis.conf
|
||||
command: ["redis-server", "/usr/local/etc/redis/redis.conf"]
|
||||
web:
|
||||
build: ./rad
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: rad/Dockerfile
|
||||
command: python manage.py runserver 0.0.0.0:8000
|
||||
#command: pip install -r requirements.txt
|
||||
volumes:
|
||||
- ./rad/:/usr/src/rad/
|
||||
- ../rts/:/usr/src/rad/rts
|
||||
- ../Viewers/platform/app/dist/:/usr/src/rad/viewer
|
||||
- ../:/usr/src/app # mount the whole repo into the container
|
||||
- ./backups:/usr/src/backups
|
||||
- ./media:/usr/src/media
|
||||
- ./static:/usr/src/static
|
||||
@@ -30,10 +30,20 @@ services:
|
||||
- POSTGRES_USER=django
|
||||
- POSTGRES_PASSWORD=postgres
|
||||
- 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:
|
||||
image: memcached
|
||||
ports:
|
||||
- 11211:11211
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
postgres_data:
|
||||
pgadmin_data:
|
||||
@@ -12,6 +12,7 @@
|
||||
{% with current_status=form.status.value %}
|
||||
{% for radio in form.status %}
|
||||
{% 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>
|
||||
{% endfor %}
|
||||
{% endwith %}
|
||||
|
||||
+6
-2
@@ -2998,8 +2998,12 @@ class GenericViewBase:
|
||||
status=form.cleaned_data["status"],
|
||||
comment=form.cleaned_data.get("comment", ""),
|
||||
)
|
||||
|
||||
return render(request, "generic/partials/question_review_block.html", {"review": review, "question": question, "app_name": self.app_name})
|
||||
# Render the updated review block and include an HX-Trigger so the client
|
||||
# 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)
|
||||
if latest:
|
||||
|
||||
@@ -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"]
|
||||
@@ -90,7 +90,7 @@
|
||||
{% if question.e_feedback %}<div class="small text-muted mt-1">Feedback: <em>{{ question.e_feedback|safe }}</em></div>{% endif %}
|
||||
</li>
|
||||
</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 %}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -85,6 +85,13 @@
|
||||
.dropdown-item {
|
||||
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>
|
||||
{% block css %}
|
||||
{% endblock %}
|
||||
@@ -194,6 +201,25 @@
|
||||
<li class="ms-3"><a class="text-muted" href="{% url 'about' %}">About</a></li>
|
||||
</ul>
|
||||
</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>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user