Browse Source

Updates for search docs

pull/1243/head
jlukic 10 years ago
parent
commit
622443973d
4 changed files with 70 additions and 45 deletions
  1. 3
      src/definitions/behaviors/api.js
  2. 59
      src/definitions/modules/search.js
  3. 37
      src/definitions/modules/search.less
  4. 16
      src/themes/default/modules/search.variables

3
src/definitions/behaviors/api.js

@ -172,7 +172,7 @@ $.api = $.fn.api = function(parameters) {
ajaxSettings = $.extend(true, {}, settings, {
type : settings.method || settings.type,
data : data,
url : url,
url : settings.base + url,
beforeSend : settings.beforeXHR,
success : function() {},
failure : function() {},
@ -767,6 +767,7 @@ $.api.settings = {
// templating
action : false,
url : false,
base : '',
// data
urlData : {},

59
src/definitions/modules/search.js

@ -70,6 +70,7 @@ $.fn.search = function(parameters) {
.on('keydown' + eventNamespace, module.handleKeyboard)
;
if(settings.automatic) {
console.log($prompt);
$prompt
.on(inputEvent + eventNamespace, module.search.throttle)
;
@ -228,7 +229,7 @@ $.fn.search = function(parameters) {
;
clearTimeout(module.timer);
if(numCharacters >= settings.minCharacters) {
module.timer = setTimeout(module.search.query, settings.searchThrottle);
module.timer = setTimeout(module.search.query, settings.searchDelay);
}
else {
module.results.hide();
@ -361,12 +362,12 @@ $.fn.search = function(parameters) {
if(settings.maxResults > 0) {
response.results = $.makeArray(response.results).slice(0, settings.maxResults);
}
if($.isFunction(template)) {
html = template(response);
}
else {
module.error(error.noTemplate, false);
}
if($.isFunction(template)) {
html = template(response);
}
else {
module.error(error.noTemplate, false);
}
}
else {
html = module.message(error.noResults, 'empty');
@ -638,37 +639,37 @@ $.fn.search.settings = {
verbose : true,
performance : true,
// onSelect default action is defined in module
onSelect : 'default',
onResultsAdd : 'default',
onSearchQuery : function(){},
onResults : function(response){},
onResultsOpen : function(){},
onResultsClose : function(){},
// api config
apiSettings : false,
type : 'simple',
minCharacters : 2,
source : false,
searchFields : [
'title',
'description'
],
automatic : 'true',
type : 'simple',
hideDelay : 300,
minCharacters : 3,
searchThrottle : 300,
searchDelay : 300,
maxResults : 7,
cache : true,
searchFields : [
'title',
'description'
],
transition : 'scale',
duration : 300,
easing : 'easeOutExpo',
transition : 'scale',
duration : 300,
easing : 'easeOutExpo',
// onSelect default action is defined in module
onSelect : 'default',
onResultsAdd : 'default',
onSearchQuery : function(){},
onResults : function(response){},
onResultsOpen : function(){},
onResultsClose : function(){},
// api config
apiSettings: false,
className: {
active : 'active',
@ -739,7 +740,7 @@ $.fn.search.settings = {
}
return html;
},
categories: function(response) {
category: function(response) {
var
html = '',
escape = $.fn.search.settings.templates.escape

37
src/definitions/modules/search.less

@ -26,13 +26,33 @@
position: relative;
}
.ui.search input {
border-radius: @promptBorderRadius;
.ui.search > .prompt {
margin: 0em;
outline: none;
-webkit-appearance: none;
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
text-shadow: none;
font-style: normal;
font-weight: normal;
line-height: @promptLineHeight;
padding: @promptPadding;
font-size: @promptFontSize;
background: @promptBackground;
border: @promptBorder;
color: @promptColor;
box-shadow: @promptBoxShadow;
box-sizing: border-box;
transition: @promptTransition;
}
.ui.search .prompt {
border-radius: @promptBorderRadius;
}
/*--------------
Icon
---------------*/
@ -165,19 +185,6 @@
background: @allResultsHoverBackground;
}
/*--------------
Loading
---------------*/
.ui.search.loading .input .icon {
background: url(@loaderPath) no-repeat 50% 50%;
}
.ui.search.loading .input .icon:before,
.ui.search.loading .input .icon:after {
display: none;
}
/*--------------
Active
---------------*/

16
src/themes/default/modules/search.variables

@ -2,7 +2,23 @@
Search
*******************************/
/* Search Prompt */
@promptFontSize: 1em;
@promptVerticalPadding: 0.8em;
@promptHorizontalPadding: 1em;
@promptLineHeight: 1.2;
@promptPadding: (@promptVerticalPadding + ((1em - @promptLineHeight) / 2)) @promptHorizontalPadding;
@promptBackground: #FFFFFF;
@promptBorder: 1px solid @borderColor;
@promptBorderRadius: @circularRadius;
@promptColor: @textColor;
@promptTransition:
background-color 0.2s ease,
color 0.2s ease,
box-shadow 0.2s ease,
border-color 0.2s ease
;
@promptBoxShadow: 0em 0em 0em 0em transparent inset;
/* Result Box */
@resultsBackground: #FFFFFF;

Loading…
Cancel
Save