[virtualcommons-developer] [lighterprints] r39 - sandbox/shawn/src
Status: Beta
Brought to you by:
alllee
|
From: <sdf...@so...> - 2011-06-16 05:19:08
|
Author: sdfitzpa
Date: Wed Jun 15 22:19:00 2011
New Revision: 39
Log:
Message box still wrong size. Added handling for the different buttons in it. Created a sample info screen which it forwards to. Added a footprint counter which increments when you do the activity. That will need to be stored either server side or as a cookie eventually and its not refreshing on the main page yet either. But it is properly incrementing at least internally.
Modified:
sandbox/shawn/src/index.js
Modified: sandbox/shawn/src/index.js
==============================================================================
--- sandbox/shawn/src/index.js Wed Jun 15 20:47:49 2011 (r38)
+++ sandbox/shawn/src/index.js Wed Jun 15 22:19:00 2011 (r39)
@@ -5,8 +5,16 @@
glossOnIcon: false,
onReady: function(options) {
- function showResult(btn){
- Ext.Msg.alert('Button Click', 'You clicked the ' + btn + ' button');
+ var footprint = 0;
+
+ function bikeFromResult(btn){
+ if (btn == 'Yes')
+ {
+ footprint += 10;
+ Ext.Msg.alert('Footprint saved: ' + footprint);
+ }
+ else if (btn == 'Info')
+ panel.setActiveItem(5);
};
@@ -21,10 +29,10 @@
cls: 'homeSpace',
handler: function() {
Ext.Msg.show({
- title:'Save Changes?',
- msg: 'Do you want to save your changes? Seriously you so should.',
- buttons: [{text:'Yes', itemId:'Yes'}, {text:'Cancel', itemId:'Cancel'}, {text:'Info', itemId:'Info'}],
- fn: showResult
+ title:'Bike From School?',
+ msg: 'Do you want to bike from school instead of driving?',
+ buttons: [{text:'Yes', itemId:'Yes'}, {text:'Cancel', itemId:'Cancel'}, {text:'Info', itemId:'Info'}],
+ fn: bikeFromResult
});
}
@@ -213,6 +221,10 @@
html: "<h1>Lighter footprints</h1>",
cls: 'titleFont'
},
+ {
+ html: "Carbon Footprint reduced: " + footprint,
+ cls: 'levelFont'
+ },
buttonPanel,
{
xtype: 'button',
@@ -363,13 +375,36 @@
}
}]
})
+
+ var bikeFromInfoPanel = new Ext.Panel({
+ fullscreen: true,
+ cls: 'backColor',
+ layout: {
+ type: 'vbox',
+ align: 'center'
+ },
+ items: [{
+ html: 'Bike From Info',
+ cls: 'titleFont'
+ },
+ {
+ xtype: 'button',
+ ui: 'round',
+ text: 'Home',
+ cls: 'teamHome',
+ width: 240,
+ handler: function() {
+ panel.setActiveItem(0);
+ }
+ }]
+ })
var panel = new Ext.Panel({
fullscreen: true,
layout: {
type: 'card'
},
- items: [homePanel, activityPanel, rulesPanel, teamPanel, discussionPanel]
+ items: [homePanel, activityPanel, rulesPanel, teamPanel, discussionPanel, bikeFromInfoPanel]
});
panel.setActiveItem(0);
}
|