diff --git a/server/documents/modules/form.html.eco b/server/documents/modules/form.html.eco index 878df4849..162ff5aa8 100755 --- a/server/documents/modules/form.html.eco +++ b/server/documents/modules/form.html.eco @@ -24,7 +24,7 @@ type : 'UI Behavior'

Usage

-

Validation Definitions

+

Validation Definitions

Form validation requires passing in a validation object with the rules required to validate your form.

A validation object includes a list of form elements, and rules to validate each against. Fields are matched by either the id tag, name tag, or the data-validate metadata matching the identifier provided in the settings object. @@ -122,75 +122,79 @@ type : 'UI Behavior'
-

- Types of Validation Rules -
Validation rules are a set of conditions required to validate a field
-

-
Validation rules are found in settings.rules, to add new global validation rules, modify $.fn.form.settings.rules to include your function.
-
To pass parameters to a rule, use bracket notation in your settings object. For example type: 'not[dog]'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameArgumentsDescription
emptyvalueChecks whether a field is empty
emailvalueChecks whether a field is a valid email address
lengthvalueChecks whether a field is longer than a length
notvalue, notValueChecks whether a field is not a value
containsvalue, textChecks whether a field contains text
isvalue, textChecks whether a field matches a value
maxLengthvalueChecks whether a field is less than a max length
matchvalue, fieldIdentifierChecks whether a field matches another field
urlvalueChecks whether a field is a url
checked-Checks whether a checkbox field is checked
+
+

+ Validation Rules +

+

Validation rules are a set of conditions required to validate a field

+
Validation rules are found in $.fn.form.settings.rules, to add new global validation rules, modify $.fn.form.settings.rules to include your function.
+
To pass parameters to a rule, use bracket notation in your settings object. For example type: 'not[dog]'
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameArgumentsDescription
emptyvalueChecks whether a field is empty
emailvalueChecks whether a field is a valid email address
lengthvalueChecks whether a field is longer than a length
notvalue, notValueChecks whether a field is not a value
containsvalue, textChecks whether a field contains text
isvalue, textChecks whether a field matches a value
maxLengthvalueChecks whether a field is less than a max length
matchvalue, fieldIdentifierChecks whether a field matches another field
urlvalueChecks whether a field is a url
checked-Checks whether a checkbox field is checked
+
+ +

Examples

-

Displaying Error Messages

+

Displaying Error Messages

Forms that contain a ui message error block will automatically be filled in with form validation information.

The template for error messages can be modified by adjusting settings.template.error
@@ -278,7 +282,7 @@ type : 'UI Behavior'
-

Validating on Blur and other Events

+

Validating on Blur and other Events

Validation messages can also appear inline. UI Forms automatically format labels with the class name prompt. These validation prompts are also set to appear on input change instead of form submission.

This example also uses a different validation event. Each element will be validated on input blur instead of the default form submit.
@@ -320,7 +324,7 @@ type : 'UI Behavior'
-

Creating Custom Validation

+

Creating Custom Validation

You can use multiple arbitrary rules to validate a form

$('.ui.form') @@ -361,7 +365,11 @@ type : 'UI Behavior'

Behavior

- All the following behaviors can be called using the syntax $('.foo').form('behavior name', argumentOne, argumentTwo) + All the following behaviors can be called using the syntax + +
+ $('.foo').form('behavior name', argumentOne, argumentTwo) +
@@ -396,233 +404,232 @@ type : 'UI Behavior'

Settings

-

- Form Settings -
Form settings modify the form validation behavior
-

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SettingDefaultDescription
keyboardShortcutstrueAdds keyboard shortcuts for enter and escape keys to submit form and blur fields respectively
onsubmitEvent used to trigger validation. Can be either submit, blur or change.
revalidatetrueIf set to true will revalidate fields with errors on input change
delaytrueDelay from last typed letter to validate a field when using on: change or when revalidating a field.
inlinefalseAdds inline error on field validation error
transition - scale - Named transition to use when animating validation errors. Fade and slide down are available without including ui transitions
duration150Animation speed for inline prompt
- -
- -

- Callbacks -
Callbacks specify a function to occur after a specific behavior.
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SettingContextDescription
onValidfieldCallback on each valid field
onInvalidfieldCallback on each invalid field
onSuccessformCallback if a form is all valid
onFailureformCallback if any form field is invalid
- -
- -

- Templates -
Templates are used to construct elements
-

-
Templates are found in settings.template, to modify templates across all forms, modify $.fn.form.settings.templates to include your function. They must return html.
- - - - - - - - - - - - - - - - - - -
TemplateArgumentsDescription
errorErrors (Array)Constructs the contents of an error message
promptErrors (Array)Constructs an element to prompt the user to an invalid field
- -
- -

