This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
mapper() | |
.namespace("admin") | |
.resources("users") | |
.end() | |
.wildcard() | |
.root(to="wheels##wheels", method="get") | |
.end() | |
</cfscript> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
component extends="Admin" { | |
function config() { | |
super.config(); | |
verifies(except="index,new,create", params="key", paramsTypes="integer", handler="objectNotFound"); | |
verifies(post=true, only="create,update,delete"); | |
} | |
function index() { | |
users=model("user").findAll(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
component extends="app.controllers.Controller" | |
{ | |
function config() { | |
filters(through="checkAdminPermissions"); | |
} | |
// This is highly simplified for illustration only | |
private function checkAdminPermissions(){ | |
if(session.user.role != "admin"){ | |
abort; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// asserts that a failed user update returns a 302 http response, an error exists in the flash and will be redirected to the error page | |
function testStatusFlashAndRedirect() { | |
local.params = { | |
controller = "users", | |
action = "update" | |
}; | |
result = processRequest(params=local.params, method="post", rollback=true, returnAs="struct"); | |
assert("result.status == 302"); | |
assert("StructKeyExists(result.flash, 'error') == true"); | |
assert("result.redirect == '/common/error'"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function test_addme() { | |
actual = addMe(1, 2); | |
expected = 3; | |
assert("actual eq expected"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
language: java | |
sudo: required | |
jdk: | |
- oraclejdk8 | |
before_install: | |
# Get Commandbox | |
- sudo apt-key adv --keyserver keys.gnupg.net --recv 6DA70622 | |
- sudo echo "deb http://downloads.ortussolutions.com/debs/noarch /" | sudo tee -a /etc/apt/sources.list.d/commandbox.list | |
install: | |
# Install Commandbox |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add your description here | |
* | |
* [section: Plugins] | |
* [category: Your Plugin Name] | |
* | |
* @myParam A description of this parameter | |
*/ | |
public array function awesomeFunction(required string myParam){ | |
local.rv=[]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Removes all HTML tags from a string. | |
* | |
* [section: View Helpers] | |
* [category: Sanitization Functions] | |
* | |
* @html The HTML to remove tag markup from. | |
*/ | |
public string function stripTags(required string html) { | |
local.rv = REReplaceNoCase(arguments.html, "<\ *[a-z].*?>", "", "all"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ box install cfwheels-cli | |
Installing package [forgebox:cfwheels-cli] | |
Verifying package 'cfwheels-cli' in ForgeBox, please wait... | |
Installing version [0.1.6]. | |
Verified entry in ForgeBox: 'cfwheels-cli' | |
Deferring to [github] endpoint for ForgeBox entry [cfwheels-cli]... | |
Using branch [v0.1.6] | |
Cloning Git URL [https://github.com/neokoenig/cfwheels-cli.git] | |
remote: Counting objects: 632 | |
remote: Compressing objects: 100% (39/39) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In controller.cfc | |
function getStuff(){ | |
myStuff=model("foo").findAll(order="name"); | |
} | |
// Mycontroller.cfc | |
init(){ | |
filters(through="getStuff", only="index"); | |
} |