Skip to content

dezoito/fw1-clipping

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ColdFusion + FW/1 Example Application

This app can be used to store clippings and news articles and was created as an exercise to learn the awesome FW/1 Framework (it has been tested with versions 3.0 and 3.1).

For detailed explanations, checkout this series of articles on the topics I tried to cover:

1- Project Structure

I decided to use subsystems, so the main app's logic is inside the /home folder (which is the default subsystem).

Notice that I added these folders to the project's root:

/customtags - It stores the few custom tags used in this project (I made one to handle pagination)

/lib - Stores User Defined Functions and UDF libraries

/setup - Contains the SQL script for database creation (I used mySQL, but it's simple enough to run on other DBs)

/static - This is where I keep JS, CSS and Image files

/tests - Self explanatory (But probably one of the most interesting parts in this project)

2- Forms and Validation Patterns

The app uses the same view to display Create or Update forms, the same methods to validade and save objects, and performs CSRF verification with CSRFVerifyToken() to stop Cross Site Request Forgery.

Validation errors and messages are displayed next to their respect form fields.

Also, note how validation rules and attribute sanitizing code are kept within the model definition.

3- Use of UDF Libraries

The /lib folder contains functions.cfc, a library of commonly used functions that is saved in the application scope so they can be easily accessed anywhere.

4- Accessing an External Service

The app can display a summary of articles in a modal window (using the flask-Summarizer App). I used this as a way to see how to make Ajax calls and also access an external service.

5- BDD Testing

The folder /tests contains the spects for tests that run using testBox and CFSelenium.

I start with some very simple tests that escalate to CRUD tests that save data to a testing database. /tests/specs/Test_6_Integration_Selenium.cfc contains full integration tests using Selenium.

To run these tests, you must have CFSelenium and testBox installed on your server.

References

Aside from the Official Documentation, I am thankful to these authors and resources:

Raymond Camdem's QBall Sample Application

Simon Bingham's Xindi CMS

Joe Steinbring's Pagination Gist