Commit 786b7bba authored by Jason Frisvold's avatar Jason Frisvold
Browse files

- Fix add feed function to bind editTags function on new rows

- Add "Feeds Saved" notice after finishing saves
parent 4374575b
......@@ -55,51 +55,7 @@
// Bind the edit tags function to each edit link
$( '.editTags' ).each( function() {
$( this ).bind('click', function () {
// Cover the screen in a blanket and show the popup
$('<div id="blanket"></div>' +
'<div id="popup"></div>').appendTo('#formdiv');
// Set the size of the popup
var lLeft = ($(window).width() / 4) + "px";
var lTop = ($(window).height() / 4) + "px";
$('#popup').css('top', lTop)
.css('left', lLeft)
.css('width', $(window).width() / 2 + 'px')
.css('height', $(window).height() / 2 + 'px');
// Variable to hold the taglist input element
taglist = $( this ).siblings('input');
tagparent = $( this ).parents('tr');
$.ajax({
url: 'feeds_ajax.php',
dataType: 'json',
type: 'POST',
data: { action: 'tagedit' },
success: function(data) {
if (data.success == 'true') {
$( '#popup' ).append(data.output);
$( '#tags' ).val( taglist.val() );
$( '#okbutton' ).bind('click', function() {
if (taglist.val() != $( '#tags' ).val() ) {
taglist.val( $( '#tags' ).val() );
tagparent.addClass('dirty');
}
$( '#popup' ).remove();
$( '#blanket' ).remove();
});
} else {
ajax_error(data.output);
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
ajax_error(errorThrown);
}
});
});
$( this ).bind('click', editTagsDialog );
});
// Bind the add function for new feeds
......@@ -124,6 +80,10 @@
var rows = $( '#feedsTable > tbody > tr' );
recolorRows(rows);
// Add the editTags handler
$( '#feedsTable tr:last .editTags' ).bind('click',
editTagsDialog );
// Add delete handler
$( '#feedsTable tbody:last td:nth-child(12) img' )
.bind('click', function() {
......@@ -154,8 +114,6 @@
return false;
}
// TODO : Display Save Banner
$('#feedsTable > tbody > tr').each(function(index) {
curRow = $( this );
if ( /dirty/.test(curRow.attr('class')) ) {
......@@ -281,12 +239,64 @@
}
});
// TODO : Remove save banner
// Show a brief notice that the feeds have been saved
$('<h1 id="saved">Feeds Saved</h1>').slideDown('slow').appendTo('#formdiv');
setTimeout(function() {
$( '#saved' ).slideUp('slow', function() {
$( '#saved' ).remove();
});
}, 3000);
return false;
});
});
// Function to display the edit Tags Dialog
// Intended to be used in a bind
function editTagsDialog() {
// Cover the screen in a blanket and show the popup
$('<div id="blanket"></div>' +
'<div id="popup"></div>').appendTo('#formdiv');
// Set the size of the popup
var lLeft = ($(window).width() / 4) + "px";
var lTop = ($(window).height() / 4) + "px";
$('#popup').css('top', lTop)
.css('left', lLeft)
.css('width', $(window).width() / 2 + 'px')
.css('height', $(window).height() / 2 + 'px');
// Variable to hold the taglist input element
taglist = $( this ).siblings('input');
tagparent = $( this ).parents('tr');
$.ajax({
url: 'feeds_ajax.php',
dataType: 'json',
type: 'POST',
data: { action: 'tagedit' },
success: function(data) {
if (data.success == 'true') {
$( '#popup' ).append(data.output);
$( '#tags' ).val( taglist.val() );
$( '#okbutton' ).bind('click', function() {
if (taglist.val() != $( '#tags' ).val() ) {
taglist.val( $( '#tags' ).val() );
tagparent.addClass('dirty');
}
$( '#popup' ).remove();
$( '#blanket' ).remove();
});
} else {
ajax_error(data.output);
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
ajax_error(errorThrown);
}
});
}
function validateInput(input_reg, input_elem) {
if (! input_reg.test(input_elem.val())) {
input_elem.parent().addClass('error');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment