Working with CoreJS
- baba baloul (Unlicensed)
Check out this table for details on what JS/CSS files are loaded for your project based on coreconfig options.
Standalone apps
Standalone apps don't run in the Toronto.ca WordPress site. Instead, they run on their own. They are ideal for creating internal (intranet) applications. If you are doing a standalone app, you should:
- Make sure that the isEmbedded property in your package.json file is to false
- Use the cot_app class to create your application 'cframe'. Check out cot_app.js for more documentation.
- Set the "includeWebtrends" option in your package.json file to true if you want to get webtrends code injected automatically
- Set the "isInternetStandaloneApp" option in your package.json file to true (your app will run on the public internet) or false (your app will run on the city intranet).
Creating forms
If you are doing a web form, use the CotForm class. Make sure that your package.json has the core configuration "includeFormValidation" set to true. Check out cot_forms.js for documentation.
You may also want to use Backbone-based data modelling. If so, make sure you have the core configuration option "includeModeling" set to true. Also check out cot_backbone.js.
You may want to extend your forms with other package.json options:
"includeEditableSelect": true, //include editableSelect control
"includePlaceholders": true, //include placeholders shim
"includeMultiSelect": true, //include multiselect control
"includeDatePicker": true, //include date picker control
"includeRangePicker": true, //include date range picker control
"includeIntlTelInput": true, //include the intl-tel-input plugin for telephone fields
Adding a map
A map can be added using the cot_map class provided by CoreJS. Set the "includeMap" option in your package.json file to true
if you want to use that option.
See more information about cot_map here
Adding intranet session logins
If you are doing an internal application with user login (via Common Components), use the cot_login and/or CotSession class. Make sure your package.json has the "includeLogin" option set to true. See cot_login.js for documentation.
Other use cases
There are other core configuration options you can specify in your package.json to help with common design patterns.
Read more about all the package.json file coreconfig options.
Page Tree