- DOM Settings -
DOM settings specify how this module should interface with the DOM
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SettingDefaultDescription
namespaceformEvent namespace. Makes sure module teardown does not effect other events attached to an element.
selector -
- selector : { - message : '.error.message', - field : 'input, textarea, select', - group : '.field', - input : 'input', - prompt : '.prompt', - submit : '.submit' - } -
-
Selectors used to match functionality to DOM
metadata -
- - metadata : { - validate: 'validate' - }, -
-
- HTML5 metadata attributes -
className -
- className : { - active : 'active', - placeholder : 'default', - disabled : 'disabled', - visible : 'visible' - } -
-
Class names used to attach style to state
- -
- -

- Debug Settings -
Debug settings controls debug output to the console
-

+
+

+ Form Settings +

+

Form settings modify the form validation behavior

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SettingDefaultDescription
keyboardShortcutstrueAdds keyboard shortcuts for enter and escape keys to submit form and blur fields respectively
onsubmitEvent used to trigger validation. Can be either submit, blur or change.
revalidatetrueIf set to true will revalidate fields with errors on input change
delaytrueDelay from last typed letter to validate a field when using on: change or when revalidating a field.
inlinefalseAdds inline error on field validation error
transition + scale + Named transition to use when animating validation errors. Fade and slide down are available without including ui transitions
duration150Animation speed for inline prompt
+
+
+

+ Callbacks +

+

Callbacks specify a function to occur after a specific behavior.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SettingContextDescription
onValidfieldCallback on each valid field
onInvalidfieldCallback on each invalid field
onSuccessformCallback if a form is all valid
onFailureformCallback if any form field is invalid
+
+
+

+ Templates +

+

Templates are used to construct elements

+
Templates are found in settings.template, to modify templates across all forms, modify $.fn.form.settings.templates to include your function. They must return html.
+ + + + + + + + + + + + + + + + + + +
TemplateArgumentsDescription
errorErrors (Array)Constructs the contents of an error message
promptErrors (Array)Constructs an element to prompt the user to an invalid field
+
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SettingDefaultDescription
nameFormName used in debug logs
debugTrueProvides standard debug output to console
performanceTrueProvides standard debug output to console
verboseTrueProvides ancillary debug output to console
errors -
- errors : { - method : 'The method you called is not defined.' - } -
-
+
+

+ DOM Settings +

+

DOM settings specify how this module should interface with the DOM

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SettingDefaultDescription
namespaceformEvent namespace. Makes sure module teardown does not effect other events attached to an element.
selector +
+ selector : { + message : '.error.message', + field : 'input, textarea, select', + group : '.field', + input : 'input', + prompt : '.prompt', + submit : '.submit' + } +
+
Selectors used to match functionality to DOM
metadata +
+ + metadata : { + validate: 'validate' + }, +
+
+ HTML5 metadata attributes +
className +
+ className : { + active : 'active', + placeholder : 'default', + disabled : 'disabled', + visible : 'visible' + } +
+
Class names used to attach style to state
+
+
+

+ Debug Settings +

+

