2010-11-09 19:52:52 +00:00
|
|
|
$(document).ready(function() {
|
|
|
|
$('input, textarea').each(function() {
|
|
|
|
var hasPlaceholder = $(this).attr("data-placeholder") == undefined ? false : true;
|
|
|
|
if (hasPlaceholder) {
|
|
|
|
$(this).data("placeholder", $(this).attr("data-placeholder"));
|
|
|
|
$(this).addClass("placeholder").val($(this).data("placeholder"));
|
|
|
|
$(this).focus(function() {
|
|
|
|
var currText = $(this).val();
|
|
|
|
if (currText == $(this).data("placeholder")) {
|
|
|
|
$(this).val('').removeClass("placeholder");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
$(this).blur(function() {
|
|
|
|
var currText = $(this).val();
|
|
|
|
if (currText == '') {
|
|
|
|
$(this).val($(this).data("placeholder"));
|
|
|
|
$(this).addClass("placeholder");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
/*
|
|
|
|
var Issue = function(json) {
|
|
|
|
this.id = json.id;
|
|
|
|
this.title = json.title;
|
|
|
|
this.summary = json.summary;
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
function renderIssues(data) {
|
|
|
|
var html = tmpl("tmpl_issue_list", data);
|
2010-11-10 21:40:04 +00:00
|
|
|
// console.log(html);
|
2010-11-09 19:52:52 +00:00
|
|
|
$('.issueListContainer').html(html);
|
|
|
|
/*
|
|
|
|
var hasNext = data.hasNext;
|
|
|
|
var hasPrev = data.hasPrev;
|
|
|
|
var issues = data.issues;
|
|
|
|
var endNo = data.end_no;
|
|
|
|
var pageSize = data.page_size;
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
$.getJSON("issue_list/", {}, function(data) {
|
|
|
|
renderIssues(data);
|
|
|
|
});
|
2010-11-10 21:40:04 +00:00
|
|
|
|
|
|
|
$('#searchForm').submit(function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
var searchInput = $('#issueSearch');
|
|
|
|
var search_terms = searchInput.val();
|
|
|
|
if (search_terms == '' || search_terms == searchInput.data("placeholder")) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
doIssuesLoading();
|
|
|
|
$.getJSON("issue_list/", {'search': search_terms}, function(data) {
|
|
|
|
renderIssues(data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2010-11-09 19:52:52 +00:00
|
|
|
});
|
|
|
|
|
2010-11-10 21:40:04 +00:00
|
|
|
function loadIssues(parentElem, page_no) {
|
|
|
|
var search_terms = parentElem.data("terms");
|
|
|
|
var params = {};
|
|
|
|
params['page'] = page_no;
|
|
|
|
//sets get var to search if search_terms is not empty string, otherwise sets to undefined.
|
|
|
|
params['search'] = search_terms == '' ? undefined : search_terms;
|
|
|
|
// console.log(start);
|
2010-11-09 19:52:52 +00:00
|
|
|
doIssuesLoading();
|
2010-11-10 21:40:04 +00:00
|
|
|
$.getJSON("issue_list/", params, function(data) {
|
2010-11-09 19:52:52 +00:00
|
|
|
renderIssues(data);
|
|
|
|
});
|
2010-11-10 21:40:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$('.nextBtn').live("click", function() {
|
|
|
|
// console.log("clicked next");
|
|
|
|
var parentElem = $(this).closest(".navBtns");
|
|
|
|
var curr_page = parseInt(parentElem.data("page"));
|
|
|
|
var next_page = curr_page + 1;
|
|
|
|
loadIssues(parentElem, next_page);
|
|
|
|
});
|
|
|
|
|
|
|
|
$('.prevBtn').live("click", function() {
|
|
|
|
var parentElem = $(this).closest(".navBtns");
|
|
|
|
var curr_page = parseInt(parentElem.data("page"));
|
|
|
|
var prev_page = curr_page - 1;
|
|
|
|
loadIssues(parentElem, prev_page);
|
2010-11-09 19:52:52 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
function doIssuesLoading() {
|
|
|
|
$.noop();
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
$('#subscribeForm').submit(function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
$('.validation').slideUp("fast");
|
|
|
|
var $email = $('#email');
|
|
|
|
var email = $email.val();
|
|
|
|
if (!isRFC822ValidEmail(email)) {
|
|
|
|
$('<div />').addClass('validation').html("Invalid Email Address").hide().insertAfter($email).slideDown("slow");
|
|
|
|
// $email.append(html);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
$('#subscribeBtn').attr("disabled", "disabled").text("Subscribing...");
|
|
|
|
$.post("/erang/subscribe/", {
|
|
|
|
'email': email
|
|
|
|
}, function(response) {
|
|
|
|
$('#subscribe').slideUp("slow", function() {
|
|
|
|
$(this).addClass("response").html("<b>" + email + "</b>" + " has been subscribed to eRang. Thanks!");
|
|
|
|
$(this).slideDown("slow");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$('#commentForm').submit(function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
$('#commentSubmit').attr("disabled", "disabled").text("Submitting...");
|
|
|
|
$.post("/erang/postfeedback/", {
|
|
|
|
'name': $('#commentName').val(),
|
|
|
|
'email': $('#commentEmail').val(),
|
|
|
|
'comment': $('#commentComment').val(),
|
|
|
|
'issue': document.title
|
|
|
|
}, function(response) {
|
|
|
|
$('#commentWrapper').slideUp("slow", function() {
|
|
|
|
$(this).addClass("response").html("Your feedback has been emailed to us at erang" + "@" + "theatreforum.in. Thanks!");
|
|
|
|
$(this).slideDown("slow", function() {
|
|
|
|
$(document).scrollTop($(document).height());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|