Skip to content

Commit d34c811

Browse files
committed
COLDBOX-1285
BoxLang Support
1 parent f102bf4 commit d34c811

File tree

6 files changed

+127
-3
lines changed

6 files changed

+127
-3
lines changed

system/web/routing/Router.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ component
250250
/**
251251
* Includes a routes configuration file as an added import and returns itself after import
252252
*
253-
* @deprecated Please use the Routes.cfc approach instead
253+
* @deprecated Please use the Routes class approach instead
254254
* @location The include location of the routes configuration template.
255255
*
256256
* @return Router

system/web/services/HandlerService.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ component extends="coldbox.system.web.services.BaseService" accessors="true" {
595595
// Convert windows \ to java /
596596
arguments.directory = replace( arguments.directory, "\", "/", "all" );
597597

598-
return directoryList( arguments.directory, true, "array", "*.cfc" ).map( function( item ){
598+
return directoryList( arguments.directory, true, "array", "*.cfc|*.bx" ).map( function( item ){
599599
var thisAbsolutePath = replace( item, "\", "/", "all" );
600600
var cleanHandler = replaceNoCase( thisAbsolutePath, directory, "", "all" );
601601
// Clean OS separators to dot notation.

system/web/services/LoaderService.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ component extends="coldbox.system.web.services.BaseService" accessors="true" {
295295
coldboxSettings[ "ConfigFileLocationOverride" ] = false;
296296

297297
// verify coldbox.cfc exists in convention: /app/config/Coldbox.cfc
298-
if ( fileExists( appRootPath & replace( configFileLocation, ".", "/", "all" ) & ".cfc" ) ) {
298+
if ( fileExists( appRootPath & replace( configFileLocation, ".", "/", "all" ) & ".cfc" ) || fileExists( appRootPath & replace( configFileLocation, ".", "/", "all" ) & ".bx" ) ) {
299299
coldboxSettings[ "ConfigFileLocation" ] = configFileLocation;
300300
}
301301

test-harness/handlers/bl.bx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
class{
2+
3+
property name="asyncManager" inject="coldbox:asyncManager";
4+
5+
this.allowedMethods = { "index" : "GET" };
6+
7+
function index( event, rc, prc ){
8+
prc.welcomeMessage = "Welcome to BoxLang!";
9+
10+
log.info( "Executing index action", { name : "Test", when : now(), arcs = [1,2,3,4], test : "Message goes here" } );
11+
12+
getInstance( "LazyModel" ).getUtil();
13+
getInstance( "LazyModel" ).getUtil2();
14+
getInstance( "LazyModel" ).getLazyData();
15+
getInstance( "LazyModel" ).getLazyData2();
16+
17+
unless( false, function(){
18+
prc.whenFalse = true;
19+
})
20+
.when( true, function(){
21+
prc.when = true;
22+
});
23+
24+
event.setView( "bl/index" );
25+
}
26+
27+
/**
28+
* actionAllowedMethod
29+
*/
30+
function actionAllowedMethod( event, rc, prc ) allowedMethods="GET"{
31+
return "Executed!";
32+
}
33+
34+
// Do something
35+
function doSomething( event, rc, prc ){
36+
relocate( "bl.index" );
37+
}
38+
39+
}

test-harness/views/bl/index.bxm

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<cfoutput>
2+
3+
<div class="jumbotron">
4+
<img src="includes/images/ColdBoxLogoSquare_125.png" class="pull-left margin10" alt="logo"/>
5+
<h1>#prc.welcomeMessage#</h1>
6+
<p>
7+
<strong>#getColdBoxSetting("codename")# #getColdBoxSetting("version")# (#getColdBoxSetting("suffix")#)</strong>.
8+
Test Harness Application
9+
<a class="btn btn-primary" href="index.cfm?fwreinit=1" >
10+
<strong>Reinitialize Framework</strong>
11+
</a>
12+
</p>
13+
</div>
14+
15+
<div class="row">
16+
<div class="col-md-9">
17+
18+
<h2>#html.slugify( "html helper ' can slugify via the string util" )#</h2>
19+
20+
<section id="eventHandlers">
21+
<div class="page-header">
22+
<h2>
23+
Registered Event Handlers: #sayHello()# #sayViewHello()#
24+
</h2>
25+
</div>
26+
27+
<div style="border:1px dotted gray; padding: 10px; margin: 10px 0px">
28+
#view( view = "viewWithArgs", args = { data = "Hi I am Data!" } )#
29+
</div>
30+
31+
<p>
32+
You can click on the following event handlers to execute their default action
33+
<span class="label label-important">index()</span>
34+
</p>
35+
<ul>
36+
<cfloop list="#getSetting("RegisteredHandlers")#" index="handler">
37+
<li><a href="#event.buildLink( handler )#">#handler#</a></li>
38+
</cfloop>
39+
</ul>
40+
</section>
41+
42+
<section id="modules">
43+
<div class="page-header">
44+
<h2>
45+
Registered Modules
46+
</h2>
47+
</div>
48+
<p>Below are your application's loaded modules, click on them to visit them.</p>
49+
<ul>
50+
<cfloop collection="#getSetting( "Modules" )#" item="thisModule">
51+
<li>
52+
<a href="#event.buildLink( getModuleConfig( thisModule ).entryPoint )#">#thisModule#</a>
53+
</li>
54+
</cfloop>
55+
</ul>
56+
<cfif structCount( getSetting("Modules") ) eq 0>
57+
<div class="alert alert-info">There are no modules in your application</div>
58+
</cfif>
59+
</section>
60+
61+
<section id="named-routes">
62+
<div class="page-header">
63+
<h2>
64+
Named Routes Construction
65+
</h2>
66+
</div>
67+
<ul>
68+
<li><a href="#event.route( "contactus" )#">#event.route( "contactus" )#</a></li>
69+
<li><a href="#event.buildLink( { name: "testRoute" } )#">#event.buildLink( { name: "testRoute" } )#</a></li>
70+
<li><a href="#event.route( "testRouteWithParams", { id=1, name='test' } )#">#event.route( "testRouteWithParams", { id=1, name='test' } )#</a></li>
71+
<li><a href="#event.buildLink( { name: "complexParams", params : { id=1, name='test' } } )#">#event.route( "complexParams", { id=1, name='test' } )#</a></li>
72+
</ul>
73+
</section>
74+
75+
</div>
76+
77+
</div>
78+
</cfoutput>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<!-- index helper -->
2+
<!-- This is the home helper by convention. Use it for any helper methods you want for the view only. -->
3+
<cfscript>
4+
function sayViewHello(){
5+
return "Hello!!!";
6+
}
7+
</cfscript>

0 commit comments

Comments
 (0)