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

💻 Unsubmit program #5304

Merged
merged 21 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
e6a3c19
start looking into unsubmitting
Annelein Mar 21, 2024
33ca67c
unsubmit button works, translations
Annelein Mar 25, 2024
058983c
🤖 Automatically update generated files
Annelein Mar 25, 2024
a961bc3
Merge branch 'main' into unsubmit-program
Annelein Mar 25, 2024
483eeb6
Merge branch 'unsubmit-program' of https://github.com/hedyorg/hedy in…
Annelein Mar 25, 2024
e99ba7f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 25, 2024
a4507d3
🤖 Automatically update generated files
pre-commit-ci[bot] Mar 25, 2024
819a646
remove old code
Annelein Mar 26, 2024
e745f3b
Merge branch 'main' into unsubmit-program
Annelein Mar 26, 2024
8446a4b
submit to db boolean
Annelein Mar 27, 2024
345656a
Merge branch 'unsubmit-program' of https://github.com/hedyorg/hedy in…
Annelein Mar 27, 2024
d26211d
check if teacher
Annelein Mar 27, 2024
141706c
button center
Annelein Mar 27, 2024
941ab2d
Merge branch 'main' into unsubmit-program
Annelein Mar 27, 2024
de74ce1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 27, 2024
221a4e6
space
Annelein Mar 27, 2024
3459adf
Merge branch 'unsubmit-program' of https://github.com/hedyorg/hedy in…
Annelein Mar 27, 2024
8eb72f8
🤖 Automatically update generated files
Annelein Mar 27, 2024
5569d00
line import too long
Annelein Mar 27, 2024
fc1ccd8
Merge branch 'unsubmit-program' of https://github.com/hedyorg/hedy in…
Annelein Mar 27, 2024
b7551a6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 27, 2024
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
1 change: 1 addition & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1648,6 +1648,7 @@ def view_program(user, id):
lang=g.lang,
level=int(result['level']),
code=code),
is_teacher=user['is_teacher'],
**arguments_dict)


Expand Down
9 changes: 9 additions & 0 deletions messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -1778,6 +1778,15 @@ msgstr ""
msgid "unsaved_class_changes"
msgstr ""

msgid "unsubmit_program"
msgstr ""

msgid "unsubmit_warning"
msgstr ""

msgid "unsubmitted"
msgstr ""

msgid "update_adventure_prompt"
msgstr ""

Expand Down
7 changes: 7 additions & 0 deletions static/js/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,13 @@ export function submit_program (id: string, index: number) {
});
}

export function unsubmit_program (id: string) {
tryCatchPopup(async () => {
const response = await postJsonWithAchievements('/programs/unsubmit', { id });
modal.notifySuccess(response.message);
});
}

