Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UI] Dynamic Survey View - Ask teacher for class info #4612 #4711

Merged
merged 43 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
f026c7b
Setting up survey view that takes x questions
Nov 2, 2023
8a55a78
Setting up survey view that takes x questions
Annelein Nov 2, 2023
17704fd
Setting up survey view that takes x questions
Annelein Nov 2, 2023
7d66ff4
Layout of view is done
Annelein Nov 3, 2023
114cf5c
Looking into parsing form responses
Annelein Nov 3, 2023
451ff6b
styling done, responses are parsed, looking into saving in database
Annelein Nov 6, 2023
7e0c5a3
Skip survey saved to database
Annelein Nov 10, 2023
2deef69
Survey description and questions as translations
Annelein Nov 10, 2023
43b28fe
Trigger should when class contains students
Annelein Nov 10, 2023
aa9ed60
Trigger should when class contains students
Annelein Nov 10, 2023
e619095
Triggered if class contains students
Annelein Nov 11, 2023
9fb621a
bigger text, remind me later button, survey table
Annelein Nov 15, 2023
3447e18
surveymodule, needs documentation
Annelein Nov 16, 2023
e05df59
translations
Annelein Nov 16, 2023
afe352b
screen size
Annelein Nov 16, 2023
570dc22
Update translations/en/LC_MESSAGES/messages.po
Annelein Nov 16, 2023
e41e1af
translations
Annelein Nov 16, 2023
648a1e9
trial for pot/po fixes
Felienne Nov 17, 2023
a2dcce6
view
Annelein Nov 17, 2023
54027d8
Merge branch 'main' into survey-class-info
Annelein Nov 17, 2023
b5b4b33
missing blueprint
Annelein Nov 17, 2023
78af349
merge conflict
Annelein Nov 20, 2023
78e8023
merge conflict
Annelein Nov 20, 2023
0ac7320
merge conflict
Annelein Nov 20, 2023
9423011
merge conflict
Annelein Nov 20, 2023
1a94d4e
translations
Annelein Nov 20, 2023
82806c0
show survey later is generic
Annelein Nov 20, 2023
ffd126e
move get_unanswered_questions to utils
Annelein Nov 20, 2023
a032f01
translations and translated question
Annelein Nov 21, 2023
b19f22e
small mistake
Annelein Nov 21, 2023
170ecef
small mistake
Annelein Nov 21, 2023
ae7f286
few test fixes
Annelein Nov 21, 2023
b93829f
few test fixes
Annelein Nov 21, 2023
cfa7ab5
Merge branch 'main' into survey-class-info
Annelein Nov 21, 2023
44404bc
==
Annelein Nov 21, 2023
56ba7be
Merge branch 'main' of github.com:hedyorg/hedy into survey-class-info
jpelay Nov 21, 2023
ac81a5b
__init__.py
Annelein Nov 21, 2023
0fbce2f
remove double strings
Felienne Nov 22, 2023
cec5d62
class test need to hide survey
Annelein Nov 22, 2023
8661469
unneeded styles
hasan-sh Nov 22, 2023
37b3fba
remove hiding survey in test
Annelein Nov 22, 2023
6e62860
hide survey when testing class activities
hasan-sh Nov 22, 2023
eb41886
hide survey when testing class activities - student copy link
Annelein Nov 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions .run/Python tests in test_level.run.xml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we modifying this file? Seems like this is IDE specific?

This file was deleted.

16 changes: 0 additions & 16 deletions .run/Python tests in test_snippets.run.xml

This file was deleted.

16 changes: 0 additions & 16 deletions .run/Python tests in test_translation_level.run.xml

This file was deleted.

