Add sessionless play for Teachers

This commit is contained in:
phoenixeliot 2016-04-08 12:59:10 -07:00 committed by Scott Erickson
parent a7114a2719
commit a524256b5b
62 changed files with 153 additions and 103 deletions

View file

@ -377,7 +377,7 @@ module.exports = class LevelLoader extends CocoClass
resource.markLoaded() if resource.spriteSheetKeys.length is 0
denormalizeSession: ->
return if @headless or @sessionDenormalized or @spectateMode or @sessionless
return if @headless or @sessionDenormalized or @spectateMode or @sessionless or me.isTeacher()
# This is a way (the way?) PUT /db/level.sessions/undefined was happening
# See commit c242317d9
return if not @session.id

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "العربية", englishDescription: "Arabi
# completed_level: "Completed Level:"
# course: "Course:"
done: "انتهاء"
# next_level: "Next Level:"
# next_level: "Next Level"
# next_game: "Next game"
# show_menu: "Show game menu"
home: "Home" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "български език", englishDescri
# completed_level: "Completed Level:"
# course: "Course:"
done: "Готово"
# next_level: "Next Level:"
# next_level: "Next Level"
# next_game: "Next game"
# show_menu: "Show game menu"
home: "На главната" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "Català", englishDescription: "Catalan", tr
completed_level: "Nivell completat:"
course: "Curs:"
done: "Fet"
next_level: "Següent nivell:"
next_level: "Següent nivell"
next_game: "Següent joc"
show_menu: "Mostrar menú del joc"
home: "Inici" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "čeština", englishDescription: "Czech", tr
# completed_level: "Completed Level:"
# course: "Course:"
done: "Hotovo"
# next_level: "Next Level:"
# next_level: "Next Level"
# next_game: "Next game"
# show_menu: "Show game menu"
home: "Domů" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "dansk", englishDescription: "Danish", trans
# completed_level: "Completed Level:"
# course: "Course:"
done: "Færdig"
# next_level: "Next Level:"
# next_level: "Next Level"
next_game: "Næste spil"
show_menu: "Vis spil menu"
home: "Hjem" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "Deutsch (Österreich)", englishDescription:
# completed_level: "Completed Level:"
# course: "Course:"
done: "Fertig"
# next_level: "Next Level:"
# next_level: "Next Level"
# next_game: "Next game"
# show_menu: "Show game menu"
home: "Startseite" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "Dütsch (Schwiiz)", englishDescription: "Ge
# completed_level: "Completed Level:"
# course: "Course:"
done: "Fertig"
# next_level: "Next Level:"
# next_level: "Next Level"
# next_game: "Next game"
# show_menu: "Show game menu"
home: "Home" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "Deutsch (Deutschland)", englishDescription:
completed_level: "Abgeschlossene Level:"
course: "Kurse:"
done: "Fertig"
next_level: "Nächster Level:"
next_level: "Nächster Level"
next_game: "Nächstes Spiel"
show_menu: "Menü anzeigen"
home: "Startseite" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "Ελληνικά", englishDescription: "Gre
completed_level: "Ολοκληρωμένο Επίπεδο:"
course: "Μάθημα:"
done: "Έτοιμο"
next_level: "Επομένο Επίπεδο:"
next_level: "Επομένο Επίπεδο"
next_game: "Επόμενο παιχνίδι"
show_menu: "Εμφάνιση μενού παιχνιδιού"
home: "Αρχική" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "English (UK)", englishDescription: "English
# completed_level: "Completed Level:"
# course: "Course:"
# done: "Done"
# next_level: "Next Level:"
# next_level: "Next Level"
# next_game: "Next game"
# show_menu: "Show game menu"
# home: "Home" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "English (US)", englishDescription: "English
# completed_level: "Completed Level:"
# course: "Course:"
# done: "Done"
# next_level: "Next Level:"
# next_level: "Next Level"
# next_game: "Next game"
# show_menu: "Show game menu"
# home: "Home" # Not used any more, will be removed soon.

View file

@ -335,10 +335,11 @@
years: "years"
play_level:
level_complete: "Level Complete"
completed_level: "Completed Level:"
course: "Course:"
done: "Done"
next_level: "Next Level:"
next_level: "Next Level"
next_game: "Next game"
show_menu: "Show game menu"
home: "Home" # Not used any more, will be removed soon.
@ -378,6 +379,7 @@
victory_new_item: "New Item"
victory_viking_code_school: "Holy smokes, that was a hard level you just beat! If you aren't already a software developer, you should be. You just got fast-tracked for acceptance with Viking Code School, where you can take your skills to the next level and become a professional web developer in 14 weeks."
victory_become_a_viking: "Become a Viking"
victory_no_progress_for_teachers: "Progress is not saved for teachers. But, you can add a student account to your classroom for yourself."
guide_title: "Guide"
tome_cast_button_run: "Run"
tome_cast_button_running: "Running"
@ -1798,4 +1800,4 @@
one_month_coupon: "coupon: choose either Rails or HTML"
one_month_discount: "discount, 30% off: choose either Rails or HTML"
license: "license"
oreilly: "ebook of your choice"
oreilly: "ebook of your choice"

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "Esperanto", englishDescription: "Esperanto"
# completed_level: "Completed Level:"
# course: "Course:"
# done: "Done"
# next_level: "Next Level:"
# next_level: "Next Level"
# next_game: "Next game"
# show_menu: "Show game menu"
# home: "Home" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "Español (América Latina)", englishDescrip
completed_level: "Nivel Completado:"
course: "Curso:"
done: "Listo"
next_level: "Siguiente Nivel:"
next_level: "Siguiente Nivel"
next_game: "Siguiente juego"
show_menu: "Mostrar menú de juego"
home: "Inicio" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "español (ES)", englishDescription: "Spanis
# completed_level: "Completed Level:"
# course: "Course:"
done: "Hecho"
# next_level: "Next Level:"
# next_level: "Next Level"
# next_game: "Next game"
# show_menu: "Show game menu"
home: "Inicio" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "Eesti", englishDescription: "Estonian", tra
# completed_level: "Completed Level:"
# course: "Course:"
# done: "Done"
# next_level: "Next Level:"
# next_level: "Next Level"
# next_game: "Next game"
# show_menu: "Show game menu"
# home: "Home" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "فارسی", englishDescription: "Persian",
# completed_level: "Completed Level:"
# course: "Course:"
# done: "Done"
# next_level: "Next Level:"
# next_level: "Next Level"
# next_game: "Next game"
# show_menu: "Show game menu"
# home: "Home" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "suomi", englishDescription: "Finnish", tran
completed_level: "Suoritit tason:"
course: "Kurssi:"
done: "Valmis"
next_level: "Seuraava taso:"
next_level: "Seuraava taso"
next_game: "Seuraava peli"
show_menu: "Näytä pelivalikko"
# home: "Home" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "français", englishDescription: "French", t
completed_level: "Niveau terminé:"
course: "Cours:"
done: "Fait"
next_level: "Niveau Suivant:"
next_level: "Niveau Suivant"
next_game: "Prochain jeu"
show_menu: "Afficher le menu"
home: "Accueil" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "Galego", englishDescription: "Galician", tr
# completed_level: "Completed Level:"
# course: "Course:"
done: "Feito"
# next_level: "Next Level:"
# next_level: "Next Level"
# next_game: "Next game"
# show_menu: "Show game menu"
home: "Inicio" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "עברית", englishDescription: "Hebrew",
completed_level: "שלב שהושלם:"
course: "מסלול:"
done: "סיים"
next_level: "השלב הבא:"
next_level: "השלב הבא"
next_game: "המשחק הבא"
show_menu: "הצג תפריט משחק"
home: "בית" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "मानक हिन्दी", englishDe
# completed_level: "Completed Level:"
# course: "Course:"
# done: "Done"
# next_level: "Next Level:"
# next_level: "Next Level"
# next_game: "Next game"
# show_menu: "Show game menu"
# home: "Home" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "magyar", englishDescription: "Hungarian", t
completed_level: "Teljesített pálya:"
course: "Kurzus:"
done: "Kész"
next_level: "Következő pálya:"
next_level: "Következő pálya"
next_game: "Következő játék"
show_menu: "Játék Menü"
home: "Kezdőlap" # Not used any more, will be removed soon.

View file