export async function set_explore_favourite(id: string, favourite: number) {
let prompt = "Are you sure you want to remove this program as a \"Hedy\'s choice\" program?";
if (favourite) {
Expand Down
7 changes: 7 additions & 0 deletions static/js/appbundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -55175,6 +55175,7 @@ ${i2}` : o2;
tryCatchErrorBox: () => tryCatchErrorBox,
tryCatchPopup: () => tryCatchPopup,
tryPaletteCode: () => tryPaletteCode,
unsubmit_program: () => unsubmit_program,
update_adventure: () => update_adventure,
update_user_tags: () => update_user_tags,
viewProgramLink: () => viewProgramLink
Expand Down Expand Up @@ -99489,6 +99490,12 @@ pygame.quit()
change_to_submitted(index3);
});
}
function unsubmit_program(id2) {
tryCatchPopup(async () => {
const response = await postJsonWithAchievements("/programs/unsubmit", { id: id2 });
modal.notifySuccess(response.message);
});
}
async function set_explore_favourite(id2, favourite) {
let prompt = `Are you sure you want to remove this program as a "Hedy's choice" program?`;
if (favourite) {
Expand Down
4 changes: 2 additions & 2 deletions static/js/appbundle.js.map

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions templates/view-program-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
<h2>{{_('submitted_header')}}</h2>
<h3 class="inline-block mt-0">{{_('submission_time')}}: {{program_timestamp}}</h3>
</div>
{% if is_teacher %}
<div class="text-center">
<button class="green-btn" data-cy="unsubmit-btn" onclick="hedyApp.modal.confirm ('{{_('unsubmit_warning')}}', function () {hedyApp.unsubmit_program ('{{initial_adventure.id}}', {{ loop_index }})})">{{_('unsubmit_program')}}</button>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<button class="green-btn" data-cy="unsubmit-btn" onclick="hedyApp.modal.confirm ('{{_('unsubmit_warning')}}', function () {hedyApp.unsubmit_program ('{{initial_adventure.id}}', {{ loop_index }})})">{{_('unsubmit_program')}}</button>
<button class="green-btn" data-cy="unsubmit-btn" onclick="hedyApp.unsubmit_program ('{{initial_adventure.id}}', '{{_('unsubmit_warning')}}'))">{{_('unsubmit_program')}}</button>

Either do this and handle the model in the backend, or convert it to htmx as we usually do!

</div>
{% endif %}
{% endif %}
<h1>{{initial_adventure.name}}</h1>
<h2 class="mt-0">{{_('level_title')}} {{level}}</h2>
Expand Down
9 changes: 9 additions & 0 deletions translations/ar/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2038,6 +2038,15 @@ msgstr "Unlock level thresholds"
msgid "unsaved_class_changes"
msgstr "There are unsaved changes, are you sure you want to leave this page?"

msgid "unsubmit_program"
msgstr ""

msgid "unsubmit_warning"
msgstr ""

msgid "unsubmitted"
msgstr ""

msgid "update_adventure_prompt"
msgstr "هل أنت متأكد أنك تريد تعديل هذه المغامرة؟"

Expand Down
9 changes: 9 additions & 0 deletions translations/bg/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2290,6 +2290,15 @@ msgstr "Unlock level thresholds"
msgid "unsaved_class_changes"
msgstr "There are unsaved changes, are you sure you want to leave this page?"

msgid "unsubmit_program"
msgstr ""

msgid "unsubmit_warning"
msgstr ""

msgid "unsubmitted"
msgstr ""

#, fuzzy
msgid "update_adventure_prompt"
msgstr "Are you sure you want to update this adventure?"
Expand Down
9 changes: 9 additions & 0 deletions translations/bn/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2385,6 +2385,15 @@ msgstr "Unlock level thresholds"
msgid "unsaved_class_changes"
msgstr "There are unsaved changes, are you sure you want to leave this page?"

msgid "unsubmit_program"
msgstr ""

msgid "unsubmit_warning"
msgstr ""

msgid "unsubmitted"
msgstr ""

#, fuzzy
msgid "update_adventure_prompt"
msgstr "Are you sure you want to update this adventure?"
Expand Down
9 changes: 9 additions & 0 deletions translations/ca/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2078,6 +2078,15 @@ msgstr "Desbloqueja els llindars de nivell"
msgid "unsaved_class_changes"
msgstr "Hi ha canvis no guardats, segur que voleu sortir d'aquesta pàgina?"

msgid "unsubmit_program"
msgstr ""

msgid "unsubmit_warning"
msgstr ""

msgid "unsubmitted"
msgstr ""

msgid "update_adventure_prompt"
msgstr "Estàs segur que vols actualitzar aquesta aventura?"

Expand Down
9 changes: 9 additions & 0 deletions translations/cs/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2281,6 +2281,15 @@ msgstr "Unlock level thresholds"
msgid "unsaved_class_changes"
msgstr "There are unsaved changes, are you sure you want to leave this page?"

msgid "unsubmit_program"
msgstr ""

msgid "unsubmit_warning"
msgstr ""

msgid "unsubmitted"
msgstr ""

#, fuzzy
msgid "update_adventure_prompt"
msgstr "Are you sure you want to update this adventure?"
Expand Down
9 changes: 9 additions & 0 deletions translations/cy/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2397,6 +2397,15 @@ msgstr "Unlock level thresholds"
msgid "unsaved_class_changes"
msgstr "There are unsaved changes, are you sure you want to leave this page?"

msgid "unsubmit_program"
msgstr ""

msgid "unsubmit_warning"
msgstr ""

msgid "unsubmitted"
msgstr ""

#, fuzzy
msgid "update_adventure_prompt"
msgstr "Are you sure you want to update this adventure?"
Expand Down
9 changes: 9 additions & 0 deletions translations/da/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2398,6 +2398,15 @@ msgstr "Unlock level thresholds"
msgid "unsaved_class_changes"
msgstr "There are unsaved changes, are you sure you want to leave this page?"

msgid "unsubmit_program"
msgstr ""

msgid "unsubmit_warning"
msgstr ""

msgid "unsubmitted"
msgstr ""

#, fuzzy
msgid "update_adventure_prompt"
msgstr "Are you sure you want to update this adventure?"
Expand Down
9 changes: 9 additions & 0 deletions translations/de/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -1915,6 +1915,15 @@ msgstr "Schalte Level.Grenzen frei"
msgid "unsaved_class_changes"
msgstr "Es gibt ungespeicherte Änderungen, bist du dir sicher, dass du diese Seite verlassen möchtest?"

msgid "unsubmit_program"
msgstr ""

msgid "unsubmit_warning"
msgstr ""

msgid "unsubmitted"
msgstr ""

msgid "update_adventure_prompt"
msgstr "Bist du sicher, dass du dieses Abenteuer updaten möchtest?"

Expand Down
9 changes: 9 additions & 0 deletions translations/el/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2122,6 +2122,15 @@ msgstr "Unlock level thresholds"
msgid "unsaved_class_changes"
msgstr "There are unsaved changes, are you sure you want to leave this page?"

msgid "unsubmit_program"
msgstr ""

msgid "unsubmit_warning"
msgstr ""

msgid "unsubmitted"
msgstr ""

msgid "update_adventure_prompt"
msgstr "Είσαι σίγουρος ότι θέλεις να ενημερώσεις την περιπέτεια;"

Expand Down
9 changes: 9 additions & 0 deletions translations/en/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -1818,6 +1818,15 @@ msgstr "Unlock level thresholds"
msgid "unsaved_class_changes"
msgstr "There are unsaved changes, are you sure you want to leave this page?"

msgid "unsubmit_program"
msgstr "Unsubmit program"

msgid "unsubmit_warning"
msgstr "Are you sure you want to unsubmit this program?"

msgid "unsubmitted"
msgstr "Unsubmitted"

msgid "update_adventure_prompt"
msgstr "Are you sure you want to update this adventure?"

Expand Down
9 changes: 9 additions & 0 deletions translations/eo/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2121,6 +2121,15 @@ msgstr "Unlock level thresholds"
msgid "unsaved_class_changes"
msgstr "There are unsaved changes, are you sure you want to leave this page?"

msgid "unsubmit_program"
msgstr ""

msgid "unsubmit_warning"
msgstr ""

msgid "unsubmitted"
msgstr ""

msgid "update_adventure_prompt"
msgstr "Ĉu vi certas, ke vi volas modifi ĉi tiun aventuron?"

Expand Down
9 changes: 9 additions & 0 deletions translations/es/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -1823,6 +1823,15 @@ msgstr "Desbloquear umbrales de nivel"
msgid "unsaved_class_changes"
msgstr "Hay cambios sin guardar, ¿estás seguro de que quieres abandonar esta página?"

msgid "unsubmit_program"
msgstr ""

msgid "unsubmit_warning"
msgstr ""

msgid "unsubmitted"
msgstr ""

msgid "update_adventure_prompt"
msgstr "¿Estás seguro de que quieres actualizar esta aventura?"

Expand Down
9 changes: 9 additions & 0 deletions translations/et/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2330,6 +2330,15 @@ msgstr "Unlock level thresholds"
msgid "unsaved_class_changes"
msgstr "There are unsaved changes, are you sure you want to leave this page?"

msgid "unsubmit_program"
msgstr ""

msgid "unsubmit_warning"
msgstr ""

msgid "unsubmitted"
msgstr ""

#, fuzzy
msgid "update_adventure_prompt"
msgstr "Are you sure you want to update this adventure?"
Expand Down
9 changes: 9 additions & 0 deletions translations/fa/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2372,6 +2372,15 @@ msgstr "Unlock level thresholds"
msgid "unsaved_class_changes"
msgstr "There are unsaved changes, are you sure you want to leave this page?"

msgid "unsubmit_program"
msgstr ""

msgid "unsubmit_warning"
msgstr ""

msgid "unsubmitted"
msgstr ""

#, fuzzy
msgid "update_adventure_prompt"
msgstr "Are you sure you want to update this adventure?"
Expand Down
9 changes: 9 additions & 0 deletions translations/fi/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2396,6 +2396,15 @@ msgstr "Unlock level thresholds"
msgid "unsaved_class_changes"
msgstr "There are unsaved changes, are you sure you want to leave this page?"

msgid "unsubmit_program"
msgstr ""

msgid "unsubmit_warning"
msgstr ""

msgid "unsubmitted"
msgstr ""

#, fuzzy
msgid "update_adventure_prompt"
msgstr "Are you sure you want to update this adventure?"
Expand Down
9 changes: 9 additions & 0 deletions translations/fr/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -1936,6 +1936,15 @@ msgstr "Déverrouiller les limites de niveau"
msgid "unsaved_class_changes"
msgstr "Il y a des changements non pris en comptes, es-tu sur de vouloir quitter la page ?"

msgid "unsubmit_program"
msgstr ""

msgid "unsubmit_warning"
msgstr ""

msgid "unsubmitted"
msgstr ""

msgid "update_adventure_prompt"
msgstr "Es-tu sur de vouloir mettre cette aventure à jour ?"

Expand Down
9 changes: 9 additions & 0 deletions translations/fy/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2279,6 +2279,15 @@ msgstr "Unlock level thresholds"
msgid "unsaved_class_changes"
msgstr "There are unsaved changes, are you sure you want to leave this page?"

msgid "unsubmit_program"
msgstr ""

msgid "unsubmit_warning"
msgstr ""

msgid "unsubmitted"
msgstr ""

#, fuzzy
msgid "update_adventure_prompt"
msgstr "Are you sure you want to update this adventure?"
Expand Down
9 changes: 9 additions & 0 deletions translations/he/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2322,6 +2322,15 @@ msgstr "Unlock level thresholds"
msgid "unsaved_class_changes"
msgstr "There are unsaved changes, are you sure you want to leave this page?"

msgid "unsubmit_program"
msgstr ""

msgid "unsubmit_warning"
msgstr ""

msgid "unsubmitted"
msgstr ""

#, fuzzy
msgid "update_adventure_prompt"
msgstr "Are you sure you want to update this adventure?"
Expand Down
9 changes: 9 additions & 0 deletions translations/hi/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2150,6 +2150,15 @@ msgstr "Unlock level thresholds"
msgid "unsaved_class_changes"
msgstr "There are unsaved changes, are you sure you want to leave this page?"

msgid "unsubmit_program"
msgstr ""

msgid "unsubmit_warning"
msgstr ""

msgid "unsubmitted"
msgstr ""

msgid "update_adventure_prompt"
msgstr "क्या आप वाकई इस adventure को अद्यतन करना चाहते हैं?"

Expand Down
9 changes: 9 additions & 0 deletions translations/hu/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2279,6 +2279,15 @@ msgstr "Unlock level thresholds"
msgid "unsaved_class_changes"
msgstr "Biztosan elhagyod ezt az oldalt? Mentetlen változtatásaid vannak, amik így elveszhetnek."

msgid "unsubmit_program"
msgstr ""

msgid "unsubmit_warning"
msgstr ""

msgid "unsubmitted"
msgstr ""

#, fuzzy
msgid "update_adventure_prompt"
msgstr "Biztosan frissíted ezt a kalandot?"
Expand Down
Loading
Loading