Permalink
Browse files

Improvement to bugtests js by sorting of tickets and to being able to…

… close the window via shaking.
  • Loading branch information...
1 parent bdd5b8b commit 190d07a6ab94f178dfdf4da2505ae52b56806e64 Blain Hamon committed Oct 27, 2010
Showing with 74 additions and 15 deletions.
  1. +74 −15 bugtests/Resources/app.js
@@ -1,26 +1,70 @@
var tickets = {
- 2132:"Vertical layout broken with auto for height",
+ 2132:"Vertical layout broken with auto for height iphone",
}
-var ticketNames = [];
+var android = [];
+var blackberry = [];
+var ipad = [];
+var iphone = [];
+var other = [];
+
for (var key in tickets)
{
- ticketNames.push(key);
- Ti.API.debug('Pushing '+key);
+ var isOther = true;
+ var lcKey = tickets[key].toLowerCase();
+ if(lcKey.match('android'))
+ {
+ android.push(key);
+ isOther = false;
+ }
+ if(lcKey.match('blackberry'))
+ {
+ blackberry.push(key);
+ isOther = false;
+ }
+ if(lcKey.match('ipad'))
+ {
+ ipad.push(key);
+ isOther = false;
+ }
+ if(lcKey.match('iphone'))
+ {
+ iphone.push(key);
+ isOther = false;
+ }
+ if(isOther)
+ {
+ other.push(key);
+ }
}
-ticketNames.sort();
+android.sort();
+blackberry.sort();
+ipad.sort();
+iphone.sort();
+other.sort();
var rows = [];
-for (var keyIndex in ticketNames)
-{
- var key = ticketNames[keyIndex];
- var row = Ti.UI.createTableViewRow({
- title:'Ticket '+key+' : '+tickets[key],
- jsfile:'tickets/'+key+'.js',
- });
- rows.push(row)
-}
+
+var generateRows=function(headerTitle,ticketNames){
+ for (var keyIndex in ticketNames)
+ {
+ var key = ticketNames[keyIndex];
+ var row = Ti.UI.createTableViewRow({
+ title:key+':'+tickets[key],
+ jsfile:'tickets/'+key+'.js',
+ header:headerTitle,
+ });
+ rows.push(row)
+ headerTitle = undefined;
+ }
+};
+
+generateRows("Android",android);
+generateRows("Blackberry",blackberry);
+generateRows("iPad",ipad);
+generateRows("iPhone",iphone);
+generateRows("other",other);
var search = Titanium.UI.createSearchBar({
barColor:'red',
@@ -48,7 +92,22 @@ tableView = Titanium.UI.createTableView({
tableView.addEventListener('click', function(e)
{
Ti.API.info('Opening ticket ' + e.source.title);
- var newWin = Ti.UI.createWindow({url:e.source.jsfile});
+ var newWin = Ti.UI.createWindow({url:e.source.jsfile,backgroundColor:'#9999FF'});
+
+ newWin.closer = function(e){
+ var alert = Ti.UI.createAlertDialog({title:'Stop test?',
+ message:'Press OK to return to the ticket table.',
+ buttonNames:['OK','Cancel'],cancel:1});
+ alert.addEventListener('click',function(e){
+ if(e.index==0)
+ {
+ Ti.Gesture.removeEventListener('shake',newWin.closer);
+ newWin.close();
+ }
+ });
+ alert.show();
+ };
+ Ti.Gesture.addEventListener('shake',newWin.closer);
newWin.open();
});

0 comments on commit 190d07a

Please sign in to comment.