Subversion Repositories SmartDukaan

Rev

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

Rev 23783 Rev 27754
Line 1... Line 1...
1
$(function() {
1
$(function() {
2
	$(".create-api").live('click', function() {
2
	$(document).on('click', ".create-api", function() {
3
		loadCreateApi("main-content");
3
		loadCreateApi("main-content");
4
	});
4
	});
5
	
5
	
6
	$(".create-api-button").live('click', function() {
6
	$(document).on('click', ".create-api-button", function() {
7
		var name = $('#apiName').val();
7
		var name = $('#apiName').val();
8
		var uri = $('#uri').val();
8
		var uri = $('#uri').val();
9
		var method = $('#api-methods option:selected').val();
9
		var method = $('#api-methods option:selected').val();
10
		createApi("main-content", name, uri, method);
10
		createApi("main-content", name, uri, method);
11
	});
11
	});
12
	
12
	
13
	$(".edit-api").live('click', function() {
13
	$(document).on('click', ".edit-api", function() {
14
		loadEditApi("main-content");
14
		loadEditApi("main-content");
15
	});
15
	});
16
	
16
	
17
	$('#apis-for-edit').live('change', function(){
17
	$(document).on('change', '#apis-for-edit', function(){
18
		var apiText = $('#apis-for-edit option:selected').text();
18
		var apiText = $('#apis-for-edit option:selected').text();
19
		var apiTexts = apiText.split('[');
19
		var apiTexts = apiText.split('[');
20
		var name = apiTexts[0].trim();
20
		var name = apiTexts[0].trim();
21
		var uri = apiTexts[1].substring(0, apiTexts[1].length - 1);
21
		var uri = apiTexts[1].substring(0, apiTexts[1].length - 1);
22
		var method = apiTexts[2].substring(0, apiTexts[2].length - 1);
22
		var method = apiTexts[2].substring(0, apiTexts[2].length - 1);
Line 24... Line 24...
24
		$('#uri').val(uri);
24
		$('#uri').val(uri);
25
		$('#api-methods').val(method);
25
		$('#api-methods').val(method);
26
		//$('#apiName').val(roleName);
26
		//$('#apiName').val(roleName);
27
	});
27
	});
28
	
28
	
29
	$(".edit-api-button").live('click', function() {
29
	$(document).on('click', ".edit-api-button", function() {
30
		var apiId = $('#apis-for-edit').val();
30
		var apiId = $('#apis-for-edit').val();
31
		var apiName = $('#apiName').val();
31
		var apiName = $('#apiName').val();
32
		var uri = $('#uri').val();
32
		var uri = $('#uri').val();
33
		var method = $('#api-methods option:selected').text();
33
		var method = $('#api-methods option:selected').text();
34
		editApi("main-content", apiId, apiName, uri, method);
34
		editApi("main-content", apiId, apiName, uri, method);
35
	});
35
	});
36
	
36
	
37
	$(".delete-api").live('click', function() {
37
	$(document).on('click', ".delete-api", function() {
38
		loadDeleteApi("main-content");
38
		loadDeleteApi("main-content");
39
	});
39
	});
40
	
40
	
41
	$(".delete-api-button").live('click', function() {
41
	$(document).on('click', ".delete-api-button", function() {
42
		var apiId = $('#apis-for-delete').val();
42
		var apiId = $('#apis-for-delete').val();
43
		deleteApi("main-content", apiId);
43
		deleteApi("main-content", apiId);
44
	});
44
	});
45
	
45
	
46
	$(".create-role").live('click', function() {
46
	$(document).on('click', ".create-role", function() {
47
		loadCreateRole("main-content");
47
		loadCreateRole("main-content");
48
	});
48
	});
49
	
49
	
50
	$(".create-role-button").live('click', function() {
50
	$(document).on('click', ".create-role-button", function() {
51
		var roleName = $('#roleName').val();
51
		var roleName = $('#roleName').val();
52
		createRole("main-content", roleName);
52
		createRole("main-content", roleName);
53
	});
53
	});
54
	
54
	
55
	$(".create-duplicate-role").live('click', function() {
55
	$(document).on('click', ".create-duplicate-role", function() {
56
		loadCreateDuplicateRole("main-content");
56
		loadCreateDuplicateRole("main-content");
57
	});
57
	});
58
	
58
	
59
	$('#roles-for-duplicate').live('change', function(){
59
	$(document).on('change', '#roles-for-duplicate', function(){
60
		var roleName = $('#roles-for-duplicate option:selected').text();
60
		var roleName = $('#roles-for-duplicate option:selected').text();
61
		$('#roleName').val(roleName+"2");
61
		$('#roleName').val(roleName+"2");
62
	});
62
	});
63
	
63
	
64
	$(".create-duplicate-role-button").live('click', function() {
64
	$(document).on('click', ".create-duplicate-role-button", function() {
65
		console.log("create duplicate role button clicked");
65
		console.log("create duplicate role button clicked");
66
		var roleId = $('#roles-for-duplicate').val();
66
		var roleId = $('#roles-for-duplicate').val();
67
		var roleName = $('#roleName').val();
67
		var roleName = $('#roleName').val();
68
		createDuplicateRole("main-content", roleId, roleName); 
68
		createDuplicateRole("main-content", roleId, roleName); 
69
	});
69
	});
70
	
70
	
71
	$(".delete-role").live('click', function() {
71
	$(document).on('click', ".delete-role", function() {
72
		loadDeleteRole("main-content");
72
		loadDeleteRole("main-content");
73
	});
73
	});
74
	
74
	
75
	$(".delete-role-button").live('click', function() {
75
	$(document).on('click', ".delete-role-button", function() {
76
		var roleId = $('#roles-for-delete').val();
76
		var roleId = $('#roles-for-delete').val();
77
		deleteRole("main-content", roleId);
77
		deleteRole("main-content", roleId);
78
	});
78
	});
79
	
79
	
80
	$(".rename-role").live('click', function() {
80
	$(document).on('click', ".rename-role", function() {
81
		loadRenameRole("main-content");
81
		loadRenameRole("main-content");
82
	});
82
	});
83
	
83
	
84
	$('#roles-for-rename').live('change', function(){
84
	$(document).on('change', '#roles-for-rename', function(){
85
		var roleName = $('#roles-for-rename option:selected').text();
85
		var roleName = $('#roles-for-rename option:selected').text();
86
		$('#roleName').val(roleName);
86
		$('#roleName').val(roleName);
87
	});
87
	});
88
	
88
	
89
	$(".rename-role-button").live('click', function() {
89
	$(document).on('click', ".rename-role-button", function() {
90
		var roleId = $('#roles-for-rename').val();
90
		var roleId = $('#roles-for-rename').val();
91
		var roleName = $('#roleName').val();
91
		var roleName = $('#roleName').val();
92
		renameRole("main-content", roleId, roleName);
92
		renameRole("main-content", roleId, roleName);
93
	});
93
	});
94
	
94
	
95
	$(".add-remove-api").live('click', function() {
95
	$(document).on('click', ".add-remove-api", function() {
96
		loadAddRemoveApi("main-content");
96
		loadAddRemoveApi("main-content");
97
	});
97
	});
98
	
98
	
99
	$(".add-remove-role").live('click', function() {
99
	$(document).on('click', ".add-remove-role", function() {
100
		loadAddRemoveRole("main-content");
100
		loadAddRemoveRole("main-content");
101
	});
101
	});
102
	
102
	
103
	$('#api-roles').live('change', function(){
103
	$(document).on('change', '#api-roles', function(){
104
		//$('#tag-listing-brand-value').text($(this).text());
104
		//$('#tag-listing-brand-value').text($(this).text());
105
		loadApisByRoleId("apis-container", $(this).val());
105
		loadApisByRoleId("apis-container", $(this).val());
106
	});
106
	});
107
	
107
	
108
	$(".add-remove-api-button").live('click', function() {
108
	$(document).on('click', ".add-remove-api-button", function() {
109
		var roleId = $('#api-roles').val();
109
		var roleId = $('#api-roles').val();
110
		var roleName = $('#api-roles option:selected').text();
110
		var roleName = $('#api-roles option:selected').text();
111
		var apiIds = $('#apis').val();
111
		var apiIds = $('#apis').val();
112
		addRemoveApis("main-content", roleId, apiIds);
112
		addRemoveApis("main-content", roleId, apiIds);
113
		//$('#api-roles option:selected').text(roleName);
113
		//$('#api-roles option:selected').text(roleName);
114
	});
114
	});
115
	
115
	
116
	$(".add-remove-role-button").live('click', function() {
116
	$(document).on('click', ".add-remove-role-button", function() {
117
		var emailIdOrMobileNumber = $('#emailIdOrMobileNumber').val();
117
		var emailIdOrMobileNumber = $('#emailIdOrMobileNumber').val();
118
		var roleIds = $('#roles').val();
118
		var roleIds = $('#roles').val();
119
		addRemoveRoles("main-content", emailIdOrMobileNumber, roleIds);
119
		addRemoveRoles("main-content", emailIdOrMobileNumber, roleIds);
120
	});
120
	});
121
	
121