'),
@@ -632,7 +632,7 @@ requires
*/
/**
- Ox.Request
+ Ox.Request request object
*/
Ox.Request = function() {
@@ -3298,6 +3298,18 @@ requires
};
+ /**
+ options:
+ format: 'short'
+ value: date value
+ weekday: false
+ width: {
+ day: 32,
+ month: options.format == 'long' ? 80 : (options.format == 'medium' ? 40 : 32),
+ weekday: options.format == 'long' ? 80 : 40,
+ year: 48
+ }
+ */
Ox.DateInput = function(options, self) {
var self = $.extend(self || {}, {
diff --git a/docs/api.js b/docs/api.js
index e98b04b5..12c142db 100644
--- a/docs/api.js
+++ b/docs/api.js
@@ -7,7 +7,9 @@ $(function() {
app.$document = $(document);
app.$window = $(window);
+ app.$ui = {};
app.docstrings = {};
+
$("
").load('../build/js/ox.ui.js', function(data) {
app.source = data;
var docstrings = app.source.match(/\/\*\*\n([\s\S]+?\*\/\n.*?)\n/gm)
@@ -26,11 +28,10 @@ $(function() {
app.docstrings[name[1]] = Ox.trim(doc.join('\n'));
}
})
- app.$ui = {};
+ });
app.docs = getDocsJSON();
app.$ui.actionList = constructList();
- app.$ui.actionInfo = Ox.Container().css({padding: '8px'});
-
+ app.$ui.actionInfo = Ox.Container().css({padding: '8px'}).html('select action on the left.');
var $main = new Ox.SplitPanel({
elements: [
@@ -46,7 +47,6 @@ $(function() {
});
$main.appendTo(app.$body);
- });
});
function constructList() {
@@ -69,12 +69,7 @@ function constructList() {
var items = [];
app.docs.forEach(function(v) {
items.push(v.name);
- });
- Ox.keys(app.docstrings).forEach(function(v) {
- if(!$.inArray(v.name, items)) {
- items.push(v.name);
- }
- });
+ });
items = Ox.map(items, function(i) { return {name: i}});
items.sort(function(a, b) { if(a.name < b.name) { return -1 } else if( a.name == b.name) { return 0 }else { return 1 } })
if(!data.keys) {
@@ -117,26 +112,28 @@ function getDocHtml(doc) {
if(app.docstrings[doc.name])
$('
').html(app.docstrings[doc.name]).appendTo($div);
- var $options = $('').html("Options: ")
- .css({'marginBottom': '20px'})
- .appendTo($div);
- var $table = $('
').attr({'cellpadding': '4'})
- .appendTo($options);
- Ox.keys(doc.options).forEach(function(k) {
- var $option = $('');
- cell(k).appendTo($option);
- if(typeof(doc.options[k]) != 'undefined') {
- cell(typeof doc.options[k]).appendTo($option);
- if(Ox.isNull(doc.options[k]))
- cell(' null').appendTo($option);
- else
- cell(' ' + doc.options[k].toString() + '').appendTo($option);
- } else {
- cell(' ').appendTo($option);
- cell('required, no default value').appendTo($option);
- }
- $option.appendTo($options);
- });
+ if(doc.options) {
+ var $options = $('').html("Options: ")
+ .css({'marginBottom': '20px'})
+ .appendTo($div);
+ var $table = $('
').attr({'cellpadding': '4'})
+ .appendTo($options);
+ Ox.keys(doc.options).forEach(function(k) {
+ var $option = $('');
+ cell(k).appendTo($option);
+ if(typeof(doc.options[k]) != 'undefined') {
+ cell(typeof doc.options[k]).appendTo($option);
+ if(Ox.isNull(doc.options[k]))
+ cell(' null').appendTo($option);
+ else
+ cell(' ' + doc.options[k].toString() + '').appendTo($option);
+ } else {
+ cell(' ').appendTo($option);
+ cell('required, no default value').appendTo($option);
+ }
+ $option.appendTo($options);
+ });
+ }
var methods = Ox.keys(doc.methods);
if (methods.length > 0) {
@@ -166,20 +163,22 @@ function getDocHtml(doc) {
});
}
- var $methodcode = $('').html(doc.functionString.replace(/').html(' View Source').appendTo($div)
- $methodcode.appendTo($div);
+ if(doc.functionString) {
+ var $methodcode = $('').html(doc.functionString.replace(/').html(' View Source').appendTo($div)
+ $methodcode.appendTo($div);
+ }
return $div;
}
@@ -194,46 +193,54 @@ function getObjectByName(obj, name) {
}
function getDocsJSON() {
- var ret = [],
- keys = Ox.keys(Ox);
- keys.forEach(function(v) {
- if (doc = getDoc(v)) {
- ret.push(doc);
- } else {
- $.noop();
- }
- });
- return ret;
+ var ret = [],
+ keys = Ox.keys(Ox);
+ keys.forEach(function(v) {
+ if (doc = getDoc(v)) {
+ ret.push(doc);
+ } else {
+ $.noop();
+ }
+ });
+ return ret;
- function getDoc(key) {
- var standardElement = new Ox.Element();
- var standardMethods = Ox.filter(Ox.keys(standardElement), function(m) { return typeof standardElement[m] === 'function' });
- var firstLetter = key.substring(0,1);
- if (firstLetter != firstLetter.toUpperCase() || typeof Ox[key] != 'function') {
- return false;
+ function getDoc(key) {
+ var standardElement = new Ox.Element();
+ var standardMethods = Ox.filter(Ox.keys(standardElement), function(m) { return typeof standardElement[m] === 'function' });
+
+ //FIXME: eventually we want to document all Ox values and functions
+ if (!/^[A-Z][a-z]/.test(key)) {
+ return false
+ }
+ var functionString = Ox[key].toString();
+ if (typeof Ox[key] != 'function') {
+ return {
+ 'name': key,
+ 'functionString': functionString
+ }
+ }
+ var functionString = Ox[key].toString();
+ try {
+ var o = new Ox[key]();
+ } catch(err) {
+ return {
+ 'name': key,
+ 'functionString': functionString
+ }
+ }
+ var methods = {};
+ var opts = {};
+ if ('options' in o && typeof o['options'] == 'function') {
+ var opts = o.options();
+ var _methods = Ox.filter(Ox.keys(o), function(m) { return (functionString.indexOf('that.'+m+' =') > -1 && typeof o[m] === 'function')});
+ $.each(_methods, function(i, m) { methods[m] = o[m].toString() });
+ }
+ return {
+ 'name': key,
+ 'options': opts,
+ 'methods': methods,
+ 'functionString': functionString
+ }
}
- try {
- var o = new Ox[key]();
- }
- catch(err) {
- return false;
- }
- if ('options' in o && typeof o['options'] == 'function') {
- var functionString = Ox[key].toString();
- var opts = o.options();
- var _methods = Ox.filter(Ox.keys(o), function(m) { return (functionString.indexOf('that.'+m+' =') > -1 && typeof o[m] === 'function')});
- var methods = {};
- $.each(_methods, function(i, m) { methods[m] = o[m].toString() });
- }
- else {
- return false;
- }
- return {
- 'name': key,
- 'options': opts,
- 'methods': methods,
- 'functionString': functionString
- }
- }
}