Permalink
Browse files

Removed the debug statement

  • Loading branch information...
1 parent 9604fb5 commit 1b93afb8ddd2eb53a2e45d64bdf649949db4e818 @sapna-hari sapna-hari committed Nov 19, 2010
Showing with 42 additions and 68 deletions.
  1. +0 −3 Resources/mp.js
  2. +22 −33 Resources/state.js
  3. +20 −32 Resources/stateList.js
View
@@ -10,7 +10,6 @@ function getMinisterInfo() {
xhr.timeout = 1000000;
var url = "http://api.myminister.info/mps/" + Titanium.App.Properties.getString("selectedMpId") + ".json";
xhr.open("GET",url);
- Ti.API.info("Sending the request" + url);
xhr.onload = function()
{
var mp = JSON.parse(this.responseText);
@@ -23,8 +22,6 @@ function getMinisterInfo() {
var email = mp.mp_profile.email;
var photo = mp.mp_profile.photo;
- Ti.API.info("name: " + mName + " constituency: " + constituency + " party: " + party + " email: " + email + " present address: " + presentAddress);
-
var mpPhoto = Titanium.UI.createImageView({url:photo, left:0, top:20});
controlsView.add(mpPhoto);
View
@@ -30,43 +30,32 @@ function getMinistersOfState() {
xhr.timeout = 1000000;
var url = "http://api.myminister.info/states/" + Titanium.App.Properties.getString("selectedStateId") + "/mps.json";
xhr.open("GET",url);
- Ti.API.info("Sending the request" + url);
xhr.onload = function()
{
- //try
- //{
- var mps = JSON.parse(this.responseText);
- Ti.API.info("type of model: " + typeof(mps.model));
- mps = JSON.parse(mps.model);
- Ti.API.info("Looping thru the data " + mps.length);
- for(var i=0; i < mps.length; i++) {
- var mpName = mps[i].name;
- var constituency = mps[i].constituency.name;
- var party = mps[i].party.name;
- var mpId = mps[i].id
- Ti.API.info("name: " + mpName + " constituency: " + constituency + " party: " + party);
-
- data.push({title:mpName+" (" + constituency + " - " + party + ")", hasChild:true, mpId:mpId, mpName:mpName});
-
- }
- var tableView = Titanium.UI.createTableView({data:data,minRowHeight:58});
- var w = Ti.UI.currentWindow;
- Ti.UI.currentWindow.add(tableView);
+ var mps = JSON.parse(this.responseText);
+ mps = JSON.parse(mps.model);
+ for(var i=0; i < mps.length; i++) {
+ var mpName = mps[i].name;
+ var constituency = mps[i].constituency.name;
+ var party = mps[i].party.name;
+ var mpId = mps[i].id
- tableView.addEventListener('click', function(e) {
- Ti.API.info("mpId: " + e.rowData.mpId);
- Titanium.App.Properties.setString("selectedMpId", e.rowData.mpId);
- win = Titanium.UI.createWindow({
- url:'mp.js',
- title:e.rowData.mpName,
- fullscreen: false
- });
- win.open({animated:true});
+ data.push({title:mpName+" (" + constituency + " - " + party + ")", hasChild:true, mpId:mpId, mpName:mpName});
+
+ }
+ var tableView = Titanium.UI.createTableView({data:data,minRowHeight:58});
+ var w = Ti.UI.currentWindow;
+ Ti.UI.currentWindow.add(tableView);
+
+ tableView.addEventListener('click', function(e) {
+ Titanium.App.Properties.setString("selectedMpId", e.rowData.mpId);
+ win = Titanium.UI.createWindow({
+ url:'mp.js',
+ title:e.rowData.mpName,
+ fullscreen: false
});
- /*}
- catch(E){
- alert(E);
- }*/
+ win.open({animated:true});
+ });
};
xhr.send();
}
View
@@ -29,42 +29,30 @@ function getStates() {
var xhr = Ti.Network.createHTTPClient();
xhr.timeout = 1000000;
xhr.open("GET","http://api.myminister.info/states.json");
- Ti.API.info("Sending the request");
xhr.onload = function()
{
- //try
- //{
- var states = JSON.parse(this.responseText);
- Ti.API.info("type of model: " + typeof(states.model));
- states = JSON.parse(states.model);
- Ti.API.info("Looping thru the data " + states.length);
- for(var i=0; i < states.length; i++) {
- var stateName = states[i].name;
- var noOfMps = states[i].no_of_mps;
- var stateId = states[i].id;
- Ti.API.info("state: " + stateName + " no of mps: " + noOfMps + " id: " + stateId);
-
- data.push({title:stateName+" (" + noOfMps + ")", hasChild:true, stateid:stateId});
-
- }
- var tableView = Titanium.UI.createTableView({data:data,minRowHeight:58});
-
- Ti.UI.currentWindow.add(tableView);
+ var states = JSON.parse(this.responseText);
+ states = JSON.parse(states.model);
+ for(var i=0; i < states.length; i++) {
+ var stateName = states[i].name;
+ var noOfMps = states[i].no_of_mps;
+ var stateId = states[i].id;
- tableView.addEventListener('click', function(e) {
- Ti.API.info("e: " + e.rowData.stateid);
- Titanium.App.Properties.setString("selectedStateId", e.rowData.stateid);
- win = Titanium.UI.createWindow({
- url:'state.js',
- title:e.rowData.title,
- fullscreen: false
- });
- win.open({animated:true});
+ data.push({title:stateName+" (" + noOfMps + ")", hasChild:true, stateid:stateId});
+ }
+ var tableView = Titanium.UI.createTableView({data:data,minRowHeight:58});
+
+ Ti.UI.currentWindow.add(tableView);
+
+ tableView.addEventListener('click', function(e) {
+ Titanium.App.Properties.setString("selectedStateId", e.rowData.stateid);
+ win = Titanium.UI.createWindow({
+ url:'state.js',
+ title:e.rowData.title,
+ fullscreen: false
});
- /*}
- catch(E){
- alert(E);
- }*/
+ win.open({animated:true});
+ });
};
xhr.send();
}

0 comments on commit 1b93afb

Please sign in to comment.