@ -375,7 +375,7 @@ module.exports = nativeDescription: "Bahasa Indonesia", englishDescription: "Ind
# completed_level: "Completed Level:"
# course: "Course:"
# done: "Done"
# next_level: "Next Level:"
# next_level: "Next Level"
# next_game: "Next game"
# show_menu: "Show game menu"
# home: "Home" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "Italiano", englishDescription: "Italian", t
completed_level: "Livello completato:"
course: "Corso:"
done: "Fatto"
next_level: "Prossimo livello:"
next_level: "Prossimo livello"
next_game: "Prossimo gioco"
show_menu: "Visualizza menu gioco"
home: "Pagina iniziale" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "日本語", englishDescription: "Japanese",
completed_level: "コンプリートレベル:"
course: "コース:"
done: "完了"
next_level: "次のレベル:"
next_level: "次のレベル"
next_game: "次のゲーム"
show_menu: "ゲームメニューを見る"
home: "ホーム" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "한국어", englishDescription: "Korean", t
completed_level: "완료된 레벨:"
course: "코스:"
done: "완료"
next_level: "다음 레벨:"
next_level: "다음 레벨"
next_game: "다음 게임"
show_menu: "게임 매뉴 보이기"
home: "" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "lietuvių kalba", englishDescription: "Lith
completed_level: "Įveiktas Lygis:"
course: "Kursas:"
done: "Gerai"
next_level: "Kitas Lygis:"
next_level: "Kitas Lygis"
next_game: "Kitas žaidimas"
show_menu: "Parodyti žaidimo meniu"
# home: "Home" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "Македонски", englishDescription:
# completed_level: "Completed Level:"
# course: "Course:"
done: "Готово"
# next_level: "Next Level:"
# next_level: "Next Level"
# next_game: "Next game"
# show_menu: "Show game menu"
home: "Дома" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "Bahasa Melayu", englishDescription: "Bahasa
# completed_level: "Completed Level:"
# course: "Course:"
# done: "Done"
# next_level: "Next Level:"
# next_level: "Next Level"
# next_game: "Next game"
# show_menu: "Show game menu"
# home: "Home" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "မြန်မာစကား", englishDes
# completed_level: "Completed Level:"
# course: "Course:"
# done: "Done"
# next_level: "Next Level:"
# next_level: "Next Level"
# next_game: "Next game"
# show_menu: "Show game menu"
# home: "Home" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "Norsk Bokmål", englishDescription: "Norweg
# completed_level: "Completed Level:"
# course: "Course:"
done: "Ferdig"
# next_level: "Next Level:"
# next_level: "Next Level"
# next_game: "Next game"
# show_menu: "Show game menu"
home: "Hjem" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "Nederlands (België)", englishDescription:
completed_level: "Voltooid Level:"
course: "Les:"
done: "Klaar"
next_level: "Volgende Level:"
next_level: "Volgende Level"
next_game: "Volgend spel"
show_menu: "Geef spelmenu weer"
home: "Home" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "Nederlands (Nederland)", englishDescription
completed_level: "Voltooid Level:"
course: "Les:"
done: "Klaar"
next_level: "Volgende Level:"
next_level: "Volgende Level"
next_game: "Volgende spel"
show_menu: "Geef spelmenu weer"
home: "Home" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "Norsk Nynorsk", englishDescription: "Norweg
# completed_level: "Completed Level:"
# course: "Course:"
# done: "Done"
# next_level: "Next Level:"
# next_level: "Next Level"
# next_game: "Next game"
# show_menu: "Show game menu"
# home: "Home" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "polski", englishDescription: "Polish", tran
completed_level: "Ukończony poziom:"
course: "Kurs:"
done: "Zrobione"
next_level: "Następny poziom:"
next_level: "Następny poziom"
next_game: "Następna gra"
show_menu: "Pokaż menu gry"
home: "Strona główna" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "Português do Brasil", englishDescription:
completed_level: "Nivel Completo:"
course: "Curso:"
done: "Pronto"
next_level: "Proximo Nivel:"
next_level: "Proximo Nivel"
next_game: "Próximo jogo"
show_menu: "Mostrar menu do jogo"
home: "Início" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "Português (Portugal)", englishDescription:
completed_level: "Nível Completo:"
course: "Curso:"
done: "Concluir"
next_level: "Próximo Nível:"
next_level: "Próximo Nível"
next_game: "Próximo jogo"
show_menu: "Mostrar o menu do jogo"
home: "Início" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "limba română", englishDescription: "Roman
# completed_level: "Completed Level:"
# course: "Course:"
done: "Gata"
# next_level: "Next Level:"
# next_level: "Next Level"
# next_game: "Next game"
# show_menu: "Show game menu"
home: "Acasă" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "русский", englishDescription: "Russi
completed_level: "Завершённый уровень:"
course: "Курс:"
done: "Готово"
next_level: "Следующий уровень:"
next_level: "Следующий уровень"
next_game: "Следующая игра"
show_menu: "Показать меню игры"
home: "На главную" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "slovenščina", englishDescription: "Sloven
# completed_level: "Completed Level:"
# course: "Course:"
# done: "Done"
# next_level: "Next Level:"
# next_level: "Next Level"
# next_game: "Next game"
# show_menu: "Show game menu"
# home: "Home" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "српски", englishDescription: "Serbian
completed_level: "Завршен ниво:"
course: "Курс:"
done: "Урађено"
next_level: "Следећи ниво:"
next_level: "Следећи ниво"
next_game: "Следећа игра"
show_menu: "Види мени игре"
home: "Почетна" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "Svenska", englishDescription: "Swedish", tr
completed_level: "Avklarad nivå:"
course: "Lektion:"
done: "Klar"
next_level: "Nästa nivå:"
next_level: "Nästa nivå"
next_game: "Nästa spel"
show_menu: "Visa spelmeny"
home: "Hem" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "ไทย", englishDescription: "Thai", tra
# completed_level: "Completed Level:"
# course: "Course:"
done: "เสร็จสิ้น"
# next_level: "Next Level:"
# next_level: "Next Level"
# next_game: "Next game"
# show_menu: "Show game menu"
home: "หน้าแรก" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "Українська", englishDescription:
# completed_level: "Completed Level:"
# course: "Course:"
done: "Готово"
# next_level: "Next Level:"
# next_level: "Next Level"
next_game: "Наступна гра"
show_menu: "Показати меню гри"
home: "На головну" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "اُردُو", englishDescription: "Urdu",
# completed_level: "Completed Level:"
# course: "Course:"
# done: "Done"
# next_level: "Next Level:"
# next_level: "Next Level"
# next_game: "Next game"
# show_menu: "Show game menu"
# home: "Home" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "O'zbekcha", englishDescription: "Uzbek", tr
# completed_level: "Completed Level:"
# course: "Course:"
# done: "Done"
# next_level: "Next Level:"
# next_level: "Next Level"
# next_game: "Next game"
# show_menu: "Show game menu"
# home: "Home" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "Tiếng Việt", englishDescription: "Vietn
completed_level: "Hoàn thành Level:"
course: "Khoá học:"
done: "Hoàn thành"
next_level: "Level tiếp theo:"
next_level: "Level tiếp theo"
next_game: "Game kế tiếp"
show_menu: "Hiện game menu"
# home: "Home" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "简体中文", englishDescription: "Chinese
completed_level: "完成关卡:"
course: "课程:"
done: "完成"
next_level: "下一个关卡:"
next_level: "下一个关卡"
next_game: "下一场游戏"
show_menu: "显示游戏菜单"
home: "主页" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "吴语", englishDescription: "Wuu (Simplifi
# completed_level: "Completed Level:"
# course: "Course:"
# done: "Done"
# next_level: "Next Level:"
# next_level: "Next Level"
# next_game: "Next game"
# show_menu: "Show game menu"
# home: "Home" # Not used any more, will be removed soon.

