ENHANCEMENT: Add styling for linking documents. Add classes for framework js to work

This commit is contained in:
Ryan O'Hara 2012-08-10 14:58:26 +12:00
parent 043eb540c1
commit 34674059f6
5 changed files with 42 additions and 35 deletions

View File

@ -1,3 +1,5 @@
#Main_FromtheCMS .ss-uploadfield-item-edit { position: relative; }
#Root_Documents { padding-left: 0; }
#Root_Documents table { white-space: normal; }
#Root_Documents table th.col-action_SetOrderTitle, #Root_Documents table th.col-FilenameWithoutID { width: 300px; }

View File

@ -3,42 +3,42 @@
$.entwine('ss', function($) {
$('.document-add-existing .document-autocomplete').entwine({
onmatch: function() {
var self = this;
this.autocomplete({
source: 'admin/pages/adddocument/documentautocomplete',
select: function(event, ui) {
if(ui.item) {
var page_id = $(this).closest('form').find(':input[name=ID]').val();
var document_id = ui.item.value;
$('.document-add-existing .document-autocomplete').entwine({
onmatch: function() {
var self = this;
this.autocomplete({
source: 'admin/pages/adddocument/documentautocomplete',
select: function(event, ui) {
if(ui.item) {
var page_id = $(this).closest('form').find(':input[name=ID]').val();
var document_id = ui.item.value;
jQuery.ajax(
'admin/pages/adddocument/linkdocument?ID=' + page_id + '&documentID=' + document_id,
{
dataType: 'json',
success: function(data, textstatus) {
var fn = window.tmpl.cache['ss-uploadfield-addtemplate'];
var fnout = fn({
files: [data],
formatFileSize: function (bytes) {
if (typeof bytes !== 'number') return '';
if (bytes >= 1000000000) return (bytes / 1000000000).toFixed(2) + ' GB';
if (bytes >= 1000000) return (bytes / 1000000).toFixed(2) + ' MB';
return (bytes / 1000).toFixed(2) + ' KB';
},
options: self.fileupload('option')
});
jQuery.ajax(
'admin/pages/adddocument/linkdocument?ID=' + page_id + '&documentID=' + document_id,
{
dataType: 'json',
success: function(data, textstatus) {
var fn = window.tmpl.cache['ss-uploadfield-addtemplate'];
var fnout = fn({
files: [data],
formatFileSize: function (bytes) {
if (typeof bytes !== 'number') return '';
if (bytes >= 1000000000) return (bytes / 1000000000).toFixed(2) + ' GB';
if (bytes >= 1000000) return (bytes / 1000000).toFixed(2) + ' MB';
return (bytes / 1000).toFixed(2) + ' KB';
},
options: self.fileupload('option')
});
$('.ss-add-files').append(fnout);
$('.ss-add-files').append(fnout);
}
}
}
);
);
}
}
}
});
}
});
});
}
});
});
}(jQuery));

View File

@ -60,7 +60,6 @@
}
});
});
}(jQuery));

View File

@ -1,5 +1,11 @@
//data-icon="cross-circle"
#Main_FromtheCMS{
.ss-uploadfield-item-edit{
position: relative;
}
}
#Root_Documents{
padding-left: 0;
table{

View File

@ -1,4 +1,4 @@
<div class="ss-add">
<div class="ss-add ss-upload">
<div class="document-add-existing field">
<h3>
@ -8,7 +8,7 @@
</span>
</h3>
<input class="document-autocomplete" placeholder="Search by ID or filename" />
<input class="document-autocomplete text" type="text" placeholder="Search by ID or filename" />
</div>
<div class="ss-assetuploadfield">