one toolbar for all, repanelize
This commit is contained in:
parent
e3f0064157
commit
3213d8c102
10 changed files with 123 additions and 136 deletions
58
static/js/toolbar.js
Normal file
58
static/js/toolbar.js
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
'use strict';
|
||||
|
||||
oml.ui.toolbar = function() {
|
||||
|
||||
var ui = oml.user.ui,
|
||||
|
||||
buttons = {
|
||||
'list': ['openButton', 'previewButton', 'listViewButtons'],
|
||||
'item': ['backButton', 'fullscreenButton', 'itemViewButtons']
|
||||
},
|
||||
|
||||
view = getView(),
|
||||
|
||||
that = Ox.Bar({size: 24})
|
||||
.css({zIndex: 2})
|
||||
.bindEvent({
|
||||
doubleclick: function(event) {
|
||||
if (view == 'list') {
|
||||
(
|
||||
ui.listView == 'list'
|
||||
? oml.$ui.list.$body
|
||||
: oml.$ui.list
|
||||
).animate({scrollTop: 0}, 250);
|
||||
}
|
||||
},
|
||||
oml_item: function(data) {
|
||||
if (!!data.value != !!data.previousValue) {
|
||||
view = getView();
|
||||
var previousView = view == 'list' ? 'item' : 'list';
|
||||
buttons[previousView].forEach(
|
||||
function(previousButton, index) {
|
||||
var button = buttons[view][index];
|
||||
oml.$ui[previousButton].replaceWith(
|
||||
oml.$ui[button] = oml.ui[button]()
|
||||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
buttons[view].forEach(function(button) {
|
||||
that.append(oml.$ui[button] = oml.ui[button]());
|
||||
});
|
||||
|
||||
that.append(
|
||||
oml.$ui.sortElement = oml.ui.sortElement()
|
||||
).append(
|
||||
oml.$ui.findElement = oml.ui.findElement()
|
||||
);
|
||||
|
||||
function getView() {
|
||||
return !ui.item ? 'list' : 'item';
|
||||
}
|
||||
|
||||
return that;
|
||||
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue