Skip to content

Commit

Permalink
default to lucee 6 for trycf
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitzer committed Nov 12, 2024
1 parent 778edd3 commit 805eb40
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 12 deletions.
2 changes: 1 addition & 1 deletion builders/html/assets/trycf/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
width="100%"
height="350px"
fullscreen="true"
engine="lucee"
engine="lucee6"
show-results="true"
code="">
</div>
Expand Down
22 changes: 11 additions & 11 deletions builders/html/assets/trycf/js/code-editor3.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ angular.module("code.editor", []).directive("codeEditor", function ($timeout) {
' <span class="code-editor-message"></span>' +
' <button class="toggle-fullscreen btn {{fullscreenbtnclass}} pull-right" ng-click="toggleFullscreen()"> <i class="icon-resize-full"></i></button>' +
' <button class="editor-options btn btn-default {{optionsbtnclass}} pull-right"> <i class="icon-gear"></i></button>' +
' <span ng-hide="showResults == false || showResults == 0" class="alert alert-info pull-right" style="padding: 5px;margin: 0px 3px 0px 3px;display: inline-block;"><span class="hidden-xs">Current Engine:</span> <span class="display-engine" style="line-height: 2.2;">></span></span>' +
' <span ng-hide="showResults == false || showResults == 0" class="alert alert-danger pull-right" style="padding: 5px;margin: 0px 3px 0px 3px;display: inline-block;"><span class="hidden-xs">Lucee:&nbsp;</span> <span class="display-engine" style="line-height: 2.2;">></span></span>' +
' <div class="modal fade" style="display:none;" tabindex="-1" role="dialog">' +
' <div class="modal-dialog">' +
' <div class="modal-content">' +
Expand Down Expand Up @@ -91,9 +91,9 @@ angular.module("code.editor", []).directive("codeEditor", function ($timeout) {
" </div>" +
' <label class="control-label">Change CFML Engine</label>' +
" <div>" +
' <label class="radio-inline"><input type="radio" name="engine" class="luceeEngine" value="lucee6-beta">Lucee 6.BETA</label>' +
' <label class="radio-inline"><input type="radio" name="engine" class="luceeEngine" value="lucee">Lucee 5.LATEST</label>' +
' <label class="radio-inline"><input type="radio" name="engine" class="luceeEngine" value="lucee4">Lucee 4.5.LATEST</label>' +
' <label class="radio-inline"><input type="radio" name="engine" class="luceeEngine" value="lucee6">Lucee 6 Latest</label>' +
' <label class="radio-inline"><input type="radio" name="engine" class="luceeEngine" value="lucee5">Lucee 5.4 ( LTS )</label>' +
' <label class="radio-inline"><input type="radio" name="engine" class="luceeEngine" value="lucee4">Lucee 4.5 ( EOL )</label>' +
" </div>" +
" </div>" +
' <div class="modal-footer">' +
Expand Down Expand Up @@ -139,11 +139,11 @@ angular.module("code.editor", []).directive("codeEditor", function ($timeout) {
scope.setupCodeGist = attrs.setupCodeGist;
scope.asserts = attrs.asserts;
scope.saveGist = saveGist;
scope.engines = { lucee4: "Lucee 4.5",
lucee: "Lucee 5",
"lucee6-beta": "Lucee 6 BETA"
scope.engines = { lucee6: "Lucee 6 Latest",
lucee5: "Lucee 5.4 LTS",
lucee4: "Lucee 4.5 EOL"
};
scope.engine = attrs.engine || "lucee";
scope.engine = attrs.engine || "lucee6";
scope.basepath = attrs.basepath || "/gist/";
var editor = element.find(".code-editor"),
codeForm = element.find(".code-form"),
Expand Down Expand Up @@ -205,11 +205,11 @@ angular.module("code.editor", []).directive("codeEditor", function ($timeout) {
showResults =
typeof attrs.showResults !== "undefined"
? attrs.showResults === "true" || attrs.showResults === "1"
: true,
: t5rue,
urlPool = {
lucee4: ["https://lucee4-sbx.trycf.com/lucee4/getremote.cfm"],
lucee: ["https://lucee5-sbx.trycf.com/lucee5/getremote.cfm"],
"lucee6-beta": ["https://lucee6-sbx.trycf.com/lucee/getremote.cfm"]
lucee5: ["https://lucee5-sbx.trycf.com/lucee5/getremote.cfm"],
lucee6: ["https://lucee6-sbx.trycf.com/getremote.cfm"]
},
url =
attrs.url ||
Expand Down
52 changes: 52 additions & 0 deletions docs/03.reference/01.functions/valueref/_examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
```luceescript+trycf
// First, let's create a simple UDF that returns a value
function getName() {
return "John Doe";
}
// Create a reference to the getName function using ValueRef()
name = ValueRef(getName);
// Example 1: Basic Usage
writeOutput("Direct function call: " & getName() & "<br>");
writeOutput("Using ValueRef: " & name & "<br>");
// Example 2: Using ValueRef with a more complex UDF
function calculateTotal(price, quantity) {
return price * quantity;
}
// Create a reference with preset values
fixedCalculation = ValueRef(function() {
return calculateTotal(10, 5);
});
writeOutput("Fixed calculation result: " & fixedCalculation & "<br>");
// Example 3: Using ValueRef with a closure
counter = 0;
incrementCounter = ValueRef(function() {
counter++;
return counter;
});
writeOutput("Counter value: " & incrementCounter & "<br>");
writeOutput("Counter value: " & incrementCounter & "<br>");
// Example 4: Using ValueRef in a struct
person = {
firstName: ValueRef(function() {
return "Jane";
}),
lastName: ValueRef(function() {
return "Smith";
}),
fullName: ValueRef(function() {
// Note: This would need to be implemented differently in practice
// as the ValueRef doesn't have access to the other references directly
return "Jane Smith";
})
};
writeOutput("Person's full name: " & person.fullName);
```

0 comments on commit 805eb40

Please sign in to comment.