works on local, testing

This commit is contained in:
Sanj 2011-06-29 22:44:27 +05:30
parent 58ad185e04
commit fb67606ba7
2 changed files with 10 additions and 4 deletions

View File

@ -2,7 +2,10 @@ $(function() {
$('#filterForm').submit(function(e) {
e.preventDefault();
var formData = $(this).serializeArray();
$('#submitFilter').val("Loading...").attr("disabled", "disabled");
$.post("files/json_list", formData, function(response) {
$('#submitFilter').val("Submit").removeAttr("disabled");
// MAAKICHUT = response;
var data = JSON.parse(response);
var files = data.files;
// console.log(files);
@ -19,13 +22,16 @@ $(function() {
function getJQ(f) {
var jq = $("<div />").data("data", f).addClass("fileItem").text(f.type + ": " + f.title);
jq.click(function() {
var d = $(this).data("data");
var $this = $(this);
$('.selectedItem').removeClass("selectedItem");
$this.addClass("selectedItem");
var d = $this.data("data");
switch (d.type) {
case "image":
var html = "<img src='" + d.url + "' />";
var html = "<img width='400' src='" + d.url + "' />";
break;
default:
var html = "<a href='" + d.url + "'>Click to view</a>";
var html = "<a href='" + d.url + "' target='_blank'>Click to view</a>";
}
$('#previewPane').html(html);
});

View File

@ -11,7 +11,7 @@
<form id="filterForm">
{{ filterForm.as_p }}
<p>
<input type="submit" value="Submit" />
<input type="submit" value="Submit" id="submitFilter" />
</p>
</form>
</div>