From f5f19c1c113298caafff270b816c4842a9274f40 Mon Sep 17 00:00:00 2001 From: rolux Date: Sat, 7 May 2011 19:52:33 +0200 Subject: [PATCH] fixes for DocPanel --- demos/doc2/js/doc.js | 2 +- source/Ox.UI/js/Core/Ox.DocPage.js | 9 ++++++--- source/Ox.UI/js/Core/Ox.DocPanel.js | 5 +++-- source/Ox.UI/js/Core/Ox.JQueryElement.js | 6 +++--- source/Ox.js | 11 +++++------ 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/demos/doc2/js/doc.js b/demos/doc2/js/doc.js index 3ecb818f..cac7c72c 100644 --- a/demos/doc2/js/doc.js +++ b/demos/doc2/js/doc.js @@ -4,7 +4,7 @@ Ox.load('UI', { }, function() { Ox.Theme('classic'); Ox.DocPanel({ - files: ['Ox.js', 'Ox.UI/js/Map/Ox.Map.js'], + files: ['Ox.js', 'Ox.UI/js/Map/Ox.Map.js', 'Ox.UI/js/Core/Ox.Element.js', 'Ox.UI/js/Core/Ox.JQueryElement.js'], getModule: function(item) { var file = item.file.replace(Ox.PATH, ''); return file == 'Ox.js' ? 'Ox' : file.split('/')[0]; diff --git a/source/Ox.UI/js/Core/Ox.DocPage.js b/source/Ox.UI/js/Core/Ox.DocPage.js index 6401ff69..642e9611 100644 --- a/source/Ox.UI/js/Core/Ox.DocPage.js +++ b/source/Ox.UI/js/Core/Ox.DocPage.js @@ -11,9 +11,12 @@ Ox.DocPage = function(options, self) { overflow: 'auto' }); - Ox.print('-------------------item', self.options.item) - - that.append($('

').append('' + self.options.item.name + '')); + that.append($('

') + .css({ + marginTop: 0, + WebkitMarginBefore: 0 + }) + .append('' + self.options.item.name + '')); getItem(self.options.item, 0).forEach(function($element) { that.append($element); diff --git a/source/Ox.UI/js/Core/Ox.DocPanel.js b/source/Ox.UI/js/Core/Ox.DocPanel.js index 5ff597ca..ba5d4e52 100644 --- a/source/Ox.UI/js/Core/Ox.DocPanel.js +++ b/source/Ox.UI/js/Core/Ox.DocPanel.js @@ -75,11 +75,12 @@ Ox.DocPanel = function(options, self) { docItem.section = self.options.getSection(docItem); if (docItem.section) { sectionIndex = Ox.getPositionById( - treeItems[moduleIndex].items, '_' + docItem.section + treeItems[moduleIndex].items, + '_' + docItem.module + '_' + docItem.section ); if (sectionIndex == -1) { treeItems[moduleIndex].items.push({ - id: '_' + docItem.section, + id: '_' + docItem.module + '_' + docItem.section, items: [], title: docItem.section }); diff --git a/source/Ox.UI/js/Core/Ox.JQueryElement.js b/source/Ox.UI/js/Core/Ox.JQueryElement.js index cd249b86..3bd141c5 100644 --- a/source/Ox.UI/js/Core/Ox.JQueryElement.js +++ b/source/Ox.UI/js/Core/Ox.JQueryElement.js @@ -10,11 +10,11 @@ Ox.JQueryElement Wrapper for jQuery Ox.JQueryElement = function($element) { var that = this; - //@ Ox.JQueryElement.id Unique id + //@ id Unique id that.id = Ox.uid(); - //@ Ox.JQueryElement.ox OxJS version + //@ ox OxJS version that.ox = Ox.VERSION; - //@ Ox.JQueryElement.$element The jQuery DOM element + //@ $element The jQuery DOM element that.$element = $element.data({ oxid: that.id }); diff --git a/source/Ox.js b/source/Ox.js index cbf09f1a..6c14f05d 100644 --- a/source/Ox.js +++ b/source/Ox.js @@ -76,11 +76,9 @@ Ox.uid = (function() { /*@ Ox.wrap Wraps a value so that one can directly call any Ox function on it - Additionally, chain() allows for chaining, and value() returns the - original value. See examples for details. (value) -> wrapped value chain wrap the return value to allow chaining - value unwrap the value wrapped by chain() + value unwrap the value wrapped by chain() value <*> Any value > Ox.wrap("foobar").repeat(2) "foobarfoobar" @@ -91,6 +89,7 @@ Ox.wrap Wraps a value so that one can directly call any Ox function on it @*/ Ox.wrap = function(val, chained) { + // somewhat inspired by underscore.js var wrapper = { chain: function() { wrapper.chained = true; @@ -1348,11 +1347,11 @@ Ox.isLeapYear = function(year, utc) { /*@ Ox.makeDate Takes a date, number or string, returns a date - > Ox.formatDate(Ox.makeDate(new Date('01/01/1970')), '%M/%D/%Y') + > Ox.formatDate(Ox.makeDate(new Date('01/01/1970')), '%m/%d/%Y') '01/01/1970' - > Ox.formatDate(Ox.makeDate(0), '%M/%D/%Y') + > Ox.formatDate(Ox.makeDate(0), '%m/%d/%Y') '01/01/1970' - > Ox.formatDate(Ox.makeDate('01/01/1970'), '%M/%D/%Y') + > Ox.formatDate(Ox.makeDate('01/01/1970'), '%m/%d/%Y') '01/01/1970' @*/ Ox.makeDate = function(date) {