From 52f1a87114abad01065ba111542f9470aa72b845 Mon Sep 17 00:00:00 2001 From: jlukic Date: Fri, 18 Oct 2013 13:34:56 -0400 Subject: [PATCH] Updates docs to include new tab layout, adds sortable tables --- server/documents/collection.html.eco | 2 +- server/documents/collections/table.html.eco | 10 +- .../introduction/definitions.html.eco | 2 +- server/documents/module.html.eco | 170 ++++- server/documents/modules/accordion.html.eco | 709 +++++++++--------- server/documents/modules/checkbox.html.eco | 6 +- server/documents/modules/dropdown.html.eco | 8 +- server/documents/modules/form.html.eco | 6 +- server/documents/modules/modal.html.eco | 8 +- server/documents/modules/popup.html.eco | 115 ++- server/documents/modules/rating.html.eco | 8 +- server/documents/modules/shape.html.eco | 6 +- server/documents/modules/sidebar.html.eco | 4 +- server/documents/modules/transition.html.eco | 4 +- server/draft/chat.html | 8 +- server/draft/tab.html.eco | 4 +- server/files/javascript/popup.js | 2 +- server/files/javascript/semantic.js | 6 +- server/files/javascript/table.js | 8 +- server/files/stylesheets/semantic.css | 19 +- server/layouts/default.html.eco | 3 +- server/partials/header.html.eco | 37 +- 22 files changed, 647 insertions(+), 498 deletions(-) diff --git a/server/documents/collection.html.eco b/server/documents/collection.html.eco index bc421f540..d921e0046 100755 --- a/server/documents/collection.html.eco +++ b/server/documents/collection.html.eco @@ -107,7 +107,7 @@ type : 'Semantic'
- +
diff --git a/server/documents/collections/table.html.eco b/server/documents/collections/table.html.eco index 8a8cd4399..a2f9e9371 100755 --- a/server/documents/collections/table.html.eco +++ b/server/documents/collections/table.html.eco @@ -6,7 +6,6 @@ title : 'Table' description : 'Tables display collections of data grouped into rows' type : 'UI Collection' --- - <%- @partial('header') %> @@ -25,7 +24,14 @@ type : 'UI Collection'

Table

A standard table

-
+
+ +
+

Responsive Element

+

Tables are designed to be responsive. Table cells will stack when a mobile viewport size is reached.

+
+
+

This example uses a segment to add padding and a background color.

Name Status
diff --git a/server/documents/introduction/definitions.html.eco b/server/documents/introduction/definitions.html.eco index f2cd59c7f..22d411eed 100755 --- a/server/documents/introduction/definitions.html.eco +++ b/server/documents/introduction/definitions.html.eco @@ -49,7 +49,7 @@ type : 'UI Introduction'

Definition Sections

All UI components of a single type are defined similarly.

-
+
All UI diff --git a/server/documents/module.html.eco b/server/documents/module.html.eco index f5a8dfc92..c230a3971 100755 --- a/server/documents/module.html.eco +++ b/server/documents/module.html.eco @@ -13,19 +13,133 @@ type : 'Semantic' +

Design Pattern

+

All official javascript modules in Semantic are designed using a singular design pattern. This pattern allows several useful features common to all javascript components

+ + + View Commented Example + +
+
+ +
+
Run-time Performance Analysis
+

Semantic modules all provide the ability to log performance traces to the console, allowing you to see which aspects of the module are more or less performant and to track total init time onDomReady

+
+
+
+ +
+
Human Readable Traces
+

Unlike other component libraries which hides explanations of behavior in inline comments which can only be read by combing the source, semantic modules provide run-time debug output to the javascript console telling you what each component is doing as it is doing it.

+
+
+
+ +
+
Settings can be overwritten after initialization
+

Semantic provides methods to set default settings, set settings at initialization, and set settings after initialization, allowing complete flexibility over component behaviors.

+
+
+
+ +
+
All modules include an initialize and destroy method
+

All events and metadata are namespaced and can be removed after initialization, modules automatically handle destroy/init events to allow users to lazy-initialize a plugin multiple times with no issues.

+
+
+
+ +
+
Instance available in metadata
+

