Skip to content

Commit 385c6a1

Browse files
committed
📦 NEW: Add simple demo to test app
1 parent 5ad051e commit 385c6a1

4 files changed

Lines changed: 33 additions & 5 deletions

File tree

test-harness/handlers/Main.cfc

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,19 @@
33
*/
44
component{
55

6-
// Index
6+
// Demo page
77
any function index( event,rc, prc ){
8-
event.setView( "main/index" );
8+
var uglySQL = "SELECT id,fname,lname FROM users where fullName='Michael Born' and age = 'infinite'";
9+
var prettySQL = getInstance( "Formatter@SQLFormatter" )
10+
.format( uglySQL );
11+
12+
event.setView(
13+
view = "main/index",
14+
args = {
15+
prettySQL: prettySQL,
16+
uglySQL : uglySQL
17+
}
18+
);
919
}
1020

1121
}

test-harness/index.cfm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ Date : October 15, 2005
66
Description :
77
This is only a place holder since everything occurs in application.cfc now.
88
----------------------------------------------------------------------->
9-
<cfsetting enablecfoutputonly="no">
9+
<cfsetting enablecfoutputonly="no">

test-harness/layouts/Main.cfm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<cfoutput>
2-
<h1>Module Tester</h1>
2+
<h1>SQLFormatter</h1>
3+
<p>Prettify your ugly SQL without Hibernate.</p>
34
<div>
45
#renderView()#
56
</div>

test-harness/views/main/index.cfm

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
11
<cfoutput>
2-
Module Tester
2+
<p>Turn:</p>
3+
4+
<pre><code class="language-sql">#args.uglySQL#</code></pre>
5+
6+
<p>into:</p>
7+
8+
<pre><code class="language-sql">#args.prettySQL#</code></pre>
9+
10+
<p>using:</p>
11+
12+
<pre><code class="language-js">getInstance( "Formatter@SQLFormatter" )
13+
.format( "SELECT id,fname,lname FROM users where fullName='Michael Born' and age = 'infinite'" );</code></pre>
14+
15+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.1/highlight.min.js" integrity="sha512-yUUc0qWm2rhM7X0EFe82LNnv2moqArj5nro/w1bi05A09hRVeIZbN6jlMoyu0+4I/Bu4Ck/85JQIU82T82M28w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
16+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.1/languages/javascript.min.js" integrity="sha512-V3q3W5043LERycIee7tLy1LAfzxblUrmI5J8p3uZF2FQ3QlMp9QddQoy4OgcIzVs4aCMEj9iwGL5UmjqHF/uBA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
17+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.1/languages/sql.min.js" integrity="sha512-5I+LDIMsGyYrMCqw6hthOUemv4JYGjjVRImZsghX4+SsALaDkU8PFlK1YP7ARi2FX5wwen0dacDLQjVnZsxFyA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
18+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.1/styles/default.min.css" integrity="sha512-hasIneQUHlh06VNBe7f6ZcHmeRTLIaQWFd43YriJ0UND19bvYRauxthDg8E4eVNPm9bRUhr5JGeqH7FRFXQu5g==" crossorigin="anonymous" referrerpolicy="no-referrer" />
19+
<script>hljs.highlightAll();</script>
320
</cfoutput>

0 commit comments

Comments
 (0)