mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-26 05:53:39 -04:00
Adjust CourseDetailsView for classrooms
* Disable settings modal * Show classroom name instead of course instance name if available
This commit is contained in:
parent
628ed9a990
commit
c8fc893ef1
2 changed files with 20 additions and 9 deletions
app
|
@ -32,11 +32,16 @@ block content
|
|||
h1(data-i18n="common.loading") Loading...
|
||||
else
|
||||
h1
|
||||
if courseInstance.get('name')
|
||||
| #{courseInstance.get('name')}
|
||||
else
|
||||
span(data-i18n='courses.unnamed_class')
|
||||
small.spl (#{course.get('name')})
|
||||
| #{course.get('name')}
|
||||
small.spl
|
||||
if courseInstance.get('name')
|
||||
| (#{courseInstance.get('name')})
|
||||
else if view.classroom.get('name')
|
||||
| (#{view.classroom.get('name')})
|
||||
else
|
||||
| (
|
||||
span(data-i18n='courses.unnamed_class')
|
||||
| )
|
||||
|
||||
if !view.owner.isNew()
|
||||
p
|
||||
|
@ -48,10 +53,11 @@ block content
|
|||
if courseInstance.get('description')
|
||||
each line in courseInstance.get('description').split('\n')
|
||||
div= line
|
||||
if adminMode && courseInstance
|
||||
+settings-dialog
|
||||
p
|
||||
button.btn.btn-xs(data-toggle='modal', data-target='#settingsModal', data-i18n="courses.edit_settings")
|
||||
// TODO: migrate these settings to classrooms
|
||||
//if adminMode && courseInstance
|
||||
// +settings-dialog
|
||||
// p
|
||||
// button.btn.btn-xs(data-toggle='modal', data-target='#settingsModal', data-i18n="courses.edit_settings")
|
||||
|
||||
div.well.well-sm(role='tabpanel')
|
||||
ul.nav.nav-pills(role='tablist')
|
||||
|
|
|
@ -2,6 +2,7 @@ Campaign = require 'models/Campaign'
|
|||
CocoCollection = require 'collections/CocoCollection'
|
||||
Course = require 'models/Course'
|
||||
CourseInstance = require 'models/CourseInstance'
|
||||
Classroom = require 'models/Classroom'
|
||||
LevelSession = require 'models/LevelSession'
|
||||
RootView = require 'views/core/RootView'
|
||||
template = require 'templates/courses/course-details'
|
||||
|
@ -30,6 +31,7 @@ module.exports = class CourseDetailsView extends RootView
|
|||
super options
|
||||
@courseID ?= options.courseID
|
||||
@courseInstanceID ?= options.courseInstanceID
|
||||
@classroom = new Classroom()
|
||||
@adminMode = me.isAdmin()
|
||||
@memberSort = 'nameAsc'
|
||||
@course = @supermodel.getModel(Course, @courseID) or new Course _id: @courseID
|
||||
|
@ -118,6 +120,9 @@ module.exports = class CourseDetailsView extends RootView
|
|||
|
||||
onCourseInstanceSync: ->
|
||||
# console.log 'onCourseInstanceSync'
|
||||
if @courseInstance.get('classroomID')
|
||||
@classroom = new Classroom({_id: @courseInstance.get('classroomID')})
|
||||
@supermodel.loadModel @classroom, 'classroom'
|
||||
@adminMode = true if @courseInstance.get('ownerID') is me.id and @courseInstance.get('name') isnt 'Single Player'
|
||||
@levelSessions = new CocoCollection([], { url: "/db/course_instance/#{@courseInstance.id}/level_sessions", model: LevelSession, comparator:'_id' })
|
||||
@listenToOnce @levelSessions, 'sync', @onLevelSessionsSync
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue