Skip to content

richwidgets/richwidgets.github.io

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

<!DOCTYPE html>

<!--[if lt IE 7]>
<html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>
<html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>
<html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
<!--<![endif]-->

<head>
  <meta charset="utf-8"/>
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <meta name="fragment" content="!"/>

  <title>Contributing</title>



  <link rel="stylesheet" href="assets-demo/richwidgets-demo.min.css">
  <script src="assets-demo/richwidgets-demo.min.js"></script>


  

  <link rel="stylesheet" href="assets-demo/highlightjs/styles/github.css">
  <script src="assets-demo/modernizr/modernizr.js"></script>
  <script src="assets-demo/highlightjs/highlight.pack.js"></script>
  <script>hljs.initHighlightingOnLoad();</script>
  <script src="assets-demo/bootstrap/js/dropdown.js"></script>
  <script src="assets-demo/bootstrap/js/collapse.js"></script>
</head>

<body class="">
  <nav class="navbar-rcue navbar-default navbar-fixed-top" role="navigation">
  <div class="container">

    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href=".">RichWidgets</a>
    </div>

    <div class="collapse navbar-collapse navbar-ex1-collapse">
      <ul class="nav navbar-nav navbar-primary navbar-left">

        <li ><a href=".">Home</a></li>
        <li class="dropdown ">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Widgets <b class="caret"></b></a>
          <ul class="dropdown-menu">
            
              
            
              
            
              
            
              
                <li ><a href="input/autocomplete.html">Autocomplete</a></li>
              
            
              
                <li ><a href="output/charts.html">Charts</a></li>
              
            
              
                <li ><a href="select/ordering-list.html">OrderingList</a></li>
              
            
              
                <li ><a href="select/pick-list.html">PickList</a></li>
              
            
              
            
          </ul>
        </li>
        <li><a href="/api">API Docs</a></li>
      </ul>
      <ul class="nav navbar-nav navbar-primary navbar-right">
        <li ><a href="about.html">About</a></li>
        <li ><a href="tests.html">Testing</a></li>
        <li  class="active"><a href="contributing.html">Contributing</a></li>
      </ul>
    </div>

  </div>
</nav>


<div class="container">
  

<a id="fork-me-on-github-ribbon" href="https://github.com/richwidgets/richwidgets"><img src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub"></a>

