Work in progress editing. Committing to allow kfiedler to work in parallel
This commit is contained in:
1
cms/static/coffee/.gitignore
vendored
Normal file
1
cms/static/coffee/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.js
|
||||
67
cms/static/coffee/main.coffee
Normal file
67
cms/static/coffee/main.coffee
Normal file
@@ -0,0 +1,67 @@
|
||||
$ ->
|
||||
$('section.main-content').children().hide()
|
||||
$('.editable').inlineEdit()
|
||||
$('.editable-textarea').inlineEdit({control: 'textarea'})
|
||||
|
||||
heighest = 0
|
||||
$('.cal ol > li').each ->
|
||||
heighest = if $(this).height() > heighest then $(this).height() else heighest
|
||||
|
||||
$('.cal ol > li').css('height',heighest + 'px')
|
||||
|
||||
$('.add-new-section').click -> return false
|
||||
|
||||
$('.new-week .close').click ->
|
||||
$(this).parents('.new-week').hide()
|
||||
$('p.add-new-week').show()
|
||||
return false
|
||||
|
||||
$('.save-update').click ->
|
||||
$(this).parent().parent().hide()
|
||||
return false
|
||||
|
||||
edit_item = (id) ->
|
||||
$.get('/edit_item', {id: id}, (data) ->
|
||||
$('section.edit-pane').empty().append(data)
|
||||
$('section.edit-pane').show()
|
||||
)
|
||||
|
||||
setHeight = ->
|
||||
windowHeight = $(this).height()
|
||||
contentHeight = windowHeight - 29
|
||||
|
||||
$('section.main-content > section').css('min-height', contentHeight)
|
||||
$('body.content .cal').css('height', contentHeight)
|
||||
|
||||
$('.edit-week').click ->
|
||||
$('body').addClass('content')
|
||||
$('body.content .cal').css('height', contentHeight)
|
||||
$('section.edit-pane').show()
|
||||
return false
|
||||
|
||||
$('a.week-edit').click ->
|
||||
$('body').addClass('content')
|
||||
$('body.content .cal').css('height', contentHeight)
|
||||
$('section.edit-pane').show()
|
||||
return false
|
||||
|
||||
$('a.sequence-edit').click ->
|
||||
$('body').addClass('content')
|
||||
$('body.content .cal').css('height', contentHeight)
|
||||
$('section.edit-pane').show()
|
||||
return false
|
||||
|
||||
$(document).ready(setHeight)
|
||||
$(window).bind('resize', setHeight)
|
||||
|
||||
$('a.module-edit').click ->
|
||||
edit_item($(this).attr('id'))
|
||||
return false
|
||||
|
||||
$('.video-new a').click ->
|
||||
$('section.edit-pane').show()
|
||||
return false
|
||||
|
||||
$('.problem-new a').click ->
|
||||
$('section.edit-pane').show()
|
||||
return false
|
||||
@@ -1,85 +0,0 @@
|
||||
$(document).ready(function(){
|
||||
$('section.main-content').children().hide();
|
||||
|
||||
$(function(){
|
||||
$('.editable').inlineEdit();
|
||||
$('.editable-textarea').inlineEdit({control: 'textarea'});
|
||||
});
|
||||
|
||||
var heighest = 0;
|
||||
$('.cal ol > li').each(function(){
|
||||
heighest = ($(this).height() > heighest) ? $(this).height() : heighest;
|
||||
|
||||
});
|
||||
|
||||
$('.cal ol > li').css('height',heighest + 'px');
|
||||
|
||||
$('.add-new-section').click(function() {
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.new-week .close').click( function(){
|
||||
$(this).parents('.new-week').hide();
|
||||
$('p.add-new-week').show();
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.save-update').click(function(){
|
||||
$(this).parent().parent().hide();
|
||||
return false;
|
||||
});
|
||||
|
||||
setHeight = function(){
|
||||
var windowHeight = $(this).height();
|
||||
var contentHeight = windowHeight - 29;
|
||||
|
||||
$('section.main-content > section').css('min-height', contentHeight);
|
||||
$('body.content .cal').css('height', contentHeight);
|
||||
|
||||
$('.edit-week').click( function() {
|
||||
$('body').addClass('content');
|
||||
$('body.content .cal').css('height', contentHeight);
|
||||
$('section.week-new').show();
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.cal ol li header h1 a').click( function() {
|
||||
$('body').addClass('content');
|
||||
$('body.content .cal').css('height', contentHeight);
|
||||
$('section.week-edit').show();
|
||||
return false;
|
||||
});
|
||||
|
||||
$('a.sequence-edit').click(function(){
|
||||
$('body').addClass('content');
|
||||
$('body.content .cal').css('height', contentHeight);
|
||||
$('section.sequence-edit').show();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(setHeight);
|
||||
$(window).bind('resize', setHeight);
|
||||
|
||||
$('.video-new a').click(function(){
|
||||
$('section.video-new').show();
|
||||
return false;
|
||||
});
|
||||
|
||||
$('a.video-edit').click(function(){
|
||||
$('section.video-edit').show();
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.problem-new a').click(function(){
|
||||
$('section.problem-new').show();
|
||||
return false;
|
||||
});
|
||||
|
||||
$('a.problem-edit').click(function(){
|
||||
$('section.problem-edit').show();
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user