We needed to build an inventory system, one that was free from the restrictions of our legacy system. We wanted to build a system that could describe any piece of inventory: from cars to carpets, from houses to job listings. We needed an interface for our sellers to actually manage that inventory. That interface is the AutoConX Inventory Manager, which we call AIM.
`js-` and to require those additional modules if the selector exists.
One of the most complex bits of functionality is the Camera. We wanted to give our users a first-class experience when adding photos to their inventory. The baseline experience of Camera is a file input field. The enhanced Camera ties together three other modules: Support, ViewFinder and CameraRoll. Support checks to see if the browser can support APIs like FileReader and Canvas. The camera then watches for changes to the file input. When a photo is taken or selected, the data is passed to the ViewFinder module which figures out how to render the image onto a canvas element on the page. ViewFinder ensures that the orientation is correct. The CameraRoll allows multiple images to be previewed, deleted and whether additional photos can be added or not (based on a max images property). CameraRoll also determines where the data for the processed images should be posted when the form is submitted. The page would be much too large to post in the traditional way, so we make multiple XHR POSTs instead. The Camera orchestrates all these parts and then submits the page when all images have been posted.