<h1 id="contributing-to-richwidgets-build-status-https-travis-ci-org-richwidgets-richwidgets-png-branch-master-https-travis-ci-org-richwidgets-richwidgets-">Contributing to RichWidgets <a href="https://travis-ci.org/richwidgets/richwidgets"><img src="https://travis-ci.org/richwidgets/richwidgets.png?branch=master" alt="Build Status"></a></h1>
<blockquote>
<p>A JavaScript project containing standalone javascript widgets based on Bootstrap, jQuery UI and other third-party widgets, styled with LESS.</p>
</blockquote>
<h2 id="hacking-on-richwidgets">Hacking on RichWidgets</h2>
<p>Begin by setting you your environment and making sure you can build RichWidgets as described the
<a href="https://github.com/richwidgets/richwidgets/blob/master/README.md#build">README.md</a>.</p>
<p>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!</p>
<p>Run the <code>grunt dev</code> command from the richwidgets root folder to start up a development version of the online demo with
integrated <a href="https://github.com/livereload/livereload-js">live-reload</a>.  You will see this demo runnin locally at:</p>
<blockquote>
<p><a href="http://localhost:9000">http://localhost:9000</a></p>
</blockquote>
<p>As you make changes to the html, javascript, and LESS
source, the source will be compiled and the demo site will be updated.</p>
<p>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.</p>
<p>The demo pages themselves use <a href="http://handlebarsjs.com/">handlebars.js</a> for templating.  This allows us to keep our demo
code <a href="http://en.wikipedia.org/wiki/Don%27t_Repeat_Yourself">DRY</a> 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&#39;s <a href="http://assemble.io/docs/Custom-Helpers.html">helper</a>
mechanism.  If you find yourself bending over backwards to make something work, consider writing such a helper.</p>
<h2 id="publishing-the-demos">Publishing the demos</h2>
<p>Publish the demos to github pages using the grunt task <code>grunt site</code></p>
<h2 id="coding-style">Coding Style</h2>
<p>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.</p>
<ul>
<li>Indentation<ul>
<li>Use spaces (not tabs)</li>
<li>Indentation size is 2 spaces</li>
</ul>
</li>
<li>Filenames<ul>
<li>All filenames will use a lowercase-hyphenated naming convention (e.g. <code>popup-panel.js</code>)</li>
</ul>
</li>
<li>LESS<ul>
<li>CSS class names use lowercase-hyphenated naming convention (e.g. <code>popup-panel</code>)</li>
<li>Define variables centrally in <code>src/widgets/variables.less</code></li>
<li>Define mixins centrally in <code>src/widgets/mixins.less</code></li>
</ul>
</li>
<li>JavaScript<ul>
<li>Functions and variables names use camelCase (e.g. <code>popupPanelWidth</code>, <code>showPopup()</code>)</li>
<li>Single quotes <code>&#39;</code> for strings</li>
<li>do not use <code>self</code> for capturing a reference to <code>this</code><ul>
<li>use <code>widget</code> where it makes sense to do so, <code>that</code> otherwise</li>
</ul>
</li>
<li>function white-spaces<ul>
<li>named functions<ul>
<li><code>function name(param1, param2) {}</code></li>
</ul>
</li>
<li>unnamed functions<ul>
<li><code>function (param1, param2) {}</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li>Widget Factory<ul>
<li>Use the <code>rich</code> jquery plugin namespace</li>
<li>No widget name prefix when it is not required<ul>
<li>i.e. when we extend upstream plugin&#39;s functionality, we make sure the API is compatible (e.g. <code>rich.autocomplete</code> extending <code>ui.autocomplete</code>)</li>
</ul>
</li>
<li>Widget event prefix: stick with the default name of the widget (eg. no underscores or abbreviating)</li>
<li>Initialize all options, using <code>null</code> as default value is required</li>
<li>Widget state should be collected for use in _trigger invocations using a method called <code>_uiHash</code></li>
<li>order of methods inside widget definition<ol>
<li>lifecycle methods (e.g. <code>_create()</code>, <code>_destroy()</code>)</li>
<li>public API methods (e.g. <code>showPopup()</code>)</li>
<li>private methods<ol>
<li>initialization methods (e.g. <code>_setOption()</code>, <code>_initDom()</code>, <code>_bindListeners()</code>)</li>
<li>cleanup methods (E.g. <code>_cleanDom()</code>)</li>
<li>common utility methods (e.g. <code>_enable()</code>, <code>_disable()</code>, <code>_uiHash()</code>)</li>
<li>event handlers</li>
<li>other private methods (E.g. <code>_uiHash()</code>)</li>
</ol>
</li>
</ol>
</li>
<li>use <code>this._super(key, value)</code> or <code>this._superApply(arguments)</code> for delegation to parent implementation</li>
</ul>
</li>
</ul>
<h2 id="creating-a-new-widget">Creating a new widget</h2>
<p>To create a new widget called &quot;My widget&quot;, start by creating the files:</p>
<ul>
<li><code>src/widget/&lt;widget-family&gt;/my-widget.less</code></li>
<li><code>src/widget/&lt;widget-family&gt;/my-widget.js</code></li>
</ul>
<p>Create a demo for your widget in</p>
<ul>
<li><code>src/demo/pages/&lt;widget-family/my-widget.hbs</code></li>
</ul>
<p>The demo pages use <a href="http://handlebarsjs.com/">handlebars.js</a>, and will be added to the site navigation automatically.</p>
<h2 id="testing">Testing</h2>
<p>Read about our approach to testing in the <a href="https://github.com/richwidgets/richwidgets/blob/master/TESTS.md">TESTS.md</a> guide.</p>

</div>


    <script>
        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
                m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

        ga('create', 'UA-7306415-8', 'richwidgets.io');
        ga('send', 'pageview');
    </script>


</body>
</html>

About

RichWidgets Site

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •