Subversion Repositories SmartDukaan

Rev

Rev 27754 | Rev 32595 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 27754 Rev 27755
Line 1... Line 1...
1
$(document).on('click', ".banner-listing", function() {
1
$(document).on('click', ".banner-listing", function() {
2
	loadBannerListing("main-content");
2
	loadBannerListing("main-content");
3
});
3
});
4
 
4
 
5
$("a.banner-listing-detail").live(
5
$(document).on('click', "a.banner-listing-detail",
6
		'click',
-
 
7
		function() {
6
		function() {
8
			var bannerListingId = $(this).data("id");
7
			var bannerListingId = $(this).data("id");
9
			doAjaxRequestHandler(
8
			doAjaxRequestHandler(
10
					`${context}/banner-listing/${bannerListingId}`, "GET",
9
					`${context}/banner-listing/${bannerListingId}`, "GET",
11
					function(response) {
10
					function(response) {
12
						$('.banner-products-container').html(response);
11
						$('.banner-products-container').html(response);
13
					});
12
					});
14
 
13
 
15
		});
14
		});
16
 
15
 
17
$("a.banner-remove").live(
16
$(document).on('click', "a.banner-remove",
18
		'click',
-
 
19
		function() {
17
		function() {
20
			var bannerId = $(this).data("bannerid");
18
			var bannerId = $(this).data("bannerid");
21
			var bannerListingId = $(this).data("bannerlistingid");
19
			var bannerListingId = $(this).data("bannerlistingid");
22
 
20
 
23
			if (confirm("Are you sure you want to remove banner") == true) {
21
			if (confirm("Are you sure you want to remove banner") == true) {
Line 31... Line 29...
31
 
29
 
32
			}
30
			}
33
 
31
 
34
		});
32
		});
35
 
33
 
36
$("#update-banner-rank").live(
34
$(document).on('click', "#update-banner-rank",
37
		'click',
-
 
38
		function() {
35
		function() {
39
			if (confirm("Are you sure you want to update ranks?")) {
36
			if (confirm("Are you sure you want to update ranks?")) {
40
				var bannerListingId = $(this).data("id");
37
				var bannerListingId = $(this).data("id");
41
				var bannerProductIds = [];
38
				var bannerProductIds = [];
42
				$("#banner-product-listing-tbody").find("tr").each(function() {
39
				$("#banner-product-listing-tbody").find("tr").each(function() {
Line 49... Line 46...
49
							$('.banner-products-container').html(response);
46
							$('.banner-products-container').html(response);
50
						});
47
						});
51
			}
48
			}
52
		});
49
		});
53
 
50
 
54
$("#addBannerUrl").live(
51
$(document).on('click', "#addBannerUrl",
55
		'click',
-
 
56
		function() {
52
		function() {
57
			bannerUrl = $("#banner-url").val();
53
			bannerUrl = $("#banner-url").val();
58
			rank = $("#rank").val();
54
			rank = $("#rank").val();
59
			bannerListingId = $(this).data("id");
55
			bannerListingId = $(this).data("id");
60
			mediaType = $("#media-type").val();
56
			mediaType = $("#media-type").val();
Line 99... Line 95...
99
			.stringify(json), function(response) {
95
			.stringify(json), function(response) {
100
		$('#main-content').html(response);
96
		$('#main-content').html(response);
101
	});
97
	});
102
}
98
}
103
 
99
 
104
$(".grab-banner")
100
$(document).on('mousedown', ".grab-banner",
105
		.live(
-
 
106
				'mousedown',
-
 
107
				function(e) {
101
				function(e) {
108
					var tr = $(e.target).closest("TR"), si = tr.index(), sy = e.pageY, b = $(document.body), drag;
102
					var tr = $(e.target).closest("TR"), si = tr.index(), sy = e.pageY, b = $(document.body), drag;
109
					b.addClass("grabCursor").css("userSelect", "none");
103
					b.addClass("grabCursor").css("userSelect", "none");
110
					tr.addClass("grabbed");
104
					tr.addClass("grabbed");
111
					function move(e) {
105
					function move(e) {