]>
git.proxmox.com Git - sencha-touch.git/blob - src/examples/kitchensink/app/controller/tablet/Main.js
2 * @class Kitchensink.controller.tablet.Main
3 * @extends Kitchensink.controller.Main
5 * This is the Main controller subclass for the 'tablet' profile. Almost all of the functionality is implemented in the
6 * superclass, here we just define showView, which is the function that is called whenever any view is navigated to via
7 * the navigation NestedList or a url change.
9 Ext
.define('Kitchensink.controller.tablet.Main', {
10 extend
: 'Kitchensink.controller.Main',
13 * This is called whenever the user taps on an item in the main navigation NestedList
15 onNavTap: function(nestedList
, list
, index
) {
16 var record
= list
.getStore().getAt(index
);
18 if (record
.isLeaf()) {
19 this.redirectTo(record
);
24 * For a given Demo model instance, shows the appropriate view. This is the endpoint for all routes matching
25 * 'demo/:id', so is called automatically whenever the user navigates back or forward between demos.
26 * @param {Kitchensink.model.Demo} item The Demo model instance for which we want to show a view
28 showView: function(item
) {
29 var nav
= this.getNav(),
30 view
= this.createView(item
),
31 main
= this.getMain(),
32 anim
= item
.get('animation'),
33 layout
= main
.getLayout(),
34 initialAnim
= layout
.getAnimation(),
38 layout
.setAnimation(anim
);
39 newAnim
= layout
.getAnimation();
42 nav
.setDetailContainer(main
);
43 nav
.setDetailCard(view
);
44 nav
.goToNode(item
.parentNode
);
46 nav
.getActiveItem().select(item
);
49 newAnim
.on('animationend', function() {
50 layout
.setAnimation(initialAnim
);
51 }, this, { single
: true });
54 this.getToolbar().setTitle(item
.get('text'));
55 this.getSourceButton().setHidden(false);
56 // nav.goToNode(item.parentNode);
57 // nav.goToLeaf(item);
61 // * This is how the view above should look once the animation is fixed
63 // XshowView: function(item) {
64 // var nav = this.getNav(),
65 // view = this.createView(this.getViewName(item));
67 // nav.setDetailCard(view);
68 // nav.goToNode(item.parentNode);
69 // nav.goToLeaf(item);
70 // nav.getCurrentList().select(item);
72 // this.getToolbar().setTitle(item.get('text'));
73 // this.getSourceButton().setHidden(false);
77 // * Ideally, even that could be reduced to this by implementing an ensureVisible function onto List
80 // XshowView: function(item) {
81 // var nav = this.getNav();
83 // nav.ensureVisible(item);
84 // nav.setDetailCard(this.createDemoView(item));
86 // this.getToolbar().setTitle(item.get('text'));
87 // this.getSourceButton().setHidden(false);
90 showMenuById: function() {