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...
|
h1(data-i18n="common.loading") Loading...
|
||||||
else
|
else
|
||||||
h1
|
h1
|
||||||
if courseInstance.get('name')
|
| #{course.get('name')}
|
||||||
| #{courseInstance.get('name')}
|
small.spl
|
||||||
else
|
if courseInstance.get('name')
|
||||||
span(data-i18n='courses.unnamed_class')
|
| (#{courseInstance.get('name')})
|
||||||
small.spl (#{course.get('name')})
|
else if view.classroom.get('name')
|
||||||
|
| (#{view.classroom.get('name')})
|
||||||
|
else
|
||||||
|
| (
|
||||||
|
span(data-i18n='courses.unnamed_class')
|
||||||
|
| )
|
||||||
|
|
||||||
if !view.owner.isNew()
|
if !view.owner.isNew()
|
||||||
p
|
p
|
||||||
|
@ -48,10 +53,11 @@ block content
|
||||||
if courseInstance.get('description')
|
if courseInstance.get('description')
|
||||||
each line in courseInstance.get('description').split('\n')
|
each line in courseInstance.get('description').split('\n')
|
||||||
div= line
|
div= line
|
||||||
if adminMode && courseInstance
|
// TODO: migrate these settings to classrooms
|
||||||
+settings-dialog
|
//if adminMode && courseInstance
|
||||||
p
|
// +settings-dialog
|
||||||
button.btn.btn-xs(data-toggle='modal', data-target='#settingsModal', data-i18n="courses.edit_settings")
|
// p
|
||||||
|
// button.btn.btn-xs(data-toggle='modal', data-target='#settingsModal', data-i18n="courses.edit_settings")
|
||||||
|
|
||||||
div.well.well-sm(role='tabpanel')
|
div.well.well-sm(role='tabpanel')
|
||||||
ul.nav.nav-pills(role='tablist')
|
ul.nav.nav-pills(role='tablist')
|
||||||
|
|
|
@ -2,6 +2,7 @@ Campaign = require 'models/Campaign'
|
||||||
CocoCollection = require 'collections/CocoCollection'
|
CocoCollection = require 'collections/CocoCollection'
|
||||||
Course = require 'models/Course'
|
Course = require 'models/Course'
|
||||||
CourseInstance = require 'models/CourseInstance'
|
CourseInstance = require 'models/CourseInstance'
|
||||||
|
Classroom = require 'models/Classroom'
|
||||||
LevelSession = require 'models/LevelSession'
|
LevelSession = require 'models/LevelSession'
|
||||||
RootView = require 'views/core/RootView'
|
RootView = require 'views/core/RootView'
|
||||||
template = require 'templates/courses/course-details'
|
template = require 'templates/courses/course-details'
|
||||||
|
@ -30,6 +31,7 @@ module.exports = class CourseDetailsView extends RootView
|
||||||
super options
|
super options
|
||||||
@courseID ?= options.courseID
|
@courseID ?= options.courseID
|
||||||
@courseInstanceID ?= options.courseInstanceID
|
@courseInstanceID ?= options.courseInstanceID
|
||||||
|
@classroom = new Classroom()
|
||||||
@adminMode = me.isAdmin()
|
@adminMode = me.isAdmin()
|
||||||
@memberSort = 'nameAsc'
|
@memberSort = 'nameAsc'
|
||||||
@course = @supermodel.getModel(Course, @courseID) or new Course _id: @courseID
|
@course = @supermodel.getModel(Course, @courseID) or new Course _id: @courseID
|
||||||
|
@ -118,6 +120,9 @@ module.exports = class CourseDetailsView extends RootView
|
||||||
|
|
||||||
onCourseInstanceSync: ->
|
onCourseInstanceSync: ->
|
||||||
# console.log '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'
|
@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' })
|
@levelSessions = new CocoCollection([], { url: "/db/course_instance/#{@courseInstance.id}/level_sessions", model: LevelSession, comparator:'_id' })
|
||||||
@listenToOnce @levelSessions, 'sync', @onLevelSessionsSync
|
@listenToOnce @levelSessions, 'sync', @onLevelSessionsSync
|
||||||
|
|
Reference in a new issue