View file

@ -315,7 +315,7 @@ module.exports = nativeDescription: "吳語", englishDescription: "Wuu (Traditio
# completed_level: "Completed Level:"
# course: "Course:"
done: "妝下落"
# next_level: "Next Level:"
# next_level: "Next Level"
# next_game: "Next game"
# show_menu: "Show game menu"
home: "主頁" # Not used any more, will be removed soon.

View file

@ -23,7 +23,7 @@ module.exports = class SuperModel extends Backbone.Model
console.info "#{_.values(@resources).length} resources."
unfinished = []
for resource in _.values(@resources) when resource
console.info "\t", resource.name, 'loaded', resource.isLoaded
console.info "\t", resource.name, 'loaded', resource.isLoaded, resource.model
unfinished.push resource unless resource.isLoaded
unfinished
@ -158,7 +158,7 @@ module.exports = class SuperModel extends Backbone.Model
# Tracking resources being loaded for this supermodel
finished: ->
return (@progress is 1.0) or (not @denom) or @failed
return (@progress is 1.0) or (not @denom) or @failed
addModelResource: (modelOrCollection, name, fetchOptions, value=1) ->
# Deprecating name. Handle if name is not included

View file

@ -5,4 +5,9 @@
margin-bottom: 5px
p
margin-top: 30px
margin-top: 30px
.course-title
white-space: nowrap
text-overflow: ellipsis
overflow: hidden

View file

@ -20,20 +20,20 @@ block content
.courses.container
- var courses = view.courses.models;
- var i = 0;
while i < courses.length
- var course = courses[i];
- i++;
- var courseIndex = 0;
while courseIndex < courses.length
- var course = courses[courseIndex];
- courseIndex++;
.course.row
.col-sm-9
+course-info(course)
.col-sm-3.hidden
.play-level-form
.col-sm-3
.play-level-form(data-course-id=course.id)
.form-group
label.control-label
span(data-i18n="courses.select_language")
| :
select.form-control
select.language-select.form-control
// TODO: Automate this list @scott
option(value="python")
| Python
@ -51,11 +51,17 @@ block content
label.control-label
span(data-i18n="courses.select_level")
| :
select.form-control
// TODO: Automate this list @scott
option(value='TODO')
| 1. Dungeons of Kithgard
a.btn.btn-lg.btn-primary
select.level-select.form-control
if view.campaigns.loaded
each level, levelIndex in view.campaigns.get(course.get('campaignID')).getLevels().models
option(value=level.get('slug'))
span
= levelIndex + 1
span
| .
span
= level.get('name')
a.play-level-button.btn.btn-lg.btn-primary
span(data-i18n="courses.play_level")
.clearfix

View file

@ -7,7 +7,7 @@
.levels-link-area
a.levels-link(href=homeLink || "/")
.glyphicon.glyphicon-play
span(data-i18n=ladderGame ? "general.ladder" : "nav.play").home-text Levels
span(data-i18n=me.isTeacher() ? "nav.courses" : (ladderGame ? "general.ladder" : "nav.play")).home-text Levels
if isMultiplayerLevel && !observing
.multiplayer-area-container

View file

@ -2,7 +2,7 @@
#close-modal.well.well-sm.well-parchment(data-dismiss="modal")
span.glyphicon.glyphicon-remove
.well.well-sm.well-parchment
h1 Level Complete
h1(data-i18n='play_level.level_complete')
.modal-body
.container-fluid
@ -10,23 +10,32 @@
- var colClass = view.nextLevel ? 'col-sm-7' : 'col-sm-12'
div(class=colClass)
.well.well-sm.well-parchment
h3.text-uppercase Completed Level:
h3.text-uppercase(data-i18n='play_level.completed_level')
h2.text-uppercase.text-center= i18n(view.level.attributes, 'name')
.well.well-sm.well-parchment
h3.text-uppercase Course:
.row
.col-sm-8
h3.text-uppercase.text-center= i18n(view.course.attributes, 'name')
.col-sm-4
- var stats = view.campaign.statsForSessions(view.levelSessions)
h1
span #{stats.levels.numDone}/#{stats.levels.size}
if me.isTeacher()
h3.course-title
span.text-uppercase.spr(data-i18n='play_level.course')
span.text-uppercase.text-center= i18n(view.course.attributes, 'name')
span(data-i18n='play_level.victory_no_progress_for_teachers')
else
h3.text-uppercase(data-i18n='play_level.course')
.row
.col-sm-8
h3.text-uppercase.text-center= i18n(view.course.attributes, 'name')
.col-sm-4
- var stats = view.campaign.statsForSessions(view.levelSessions)
h1
span #{stats.levels.numDone}/#{stats.levels.size}
if view.nextLevel
.col-sm-5
.well.well-sm.well-parchment
h3.text-uppercase Next Level:
h3.text-uppercase
span(data-i18n='play_level.next_level')
span :
h2.text-uppercase= i18n(view.nextLevel.attributes, 'name')
p= i18n(view.nextLevel.attributes, 'description')
@ -37,6 +46,6 @@
// button#continue-btn.btn.btn-illustrated.btn-default.btn-block.btn-lg.text-uppercase View Leaderboards
.col-sm-5
if view.nextLevel
button#next-level-btn.btn.btn-illustrated.btn-primary.btn-block.btn-lg.text-uppercase Next Level
button#next-level-btn.btn.btn-illustrated.btn-primary.btn-block.btn-lg.text-uppercase(data-i18n='play_level.next_level')
else
button#done-btn.btn.btn-illustrated.btn-primary.btn-block.btn-lg.text-uppercase Done
button#done-btn.btn.btn-illustrated.btn-primary.btn-block.btn-lg.text-uppercase(data-i18n='play_level.done')

