Commit a86c84a4 by Prem Sichanugrist

Use Backbone's `render` convention instead

parent 9cb24ccc
......@@ -5,7 +5,7 @@
viewStack: []
start: ->
new CMS.Views.Course el: $('section.main-container')
new CMS.Views.Course(el: $('section.main-container')).render()
replaceView: (view) ->
@viewStack = [view]
......
class CMS.Views.Course extends Backbone.View
initialize: ->
@$('#weeks > li').each (index, week) =>
new CMS.Views.Week el: week, height: @maxWeekHeight()
CMS.on('content.show', @showContent)
CMS.on('content.hide', @hideContent)
render: ->
@$('#weeks > li').each (index, week) =>
new CMS.Views.Week(el: week, height: @maxWeekHeight()).render()
return @
showContent: (subview) =>
$('body').addClass('content')
@$('.main-content').html(subview.el)
@$('.main-content').html(subview.render().el)
@$('.cal').css height: @contentHeight()
@$('>section').css minHeight: @contentHeight()
......
......@@ -3,15 +3,16 @@ class CMS.Views.Week extends Backbone.View
'click .week-edit': 'edit'
initialize: ->
CMS.on('content.show', @resetHeight)
CMS.on('content.hide', @setHeight)
render: ->
@setHeight()
@$('.editable').inlineEdit()
@$('.editable-textarea').inlineEdit(control: 'textarea')
@$('.modules .module').each ->
new CMS.Views.Module el: this
CMS.on('content.show', @resetHeight)
CMS.on('content.hide', @setHeight)
new CMS.Views.Module(el: this).render()
return @
edit: =>
CMS.replaceView(new CMS.Views.WeekEdit(model: new CMS.Models.Week(id: @$el.data('id'))))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment