This course expands on the foundation tutorial titled "Build a foundation app with Coldbox" that was released a few months ago. We are going to build a modular application that features a component driven dynamic menu. The menu content will be stored in a navigation structure component that will be injected as a dependency in our handlers. At the end of the course, this menu and the core application will be presented in different languages by simply toggling the user locale preference in the MyAccount view where the user can edit his/her account.
We are first going to enhance our MySQL database schema with additional tables (14 altogether) and create foreign key constraints with the help of the cfmigrations module. The cfmigrations module was already briefly covered in the foundation tutorial but will be re-visited again in section 2, at the beginning of this course.
Next, we are going to build entities and map them to the database schema using Quick ORM.
From the Home page, we'll have a main menu of what we call "processes" (or features within Tamarind) such as Admin or Globalization that link to an array of sub-menu options that would remain in context or disappear dynamically from the view, as we navigate through the main menu. One of the features (Globalization) will be implemented as a Coldbox custom module. Each sub-menu option will then link to views mapped to actions defined in their corresponding handler (index, new, create, edit, update, delete), while keeping track of the current menu navigation cursor as we click around between views. We are also going to trap invalid events in our application with a Coldbox event interceptor and with methods added to the Main.cfc handler that are registered in the Coldbox configuration file to prevent users from manipulating the URL and therefore trigger exceptions.
We are then, going to customise the application layout and build a dynamic menu using the concept of re-usable events with the Viewlets handler. Working with the Viewlets component will help us explore Model-View-Controller in action, and in particular, understand the benefits of the request collection structures (RC,PRC) to exchange data between the views and the handler in conjunction with each event. Request collections constitute one of the key principles of the Coldbox MVC framework that are essential to understand.
Next, we are going to build the application Views (or forms) in conjunction with Coldbox cbValidation and cbMessagebox modules, and associate them to their respective handlers and entities.
Next, we are going to demonstrate how to use the debugger to tune the performance of our queries. Although you may query database tables directly with the qb module, the performance advantage of using qb and Quick ORM stems from performing queries on entities in memory, not on database tables to retrieve records. With the help of the debugger we will show you how to use a technique known as eager loading to improve query performance.
Finally, in the last section, we will configure our project for internationalisation (i18n). We are going to load resource bundles for the following nine locales: Arabic(UAE), English(US), English(Singapore), French(France), French(Canada), Japanese, Korean, Thai and Chinese(Singapore). Note that in Tamarind v1, our application will not generate resource bundles as the result of the maintenance of dictionary keys and their translations in the various locales, which means that the resource bundles will remain as they are, with no feature to update them.
Our menu component as well as the core of our application will then be enabled for translation in any of the nine locales above listed. We will achieve that with the creation of a Translation builder service component and by using a technique called an Application helper that will fetch a getTranslation() function from a single location in the code and make it available to our layout, our handlers and all our views.
At the end of the course, you should have acquired a solid and practical understanding of the Coldbox framework using Layouts, Modules, Entities, Handlers and Internationalisation (i18n), with proper testing using TestBox at every stage of our development. As a result, we would have delivered Tamarind, in its version 1, a real world foundation application, using basic Bootstrap for its user interface.