##// END OF EJS Templates
Better interface for the thread admin tags list
Better interface for the thread admin tags list

File last commit:

r713:7f2e98f4 default
r921:eeea6bf9 default
Show More
form.js
41 lines | 1.3 KiB | application/javascript | JavascriptLexer
neko259
When swapping the form view, move elements of one form instead of swapping 2...
r698 var isCompact = false;
neko259
Added image preview in the forms
r673
neko259
Updated form to a new style. Fixed mark manel
r680 $('input[name=image]').wrap($('<div class="file_wrap"></div>'));
neko259
Added a compact form to the thread.
r676
$('body').on('change', 'input[name=image]', function(event) {
neko259
Added image preview in the forms
r673 var file = event.target.files[0];
if(file.type.match('image.*')) {
var fileReader = new FileReader();
fileReader.addEventListener("load", function(event) {
neko259
Updated form to a new style. Fixed mark manel
r680 var wrapper = $('.file_wrap');
wrapper.find('.file-thumb').remove();
wrapper.append(
$('<div class="file-thumb" style="background-image: url('+event.target.result+')"></div>')
neko259
Added image preview in the forms
r673 );
});
fileReader.readAsDataURL(file);
}
});
neko259
Added a compact form to the thread.
r676
var fullForm = $('.swappable-form-full');
function swapForm() {
if (isCompact) {
neko259
When swapping the form view, move elements of one form instead of swapping 2...
r698 // TODO Use IDs (change the django form code) instead of absolute numbers
neko259
Fixed full form switching
r713 fullForm.find('textarea').appendTo(fullForm.find('.form-row')[4].children[0]);
fullForm.find('.file_wrap').appendTo(fullForm.find('.form-row')[7].children[0]);
neko259
When swapping the form view, move elements of one form instead of swapping 2...
r698 fullForm.find('.form-row').show();
neko259
Added js code highlight
r703
scrollToBottom();
neko259
Added a compact form to the thread.
r676 } else {
neko259
When swapping the form view, move elements of one form instead of swapping 2...
r698 fullForm.find('textarea').appendTo($('.compact-form-text'));
fullForm.find('.file_wrap').insertBefore($('.compact-form-text'));
fullForm.find('.form-row').hide();
fullForm.find('input[type=text]').val('');
neko259
Added a compact form to the thread.
r676 }
isCompact = !isCompact;
}