Skip to content
This repository has been archived by the owner on Jun 19, 2020. It is now read-only.

Commit

Permalink
add sidebar & containerview
Browse files Browse the repository at this point in the history
  • Loading branch information
Kévin La Rosa committed Jul 23, 2013
1 parent 3d449e2 commit 0f94ddb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 46 deletions.
41 changes: 22 additions & 19 deletions app/sleek.js
Expand Up @@ -15,6 +15,7 @@ define([
'joshlib!ui/item',
'joshlib!ui/list',
'joshlib!ui/listitem',
'ui/sideBar',
'joshlib!ui/fadeinpanel',
'joshlib!ui/factorymedia',
'ui/imagesloader',
Expand All @@ -34,6 +35,7 @@ define([
Item,
List,
ListItem,
SideBar,
FadeInPanel,
FactoryMedia,
ImagesLoader,
Expand Down Expand Up @@ -267,7 +269,6 @@ define([
if (navigator && navigator.splashscreen) {
setTimeout(navigator.splashscreen.hide, 500);
}
console.debug(this.containerView);
self.containerView.$el.show();
};

Expand Down Expand Up @@ -503,28 +504,30 @@ define([


/**
* Creates the sidebar UI element. Default implementation is a sidebar,
* but you may want to override this in derivated classes.
* Creates the sidebarPanel UI element.
* Overrides base function to return a sidebarPanel element with appropriate
* scrolling options.
*
* @function
* @return {UIElement} The sidebar UI element to use
* @return {UIElement} The sidebarPanel UI element to use
*/
createSidebarElement: function() {
logger.log('create sidebar element');
var sidebar = List.extend({
generate: function (cb) {
if (this.collection && (this.collection.length < 2)) {
logger.info('no sidebar element needed');
$('body').addClass('no-sidebar');
}
List.prototype.generate.call(this, cb);
}
});
return new sidebar({
name: 'sidebar',
el: '#sidebar',
templateEl: '#template-sidebar',
itemTemplateEl: '#sidebar-item'
logger.log('create sidebarPanel element');
return new SideBar({
name: 'sidebarPanel',
el: '#sidebarPanel',
templateEl: '#template-sidebarPanel',
itemTemplateEl: '#sidebarPanel-item',
scroller: true,
scrollOptions: {
vScroll: false,
hScrollbar: false,
snap: true,
bounce: false,
disabled: true
},
useWindowWidth: true,
minLengthToShow: 2
});
},

Expand Down
27 changes: 0 additions & 27 deletions app/sleek.phone.js
Expand Up @@ -31,33 +31,6 @@ define([
Sleek.prototype.initialize.call(this);
},

/**
* Creates the sidebarPanel UI element.
* Overrides base function to return a sidebarPanel element with appropriate
* scrolling options.
*
* @function
* @return {UIElement} The sidebarPanel UI element to use
*/
createSidebarElement: function() {
logger.log('create sidebarPanel element');
return new SideBar({
name: 'sidebarPanel',
el: '#sidebarPanel',
templateEl: '#template-sidebarPanel',
itemTemplateEl: '#sidebarPanel-item',
scroller: true,
scrollOptions: {
vScroll: false,
hScrollbar: false,
snap: true,
bounce: false,
disabled: true
},
useWindowWidth: true,
minLengthToShow: 2
});
},

/**
* Must create a list + detail view for a section.
Expand Down

0 comments on commit 0f94ddb

Please sign in to comment.