A JavaScript project containing standalone javascript widgets based on Bootstrap, jQuery UI and other third-party widgets, styled with LESS.
Begin by setting you your environment and making sure you can build RichWidgets as described the README.md.
Widgets are highly visual constructs, and we are more effective in developing them when we get rapid feedback as we introduce changes. Without this rapid feedback, we are like sculptors carving blindfolded!
Run the grunt dev
command from the richwidgets root folder to start up a development version of the online demo with
integrated live-reload. You will see this demo runnin locally at:
As you make changes to the html, javascript, and LESS source, the source will be compiled and the demo site will be updated.
Additionally, this development version of the demo uses unminified versions of the sources making it easier to debug your widget in your browsers development tools.
The demo pages themselves use handlebars.js for templating. This allows us to keep our demo code DRY by using the same code to both run the page sample as well as display the code on the page. Handlebars is easily extensible through it's helper mechanism. If you find yourself bending over backwards to make something work, consider writing such a helper.
Publish the demos to github pages using the grunt task grunt site
It helps to be consistent. Here are the coding style conventions we have agreed to follow in this project. this will be updated as new discrepancies are discovered and cleaned up. Wherever possible these conventions are being monitored by jshint.
popup-panel.js
)popup-panel
)src/widgets/variables.less
src/widgets/mixins.less
popupPanelWidth
, showPopup()
)'
for stringsself
for capturing a reference to this
widget
where it makes sense to do so, that
otherwisefunction name(param1, param2) {}
function (param1, param2) {}
rich
jquery plugin namespacerich.autocomplete
extending ui.autocomplete
)null
as default value is required_uiHash
_create()
, _destroy()
)showPopup()
)_setOption()
, _initDom()
, _bindListeners()
)_cleanDom()
)_enable()
, _disable()
, _uiHash()
)_uiHash()
)this._super(key, value)
or this._superApply(arguments)
for delegation to parent implementationTo create a new widget called "My widget", start by creating the files:
src/widget/<widget-family>/my-widget.less
src/widget/<widget-family>/my-widget.js
Create a demo for your widget in
src/demo/pages/<widget-family/my-widget.hbs
The demo pages use handlebars.js, and will be added to the site navigation automatically.
Read about our approach to testing in the TESTS.md guide.