remove cut/paste error which results in a server error. is not defined when there are no assets. Also fix up base.js to only register one set of handlers for file section which gets rid of the multiple file selection dialogs from appearing

This commit is contained in:
Chris Dodge
2012-10-18 21:57:06 -04:00
parent d80c834095
commit 424875848e
2 changed files with 6 additions and 5 deletions

View File

@@ -86,6 +86,11 @@ $(document).ready(function() {
$('.set-publish-date').bind('click', setSectionScheduleDate);
$('.edit-section-start-cancel').bind('click', cancelSetSectionScheduleDate);
$('.edit-section-start-save').bind('click', saveSetSectionScheduleDate);
// modal upload asset dialog. Bind it in the initializer otherwise multiple hanlders will get registered causing
// pretty wacky stuff to happen
$('.file-input').bind('change', startUpload);
$('.upload-modal .choose-file-button').bind('click', showFileSelectionMenu);
});
function showImportSubmit(e) {
@@ -304,8 +309,6 @@ function _deleteItem($el) {
function showUploadModal(e) {
e.preventDefault();
$('.upload-modal').show();
$('.file-input').bind('change', startUpload);
$('.upload-modal .choose-file-button').bind('click', showFileSelectionMenu);
$modalCover.show();
}
@@ -358,8 +361,6 @@ function displayFinishedUpload(xhr) {
var html = Mustache.to_html(template, resp);
$('table > tbody > tr:first').before(html);
$("tr[data-id='" + resp.url + "'] a.show-xml").toggle(showEmbeddableXML, hideEmbeddableXML);
}
function markAsLoaded() {

View File

@@ -99,7 +99,7 @@
</div>
<div class="embeddable">
<label>Embeddable XML:</label>
<input type="text" class="embeddable-xml-input" value='<img src="${asset['url']}"/>'>
<input type="text" class="embeddable-xml-input" value='<img src=""/>'>
</div>
<form class="file-chooser" action="${upload_asset_callback_url}"
method="post" enctype="multipart/form-data">