Debug settings controls debug output to the console

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SettingDefaultDescription
nameFormName used in debug logs
debugTrueProvides standard debug output to console
performanceTrueProvides standard debug output to console
verboseTrueProvides ancillary debug output to console
errors +
+ errors : { + method : 'The method you called is not defined.' + } +
+
+
diff --git a/server/files/javascript/semantic.js b/server/files/javascript/semantic.js index c498c2474..e9fadfe4c 100755 --- a/server/files/javascript/semantic.js +++ b/server/files/javascript/semantic.js @@ -40,6 +40,7 @@ semantic.ready = function() { $demo = $('.demo'), $container = $('.main.container'), + $allHeaders = $('.main.container > h2, .main.container > .tab > h2, .main.container > .tab > .examples h2'), $sectionHeaders = $container.children('h2'), $followMenu = $container.find('.following.menu'), $sectionExample = $container.find('.example'), @@ -84,27 +85,13 @@ semantic.ready = function() { ; }, - getSpecification: function(callback) { - var - url = $(this).data('url') || false - ; - callback = callback || function(){}; - if(url) { - $.ajax({ - method : 'get', - url : url, - type : 'json', - complete : callback - }); - } - }, - createWaypoints: function() { $sectionHeaders .visibility({ - offset: 70, once: false, + offset: 70, onTopPassed: handler.activate.section, + onBottomPassed: handler.activate.section, onTopPassedReverse: handler.activate.previous }) ; @@ -172,6 +159,46 @@ semantic.ready = function() { } }, + tryCreateMenu: function(event) { + if($(window).width() > 1000) { + if($container.find('.following.menu').size() === 0) { + handler.createMenu(); + handler.createWaypoints(); + $(window).off('resize.menu'); + } + } + }, + + createAnchors: function() { + $allHeaders + .each(function() { + var + $section = $(this), + safeName = $section.text().trim().replace(/\s+/g, '-').toLowerCase(), + id = window.escape(safeName), + $anchor = $('').addClass('anchor').attr('id', id) + ; + $section + .append($anchor) + ; + }) + ; + $example + .each(function() { + var + $title = $(this).children('h4').eq(0), + safeName = $title.text().trim().replace(/\s+/g, '-').toLowerCase(), + id = window.escape(safeName), + $anchor = $('').addClass('anchor').attr('id', id) + ; + if($title.size() > 0) { + $title.prepend($anchor); + } + }) + ; + + }, + createMenu: function() { // grab each h3 var @@ -188,13 +215,10 @@ semantic.ready = function() { activeClass = (index === 0) ? 'active ' : '', - safeName = $currentHeader.text().replace(/\s+/g, '-').toLowerCase(), + safeName = $currentHeader.text().trim().replace(/\s+/g, '-').toLowerCase(), id = window.escape(safeName), $anchor = $('').addClass('anchor').attr('id', id) ; - $currentHeader - .append($anchor) - ; html += '
'; if($examples.size() === 0) { html += '' + $(this).text() + ''; @@ -208,13 +232,10 @@ semantic.ready = function() { .each(function() { var $title = $(this).children('h4').eq(0), - safeName = $title.text().replace(/\s+/g, '-').toLowerCase(), + safeName = $title.text().trim().replace(/\s+/g, '-').toLowerCase(), id = window.escape(safeName), $anchor = $('').addClass('anchor').attr('id', id) ; - $title - .after($anchor) - ; if($title.size() > 0) { html += '' + $(this).children('h4').text() + ''; } @@ -264,21 +285,13 @@ semantic.ready = function() { $element = $('#'+id), position = $element.offset().top ; - $followMenu - .find('.menu .item.active') - .removeClass('active') - ; $element .addClass('active') ; $('html, body') .animate({ scrollTop: position - }, 500, function() { - $element - .addClass('active') - ; - }) + }, 500) ; location.hash = '#' + id; event.stopImmediatePropagation(); @@ -746,6 +759,7 @@ semantic.ready = function() { }; + handler.createAnchors(); if( $pageTabs.size() > 0 ) { $pageTabs @@ -754,9 +768,8 @@ semantic.ready = function() { childrenOnly : true, history : true, onTabInit : function() { - // create code handler.makeCode(); - // create follow menu + $container = ($('.fixed.column').size() > 0 ) ? $(this).find('.examples') : $(this) @@ -764,13 +777,13 @@ semantic.ready = function() { $sectionHeaders = $container.children('h2'); $sectionExample = $container.find('.example'); $exampleHeaders = $sectionExample.children('h4'); - - - handler.createMenu(); - $followMenu = $container.find('.following.menu'); - handler.createWaypoints(); + // create code + handler.tryCreateMenu(); + $(window).on('resize.menu', function() { + handler.tryCreateMenu(); + }); }, - onTabLoad : function() { + onTabLoad : function() { $sticky.filter(':visible').sticky('refresh'); } }) @@ -781,6 +794,8 @@ semantic.ready = function() { handler.createMenu(); handler.createWaypoints(); } + + $sticky .sticky({ context : '.main.container', diff --git a/server/files/stylesheets/semantic.css b/server/files/stylesheets/semantic.css index e05fe07cf..73f995034 100755 --- a/server/files/stylesheets/semantic.css +++ b/server/files/stylesheets/semantic.css @@ -730,7 +730,7 @@ body#example.hide { #example .page > .footer { margin-top: 5em; - padding: 5em 0em 8em; + padding: 5em 0em 6em; } /*---------------- @@ -1448,48 +1448,57 @@ body.progress .ui.progress .bar { } @media only screen and (max-width : 600px) { + #example .page > .footer { + margin-top: 3em; + padding: 2em 0em; + } #example .container { width: auto; margin: 0em 1rem; } } -@media only screen and (min-width : 600px) and (max-width : 1000px) { +@media only screen and (min-width : 600px) and (max-width : 998px) { #example .container { width: auto; margin: 0em 3rem; } } -@media only screen and (min-width : 1000px) and (max-width: 1355px) { - #example .container { - width: auto; - margin-right: auto; - margin-left: auto; - max-width: 700px; - } -} -@media only screen and (max-width : 1355px) { +@media only screen and (max-width : 998px) { #example .following.menu { display: none; } } - -@media only screen and (min-width : 1355px) { +@media only screen and (min-width : 998px) { + #example .following.menu { + display: block; + } #example .container { right: 100px; } - #example .following.menu { - display: block; +} +@media only screen and (min-width : 998px) and (max-width: 1200px) { + #example .container { + width: 650px; + margin: 0em auto; } + #example .container .right.rail { + width: 200px; + } +} +@media only screen and (min-width : 1200px) and (max-width: 1355px) { #example .container { - width: 850px; + width: 700px; + margin: 0em auto; } - #example.item .container, - #example.card .container { - width: 1100px; +} +@media only screen and (min-width : 1355px) { + #example .container { + width: 850px; } } + /* Homepage */ @media only screen and (max-width : 780px) { #example.index .container { @@ -1534,20 +1543,7 @@ body.progress .ui.progress .bar { Responsive *******************************/ - -@media only screen and (max-width : 1365px) { - #example .sticky-wrapper.stuck .peek { - margin-left: 0px; - left: 95px; - } -} -@media only screen and (max-width : 1500px) { - #example.index .icon.header .icon { - font-size: 3em; - } -} - -@media only screen and (max-width : 1050px) { +@media only screen and (max-width : 998px) { #example .fixed .section, #example .fixed .title b { display: none; @@ -1566,10 +1562,14 @@ body.progress .ui.progress .bar { #example .fixed .launch { display: inline-block; } - #example .sticky-wrapper { - display: none; +} + +@media only screen and (max-width : 1500px) { + #example.index .icon.header .icon { + font-size: 3em; } } + @media only screen and (max-width : 780px) { pre.console { height: 150px; diff --git a/server/layouts/default.html.eco b/server/layouts/default.html.eco index c2141a33a..bae8f4ef1 100755 --- a/server/layouts/default.html.eco +++ b/server/layouts/default.html.eco @@ -260,12 +260,12 @@
-

We Need Your Help

+

Help Keep Semantic UI Alive

Maintaining an open source UI library is no small task. Support for the continued development of Semantic UI comes directly from the community.

- +
diff --git a/src/definitions/collections/grid.less b/src/definitions/collections/grid.less index 1a6b21415..6dddad4b8 100755 --- a/src/definitions/collections/grid.less +++ b/src/definitions/collections/grid.less @@ -1034,10 +1034,18 @@ box-shadow: none !important; } + .ui.stackable.celled.grid > .column, + .ui.stackable.celled.grid > .row > .column, .ui.stackable.divided.grid > .column, - .ui.stackable.celled.grid > .row > .column { + .ui.stackable.divided.grid > .row > .column { border-top: @stackableMobileBorder; } + .ui.inverted.stackable.celled.grid > .column, + .ui.inverted.stackable.celled.grid > .row > .column, + .ui.inverted.stackable.divided.grid > .column, + .ui.inverted.stackable.divided.grid > .row > .column { + border-top: @stackableInvertedMobileBorder; + } .ui.stackable.grid > .row:first-child > .column:first-child, .ui.stackable.grid > .column:first-child { margin-top: 0em !important; diff --git a/src/definitions/modules/tab.js b/src/definitions/modules/tab.js index 74e237209..77c51f97d 100755 --- a/src/definitions/modules/tab.js +++ b/src/definitions/modules/tab.js @@ -312,7 +312,8 @@ $.tab = $.fn.tab = function(parameters) { // look for in page anchor $anchor = $('#' + tabPath + ', a[name="' + tabPath + '"]'); currentPath = $anchor.closest('[data-tab]').data('tab'); - + $tab = module.get.tabElement(currentPath); + // if anchor exists use parent tab if($anchor.size() > 0 && currentPath) { module.debug('No tab found, but deep anchor link present, opening parent tab'); module.activate.all(currentPath); diff --git a/src/themes/packages/default/collections/grid.variables b/src/themes/packages/default/collections/grid.variables index e295be092..0cb1de8d2 100755 --- a/src/themes/packages/default/collections/grid.variables +++ b/src/themes/packages/default/collections/grid.variables @@ -92,5 +92,6 @@ @stackableRowSpacing: @rowSpacing; @stackableGutterWidth: 1.5em; @stackableMobileBorder: 1px solid @borderColor; +@stackableInvertedMobileBorder: 1px solid @whiteBorderColor; @doublingRowSpacing: @rowSpacing;