PageRenderTime 13ms CodeModel.GetById 11ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 1ms

/core/dashboard.cfm

http://github.com/atuttle/Taffy
ColdFusion | 95 lines | 90 code | 5 blank | 0 comment | 1 complexity | f07f81d75def9a4662b543cd31b08efc MD5 | raw file
 1<html>
 2<head>
 3	<title>Taffy Dashboard</title>
 4	<style type="text/css">
 5		<cfinclude template="dashboard.css" />
 6	</style>
 7</head>
 8<body>
 9<h1>Taffy Dashboard</h1>
10<p id="toolbar">
11	<button type="button" id="reloader">Reload API Cache</button>
12	<button type="button" id="showDash" class="active">API Configuration</button>
13	<button type="button" id="showDocs">API Documentation</button>
14	<button type="button" id="showMock">Mock Client</button>
15</p>
16
17<div id="dash">
18	<h2>Resources:</h2>
19	<table border="0">
20		<tr>
21			<th>Resource</th>
22			<th>URI</th>
23			<th>Methods</th>
24		</tr>
25		<cfoutput>
26			<cfset variables.resources = listSort(structKeyList(application._taffy.endpoints), "textnocase") />
27			<cfloop list="#variables.resources#" index="resource">
28				<cfset currentResource = application._taffy.endpoints[resource] />
29				<tr>
30					<td>#currentResource.beanName#</td>
31					<td>#currentResource.srcURI#</td>
32					<td>#structKeyList(currentResource.methods, "|")#</td>
33				</tr>
34			</cfloop>
35		</cfoutput>
36	</table>
37
38	<h3>Implemented Encodings:</h3>
39	<ul>
40		<cfoutput>
41		<cfloop list="#structKeyList(application._taffy.settings.mimeExtensions)#" index="mime">
42			<li>#mime# <cfif mime eq application._taffy.settings.defaultMime><em>(default)</em></cfif></li>
43		</cfloop>
44		</cfoutput>
45	</ul>
46</div>
47
48<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
49
50<div id="mock">
51	<cfinclude template="mocker.cfm"/>
52</div>
53<div id="docs">
54	<cfinclude template="docs.cfm" />
55</div>
56
57<script type="text/javascript">
58	$(function(){
59		var baseurl = '<cfoutput>#cgi.script_name#?dashboard</cfoutput>';
60		$("#reloader").click(function(){
61			document.location.href = baseurl + '<cfoutput>&#application._taffy.settings.reloadKey#=#application._taffy.settings.reloadPassword#</cfoutput>';
62		});
63		$("#exportPDF").click(function(){
64			document.location.href = baseurl + '&exportPDF';
65		});
66		//save some selector refs for frequent use
67		var m = $("#mock");
68		var d = $("#dash");
69		var o = $("#docs");
70		var b = $("#toolbar button");
71		$("#showDash").click(function(){
72			b.removeClass("active");
73			$(this).addClass("active");
74			m.hide("fast");
75			o.hide("fast");
76			d.show("fast");
77		});
78		$("#showMock").click(function(){
79			b.removeClass("active");
80			$(this).addClass("active");
81			d.hide("fast");
82			o.hide("fast");
83			m.show("fast");
84		});
85		$("#showDocs").click(function(){
86			b.removeClass("active");
87			$(this).addClass("active");
88			m.hide("fast");
89			d.hide("fast");
90			o.show("fast");
91		});
92	});
93</script>
94</body>
95</html>