Prerequisite for building new
...
control.
- Knockout (knockout-3.4.2.js): http://knockoutjs.com/
- knockout.validation (knockout.validation.min.js) : https://github.com/Knockout-Contrib/Knockout-Validation
- Bootstrap (bootstrap.min.js): https://getbootstrap.com/
- JavaScript (Basic): https://www.javascript.com/
- Jquery (BasicJquery (jquery-3.2.1.min.js): https://jquery.com/
- Moment JS (moment.min.js): https://momentjs.com/
...
3rd Party control files.
- fullcalender.min.js
- fullcalendar.css
- alertify-1.0.6.js
Control level guidelines with examples.
- A control should have one javascript file and one HTML template file with the same name. HTML template file should have plain HTML tags with knockout attributes
example: html/BillingShippingAddress.html and js/BillingShippingAddress.js - A control's name should unique and meaningful and should not duplicate.
example: BillingShippingAddress.html and BillingShippingAddress.js - A javascript variable will be created that will act as a collection for all of the controls objects.
example : var eb_billingShippingAddress = eb_billingShippingAddress || {}; - Control's properties, functions and methods name should start with came case.
example: productCatalogPage - Any object at the collection level should be generic to all instances of that control. Instance-specific information should live at the model level. SitePath, TemplatePath and ServicePath would be fixed properties for each control. These variables should be prefixed with an eb_prefix so that it does not collide with other JavaScript systems.
example :
eb_billingShippingAddress.SitePath = eb_Config.SitePath;
eb_billingShippingAddress.TemplatePath = "html/BillingShippingAddress.html";
eb_billingShippingAddress.ServicePath = eb_Config.ServicePath; - The Path of the HTML template should mirror that of the path to the JS.
example: eb_billingShippingAddress.TemplatePath = "html/BillingShippingAddress.html"; - Each model's properties / field should be defined camel case and assign to ko.observable / ko.observableArray / ko.computed based on logic.
example:
var _that = this;
_that.domElement = options.domElement;_that.showError = ko.observable(0);
_that.errorMessage = ko.observable();
_that.showSuccess = ko.observable(0);
_that.successMessage = ko.observable();
_that.billingAddress = ko.observableArray(); - Should not use 'this' object directly in function. It should use var _self = this;
...