View file

@ -48,5 +48,5 @@ module.exports = class ContactModal extends ModalView
updateScreenshot: ->
return unless @screenshotURL
screenshotEl = @$el.find('#contact-screenshot').removeClass('secret')
screenshotEl.find('a').prop('href', @screenshotURL)
screenshotEl.find('img').prop('src', @screenshotURL)
screenshotEl.find('a').prop('href', @screenshotURL.replace("http://codecombat.com/", "/"))
screenshotEl.find('img').prop('src', @screenshotURL.replace("http://codecombat.com/", "/"))

View file

@ -3,6 +3,7 @@ app = require 'core/application'
CocoCollection = require 'collections/CocoCollection'
CocoModel = require 'models/CocoModel'
Course = require 'models/Course'
Campaigns = require 'collections/Campaigns'
Classroom = require 'models/Classroom'
Classrooms = require 'collections/Classrooms'
InviteToClassroomModal = require 'views/courses/InviteToClassroomModal'
@ -22,6 +23,7 @@ module.exports = class TeacherCoursesView extends RootView
'click .btn-add-students': 'onClickAddStudents'
'click .create-new-class': 'onClickCreateNewClassButton'
'click .edit-classroom-small': 'onClickEditClassroomSmall'
'click .play-level-button': 'onClickPlayLevel'
guideLinks:
{
@ -43,6 +45,9 @@ module.exports = class TeacherCoursesView extends RootView
@classrooms.comparator = '_id'
@listenToOnce @classrooms, 'sync', @onceClassroomsSync
@supermodel.loadCollection(@classrooms, 'classrooms', {data: {ownerID: me.id}})
@campaigns = new Campaigns()
@campaigns.fetch()
@supermodel.trackCollection(@campaigns)
@courseInstances = new CocoCollection([], { url: "/db/course_instance", model: CourseInstance })
@courseInstances.comparator = 'courseID'
@courseInstances.sliceWithMembers = -> return @filter (courseInstance) -> _.size(courseInstance.get('members')) and courseInstance.get('classroomID')
@ -99,6 +104,14 @@ module.exports = class TeacherCoursesView extends RootView
modal = new ClassroomSettingsModal({classroom: classroom})
@openModalView(modal)
@listenToOnce modal, 'hide', @render
onClickPlayLevel: (e) ->
form = $(e.currentTarget).closest('.play-level-form')
levelSlug = form.find('.level-select').val()
courseID = form.data('course-id')
language = form.find('.language-select').val()
url = "/play/level/#{levelSlug}?course=#{courseID}&codeLanguage=#{language}"
application.router.navigate(url, { trigger: true })
onLoaded: ->
super()

View file

@ -75,7 +75,10 @@ module.exports = class ControlBarView extends CocoView
c.spectateGame = @spectateGame
c.observing = @observing
@homeViewArgs = [{supermodel: if @hasReceivedMemoryWarning then null else @supermodel}]
if @level.get('type', true) in ['ladder', 'ladder-tutorial', 'hero-ladder', 'course-ladder']
if me.isTeacher()
@homeLink = "/teachers/courses"
@homeViewClass = "views/courses/TeacherCoursesView"
else if @level.get('type', true) in ['ladder', 'ladder-tutorial', 'hero-ladder', 'course-ladder']
levelID = @level.get('slug')?.replace(/\-tutorial$/, '') or @level.id
@homeLink = '/play/ladder/' + levelID
@homeViewClass = 'views/ladder/LadderView'

View file

@ -136,7 +136,10 @@ module.exports = class PlayLevelView extends RootView
load: ->
@loadStartTime = new Date()
@god = new God()
@levelLoader = new LevelLoader supermodel: @supermodel, levelID: @levelID, sessionID: @sessionID, opponentSessionID: @opponentSessionID, team: @getQueryVariable('team'), observing: @observing, courseID: @courseID
levelLoaderOptions = supermodel: @supermodel, levelID: @levelID, sessionID: @sessionID, opponentSessionID: @opponentSessionID, team: @getQueryVariable('team'), observing: @observing, courseID: @courseID
if me.isTeacher()
levelLoaderOptions.fakeSessionConfig = {}
@levelLoader = new LevelLoader levelLoaderOptions
@listenToOnce @levelLoader, 'world-necessities-loaded', @onWorldNecessitiesLoaded
trackLevelLoadEnd: ->
@ -549,7 +552,7 @@ module.exports = class PlayLevelView extends RootView
@endHighlight()
options = {level: @level, supermodel: @supermodel, session: @session, hasReceivedMemoryWarning: @hasReceivedMemoryWarning, courseID: @courseID, courseInstanceID: @courseInstanceID, world: @world}
ModalClass = if @level.get('type', true) in ['hero', 'hero-ladder', 'hero-coop', 'course', 'course-ladder'] then HeroVictoryModal else VictoryModal
ModalClass = CourseVictoryModal if @isCourseMode()
ModalClass = CourseVictoryModal if @isCourseMode() or me.isTeacher()
ModalClass = PicoCTFVictoryModal if window.serverConfig.picoCTF
victoryModal = new ModalClass(options)
@openModalView(victoryModal)

View file

@ -100,20 +100,23 @@ module.exports = class CourseVictoryModal extends ModalView
triggeredBy: @session.id
achievement: achievement.id
})
ea.save()
# Can't just add models to supermodel because each ea has the same url
ea.sr = @supermodel.addSomethingResource(ea.cid)
@newEarnedAchievements.push ea
@listenToOnce ea, 'sync', (model) ->
model.sr.markLoaded()
if _.all((ea.id for ea in @newEarnedAchievements))
unless me.loading
@supermodel.loadModel(me, {cache: false})
@newEarnedAchievementsResource.markLoaded()
if me.isTeacher()
@newEarnedAchievements.push ea
else
ea.save()
# Can't just add models to supermodel because each ea has the same url
ea.sr = @supermodel.addSomethingResource(ea.cid)
@newEarnedAchievements.push ea
@listenToOnce ea, 'sync', (model) ->
model.sr.markLoaded()
if _.all((ea.id for ea in @newEarnedAchievements))
unless me.loading
@supermodel.loadModel(me, {cache: false})
@newEarnedAchievementsResource.markLoaded()
# have to use a something resource because addModelResource doesn't handle models being upserted/fetched via POST like we're doing here
@newEarnedAchievementsResource = @supermodel.addSomethingResource('earned achievements') if @newEarnedAchievements.length
unless me.isTeacher()
# have to use a something resource because addModelResource doesn't handle models being upserted/fetched via POST like we're doing here
@newEarnedAchievementsResource = @supermodel.addSomethingResource('earned achievements') if @newEarnedAchievements.length
onLoaded: ->
@ -160,9 +163,15 @@ module.exports = class CourseVictoryModal extends ModalView
@showView(@views[index+1])
onNextLevel: ->
link = "/play/level/#{@nextLevel.get('slug')}?course=#{@courseID}&course-instance=#{@courseInstanceID}"
if me.isTeacher()
link = "/play/level/#{@nextLevel.get('slug')}?course=#{@courseID}&codeLanguage=#{me.get('aceConfig').language}"
else
link = "/play/level/#{@nextLevel.get('slug')}?course=#{@courseID}&course-instance=#{@courseInstanceID}"
application.router.navigate(link, {trigger: true})
onDone: ->
link = "/courses/#{@courseID}/#{@courseInstanceID}"
if me.isTeacher()
link = "/teachers/courses"
else
link = "/courses/#{@courseID}/#{@courseInstanceID}"
application.router.navigate(link, {trigger: true})