add home button to doc page and example page

This commit is contained in:
rolux 2012-06-18 10:57:52 +02:00
parent 3286d80b40
commit ba1a3c4b2a
4 changed files with 47 additions and 15 deletions

View file

@ -24,6 +24,19 @@ Ox.DocPage = function(options, self) {
self.$toolbar = Ox.Bar({size: 24}); self.$toolbar = Ox.Bar({size: 24});
self.$homeButton = Ox.Button({
title: 'home',
tooltip: 'Home',
type: 'image'
})
.css({float: 'left', margin: '4px 2px 4px 4px'})
.bindEvent({
click: function() {
that.triggerEvent('close');
}
})
.appendTo(self.$toolbar);
self.$title = Ox.Label({ self.$title = Ox.Label({
style: 'square', style: 'square',
title: self.options.item.name title: self.options.item.name
@ -34,7 +47,7 @@ Ox.DocPage = function(options, self) {
height: '13px', height: '13px',
paddingTop: '1px', paddingTop: '1px',
borderRadius: '4px', borderRadius: '4px',
margin: '4px' margin: '4px 2px 4px 2px'
}) })
.appendTo(self.$toolbar) .appendTo(self.$toolbar)

View file

@ -329,11 +329,11 @@ Ox.DocPanel = function(options, self) {
replace: self.options.replace replace: self.options.replace
}) })
.bindEvent({ .bindEvent({
close: function() {
selectItem();
},
example: function(data) { example: function(data) {
that.triggerEvent('example', data); that.triggerEvent('example', data);
},
select: function(data) {
selectItem(data.id);
} }
}); });
that.$element.replaceElement(1, self.$page); that.$element.replaceElement(1, self.$page);

View file

@ -24,12 +24,25 @@ Ox.ExamplePage = function(options, self) {
self.$toolbar = Ox.Bar({size: 24}); self.$toolbar = Ox.Bar({size: 24});
self.$homeButton = Ox.Button({
title: 'home',
tooltip: 'Home',
type: 'image'
})
.css({float: 'left', margin: '4px 2px 4px 4px'})
.bindEvent({
click: function() {
that.triggerEvent('close');
}
})
.appendTo(self.$toolbar)
self.$title = Ox.Label({ self.$title = Ox.Label({
style: 'square', style: 'square',
title: self.options.title title: self.options.title
}) })
.css({float: 'left', borderRadius: '4px', margin: '4px'}) .css({float: 'left', borderRadius: '4px', margin: '4px 2px 4px 2px'})
.appendTo(self.$toolbar) .appendTo(self.$toolbar);
self.$openButton = Ox.Button({ self.$openButton = Ox.Button({
disabled: self.options.selected == 'source', disabled: self.options.selected == 'source',

View file

@ -113,17 +113,23 @@ Ox.ExamplePanel = function(options, self) {
item = Ox.getObjectById(self.items, id); item = Ox.getObjectById(self.items, id);
self.$panel.replaceElement(1, self.$panel.replaceElement(1,
self.$page = Ox.ExamplePage({ self.$page = Ox.ExamplePage({
height: window.innerHeight, height: window.innerHeight,
html: item.html, html: item.html,
js: item.js, js: item.js,
references: item.references, references: item.references,
replaceCode: self.options.replaceCode, replaceCode: self.options.replaceCode,
replaceComment: self.options.replaceComment, replaceComment: self.options.replaceComment,
title: item.title, title: item.title,
width: window.innerWidth - self.options.size width: window.innerWidth - self.options.size
}) })
.bindEvent({
close: function() {
selectItem();
}
})
); );
} else { } else {
self.$list.options({selected: []});
self.$page.empty().append(self.options.element); self.$page.empty().append(self.options.element);
} }
self.options.selected = id; self.options.selected = id;