-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from peckadesign/generovani-css-class-ve-vlast…
…ni-metode Generování CSS class pro chybovou hlášku obstarává samostatná metoda
- Loading branch information
Showing
2 changed files
with
13 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
"name": "pd-forms", | ||
"title": "pdForms", | ||
"description": "Customization of netteForms for use in PeckaDesign.", | ||
"version": "3.5.0", | ||
"version": "3.6.0", | ||
"author": "PeckaDesign, s.r.o <[email protected]>", | ||
"contributors": [ | ||
"Radek Šerý <[email protected]>", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/** | ||
* @name pdForms | ||
* @author Radek Šerý <[email protected]> | ||
* @version 3.5.0 | ||
* @version 3.6.0 | ||
* | ||
* Features: | ||
* - live validation | ||
|
@@ -45,7 +45,7 @@ | |
|
||
var pdForms = window.pdForms || {}; | ||
|
||
pdForms.version = '3.5.0'; | ||
pdForms.version = '3.6.0'; | ||
|
||
|
||
/** | ||
|
@@ -399,6 +399,14 @@ | |
}; | ||
|
||
|
||
/** | ||
* Returns class name used for generated message. | ||
*/ | ||
pdForms.getMessageClassName = function (isGlobalMessage, tagName, type) { | ||
return (tagName === 'p') ? ('message message--' + type) : ('inp-' + type); | ||
} | ||
|
||
|
||
/** | ||
* Display message. Either input associated or (if appropriate selector not found) as "global" form message. | ||
* Message placeholding: | ||
|
@@ -434,17 +442,12 @@ | |
return false; | ||
} | ||
|
||
var tagName = 'label'; | ||
var className = 'inp-' + type; | ||
|
||
if (placeholder.isGlobal) { | ||
tagName = 'p'; | ||
} | ||
var tagName = placeholder.isGlobal ? 'p' : 'label'; | ||
|
||
// global message or non-error message or first error message | ||
if (placeholder.isGlobal || type !== pdForms.constants.MESSAGE_ERROR || (type === pdForms.constants.MESSAGE_ERROR && ((' ' + placeholder.elem.className + ' ').indexOf(' ' + type + ' ') === -1))) { | ||
tagName = placeholder.elem.getAttribute('data-pdforms-messages-tagname') || tagName; | ||
className = (tagName === 'p') ? 'message message--' + type : className; | ||
var className = pdForms.getMessageClassName(placeholder.isGlobal, tagName, type); | ||
|
||
var msg = document.createElement(tagName); | ||
|
||
|