Subversion Repositories SmartDukaan

Rev

Rev 28270 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
28264 tejbeer 1
$(function() {
2
	$(document).on('click', ".url-generation", function() {
3
		loadUrlGenration("main-content");
4
	});
5
 
6
 
7
 
8
	$(document).on('click', "#submitImage", function() {
9
 
10
		if (confirm("Are you sure?")) {
11
			var mediaPojo = {};
12
 
13
			var title = $('#imageTitle').val();
14
			if (title === "") {
28270 tejbeer 15
				alert("Title is required!");
28264 tejbeer 16
				return false;
17
			}
28320 tejbeer 18
			//title = title.replace(/\s+/g, "-");
28264 tejbeer 19
			mediaPojo.title = title;
20
 
21
			mediaPojo.imageData = $('#imgPreview').attr("src");
22
 
23
			console.log(mediaPojo)
24
 
25
			doPostAjaxRequestWithJsonHandler(context + "/image/media/upload", JSON.stringify(mediaPojo), function(response) {
26
				bootbox.alert("Images uploaded successfully");
27
 
28
				$('#searchImage').click();
29
 
30
			});
31
 
32
		}
33
 
34
 
35
	});
36
 
37
 
38
	$(document).on('click', "#searchImage", function() {
39
 
40
 
41
		var title = $('#imageTitle').val();
42
		if (title === "") {
43
			alert("Title is required!");
44
			return false;
45
		}
46
		title = title.replace(/\s+/g, "-");
47
 
48
		doGetAjaxRequestHandler(context + "/search/image/media?title=" + title, function(response) {
49
			$('#image-url-container').html(response);
50
 
51
		})
52
 
53
	});
54
 
55
 
56
 
57
});
58
 
59
function loadUrlGenration(domId) {
60
 
61
	doGetAjaxRequestHandler(context + "/urlGeneration", function(response) {
62
		$('#' + domId).html(response);
63
	});
64
}