o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1355470625.599173:@value"{I"
class:EFI"BundledAsset; FI"logical_path; FI""mercury/modals/inserttable.js; FI"
pathname; FI"/Users/brownjohn/.rvm/gems/ruby-1.9.3-p194/gems/mercury-rails-0.8.0/app/assets/javascripts/mercury/modals/inserttable.js.coffee; FI"content_type; FI"application/javascript; FI"
mtime; FI"2012-08-08T16:13:36+08:00; FI"length; Fi
I"digest; F"%1bd51f0a6309104b36817450a35aafa4I"source; FI"
(function() {
this.Mercury.modalHandlers.insertTable = {
initialize: function() {
var _this = this;
this.table = this.element.find('#table_display table');
this.table.on('click', function(event) {
return _this.onCellClick($(event.target));
});
this.element.find('#table_alignment').on('change', function() {
return _this.setTableAlignment();
});
this.element.find('#table_border').on('keyup', function() {
return _this.setTableBorder();
});
this.element.find('#table_spacing').on('keyup', function() {
return _this.setTableCellSpacing();
});
this.element.find('[data-action]').on('click', function(event) {
event.preventDefault();
return _this.onActionClick(jQuery(event.target).data('action'));
});
this.selectFirstCell();
return this.element.find('form').on('submit', function(event) {
event.preventDefault();
_this.submitForm();
return _this.hide();
});
},
selectFirstCell: function() {
var firstCell;
firstCell = this.table.find('td, th').first();
firstCell.addClass('selected');
return Mercury.tableEditor(this.table, firstCell, ' ');
},
onCellClick: function(cell) {
this.cell = cell;
this.table = this.cell.closest('table');
this.table.find('.selected').removeAttr('class');
this.cell.addClass('selected');
return Mercury.tableEditor(this.table, this.cell, ' ');
},
onActionClick: function(action) {
if (!action) {
return;
}
return Mercury.tableEditor[action]();
},
setTableAlignment: function() {
return this.table.attr({
align: this.element.find('#table_alignment').val()
});
},
setTableBorder: function() {
return this.table.attr({
border: parseInt(this.element.find('#table_border').val(), 10) || 1
});
},
setTableCellSpacing: function() {
return this.table.attr({
cellspacing: parseInt(this.element.find('#table_spacing').val(), 10) || 1
});
},
submitForm: function() {
var html, value;
this.table.find('.selected').removeAttr('class');
this.table.find('td, th').html('
');
html = jQuery('