-
Notifications
You must be signed in to change notification settings - Fork 1k
Gh pages audit #680
Gh pages audit #680
Changes from all commits
8990da4
eeb070b
7a01c2a
dea18c9
153a023
6b835e6
e685c83
4cfc0bf
14ca89c
54dace8
b891ebb
b87ab98
1b6bacb
aad4d80
467fa2e
316ea87
edaa3b2
a0aa71e
f50c9b4
12d98d6
6e00481
4f0adc0
e68e5c0
88c8568
eb1da0a
5d260d3
d4712a8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,19 @@ | ||
Fuel UX - Live Documentation | ||
====== | ||
|
||
### Notes | ||
### Setup | ||
* To install bower dependencies, `bower install` | ||
* To update bower dependencies, run `bower update` | ||
* To update a specific bower dependency, `bower update fuelux` | ||
* To install jekyll, run `bundle install` | ||
* To serve a jekyll site and watch, run `jekyll serve --watch` | ||
* To serve a jekyll site and watch, run `jekyll serve --watch` | ||
** If that doesn't work, try `bundle exec jekyll serve --watch` | ||
|
||
### Local Development FAQ | ||
* _config.yml contains config stuff related to the `{{site}}` variables used throughout the gh-pages site. | ||
** If you are editing local JS or CSS, you will need to uncomment the local `url` var in this file (`url: http://0.0.0.0:4000/`) | ||
|
||
|
||
### Notes | ||
* Any h tag with an id will automagically be given a little link thing to its left that people can use to link back to the documentation. The more h tags have ids, the more reference-able our documentation will be. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,41 +4,81 @@ | |
<h1 id="overview" class="page-header">Overview</h1> | ||
|
||
<div class="fu-callout fu-callout-danger"> | ||
<h4 id="plugin-dependencies">Plugin dependencies</h4> | ||
<p>Some controls depend on other controls. If you include a control individually, make sure to check for dependencies in the documentation below. A console error should be thrown if dependencies are not met. All plugins depend on jQuery <i>and</i> Bootstrap and these must be loaded <strong>before</strong> any Fuel UX files).</p> | ||
<p><a href="{{ site.repo }}/blob/{{ site.current_version }}/bower.json">Consult our <code>bower.json</code></a> to see which versions of jQuery and Bootstrap are currently tested and supported.</p> | ||
<h4 id="overview-plugin-dependencies">Plugin Dependencies</h4> | ||
<p>Like Bootstrap, Fuel UX is a collection of jQuery plugins.</p> | ||
<ul> | ||
<li>All plugins depend on jQuery <i>and</i> Bootstrap; these must be loaded <strong>before</strong> Fuel UX.</li> | ||
<li>Version requirements for jQuery/Bootstrap are documented in our <a href="{{ site.repo }}/blob/{{ site.current_version }}/bower.json"><code>bower.json</code></a> file.</li> | ||
<li>Check dependencies if including controls individually <span class="text-muted">(console errors will indicate unmet dependencies). Some controls depend on others.</span></li> | ||
</ul> | ||
</div> | ||
|
||
<h3 id="control-initialization">Control initialization</h3> | ||
|
||
<h4>With markup: data-attributes</h4> | ||
<p>You can initialize Fuel UX controls that <i>do not require a data source</i> on page load purely through markup without writing a single line of JavaScript. Controls that can to be auto-initialized are checkbox, combobox, datepicker, loader, pillbox, placard, radio, scheduler, search, selectlist, spinbox, and wizard. These controls can contain the <code>data-initialize</code> attribute. Attribute initialization is used in this section's examples when available. | ||
<div class="fu-callout fu-callout-danger"> | ||
<h4 id="overview-class-dependeny">Class Dependency</h4> | ||
<p>In order for Fuel UX to work, you must have the <code>fuelux</code> class on the body of your document <span class="text-muted">(Or at least on a parent container of the fuelux elements on your page)</span></p> | ||
</div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is good because this tripped me up too the first few times I used FuelUX. |
||
|
||
<p>Like Bootstrap, these controls can be 'lazily' initialized when the user interacts with them (such as on <code>mouseover</code>. Be careful of <code>changed</code> events when initializing. To disable this data-api, use <code>$.off('fu.data-api')</code>. The Fuel UX team recommends the precision and greater number of options provided by initializing manually via JavaScript.</p> | ||
<h3 id="overview-control-initialization">Control Initialization</h3> | ||
|
||
<h4>With JavaScript</h4> | ||
<p>You can also initialize a component at any time via JavaScript. Most controls accept an optional options object, a string which targets a particular method, or nothing (which initiates a plugin with default behavior):</p> | ||
<h4 id="overview-control-initialization-javascript">With JavaScript</h4> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because this is the recommended way, putting this first is important. The order of things in this doc implies priority. |
||
<p>Initialize a component at any time via JavaScript: | ||
{% highlight js %} | ||
// initialized with defaults | ||
$('#myWizard').wizard() | ||
// initialized with no options specified (fuelux defaults get used) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is is a good clarifying change. |
||
$("#myCombobox").combobox(); | ||
|
||
// initialized with selectedItem | ||
$('#myWizard').wizard('selectedItem', { step: 3 });) | ||
// initialized with options specified | ||
$('#myCombobox').combobox('selectByIndex', '1'); | ||
{% endhighlight %} | ||
</p> | ||
|
||
<div class="fu-callout fu-callout-warning"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Making this a callout is a good idea. This is something important for people to know, and in the old docs is was the same color and formatting as the rest of the text and didn't stand out as all the important. |
||
<h4 id="overview-destruction-and-reinitialization">Destruction and re-initialization</h4> | ||
<p><em>Fuel UX controls cannot be re-initialized</em>. Passing new options to an already initialized control <em>will do effectively nothing</em>. Many controls have convenience methods that allow some internal variables to be changed; otherwise use Javascript to call the control's <code>destroy()</code> method and initialize again with the newly desired markup and options. The <code>destroy()</code> method will attempt to return the pre-initialization markup for the element being destroyed.</p> | ||
</div> | ||
|
||
<h4 id="overview-control-initialization-markup">With markup: data-attributes</h4> | ||
<p class="bg-danger">The Fuel UX team recommends the precision and greater number of options provided by <a href="#control-initialization-javascript">initializing manually via JavaScript</a>.</p> | ||
<p>The following Fuel UX controls <em class="text-muted">(those that that do not require a data source)</em> can be initialized on page load using the <code>data-initialize</code> attribute: | ||
<ul> | ||
<li><a href="#checkbox">checkbox</a></li> | ||
<li><a href="#combobox">combobox</a></li> | ||
<li><a href="#datepicker">datepicker</a></li> | ||
<li><a href="#loader">loader</a></li> | ||
<li><a href="#pillbox">pillbox</a></li> | ||
<li><a href="#placard">placard</a></li> | ||
<li><a href="#radio">radio</a></li> | ||
<li><a href="#scheduler">scheduler</a></li> | ||
<li><a href="#search">search</a></li> | ||
<li><a href="#selectlist">selectlist</a></li> | ||
<li><a href="#spinbox">spinbox</a></li> | ||
<li><a href="#wizard">wizard</a></li> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't say enough how helpful this list is. I used to find it hard trying to figure out which controls could use data-attributes and which couldn't. In the old docs you had to read the entire page (time consuming and frustrating). This way its right at the top and easy to scan & access. |
||
</ul> | ||
<span class="text-muted">Attribute initialization is used in each section's examples when available.</span> | ||
</p> | ||
|
||
<p>If control is not present <cod>onready</cod>, it will be 'lazily' initialized when the user interacts with it (such as on <code>mouseover</code>).</p> | ||
|
||
<p class="bg-danger">Currently there is a bug causing <code>changed</code> events to fire twice for some elements (such as <a href="#spinbox">spinbox</a>). The workaround is to disable this data-api, using <code>$.off('fu.data-api')</code></p> | ||
|
||
<div class="bs-callout bs-callout-warning"> | ||
<h4>Destruction and re-initialization</h4> | ||
<p>Unlike some heavier UI control libraries, <i>Fuel UX controls cannot be re-initialized</i>. If a control is already initialized, passing in an options/default object will only change the defaults--which means <i>nothing will happen</i>. Many controls have methods that allow certain internal variables to be changed, but if the variable you would like to change is not available via a method mentioned in the tables below, then you should use the control's <code>destroy</code> method and initialize new markup with the respective options object via Javascript.</p> | ||
<div class="fu-callout fu-callout-warning"> | ||
<h4 id="overview-manual-initialization">Requires Manual Initialization</h4> | ||
<p>The following Fuel UX controls require a data source and must be initialized manually: | ||
<ul> | ||
<li><a href="#infinite-scroll">Infinite Scroll</a></li> | ||
<li><a href="#repeater">Repeater</a></li> | ||
<li><a href="#tree">Tree</a></li> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, thank you for this list. |
||
</ul> | ||
</p> | ||
</div> | ||
|
||
<h3 id="events">Events</h3> | ||
<p>Fuel UX provides custom events for most components' actions. All events are namespaced with 'fu' and their control name (ex. <code>'changed.fu.checkbox'</code> ). All Fuel UX events are past tense, so not to trigger standard events (ex. <code>changed</code> vs. <code>change</code>). Although it is not tested, nor recommended, this allows you listen for standard events and Bootstrap supported events on any internal element that you choose.</p> | ||
<h3 id="overview-events">Events</h3> | ||
<p>Fuel UX provides custom events for most components' actions. All events are namespaced with 'fu' and their control name (ex. <code>'changed.fu.checkbox'</code> ). All Fuel UX events are past tense so that they don't trigger standard and Bootstrap events (eg. <code>changed</code> vs. <code>change</code>). Listening for standard and Bootstrap supported events on an internal element is not tested, and therefore not recommended.</p> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is better language. Simply saying "don't do this" is more clear than the previous sentence that sounded non-committal on whether you should do it or not. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not necessarily a comment on the this documentation, but most of our code samples for events should be updated so show the arguments passed into the callback function. Some don't include these, and some list them incorrectly. I believe most (if not all) pass the event as the first argument, and the element as the second. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call! I completely agree that the code samples need a thorough gone-through. This initial pass was (is) about structure and organization, as well as the general overview sections. I've done some light editing on the "usage" sections as well (especially the method lists) but I have pretty much left the examples un-touched. I'm planning at least one, probably two, more passes through the documentation as a whole. One of which will be to heavily audit the samples and examples. At that time we will be integrating our jsfiddle-like thingamabob that Jason Gekeler is working on ATM. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't +1 Matt's comment enough. It always drive me nuts that I can't just go find what the callback params are in the docs... I always have to write a little test and use console.log in the browser to figure it out. |
||
|
||
<h3 id="individual-compiled">Individual or compiled</h3> | ||
<p>Components can be included individually (using Fuel UX's individual <code>*.js</code> files), or all at once (using <code>fuelux.js</code> or the minified <code>fuelux.min.js</code>). Do not include both files on your page.</p> | ||
<h3 id="overview-individual-compiled">Individual or compiled</h3> | ||
<p>Include components either altogether or individually, <em class="text-danger">but never do both</em> (include either individual <code>*.js</code> files, or the unminified <code>fuelux.js</code>, or the minified <code>fuelux.min.js</code>).</p> | ||
|
||
<h3 id="accessibility">Accessibility</h3> | ||
<h3 id="overview-accessibility">Accessibility</h3> | ||
|
||
<p>ARIA support has been added when appropriate, and all inputs have labels even if they are "screen reader only." All controls are keyboard friendly and can be navigated by tabbing to display a keyboard-focus. We hope this not only aids in accessibility, but also increases the user's productivity. Controls have been "fat-finger" tested on touch devices. If you have accessibility issues with Fuel UX controls, please <a href="https://github.com/ExactTarget/fuelux/issues/new">create an issue on GitHub</a>.</p> | ||
<p>ARIA support has been added when appropriate, and all inputs have labels even if they are "screen reader only." All controls are keyboard friendly and can be navigated by tabbing to display a keyboard-focus. Controls have been "fat-finger" tested on touch devices. <em>We care</em>; if you have accessibility issues with Fuel UX controls, please <a href="https://github.com/ExactTarget/fuelux/issues/new">create an issue on GitHub</a>.</p> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a good change, removing the unnecessary sentence and getting to the point faster. |
||
|
||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,54 @@ | ||
<!-- checkbox | ||
================================================== --> | ||
<div class="fu-docs-section"> | ||
<h1 id="checkboxes" class="page-header">Checkboxes <small>checkboxes.js</small></h1> | ||
<h1 id="checkbox" class="page-header">Checkbox <a href="{{ site.repo }}/blob/{{ site.current_version }}/js/checkbox.js"><small>checkbox.js</small></a></h1> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Having the pluralization match the file name is very helpful. The old style was not only confusing, but not even the correct file name. Linking directly to the file is also a great idea for people who prefer to "read the code" (I'm like that). |
||
|
||
<h2 id="checkboxes-examples">Examples</h2> | ||
<p>Add a custom look and feel for checkbox element.</p> | ||
<p>The checkbox control provides a customized look and feel that can be standardized across all browsers.</p> | ||
<label class="checkbox-custom checkbox-inline" data-initialize="checkbox" id="myCheckbox7"> | ||
<input class="sr-only" type="checkbox" value="option3"> <span class="checkbox-label">checkbox</span> | ||
</label> | ||
|
||
<h2 id="checkbox-usage">Usage</h2> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Putting this first reads much better and optimizes the scanability of the docs and answers the question "how do I use this" straight away. Markup for controls is only needed the first time, whereas using the API for the controls will need referenced multiple times as you build your app adding in functionality in Javascript for interacting with the control. In the old style of the docs, the markup at the top is bulky and takes up a lot of scroll-space for something that is only needed the first time you access the docs. Showing all of the permutations is also something that is not needed nearly as frequently as using the API. |
||
<h3 id="checkbox-usage-javascript">Via JavaScript</h3> | ||
<p>Initialize the checkbox control via JavaScript:</p> | ||
{% highlight js %}$('#myCheckbox').checkbox();{% endhighlight %} | ||
|
||
<h3 id="checkbox-usage-data-attributes">Via data-attributes</h3> | ||
<ul> | ||
<li>Checkbox input elements that exist when <code>$.ready()</code> executes that have <code>data-initialize="checkbox"</code> on their parent will be initialized immediately.</li> | ||
<li>Checkbox input elements that are created with <code>data-initialize="checkbox"</code> after <code>$.ready()</code> executes will initialize when a <code>mouseover</code> event occurs on them.</li> | ||
</ul> | ||
|
||
<h3 id="checkbox-usage-methods">Methods</h3> | ||
<p>Once your checkbox is <a href="#checkbox-usage">initialized</a>, you can execute any of the following methods on it:</p> | ||
|
||
<dl> | ||
<dt>.checkbox('check')</dt> | ||
<dd>Ensures the checkbox is checked.</dd> | ||
|
||
<dt>.checkbox('destroy')</dt> | ||
<dd>Removes all functionality, jQuery data, and the markup from the DOM. Returns string of control markup as close to it's pre-initialization state as possible.</dd> | ||
|
||
<dt>.checkbox('disable')</dt> | ||
<dd>Ensures the checkbox is disabled.</dd> | ||
|
||
<dt>.checkbox('enable')</dt> | ||
<dd>Ensures the checkbox is enabled.</dd> | ||
|
||
<dt>.checkbox('isChecked')</dt> | ||
<dd>Returns <code>true</code> or <code>false</code> indicating the checked state of the checkbox.</dt> | ||
|
||
<dt>.checkbox('toggle')</dt> | ||
<dd>Toggles the checkbox between checked/unchecked states.</dd> | ||
|
||
<dt>.checkbox('uncheck')</dt> | ||
<dd>Ensures the checkbox is unchecked.</dd> | ||
|
||
</dl> | ||
|
||
<h4>Default (stacked)</h4> | ||
<h2 id="checkbox-examples">Examples</h2> | ||
|
||
<h4 id="checkbox-examples-default">Default (stacked)</h4> | ||
<div class="fu-example section"> | ||
<div id="myCheckbox" class="checkbox" data-initialize="checkbox"> | ||
<label class="checkbox-custom"> | ||
|
@@ -60,7 +102,7 @@ <h4>Default (stacked)</h4> | |
</div> | ||
{% endhighlight %} | ||
|
||
<h4>Inline checkboxes</h4> | ||
<h4 id="checkbox-examples-inline">Inline checkboxes</h4> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding these links is not only helpful, but will be necessary when linking to "FuelUX Controls" from the Pattern Library website. |
||
<p>Use the <code>.checkbox-inline</code> class on checkboxes for controls that appear on the same line.</p> | ||
<div class="fu-example section"> | ||
<label class="checkbox-custom checkbox-inline" data-initialize="checkbox"> | ||
|
@@ -85,7 +127,7 @@ <h4>Inline checkboxes</h4> | |
</label> | ||
{% endhighlight %} | ||
|
||
<h4>Element toggling checkboxes</h4> | ||
<h4 id="checkbox-examples-element-toggling">Element toggling checkboxes</h4> | ||
<p>Use the <code>data-toggle="{{selector}}"</code> to automatically show or hide elements matching the selector within the body upon check or uncheck. This control works with any <a href="http://api.jquery.com/category/selectors/">jQuery selector</a>. | ||
</p> | ||
<div class="fu-example section"> | ||
|
@@ -124,7 +166,7 @@ <h4>Element toggling checkboxes</h4> | |
<div class="alert bg-success checkboxToggleCLASS" style="display: none;">Class toggling container</div> | ||
{% endhighlight %} | ||
|
||
<h4>Highlighting checkboxes</h4> | ||
<h4 id="checkbox-examples-highlighting">Highlighting checkboxes</h4> | ||
<p>Use the <code>.highlight</code> class to add a background highlight upon check. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Putting these in this huge formatted box might have been ok if there was also the "copy" button like in the Bootstrap docs. But without that the code part is only duplicating exactly what the text above it says and is a waste of space. The new format is clearer, easier to read, and more compact. |
||
</p> | ||
<div class="fu-example section"> | ||
|
@@ -152,45 +194,4 @@ <h4>Highlighting checkboxes</h4> | |
</label> | ||
{% endhighlight %} | ||
|
||
<h2 id="checkboxes-usage">Usage</h2> | ||
|
||
<h3>Via data-attributes</h3> | ||
<p>To enable the checkbox control without writing Javascript, add <code>data-initialize="checkbox"</code> to the parent of the checkbox input that you wish to initialize. Such elements that exist when <code>$.ready()</code> executes will be initialized. Any checkbox markup that is programatically created with <code>data-initialize="checkbox"</code> sometime after the initial page load will not immediately initialize. Rather, it will be initialized when the <code>mouseover</code> event is fired on it.</p> | ||
|
||
<h3>Via JavaScript</h3> | ||
<p>Call the checkbox control via JavaScript:</p> | ||
{% highlight js %}$('#myCheckbox').checkbox();{% endhighlight %} | ||
|
||
<h3>Methods</h3> | ||
<h4>$().checkbox();</h4> | ||
Activates your content as a custom checkbox | ||
|
||
<h4>.checkbox('check')</h4> | ||
<p>Checks the checkbox</p> | ||
{% highlight js %}$('#myCheckbox').checkbox('check');{% endhighlight %} | ||
|
||
<h4>.checkbox('destroy')</h4> | ||
<p>Removes all functionality, jQuery data, and the markup from the DOM. Returns string of control markup.</p> | ||
{% highlight js %}$('#myCheckbox').checkbox('destroy');{% endhighlight %} | ||
|
||
<h4>.checkbox('disable')</h4> | ||
<p>Disables the checkbox</p> | ||
{% highlight js %}$('#myCheckbox').checkbox('disable');{% endhighlight %} | ||
|
||
<h4>.checkbox('enable')</h4> | ||
<p>Enables the checkbox</p> | ||
{% highlight js %}$('#myCheckbox').checkbox('enable');{% endhighlight %} | ||
|
||
<h4>.checkbox('isChecked')</h4> | ||
<p>Returns <code>true</code> or <code>false</code> depending on whether the checkbox is checked</p> | ||
{% highlight js %}$('#myCheckbox').checkbox('isChecked');{% endhighlight %} | ||
|
||
<h4>.checkbox('toggle')</h4> | ||
<p>Toggles the checkbox between checked/unchecked states</p> | ||
{% highlight js %}$('#myCheckbox').checkbox('toggle');{% endhighlight %} | ||
|
||
<h4>.checkbox('uncheck')</h4> | ||
<p>Unchecks the checkbox</p> | ||
{% highlight js %}$('#myCheckbox').checkbox('uncheck');{% endhighlight %} | ||
|
||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This paragraph is more helpful than the previous one. It also clarifies that these are all jQuery plugins, whereas the previous docs assumed the reader could figure this out on their own which is not good technical writing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor note, should be "Fuel UX", not "FuelUX" (eg Fuel UX is a collection of jQuery plugins.)