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 all 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

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.

4 changes: 3 additions & 1 deletion 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 @@ -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
27 changes: 27 additions & 0 deletions messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,24 @@ msgstr ""
msgid "class_overview"
msgstr ""

msgid "class_survey_description"
msgstr ""

msgid "class_survey_later"
msgstr ""

msgid "class_survey_question1"
msgstr ""

msgid "class_survey_question2"
msgstr ""

msgid "class_survey_question3"
msgstr ""

msgid "class_survey_question4"
msgstr ""

msgid "close"
msgstr ""

Expand Down Expand Up @@ -1289,6 +1307,9 @@ msgstr ""
msgid "retrieve_tag_error"
msgstr ""

msgid "retrieve_tag_error"
msgstr ""

msgid "role"
msgstr ""

Expand Down Expand Up @@ -1469,6 +1490,12 @@ msgstr ""
msgid "surname"
msgstr ""

msgid "survey_skip"
msgstr ""

msgid "survey_submit"
msgstr ""

msgid "tag_in_adventure"
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 and survey_later %}
{{ render_partial('htmx-survey.html', survey_id=survey_id, description=description, questions=questions, survey_later=survey_later) }}
{% 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="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 gap-2 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 %}

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ describe('Is able to see copy link to add student to class', () => {


cy.get(".view_class").first().click();
cy.get('body').then($b => $b.find("#survey")).then($s => $s.length && $s.hide())
cy.get('#add-student').click();
cy.get('#copy-join-link').should('be.visible').should('be.enabled').click();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ describe('Is able to add student by name', () => {
cy.wait(500);

cy.get(".view_class").first().click();
cy.get('body').then($b => $b.find("#survey")).then($s => $s.length && $s.hide())

//delete student1 if in class

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ describe('Is able to go to logs page', () => {
var currentUrl = '';
cy.url().then(url => {
currentUrl = url;
cy.get('#survey').invoke('hide').should('not.be.visible');
cy.get('#customize-class-button').click(); // Press logs button

let statsUrl = Cypress.env('customize_class_page') + currentUrl.substring(currentUrl.indexOf('class/')+6);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ describe('customize class page', () => {
// ensureIsSecondTeacher("teacher1", "teacher2")
// await ensureClass();
cy.getBySel('view_class_link').first().click(); // Press on view class button
cy.get('body').then($b => $b.find("#survey")).then($s => $s.length && $s.hide())
cy.getBySel('customize_class_button').click(); // Press customize class button

// Remove any customizations that already exist to get the class into a predictable state
Expand Down
1 change: 1 addition & 0 deletions tests/cypress/e2e/tools/classes/class.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export function addStudents(classname, count) {
cy.get(".view_class").contains(new RegExp(`^${classname}$`)).click();
cy.wait(500);

cy.get('body').then($b => $b.find("#survey")).then($s => $s.length && $s.hide())
cy.get('#add-student').click();
cy.get('#create-accounts').click();
cy.wrap(students).each((student, index) => {
Expand Down
30 changes: 30 additions & 0 deletions translations/ar/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,24 @@ msgstr "أدخل اسم الصف رجاء"
msgid "class_overview"
msgstr "Class overview"

msgid "class_survey_description"
msgstr ""

msgid "class_survey_later"
msgstr ""

msgid "class_survey_question1"
msgstr ""

msgid "class_survey_question2"
msgstr ""

msgid "class_survey_question3"
msgstr ""

msgid "class_survey_question4"
msgstr ""

#, fuzzy
msgid "close"
msgstr "Sluiten"
Expand Down Expand Up @@ -1777,6 +1795,12 @@ msgstr ""
msgid "surname"
msgstr "الاسم الأول"

msgid "survey_skip"
msgstr ""

msgid "survey_submit"
msgstr ""

msgid "tag_in_adventure"
msgstr ""

Expand Down Expand Up @@ -2220,3 +2244,9 @@ msgstr "Your program"
#~ msgid "tag_deleted"
#~ msgstr "لقد تم حذف العلامة"

#~ msgid "survey_later"
#~ msgstr ""

#~ msgid "class_survey_questions"
#~ msgstr ""

Loading
Loading