Correctly hide the content when cancel
This commit is contained in:
@@ -4,6 +4,7 @@ class CMS.Views.Course extends Backbone.View
|
||||
new CMS.Views.Week el: week, height: @maxWeekHeight()
|
||||
|
||||
CMS.on('showContent', @showContent)
|
||||
CMS.on('hideContent', @hideContent)
|
||||
|
||||
showContent: (subview) =>
|
||||
$('body').addClass('content')
|
||||
@@ -11,6 +12,12 @@ class CMS.Views.Course extends Backbone.View
|
||||
@$('.cal').css height: @contentHeight()
|
||||
@$('>section').css minHeight: @contentHeight()
|
||||
|
||||
hideContent: =>
|
||||
$('body').removeClass('content')
|
||||
@$('.main-content').empty()
|
||||
@$('.cal').css height: ''
|
||||
@$('>section').css minHeight: ''
|
||||
|
||||
maxWeekHeight: ->
|
||||
_.max($('#weeks > li').map -> $(this).height()) + 1
|
||||
|
||||
|
||||
@@ -2,6 +2,12 @@ class CMS.Views.ModuleEdit extends Backbone.View
|
||||
tagName: 'section'
|
||||
className: 'edit-pane'
|
||||
|
||||
events:
|
||||
'click .cancel': 'cancel'
|
||||
|
||||
initialize: ->
|
||||
CMS.trigger 'module.edit'
|
||||
@$el.append($('<div id="module-html">').load(@model.editUrl()))
|
||||
@$el.append($("""<div id="#{@model.get('id')}">""").load(@model.editUrl()))
|
||||
|
||||
cancel: ->
|
||||
CMS.trigger 'hideContent'
|
||||
|
||||
@@ -3,13 +3,22 @@ class CMS.Views.Week extends Backbone.View
|
||||
'click .module-edit': 'edit'
|
||||
|
||||
initialize: ->
|
||||
@model = new CMS.Models.Week(id: @el.id)
|
||||
@$el.height @options.height
|
||||
@model = new CMS.Models.Week(id: @$el.data('id'))
|
||||
@setHeight()
|
||||
@$('.editable').inlineEdit()
|
||||
@$('.editable-textarea').inlineEdit(control: 'textarea')
|
||||
|
||||
@$('#modules .module').each ->
|
||||
@$('.modules .module').each ->
|
||||
new CMS.Views.Module el: this
|
||||
|
||||
CMS.on('showContent', @resetHeight)
|
||||
CMS.on('hideContent', @setHeight)
|
||||
|
||||
edit: =>
|
||||
CMS.trigger('showContent', new CMS.Views.WeekEdit(model: @model))
|
||||
|
||||
setHeight: =>
|
||||
@$el.height(@options.height)
|
||||
|
||||
resetHeight: =>
|
||||
@$el.height('')
|
||||
|
||||
Reference in New Issue
Block a user