Modules store their instance in metadata meaning that, in a pinch, you can directly modify the instance of a UI element by modifying its properties.

+
+
+
+

Behaviors

+

Behaviors are an elements API. These can be invoke functionality or return aspects of the current state for an element

+ +

Triggering a Behavior

+

Behaviors are triggered in Semantic using a familiar syntax. API behaviors can be called using spaced words, camelcase or dot notation. The preferred method however is spaced words. Method lookup is done internally.

+
+ // generically + $('.ui.element') + .module('method', valueOne, valueTwo) + ; + // Sets a popup to top left position with an offset of negative five + $('.ui.popup') + .popup('set position', 'top left', -5) + ; +
+ +

Common Behaviors

+

All modules have a set of core behaviors which allow you to configure the component

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameUsage
initializeInitializes an element, adding page event handlers and init data
destroyRemoves all changes to the page made by initialization
refreshRefreshes cached values for a component
setting(setting, value)Allows you to modify or read a component setting
invoke(query, passedArguments, instance)Internal method used for translating sentence case method into an internal method
log(comment, values)Displays a log if a user has logging enabled
verbose(comment, values)Displays a log if a user has verbose logging enabled
error(name)Displays a name error message from the component's settings
performance log(comment, value)Adds a performance trace for an element
performance displayDisplays current element performance trace

Settings

-

Settings in UI widgets are any part of a widget definition which is mutable. Most UI widgets have a set of common settings which are useful across all plugins. +

Unlike many javascript components, anything arbitrary in Semantic is a setting. This means no need to dig inside the internals of the component to alter an expected css selector or class name, simply alter the settings object

Common Settings

- - - - - +

That means class names, selectors, error output, dom metadata etc can all be controlled by altering the settings object.

+

The following is a list of common settings usually found in each javascript module. +

NameUsage
+ + + + + @@ -67,38 +181,50 @@ type : 'Semantic'
NameUsage
name Name used in debug logs to differentiate this widget from other debug statements.

Changing Settings

-
    -
  1. A settings object can be passed in when initializing the plugin +

    The following examples use popup as an example for how to modify settings

    +
    +
    +
    Setting module defaults
    + Default settings for the module can be overridden by modifying $.fn.module.settings. +
    $.fn.popup.settings.moduleName = 'Godzilla';
    +
    +
    +
    At initialization
    + A settings object can be passed in when initializing the plugin
    $('.foo') - .module({ - moduleName: 'Godzilla', - verbose: true + .popup({ + moduleName : 'Godzilla', + verbose : true }) ;
    -
  2. -
  3. Default settings for the module can be overridden by modifying $.fn.module.settings. -
    $.fn.module.settings.moduleName = 'Godzilla';
    -
  4. -
  5. Settings can be changed after a module is initialized by calling the 'settings' method on the module with either a settings object or a name, value pair. + +
    +
    After initialization
    + Settings can be changed after a module is initialized by calling the 'settings' method on the module with either a settings object or a name, value pair.
    $('.foo') // lets initialize that! - .module() + .popup() // oh wait forgot something - .module('setting', 'moduleName', 'Godzilla') + .popup('setting', 'moduleName', 'Godzilla') + // and some more things + .popup('setting', { + debug : true, + verbose : true + }) ;
    -
  6. -
+ +

Reading Settings

Settings can also be read programmatically:

- $('.foo').module('setting', 'moduleName'); // outputs godzilla + $('.foo').popup('setting', 'moduleName');
diff --git a/server/documents/modules/accordion.html.eco b/server/documents/modules/accordion.html.eco index 2ae4d34e4..e17c9b397 100755 --- a/server/documents/modules/accordion.html.eco +++ b/server/documents/modules/accordion.html.eco @@ -8,187 +8,238 @@ type : 'UI Module' --- -<%- @partial('header') %> +<%- @partial('header', { tabs: 'module' }) %>
- +
-

Types

-
-

Accordion

-

A standard accordion

-
-
- - What is a dog? -
-
-

A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.

-
-
- - What kinds of dogs are there? -
-
-

There are many breeds of dogs. Each breed varies in size and temperament. Owners often select a breed of dog that they find to be compatible with their own lifestyle and desires from a companion.

-
-
- - How do you acquire a dog? -
-
-

Three common ways for a prospective owner to acquire a dog is from pet shops, private owners, or shelters.

-

A pet shop may be the most convenient way to buy a dog. Buying a dog from a private owner allows you to assess the pedigree and upbringing of your dog before choosing to take it home. Lastly, finding your dog from a shelter, helps give a good home to a dog who may not find one so readily.

+ -
-
-

Basic

-

A basic accordion does not add any extra formatting

-
-
- - What is a dog? -
-
-

A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.

-
-
- - What kinds of dogs are there? -
-
-

There are many breeds of dogs. Each breed varies in size and temperament. Owners often select a breed of dog that they find to be compatible with their own lifestyle and desires from a companion.

+

Types

+
+

Accordion

+

A standard accordion

+
+
+ + What is a dog? +
+
+

A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.

+
+
+ + What kinds of dogs are there? +
+
+

There are many breeds of dogs. Each breed varies in size and temperament. Owners often select a breed of dog that they find to be compatible with their own lifestyle and desires from a companion.

+
+
+ + How do you acquire a dog? +
+
+

Three common ways for a prospective owner to acquire a dog is from pet shops, private owners, or shelters.

+

A pet shop may be the most convenient way to buy a dog. Buying a dog from a private owner allows you to assess the pedigree and upbringing of your dog before choosing to take it home. Lastly, finding your dog from a shelter, helps give a good home to a dog who may not find one so readily.

+
-
- - How do you acquire a dog? +
+ +
+

Basic

+

A basic accordion does not add any extra formatting

+
+
+ + What is a dog? +
+
+

A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.

+
+
+ + What kinds of dogs are there? +
+
+

There are many breeds of dogs. Each breed varies in size and temperament. Owners often select a breed of dog that they find to be compatible with their own lifestyle and desires from a companion.

+
+
+ + How do you acquire a dog? +
+
+

Three common ways for a prospective owner to acquire a dog is from pet shops, private owners, or shelters.

+

A pet shop may be the most convenient way to buy a dog. Buying a dog from a private owner allows you to assess the pedigree and upbringing of your dog before choosing to take it home. Lastly, finding your dog from a shelter, helps give a good home to a dog who may not find one so readily.

+
-
-

Three common ways for a prospective owner to acquire a dog is from pet shops, private owners, or shelters.

-

A pet shop may be the most convenient way to buy a dog. Buying a dog from a private owner allows you to assess the pedigree and upbringing of your dog before choosing to take it home. Lastly, finding your dog from a shelter, helps give a good home to a dog who may not find one so readily.

+
+ +

Variations

+
+

Fluid

+

An accordion can take up the width of its container

+
+
+ + What is a dog? +
+
+

A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.

+
+
+ + What kinds of dogs are there? +
+
+

There are many breeds of dogs. Each breed varies in size and temperament. Owners often select a breed of dog that they find to be compatible with their own lifestyle and desires from a companion.

+
+
+ + How do you acquire a dog? +
+
+

Three common ways for a prospective owner to acquire a dog is from pet shops, private owners, or shelters.

+

A pet shop may be the most convenient way to buy a dog. Buying a dog from a private owner allows you to assess the pedigree and upbringing of your dog before choosing to take it home. Lastly, finding your dog from a shelter, helps give a good home to a dog who may not find one so readily.

+
+ +

Behavior

+ + All the following behaviors can be called using the syntax $('.foo').accordion('behavior name', argumentOne, argumentTwo) + + + + + + + + + + + + + + +
open (index)Opens accordion content at index
close (index)Closes accordion content at index
toggle (index)Closes accordion content at index
+
-

Examples

+
-
-

Form

-

An accordion can be used anywhere where content can be shown or hidden. For example, to show optional form fields.

-
-
-
- - +
+

Form

+

An accordion can be used anywhere where content can be shown or hidden. For example, to show optional form fields.

+
+
+
+ + +
+
+ + +
-
- - +
+ + Optional Details
-
-
- - Optional Details -
-
-
- - +
+
+ + +
-
-
-

Menu

-

An accordion can be used to create content drawers inside a menu

-