6 changes: 4 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
from utils import dump_yaml_rt, is_debug_mode, load_yaml_rt, timems, version, strip_accents
from website import (ab_proxying, achievements, admin, auth_pages, aws_helpers,
cdn, classes, database, for_teachers, s3_logger, parsons,
profile, programs, querylog, quiz, statistics,
profile, programs, querylog, quiz, statistics, surveys,
translating, tags)
from website.auth import (current_user, is_admin, is_teacher, is_second_teacher, has_public_profile,
login_user_from_token_cookie, requires_login, requires_login_redirect, requires_teacher,
Expand Down Expand Up @@ -106,6 +106,7 @@
ACHIEVEMENTS_TRANSLATIONS = hedyweb.AchievementTranslations()
DATABASE = database.Database()
ACHIEVEMENTS = achievements.Achievements(DATABASE, ACHIEVEMENTS_TRANSLATIONS)
SURVEYS = surveys.SurveysModule(DATABASE)

TAGS = collections.defaultdict(hedy_content.NoSuchAdventure)
for lang in ALL_LANGUAGES.keys():
Expand Down Expand Up @@ -2475,7 +2476,7 @@ def current_user_allowed_to_see_program(program):
app.register_blueprint(auth_pages.AuthModule(DATABASE))
app.register_blueprint(profile.ProfileModule(DATABASE))
app.register_blueprint(programs.ProgramsModule(DATABASE, ACHIEVEMENTS))
app.register_blueprint(for_teachers.ForTeachersModule(DATABASE, ACHIEVEMENTS))
app.register_blueprint(for_teachers.ForTeachersModule(DATABASE, ACHIEVEMENTS, SURVEYS))
app.register_blueprint(classes.ClassModule(DATABASE, ACHIEVEMENTS))
app.register_blueprint(classes.MiscClassPages(DATABASE, ACHIEVEMENTS))
app.register_blueprint(admin.AdminModule(DATABASE))
Expand All @@ -2485,6 +2486,7 @@ def current_user_allowed_to_see_program(program):
app.register_blueprint(statistics.StatisticsModule(DATABASE))
app.register_blueprint(statistics.LiveStatisticsModule(DATABASE))
app.register_blueprint(tags.TagsModule(DATABASE, ACHIEVEMENTS))
app.register_blueprint(surveys.SurveysModule(DATABASE))


# *** START SERVER ***
Expand Down
15 changes: 6 additions & 9 deletions messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,12 @@ msgstr ""
msgid "class_overview"
msgstr ""

msgid "class_survey_description"
msgstr ""

msgid "class_survey_questions"
msgstr ""

msgid "close"
msgstr ""

Expand Down Expand Up @@ -1441,15 +1447,6 @@ msgstr ""
msgid "surname"
msgstr ""

msgid "tag_deleted"
msgstr ""

msgid "tag_input_placeholder"
msgstr ""

msgid "tags"
msgstr ""

msgid "teacher"
msgstr ""

Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4,516 changes: 4,515 additions & 1 deletion static/css/generated.css

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions static/css/generated.full.css
Original file line number Diff line number Diff line change
Expand Up @@ -5521,6 +5521,10 @@ code {
margin-top: -2rem;
}

.mt-1 {
margin-top: 0.25rem;
}

.mt-auto {
margin-top: auto;
}
Expand Down Expand Up @@ -16040,9 +16044,9 @@ code {
border-color: rgb(104 211 145 / var(--tw-border-opacity));
}

.border-blue-600 {
.border-green-400 {
--tw-border-opacity: 1;
border-color: rgb(49 130 206 / var(--tw-border-opacity));
border-color: rgb(104 211 145 / var(--tw-border-opacity));
}

.border-blue-500 {
Expand Down
3 changes: 3 additions & 0 deletions templates/class-overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,8 @@ <h2>{{_('pending_invites')}}</h2>
</div>
{% endif %}
</div>
{% if survey_id and description and questions %}
{{ render_partial('htmx-survey.html', survey_id=survey_id, description=description, questions=questions) }}
{% endif %}
</div>
{% endblock %}
42 changes: 42 additions & 0 deletions templates/htmx-survey.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{% block regular_content %}
<div id="survey" class="z-50 fixed w-screen h-screen" style="width: 30%; top: 50%; left: 50%; transform: translate(-50%, -50%);">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's to make sure that the numbers don't change for different screens, use flex box:

<div id="survey" class="flex absolute inset-0 items-center justify-center">

<div class="bg-blue-500 border border-black rounded-lg px-8 py-4 text-center">
<div id="description" class="text-white mb-8 text-l">{{ _(description) }}</div>
<form id="survey-form">
{% for question in questions %}
<div class="mb-4">
<div id="question" class="text-white mb-4 text-xl">{{ _(question) }}</div>
<div class="flex flex-row justify-center space-x-1">
<input autofocus="autofocus" id="input" type="text" class="flex items-center border border-green-400 rounded p-2 px-3 w-4/5 mx-auto" name="{{ question }}">
</div>
</div>
{% endfor %}
<div class="mt-4 flex flex-row justify-center">
<button type="submit" class="green-btn block mx-auto w-40 pb-4 pt-4"
hx-trigger="click"
hx-post="/surveys/submit-survey/{{ survey_id }}"
hx-include="[name='question']"
hx-swap="innerHTML"
_="on click toggle .hidden on #survey">
{{_('survey_submit')}}</button>
<button type="remind_later" class="red-btn block mx-auto w-40 pb-4 pt-4"
hx-trigger="click"
hx-post="/surveys/remind-later-survey/{{ survey_id }}"
hx-swap="innerHTML"
_="on click toggle .hidden on #survey">
{{_('survey_later')}}</button>
</div>
<div class="flex-row justify-center">
<button type="skip" class="text-white m-1 w-40 pb-4 pt-4"
hx-trigger="click"
hx-post="/surveys/skip-survey/{{ survey_id }}"
hx-swap="innerHTML"
_="on click toggle .hidden on #survey">
<u>{{_('survey_skip')}}</u></button>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since you always skip for today, make sure to inform the user about that.

</div>
</form>
</div>
</div>
</div>
{% endblock %}

6 changes: 6 additions & 0 deletions translations/ar/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,12 @@ msgstr "أدخل اسم الصف رجاء"
msgid "class_overview"
msgstr "Class overview"

msgid "class_survey_description"
msgstr ""

msgid "class_survey_questions"
msgstr ""

#, fuzzy
msgid "close"
msgstr "Sluiten"
Expand Down
21 changes: 21 additions & 0 deletions translations/bg/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Bulgarian translations for PROJECT.
# Copyright (C) 2023 ORGANIZATION
# This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2023.
#
#, fuzzy
msgid ""
msgstr "Project-Id-Version: PACKAGE VERSION\nReport-Msgid-Bugs-To: \nPOT-Creation-Date: 2023-11-02 08:48+0200\nPO-Revision-Date: 2023-11-14 20:05+0000\nLast-Translator: Prefill add-on <[email protected]>\nLanguage-Team: LANGUAGE <[email protected]>\nLanguage: bg\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\nPlural-Forms: nplurals=2; plural=n != 1;\nX-Generator: Weblate 5.2-dev\n"

Expand Down Expand Up @@ -420,6 +426,12 @@ msgstr "Please enter the name of the class"
msgid "class_overview"
msgstr "Class overview"

msgid "class_survey_description"
msgstr ""

msgid "class_survey_questions"
msgstr ""

#, fuzzy
msgid "close"
msgstr "Sluiten"
Expand Down Expand Up @@ -1992,6 +2004,15 @@ msgstr "Абонирай се за нашия журнал"
msgid "surname"
msgstr "Потребителско име"

msgid "survey_later"
msgstr ""

msgid "survey_skip"
msgstr ""

msgid "survey_submit"
msgstr ""

#, fuzzy
msgid "tag_deleted"
msgstr "This tag was successfully deleted."
Expand Down
40 changes: 28 additions & 12 deletions translations/bn/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Bangla translations for PROJECT.
# Copyright (C) 2023 ORGANIZATION
# This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2023.
#
#, fuzzy
msgid ""
msgstr "Project-Id-Version: PACKAGE VERSION\nReport-Msgid-Bugs-To: \nPOT-Creation-Date: 2023-11-02 08:48+0200\nPO-Revision-Date: 2023-11-14 20:05+0000\nLast-Translator: Prefill add-on <[email protected]>\nLanguage-Team: LANGUAGE <[email protected]>\nLanguage: bn\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\nPlural-Forms: nplurals=2; plural=n > 1;\nX-Generator: Weblate 5.2-dev\n"

Expand Down Expand Up @@ -438,6 +444,12 @@ msgstr "Please enter the name of the class"
msgid "class_overview"
msgstr "Class overview"

msgid "class_survey_description"
msgstr ""

msgid "class_survey_questions"
msgstr ""

#, fuzzy
msgid "close"
msgstr "Sluiten"
Expand Down Expand Up @@ -2077,18 +2089,6 @@ msgstr "Subscribe to the newsletter"
msgid "surname"
msgstr "Username"

#, fuzzy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tagging @hasan-sh for this one. Are these tags still in use or are they deleted correctly?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why the translation keys related to tagging are removed:
image

Is that what you were asking @Felienne ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a quick search on main, and these tags are not included in any HTML or python file, so maybe it was correct?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get why these are removed...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just started a discusion in Discord, I think I understand why, but this is in any case not a problem with the PR @Annelein

msgid "tag_deleted"
msgstr "This tag was successfully deleted।"

#, fuzzy
msgid "tag_input_placeholder"
msgstr "Enter a new tag"

#, fuzzy
msgid "tags"
msgstr "Tags"

#, fuzzy
msgid "teacher"
msgstr "Looks like you are not a teacher!"
Expand Down Expand Up @@ -2554,3 +2554,19 @@ msgstr "Your program"

#~ msgid "title_class statistics"
#~ msgstr "My statistics"

#, fuzzy
msgid "invalid_level_comment"
msgstr "# The provided level is invalid, level is set to level 1"

#, fuzzy
msgid "invalid_language_comment"
msgstr "# The provided language is invalid, language set to English"

#, fuzzy
msgid "invalid_keyword_language_comment"
msgstr "# The provided keyword language is invalid, keyword language is set to English"

#, fuzzy
msgid "invalid_program_comment"
msgstr "# The provided program is invalid, please try again"
6 changes: 6 additions & 0 deletions translations/ca/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,12 @@ msgstr "Si us plau, introdueix el nom de la nova classe"
msgid "class_overview"
msgstr "Visió general de la classe"

msgid "class_survey_description"
msgstr ""

msgid "class_survey_questions"
msgstr ""

msgid "close"
msgstr "Tanca"

Expand Down
Loading
Loading