SlideShare a Scribd company logo
1 of 101
Download to read offline
Create A Mobile Web App
          with
     Sencha Touch
       @ jamespearce
Single device            Multi device
Sedentary user            Mobile user
                                 *


Declarative               Imperative
Thin client               Thick client
Documents                Applications

         * or supine, or sedentary, or passive, or...
A badge for all these ways
   the web is changing
HTML5 is a new version of HTML4,
 XHTML1, and DOM Level 2 HTML
 addressing many of the issues of
 those specifications while at the
  same time enhancing (X)HTML
to more adequately address Web
          applications.
                       - WHATWG Wiki
What is an app?
Consumption vs Creation
      Linkability
    User Experience
     Architecture
WebFont        Video      Audio     Graphics
Device Access
  Camera                   CSS Styling & Layout                Network
  Location                                                      HTTP
                                  JavaScript
  Contacts                                                      AJAX

    SMS                        Semantic HTML                   Events

 Orientation                                                   Sockets
                File Systems      Workers &
                                                  Cross-App
    Gyro         Databases         Parallel                     SSL
                                                  Messaging
                App Caches        Processing



        (all the elements of a modern application platform)
Introducing
Sencha Touch
A JavaScript framework
       for building
    rich mobile apps
  with web standards
http://sencha.com/touch
Components

    Lists
Theming
Forms
Scrolling
Touch Events
Data access & MVC
Charts
Kitchen Sink




http://sencha.com/x/5e
Hello World
http://sencha.com/x/d5
<!DOCTYPE	
  html>
<html>
	
  	
  <head>
	
  	
  
	
  	
  	
  	
  <title>Hello	
  World</title>

	
  	
  	
  	
  <script	
  src="lib/touch/sencha-­‐touch.js"></script>
	
  	
  	
  	
  <script	
  src="app/app.js"></script>
	
  	
  	
  	
  
	
  	
  	
  	
  <link	
  href="lib/touch/resources/css/sencha-­‐touch.css"
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  rel="stylesheet"	
  type="text/css"	
  />
	
  	
  
	
  	
  </head>
	
  	
  <body></body>
</html>
new	
  Ext.Application({

	
  	
  	
  	
  launch:	
  function()	
  {

	
  	
  	
  	
  	
  	
  	
  	
  new	
  Ext.Panel({
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  fullscreen:	
  true,
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  dockedItems:	
  [{xtype:'toolbar',	
  title:'My	
  First	
  App'}],
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  layout:	
  'fit',
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  styleHtmlContent:	
  true,
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  html:	
  '<h2>Hello	
  World!</h2>I	
  did	
  it!'
	
  	
  	
  	
  	
  	
  	
  	
  });

	
  	
  	
  	
  }

});
Lists
var	
  list	
  =	
  new	
  Ext.List({
	
  	
  	
  	
  store:	
  store,
	
  	
  	
  	
  itemTpl:	
  '{firstName}	
  {lastName}',
	
  	
  	
  	
  grouped:	
  true,
	
  	
  	
  	
  indexBar:	
  true
});
Nested Lists
var	
  list	
  =	
  new	
  Ext.NestedList({
	
  	
  	
  	
  store:	
  store,
	
  	
  	
  	
  displayField:	
  'name',
	
  	
  	
  	
  title:	
  'My	
  List',
	
  	
  	
  	
  updateTitleText:	
  true,
	
  	
  	
  	
  getDetailCard:
	
  	
  	
  	
  	
  	
  	
  	
  function(record,	
  parent)	
  {..}
});
Carousels
var	
  carousel	
  =	
  new	
  Ext.Carousel({
	
  	
  	
  	
  direction:	
  'horizontal',
	
  	
  	
  	
  indicator:	
  true,
	
  	
  	
  	
  items:	
  [
	
  	
  	
  	
  	
  	
  	
  	
  ..
	
  	
  	
  	
  ]
});
Sheets
var	
  sheet	
  =	
  new	
  Ext.ActionSheet({
	
  	
  	
  	
  items:	
  [
	
  	
  	
  	
  	
  	
  	
  	
  {
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  text:	
  'Delete	
  draft',
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ui:	
  'decline'
	
  	
  	
  	
  	
  	
  	
  	
  },	
  {
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  text:	
  'Save	
  draft'
	
  	
  	
  	
  	
  	
  	
  	
  },	
  {
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  text:	
  'Cancel',
	
  	
  	
  	
  	
  	
  	
  	
  }
	
  	
  	
  	
  ]
});

sheet.show();
Common patterns
      1
var	
  list	
  =	
  new	
  Ext.List({
	
  	
  	
  	
  store:	
  store,
	
  	
  	
  	
  itemTpl:	
  '{firstName}	
  {lastName}',
	
  	
  	
  	
  grouped:	
  true,
	
  	
  	
  	
  indexBar:	
  true
});


var	
  panel	
  =	
  new	
  Ext.Panel({
	
  	
  	
  	
  fullscreen:	
  true,
	
  	
  	
  	
  layout:	
  'fit',
	
  	
  	
  	
  items:	
  [list]
});
Common patterns
      2
var	
  panel	
  =	
  new	
  Ext.Panel({
	
  	
  	
  	
  fullscreen:	
  true,
	
  	
  	
  	
  layout:	
  'fit',
	
  	
  	
  	
  items:	
  [{
	
  	
  	
  	
  	
  	
  	
  	
  xtype:	
  'list',
	
  	
  	
  	
  	
  	
  	
  	
  store:	
  store,
	
  	
  	
  	
  	
  	
  	
  	
  itemTpl:	
  '{firstName}	
  {lastName}',
	
  	
  	
  	
  	
  	
  	
  	
  grouped:	
  true,
	
  	
  	
  	
  	
  	
  	
  	
  indexBar:	
  true
	
  	
  	
  	
  }]
});
A more complex app
Pre-requisites
                Sencha Touch SDK:
        http://sencha.com/products/touch/

              Yelp developer API key:
  http://www.yelp.com/developers/getting_started/
                   api_overview

              Install Sass and Compass:
        http://sass-lang.com/download.html
         http://compass-style.org/install/
The Valley App




http://senchalearn.github.com/valley
       http://sencha.com/x/dr
https://github.com/
 senchalearn/valley
Development sequence
1 Structure the app   5 Detail page

2 Layout the UI       6 Add a map

3 Model the data      7 More data

4 Load the list       8 Customize theme
1 Structure the app
index.html

<!doctype	
  html>
<html>
	
  	
  	
  	
  <head>
	
  	
  	
  	
  	
  	
  	
  	
  <title>Valley	
  Guide</title>
	
  	
  	
  	
  </head>
                <body></body>
</html>
index.html

<script	
  src="lib/touch/sencha-­‐touch.js"></script>

<script	
  src="app/yelp.js"></script>
<script	
  src="app/app.js"></script>



<link	
  href="lib/touch/resources/css/sencha-­‐touch.css"	
  
	
  	
  	
  	
  	
  	
  rel="stylesheet"	
  type="text/css"	
  />
app.js
va	
  =	
  new	
  Ext.Application({

	
  	
  	
  	
  launch:	
  function()	
  {

	
  	
  	
  	
  	
  	
  	
  	
  this.viewport	
  =	
  new	
  Ext.Panel({

	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  layout:	
  'card',
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  fullscreen:	
  true,
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  html:	
  "Hello	
  world!"
	
  	
  	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  });

	
  	
  	
  	
  }

});
2 Layout the UI

   toolbar                   toolbar


   dataList

   listCard                 detailCard
              na.viewport
The app...
var	
  va	
  =	
  new	
  Ext.Application({
	
  	
  	
  	
  launch:	
  function()	
  {

	
  	
  	
  	
  	
  	
  	
  	
  this.listCard	
  =	
  new	
  Ext.Panel({
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  html:	
  'I	
  am	
  the	
  list'
	
  	
  	
  	
  	
  	
  	
  	
  });

	
  	
  	
  	
  	
  	
  	
  	
  this.detailCard	
  =	
  new	
  Ext.Panel({
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  html:	
  'I	
  am	
  the	
  detail'
	
  	
  	
  	
  	
  	
  	
  	
  });

	
  	
  	
  	
  	
  	
  	
  	
  this.viewport	
  =	
  new	
  Ext.Panel({
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  layout:	
  'card',
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  fullscreen:	
  true,
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  cardSwitchAnimation:	
  'slide',
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  items:	
  [this.listCard,	
  this.detailCard]
	
  	
  	
  	
  	
  	
  	
  	
  });
	
  	
  	
  	
  }
});
listCard
this.listCardToolbar	
  =	
  new	
  Ext.Toolbar({
	
  	
  	
  	
  dock:	
  'top',
	
  	
  	
  	
  title:	
  'Valley	
  Guide'
});

this.listCardDataList	
  =	
  new	
  Ext.List({
	
  	
  	
  	
  store:	
  null,
	
  	
  	
  	
  itemTpl:	
  ''
});

this.listCard	
  =	
  new	
  Ext.Panel({
	
  	
  	
  	
  dockedItems:	
  [this.listCardToolbar],
	
  	
  	
  	
  items:	
  [this.listCardDataList],
	
  	
  	
  	
  layout:	
  'fit'
});
detailCard
this.detailCardToolbar	
  =	
  new	
  Ext.Toolbar({
	
  	
  	
  	
  dock:	
  'top',
	
  	
  	
  	
  title:	
  '...'
});

this.detailCard	
  =	
  new	
  Ext.Panel({
	
  	
  	
  	
  dockedItems:	
  [this.detailCardToolbar]
});
3 Model the data

http://api.yelp.com/business_review_search
?ywsid=YELP_KEY
&term=Restaurants
&location=Silicon%20Valley
Apigee console
"businesses":	
  [
	
  	
  	
  	
  {
	
  	
  	
  	
  	
  "rating_img_url"	
  :	
  "http://media4.px.yelpcdn.com/...",
	
  	
  	
  	
  	
  "country_code"	
  :	
  "US",
	
  	
  	
  	
  	
  "id"	
  :	
  "BHpAlynD9dIGIaQDRqHCTA",
	
  	
  	
  	
  	
  "is_closed"	
  :	
  false,
	
  	
  	
  	
  	
  "city"	
  :	
  "Nashville",
	
  	
  	
  	
  	
  "mobile_url"	
  :	
  "http://mobile.yelp.com/biz/...",
	
  	
  	
  	
  	
  "review_count"	
  :	
  50,
	
  	
  	
  	
  	
  "zip"	
  :	
  "11231",
	
  	
  	
  	
  	
  "state"	
  :	
  "TN",
	
  	
  	
  	
  	
  "latitude"	
  :	
  40.675758,
	
  	
  	
  	
  	
  "address1"	
  :	
  "253	
  Conover	
  St",
	
  	
  	
  	
  	
  "address2"	
  :	
  "",
	
  	
  	
  	
  	
  "address3"	
  :	
  "",
	
  	
  	
  	
  	
  "phone"	
  :	
  "7186258211",
	
  	
  	
  	
  	
  "state_code"	
  :	
  "TN",
	
  	
  	
  	
  	
  "categories":	
  [
	
  	
  	
  	
  	
  	
  ...",
	
  	
  	
  	
  	
  ],
	
  	
  	
  	
  	
  ...
A data namespace
this.data	
  =	
  {};
The ‘Business’ model
this.data.Business	
  =	
  Ext.regModel('',	
  {
	
  	
  	
  	
  fields:	
  [
	
  	
  	
  	
  	
  	
  	
  	
  {name:	
  "id",	
  type:	
  "int"},
	
  	
  	
  	
  	
  	
  	
  	
  {name:	
  "name",	
  type:	
  "string"},
	
  	
  	
  	
  	
  	
  	
  	
  {name:	
  "latitude",	
  type:	
  "string"},
	
  	
  	
  	
  	
  	
  	
  	
  {name:	
  "longitude",	
  type:	
  "string"},
	
  	
  	
  	
  	
  	
  	
  	
  {name:	
  "address1",	
  type:	
  "string"},
	
  	
  	
  	
  	
  	
  	
  	
  {name:	
  "address2",	
  type:	
  "string"},
	
  	
  	
  	
  	
  	
  	
  	
  {name:	
  "address3",	
  type:	
  "string"},
	
  	
  	
  	
  	
  	
  	
  	
  {name:	
  "phone",	
  type:	
  "string"},
	
  	
  	
  	
  	
  	
  	
  	
  {name:	
  "state_code",	
  type:	
  "string"},
	
  	
  	
  	
  	
  	
  	
  	
  {name:	
  "mobile_url",	
  type:	
  "string"},
	
  	
  	
  	
  	
  	
  	
  	
  {name:	
  "rating_img_url_small",	
  type:	
  "string"},
	
  	
  	
  	
  	
  	
  	
  	
  {name:	
  "photo_url",	
  type:	
  "string"},
	
  	
  	
  	
  ]
});
A store of those models
this.data.restaurants	
  =	
  new	
  Ext.data.Store({
	
  	
  	
  	
  model:	
  this.data.Business,
	
  	
  	
  	
  autoLoad:	
  true,
	
  	
  	
  	
  proxy:	
  {
	
  	
  	
  	
  	
  	
  	
  	
  type:	
  'scripttag',
	
  	
  	
  	
  	
  	
  	
  	
  url:	
  'http://api.yelp.com/business_review_search'	
  +
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  '?ywsid='	
  +	
  YELP_KEY	
  +
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  '&term=Restaurant'	
  +
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  '&location=Silicon%20Valley',
	
  	
  	
  	
  	
  	
  	
  	
  reader:	
  {
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  type:	
  'json',
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  root:	
  'businesses'
	
  	
  	
  	
  	
  	
  	
  	
  }
	
  	
  	
  	
  }
});
4 Load the list
this.listCardDataList	
  =	
  new	
  Ext.List({
	
  	
  	
  	
  store:	
  this.data.restaurants,
	
  	
  	
  	
  itemTpl:	
  '{name}'
});
A more interesting template
itemTpl:
	
  	
  	
  	
  '<img	
  class="photo"	
  src="{photo_url}"	
  width="40"	
  height="40"/>'	
  +
	
  	
  	
  	
  '{name}<br/>'	
  +
	
  	
  	
  	
  '<img	
  src="{rating_img_url_small}"/>&nbsp;'	
  +
	
  	
  	
  	
  '<small>{address1}</small>'
Hack the style
<style>
	
  	
  	
  	
  .photo	
  {
	
  	
  	
  	
  	
  	
  	
  	
  float:left;
	
  	
  	
  	
  	
  	
  	
  	
  margin:0	
  8px	
  16px	
  0;
	
  	
  	
  	
  	
  	
  	
  	
  border:1px	
  solid	
  #ccc;
	
  	
  	
  	
  	
  	
  	
  	
  -­‐webkit-­‐box-­‐shadow:
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  0	
  2px	
  4px	
  #777;
	
  	
  	
  	
  }
</style>
Get images resized...

       ...width="40"	
  height="40"	
  />
...in the cloud

src="http://src.sencha.io/40/{photo_url}"	
  width="40"	
  height="40"/>
5 Detail page
this.listCardDataList	
  =	
  new	
  Ext.List({
	
  	
  	
  	
  store:	
  this.data.restaurants,
	
  	
  	
  	
  itemTpl:	
  ...
	
  	
  	
  	
  listeners:	
  {
	
  	
  	
  	
  	
  	
  	
  	
  selectionchange:	
  function	
  (selectionModel,	
  records)	
  {
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  if	
  (records[0])	
  {
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  va.viewport.setActiveItem(va.detailCard);
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  va.detailCardToolbar.setTitle(
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  records[0].get('name')
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  );
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  }
	
  	
  	
  	
  	
  	
  	
  	
  }
	
  	
  	
  	
  }
});
A back button
this.detailCardToolbar	
  =	
  new	
  Ext.Toolbar({
	
  	
  	
  	
  dock:	
  'top',
	
  	
  	
  	
  title:	
  '...',
	
  	
  	
  	
  items:	
  [{
	
  	
  	
  	
  	
  	
  	
  	
  text:	
  'Back',
	
  	
  	
  	
  	
  	
  	
  	
  ui:	
  'back',
	
  	
  	
  	
  	
  	
  	
  	
  handler:	
  function	
  ()	
  {
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  va.viewport.setActiveItem(
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  va.listCard,
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  {type:	
  'slide',	
  direction:	
  'right'}
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  );
	
  	
  	
  	
  	
  	
  	
  	
  }
	
  	
  	
  	
  }]
});
Detail template
this.detailCard	
  =	
  new	
  Ext.Panel({
	
  	
  	
  	
  dockedItems:	
  [this.detailCardToolbar],
	
  	
  	
  	
  styleHtmlContent:	
  true,
	
  	
  	
  	
  cls:	
  'detail',
	
  	
  	
  	
  tpl:	
  [
	
  	
  	
  	
  	
  	
  	
  	
  '<img	
  class="photo"	
  src="{photo_url}"	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  width="100"	
  height="100"/>',
	
  	
  	
  	
  	
  	
  	
  	
  '<h2>{name}</h2>',
	
  	
  	
  	
  	
  	
  	
  	
  '<div	
  class="info">',
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  '{address1}<br/>',
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  '<img	
  src="{rating_img_url_small}"/>',
	
  	
  	
  	
  	
  	
  	
  	
  '</div>',
	
  	
  	
  	
  	
  	
  	
  	
  '<div	
  class="phone	
  x-­‐button">',
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  '<a	
  href="tel:{phone}">{phone}</a>',
	
  	
  	
  	
  	
  	
  	
  	
  '</div>',
	
  	
  	
  	
  	
  	
  	
  	
  '<div	
  class="link	
  x-­‐button">',
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  '<a	
  href="{mobile_url}">Read	
  more</a>',
	
  	
  	
  	
  	
  	
  	
  	
  '</div>'
	
  	
  	
  	
  ]
});
A little styling
.x-­‐html	
  h2	
  {
	
  	
  	
  	
  margin-­‐bottom:0;
}
.phone,	
  .link	
  {
	
  	
  	
  	
  clear:both;
	
  	
  	
  	
  font-­‐weight:bold;
	
  	
  	
  	
  display:block;
	
  	
  	
  	
  text-­‐align:center;
	
  	
  	
  	
  margin-­‐top:8px;
}
6 Add a map

      toolbar     toolbar


      dataList   dataList
                 detailCard

      listCard   detailTabs
va.viewport
6 Add a map
va.viewport.setActiveItem(va.detailTabs);

...

this.detailMap	
  =	
  new	
  Ext.Map({});

this.detailTabs	
  =	
  new	
  Ext.TabPanel({
	
  	
  	
  	
  dockedItems:	
  [this.detailCardToolbar],
	
  	
  	
  	
  items:	
  [this.detailCard,	
  this.detailMap]
});

va.viewport	
  =	
  new	
  Ext.Panel({
	
  	
  	
  	
  layout:	
  'card',
	
  	
  	
  	
  fullscreen:	
  true,
	
  	
  	
  	
  cardSwitchAnimation:	
  'slide',
	
  	
  	
  	
  items:	
  [this.listCard,	
  this.detailTabs]
});
Tab titles
this.detailCard	
  =	
  new	
  Ext.Panel({
	
  	
  	
  	
  ...
	
  	
  	
  	
  title:	
  'Info'
});

this.detailMap	
  =	
  new	
  Ext.Map({
	
  	
  	
  	
  title:	
  'Map'
});
Google Maps script
<script	
  type="text/javascript"
	
  	
  src="http://maps.google.com/maps/api/js?sensor=true">
</script>
Update the map location
selectionchange:	
  function	
  (selectionModel,	
  records)	
  {
	
  	
  	
  	
  ...
	
  	
  	
  	
  var	
  map	
  =	
  va.detailMap.map;

	
  	
  	
  	
  if	
  (!map.marker)	
  {
	
  	
  	
  	
  	
  	
  	
  	
  map.marker	
  =	
  new	
  google.maps.Marker();
	
  	
  	
  	
  	
  	
  	
  	
  map.marker.setMap(map);
	
  	
  	
  	
  }

	
  	
  	
  	
  map.setCenter(
	
  	
  	
  	
  	
  	
  	
  	
  new	
  google.maps.LatLng(
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  records[0].get('latitude'),
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  records[0].get('longitude')
	
  	
  	
  	
  	
  	
  	
  	
  )
	
  	
  	
  	
  );

	
  	
  	
  	
  map.marker.setPosition(
	
  	
  	
  	
  	
  	
  	
  	
  map.getCenter()
	
  	
  	
  	
  );
Improve the tab bar
this.detailTabs	
  =	
  new	
  Ext.TabPanel({
	
  	
  	
  	
  dockedItems:	
  [this.detailCardToolbar],
	
  	
  	
  	
  items:	
  [this.detailCard,	
  this.detailMap],

	
  	
  	
  	
  tabBar:	
  {
	
  	
  	
  	
  	
  	
  	
  	
  ui:	
  'light',
	
  	
  	
  	
  	
  	
  	
  	
  layout:	
  {	
  pack:	
  'center'	
  }
	
  	
  	
  	
  }

});
7 More?
More data...
['hotels',	
  'bars',	
  'restaurants'].forEach(	
  function	
  (type)	
  {
	
  	
  	
  	
  va.data[type]	
  =	
  new	
  Ext.data.Store({
	
  	
  	
  	
  	
  	
  	
  	
  model:	
  va.data.Business,
	
  	
  	
  	
  	
  	
  	
  	
  autoLoad:	
  true,
	
  	
  	
  	
  	
  	
  	
  	
  proxy:	
  {
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  type:	
  'scripttag',
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  url:	
  'http://api.yelp.com/business_review_search'	
  +
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  '?ywsid='	
  +	
  YELP_KEY	
  +
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  '&term='	
  +	
  type	
  +
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  '&location=Silicon%20Valley',
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  reader:	
  {
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  type:	
  'json',
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  root:	
  'businesses'
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  }
	
  	
  	
  	
  	
  	
  	
  	
  }
	
  	
  	
  	
  });
});
Make list into a ‘class’
this.ListCardDataList	
  =	
  Ext.extend(Ext.List,	
  {
	
  	
  	
  	
  store:	
  null,
	
  	
  	
  	
  itemTpl:
	
  	
  	
  	
  	
  	
  	
  	
  '<img	
  class="photo"	
  ...
Instantiate that 3 times
this.stayCardDataList	
  =	
  new	
  this.ListCardDataList({
	
  	
  	
  	
  store:	
  this.data.hotels
});

this.eatCardDataList	
  =	
  new	
  this.ListCardDataList({
	
  	
  	
  	
  store:	
  this.data.restaurants
});

this.drinkCardDataList	
  =	
  new	
  this.ListCardDataList({
	
  	
  	
  	
  store:	
  this.data.bars
});




                                            Consider lazy-loading...
Turn container into tabs too
this.listCard	
  =	
  new	
  Ext.TabPanel({
	
  	
  	
  	
  items:	
  [
	
  	
  	
  	
  	
  	
  	
  	
  this.stayCardDataList,	
  
	
  	
  	
  	
  	
  	
  	
  	
  this.eatCardDataList,	
  
	
  	
  	
  	
  	
  	
  	
  	
  this.drinkCardDataList
	
  	
  	
  	
  ],
	
  	
  	
  	
  tabBar:	
  {
	
  	
  	
  	
  	
  	
  	
  	
  ui:	
  'light',
	
  	
  	
  	
  	
  	
  	
  	
  layout:	
  {	
  pack:	
  'center'	
  },
	
  	
  	
  	
  	
  	
  	
  	
  dock:	
  'bottom'
	
  	
  	
  	
  },
	
  	
  	
  	
  cardSwitchAnimation:	
  'flip',
...
And add titles & icons
this.stayCardDataList	
  =	
  new	
  this.ListCardDataList({
	
  	
  	
  	
  store:	
  this.data.hotels,
	
  	
  	
  	
  title:	
  'Stay',
	
  	
  	
  	
  iconCls:	
  'home'
});

this.eatCardDataList	
  =	
  new	
  this.ListCardDataList({
	
  	
  	
  	
  store:	
  this.data.restaurants,
	
  	
  	
  	
  title:	
  'Eat',
	
  	
  	
  	
  iconCls:	
  'locate'
});

this.drinkCardDataList	
  =	
  new	
  this.ListCardDataList({
	
  	
  	
  	
  store:	
  this.data.bars,
	
  	
  	
  	
  title:	
  'Drink',
	
  	
  	
  	
  iconCls:	
  'star'
});
Pull-to-refresh
this.ListCardDataList	
  =	
  Ext.extend(Ext.List,	
  {
	
  	
  	
  	
  ...
	
  	
  	
  	
  plugins:	
  [{
	
  	
  	
  	
  	
  	
  	
  	
  ptype:	
  'pullrefresh'
	
  	
  	
  	
  }]
});
8 Customize theme
http://sass-lang.com/
Variables
/* SCSS */                     /* CSS */

$blue: #3bbfce;                .content-navigation {
$margin: 16px;                   border-color: #3bbfce;
                                 color: #2b9eab;
.content-navigation {          }
  border-color: $blue;
  color:                       .border {
    darken($blue, 9%);           padding: 8px;
}                                margin: 8px;
                                 border-color: #3bbfce;
.border {                      }
  padding: $margin / 2;
  margin: $margin / 2;
  border-color: $blue;
}
$> sudo gem install compass




       http://rubyinstaller.org/
$> compass -v

Compass 0.11.1 (Antares)
Copyright (c) 2008-2011 Chris Eppstein
Released under the MIT License.


$> sass -v

Sass 3.1.1 (Brainy Betty)
Start by copying sencha-touch.scss
config.rb
dir	
  =	
  File.dirname(__FILE__)

load	
  File.join(dir,	
  '..',	
  'lib',	
  'touch',	
  'resources',	
  
'themes')

#	
  Compass	
  configurations
sass_path	
  	
  	
  	
  =	
  dir
css_path	
  	
  	
  	
  	
  =	
  dir
environment	
  	
  =	
  :production
output_style	
  =	
  :compressed

#	
  or	
  :nested,	
  :expanded,	
  :compact
Compile...
$>	
  cd	
  theming

$>	
  compass	
  compile	
  valley.scss
	
  	
  	
  	
  	
  	
  create	
  valley.css


$>	
  compass	
  compile	
  valley.scss
	
  	
  	
  	
  	
  	
  identical	
  valley.css


[edit	
  file]
$>	
  compass	
  compile	
  valley.scss
	
  	
  	
  	
  	
  	
  overwrite	
  valley.css


$>	
  compass	
  watch	
  valley.scss
	
  	
  	
  	
  	
  	
  >>>	
  Change	
  detected	
  to:	
  valley.scss
	
  	
  	
  	
  	
  	
  overwrite	
  valley.css
Link...
<link	
  href="theming/valley.css"	
  rel="stylesheet"
	
  	
  	
  	
  	
  	
  type="text/css"	
  />
valley.scss
@import	
  'sencha-­‐touch/default/all';

@include	
  sencha-­‐panel;
@include	
  sencha-­‐buttons;
@include	
  sencha-­‐sheet;
@include	
  sencha-­‐tabs;
@include	
  sencha-­‐toolbar;
@include	
  sencha-­‐list;
@include	
  sencha-­‐list-­‐pullrefresh;
@include	
  sencha-­‐layout;
@include	
  sencha-­‐loading-­‐spinner;
...
valley.scss
$base-­‐color:	
  #9D9E00;

@import	
  'sencha-­‐touch/default/all';

@include	
  sencha-­‐panel;
@include	
  sencha-­‐buttons;
@include	
  sencha-­‐sheet;
@include	
  sencha-­‐tabs;
@include	
  sencha-­‐toolbar;
@include	
  sencha-­‐list;
@include	
  sencha-­‐list-­‐pullrefresh;
@include	
  sencha-­‐layout;
@include	
  sencha-­‐loading-­‐spinner;
Choose own icons
$base-­‐color:	
  #9D9E00;
$include-­‐default-­‐icons:	
  false;

@import	
  'sencha-­‐touch/default/all';

@include	
  sencha-­‐panel;
@include	
  sencha-­‐buttons;
...

@include	
  pictos-­‐iconmask('briefcase1');
@include	
  pictos-­‐iconmask('heart');
@include	
  pictos-­‐iconmask('music1');
Specify iconCls
this.stayCardDataList	
  =	
  new	
  this.ListCardDataList({
	
  	
  	
  	
  store:	
  this.data.hotels,
	
  	
  	
  	
  title:	
  'Stay',
	
  	
  	
  	
  iconCls:	
  'briefcase1'
});

this.eatCardDataList	
  =	
  new	
  this.ListCardDataList({
	
  	
  	
  	
  store:	
  this.data.restaurants,
	
  	
  	
  	
  title:	
  'Eat',
	
  	
  	
  	
  iconCls:	
  'heart'
});

this.drinkCardDataList	
  =	
  new	
  this.ListCardDataList({
	
  	
  	
  	
  store:	
  this.data.bars,
	
  	
  	
  	
  title:	
  'Drink',
	
  	
  	
  	
  iconCls:	
  'music1'
});
_variables.scss
$include-html-style: true;        $base-color: #354F6E;

$include-default-icons: true;     $base-gradient: 'matte';

$include-form-sliders: true;      $alert-color: red;

$include-floating-panels: true;   $confirm-color: #92cf00;

$include-default-uis: true;       $page-bg-color: #eee;

$include-highlights: true;        $global-row-height: 2.6em;

$include-border-radius: true;     $active-color: darken(
                                    saturate($base-color, 55%),
$basic-slider: false;             10%);
http://dev.sencha.com/deploy/touch/docs/theme/
Sass is a superset of CSS
$base-­‐color:	
  #9D9E00;
$include-­‐default-­‐icons:	
  false;

@import	
  'sencha-­‐touch/default/all';
...

@include	
  pictos-­‐iconmask('briefcase1');
@include	
  pictos-­‐iconmask('heart');
@include	
  pictos-­‐iconmask('music1');

.photo	
  {
	
  	
  	
  	
  float:left;
	
  	
  	
  	
  margin:0	
  8px	
  16px	
  0;
	
  	
  	
  	
  border:1px	
  solid	
  #ccc;
	
  	
  	
  	
  -­‐webkit-­‐box-­‐shadow:
	
  	
  	
  	
  	
  	
  	
  	
  0	
  2px	
  4px	
  #777;
}
...
WebFonts
@import	
  url(http://fonts.googleapis.com/css?family=Voltaire);


.x-­‐toolbar-­‐title	
  {
	
  	
  font-­‐family:	
  Voltaire;
	
  	
  font-­‐weight:	
  normal;
	
  	
  font-­‐size:	
  1.7em;
	
  	
  line-­‐height:	
  1.7em;
	
  	
  letter-­‐spacing:	
  0.05em;
}
Done?
Development sequence
1 Structure the app   5 Detail page

2 Layout the UI       6 Add a map

3 Model the data      7 More data

4 Load the list       8 Customize theme
A ‘responsive’ app...




http://sencha.com/x/cv
And if we’d had time...
 Add to home screen
 - Icon
 - Splash screen

 Hybrid app; PhoneGap / NimbleKit
 - Contacts API
 - Geolocation


 http://sencha.com/x/cy
 http://sencha.com/x/de
O ine app
$>	
  phantomjs	
  confess.js	
  http://github/valley/

CACHE	
  MANIFEST

#	
  This	
  manifest	
  was	
  created	
  by	
  confess.js
#	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  Time:	
  Wed	
  Sep	
  14	
  2011	
  10:14:45	
  GMT-­‐0700	
  (PDT)
#	
  	
  	
  	
  User-­‐agent:	
  Mozilla/5.0	
  ...

CACHE:
app/app.js
app/yelp.js
http://cdn.sencha.io/touch/1.1.0/sencha-­‐touch.js
http://maps.google.com/maps/api/js?sensor=true
http://maps.gstatic.com/intl/en_us/mapfiles/api-­‐3/6/4/main.js
theming/valley.css

NETWORK:
*


http://github.com/jamesgpearce/confess
O ine data
Taking Yelp data o ine

Taking images o ine
- src.sencha.io to generate cross-origin B64

Detecting network connection changes




http://sencha.com/x/df
Weinre




http://phonegap.github.com/weinre
built with

Apps vs Web technology
James Pearce
@ jamespearce

More Related Content

What's hot

Html5 and web technology update
Html5 and web technology updateHtml5 and web technology update
Html5 and web technology updateDoug Domeny
 
IBM Lotus Notes Domino XPages and XPages for Mobile
IBM Lotus Notes Domino XPages and XPages for MobileIBM Lotus Notes Domino XPages and XPages for Mobile
IBM Lotus Notes Domino XPages and XPages for MobileChris Toohey
 
After max+phonegap
After max+phonegapAfter max+phonegap
After max+phonegapyangdj
 
Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsEPAM Systems
 
Building sustainable RESTFul services
Building sustainable RESTFul servicesBuilding sustainable RESTFul services
Building sustainable RESTFul servicesOrtus Solutions, Corp
 
GDI Seattle - Intro to JavaScript Class 4
GDI Seattle - Intro to JavaScript Class 4GDI Seattle - Intro to JavaScript Class 4
GDI Seattle - Intro to JavaScript Class 4Heather Rock
 
ADO.NET Entity Framework by Jose A. Blakeley and Michael Pizzo
ADO.NET Entity Framework by Jose A. Blakeley and Michael PizzoADO.NET Entity Framework by Jose A. Blakeley and Michael Pizzo
ADO.NET Entity Framework by Jose A. Blakeley and Michael PizzoHasnain Iqbal
 
QCon 2015 - Thinking in components: A new paradigm for Web UI
QCon 2015 - Thinking in components: A new paradigm for Web UIQCon 2015 - Thinking in components: A new paradigm for Web UI
QCon 2015 - Thinking in components: A new paradigm for Web UIOliver Häger
 
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoBuilding iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoRob Bontekoe
 
Desenvolvimento web com Ruby on Rails (extras)
Desenvolvimento web com Ruby on Rails (extras)Desenvolvimento web com Ruby on Rails (extras)
Desenvolvimento web com Ruby on Rails (extras)Joao Lucas Santana
 
Devoxx 2014-webComponents
Devoxx 2014-webComponentsDevoxx 2014-webComponents
Devoxx 2014-webComponentsCyril Balit
 
Wordcamp abq cf-cpt
Wordcamp abq cf-cptWordcamp abq cf-cpt
Wordcamp abq cf-cptmy easel
 
2012 SVCodeCamp: In App Payments with HTML5
2012 SVCodeCamp: In App Payments with HTML52012 SVCodeCamp: In App Payments with HTML5
2012 SVCodeCamp: In App Payments with HTML5Jonathan LeBlanc
 
WordPress development paradigms, idiosyncrasies and other big words
WordPress development paradigms, idiosyncrasies and other big wordsWordPress development paradigms, idiosyncrasies and other big words
WordPress development paradigms, idiosyncrasies and other big wordsTomAuger
 
Angular JS blog tutorial
Angular JS blog tutorialAngular JS blog tutorial
Angular JS blog tutorialClaude Tech
 
WordCamp ABQ 2013: Making the leap from Designer to Designer/Developer
WordCamp ABQ 2013: Making the leap from Designer to Designer/DeveloperWordCamp ABQ 2013: Making the leap from Designer to Designer/Developer
WordCamp ABQ 2013: Making the leap from Designer to Designer/Developermy easel
 

What's hot (20)

Html5 and web technology update
Html5 and web technology updateHtml5 and web technology update
Html5 and web technology update
 
前端概述
前端概述前端概述
前端概述
 
IBM Lotus Notes Domino XPages and XPages for Mobile
IBM Lotus Notes Domino XPages and XPages for MobileIBM Lotus Notes Domino XPages and XPages for Mobile
IBM Lotus Notes Domino XPages and XPages for Mobile
 
After max+phonegap
After max+phonegapAfter max+phonegap
After max+phonegap
 
Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript Basics
 
Building sustainable RESTFul services
Building sustainable RESTFul servicesBuilding sustainable RESTFul services
Building sustainable RESTFul services
 
GDI Seattle - Intro to JavaScript Class 4
GDI Seattle - Intro to JavaScript Class 4GDI Seattle - Intro to JavaScript Class 4
GDI Seattle - Intro to JavaScript Class 4
 
Html5 For Jjugccc2009fall
Html5 For Jjugccc2009fallHtml5 For Jjugccc2009fall
Html5 For Jjugccc2009fall
 
ADO.NET Entity Framework by Jose A. Blakeley and Michael Pizzo
ADO.NET Entity Framework by Jose A. Blakeley and Michael PizzoADO.NET Entity Framework by Jose A. Blakeley and Michael Pizzo
ADO.NET Entity Framework by Jose A. Blakeley and Michael Pizzo
 
QCon 2015 - Thinking in components: A new paradigm for Web UI
QCon 2015 - Thinking in components: A new paradigm for Web UIQCon 2015 - Thinking in components: A new paradigm for Web UI
QCon 2015 - Thinking in components: A new paradigm for Web UI
 
Polymer
PolymerPolymer
Polymer
 
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoBuilding iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" Domino
 
Desenvolvimento web com Ruby on Rails (extras)
Desenvolvimento web com Ruby on Rails (extras)Desenvolvimento web com Ruby on Rails (extras)
Desenvolvimento web com Ruby on Rails (extras)
 
Devoxx 2014-webComponents
Devoxx 2014-webComponentsDevoxx 2014-webComponents
Devoxx 2014-webComponents
 
Wordcamp abq cf-cpt
Wordcamp abq cf-cptWordcamp abq cf-cpt
Wordcamp abq cf-cpt
 
2012 SVCodeCamp: In App Payments with HTML5
2012 SVCodeCamp: In App Payments with HTML52012 SVCodeCamp: In App Payments with HTML5
2012 SVCodeCamp: In App Payments with HTML5
 
WordPress development paradigms, idiosyncrasies and other big words
WordPress development paradigms, idiosyncrasies and other big wordsWordPress development paradigms, idiosyncrasies and other big words
WordPress development paradigms, idiosyncrasies and other big words
 
Angular JS blog tutorial
Angular JS blog tutorialAngular JS blog tutorial
Angular JS blog tutorial
 
Geb qa fest2017
Geb qa fest2017Geb qa fest2017
Geb qa fest2017
 
WordCamp ABQ 2013: Making the leap from Designer to Designer/Developer
WordCamp ABQ 2013: Making the leap from Designer to Designer/DeveloperWordCamp ABQ 2013: Making the leap from Designer to Designer/Developer
WordCamp ABQ 2013: Making the leap from Designer to Designer/Developer
 

Viewers also liked

Ext Js introduction and new features in Ext Js 6
Ext Js introduction and new features in Ext Js 6Ext Js introduction and new features in Ext Js 6
Ext Js introduction and new features in Ext Js 6Sushil Shinde
 
The City Bars App with Sencha Touch 2
The City Bars App with Sencha Touch 2The City Bars App with Sencha Touch 2
The City Bars App with Sencha Touch 2James Pearce
 
Mobile app with sencha touch
Mobile app with sencha touchMobile app with sencha touch
Mobile app with sencha touchfch415
 
Mobile Device APIs
Mobile Device APIsMobile Device APIs
Mobile Device APIsJames Pearce
 
Building Sencha Themes
Building Sencha ThemesBuilding Sencha Themes
Building Sencha ThemesSencha
 
Sencha Touch Charts
Sencha Touch ChartsSencha Touch Charts
Sencha Touch Chartssaadulde
 

Viewers also liked (6)

Ext Js introduction and new features in Ext Js 6
Ext Js introduction and new features in Ext Js 6Ext Js introduction and new features in Ext Js 6
Ext Js introduction and new features in Ext Js 6
 
The City Bars App with Sencha Touch 2
The City Bars App with Sencha Touch 2The City Bars App with Sencha Touch 2
The City Bars App with Sencha Touch 2
 
Mobile app with sencha touch
Mobile app with sencha touchMobile app with sencha touch
Mobile app with sencha touch
 
Mobile Device APIs
Mobile Device APIsMobile Device APIs
Mobile Device APIs
 
Building Sencha Themes
Building Sencha ThemesBuilding Sencha Themes
Building Sencha Themes
 
Sencha Touch Charts
Sencha Touch ChartsSencha Touch Charts
Sencha Touch Charts
 

Similar to Create a mobile web app with Sencha Touch

Bd conf sencha touch workshop
Bd conf sencha touch workshopBd conf sencha touch workshop
Bd conf sencha touch workshopJames Pearce
 
Building a Mobile App with Sencha Touch
Building a Mobile App with Sencha TouchBuilding a Mobile App with Sencha Touch
Building a Mobile App with Sencha TouchJames Pearce
 
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...goodfriday
 
Sencha Touch basic concepts, pros and cons
Sencha Touch basic concepts, pros and consSencha Touch basic concepts, pros and cons
Sencha Touch basic concepts, pros and consOleg Gomozov
 
How to use lekhoniya.pdf
How to use lekhoniya.pdfHow to use lekhoniya.pdf
How to use lekhoniya.pdfSubhamMandal40
 
Mozilla Web Apps - Super-VanJS
Mozilla Web Apps - Super-VanJSMozilla Web Apps - Super-VanJS
Mozilla Web Apps - Super-VanJSRobert Nyman
 
netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8
netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8
netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8netmind
 
An Introduction to Sencha Touch
An Introduction to Sencha TouchAn Introduction to Sencha Touch
An Introduction to Sencha TouchJames Pearce
 
Itemscript, a specification for RESTful JSON integration
Itemscript, a specification for RESTful JSON integrationItemscript, a specification for RESTful JSON integration
Itemscript, a specification for RESTful JSON integration{item:foo}
 
Developing your first application using FIWARE
Developing your first application using FIWAREDeveloping your first application using FIWARE
Developing your first application using FIWAREFIWARE
 
CTS Conference Web 2.0 Tutorial Part 2
CTS Conference Web 2.0 Tutorial Part 2CTS Conference Web 2.0 Tutorial Part 2
CTS Conference Web 2.0 Tutorial Part 2Geoffrey Fox
 
Mobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhoneMobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhoneMohammad Shaker
 
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitJava Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitIMC Institute
 
HTML5 and the dawn of rich mobile web applications pt 1
HTML5 and the dawn of rich mobile web applications pt 1HTML5 and the dawn of rich mobile web applications pt 1
HTML5 and the dawn of rich mobile web applications pt 1James Pearce
 
Silverlight Developer Introduction
Silverlight   Developer IntroductionSilverlight   Developer Introduction
Silverlight Developer IntroductionTomy Ismail
 
混搭移动开发:PhoneGap+JQurey+Dreamweaver
混搭移动开发:PhoneGap+JQurey+Dreamweaver混搭移动开发:PhoneGap+JQurey+Dreamweaver
混搭移动开发:PhoneGap+JQurey+Dreamweaveryangdj
 

Similar to Create a mobile web app with Sencha Touch (20)

Bd conf sencha touch workshop
Bd conf sencha touch workshopBd conf sencha touch workshop
Bd conf sencha touch workshop
 
Building a Mobile App with Sencha Touch
Building a Mobile App with Sencha TouchBuilding a Mobile App with Sencha Touch
Building a Mobile App with Sencha Touch
 
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
 
Sencha Touch basic concepts, pros and cons
Sencha Touch basic concepts, pros and consSencha Touch basic concepts, pros and cons
Sencha Touch basic concepts, pros and cons
 
How to use lekhoniya.pdf
How to use lekhoniya.pdfHow to use lekhoniya.pdf
How to use lekhoniya.pdf
 
Mozilla Web Apps - Super-VanJS
Mozilla Web Apps - Super-VanJSMozilla Web Apps - Super-VanJS
Mozilla Web Apps - Super-VanJS
 
netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8
netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8
netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8
 
An Introduction to Sencha Touch
An Introduction to Sencha TouchAn Introduction to Sencha Touch
An Introduction to Sencha Touch
 
Itemscript, a specification for RESTful JSON integration
Itemscript, a specification for RESTful JSON integrationItemscript, a specification for RESTful JSON integration
Itemscript, a specification for RESTful JSON integration
 
Developing your first application using FIWARE
Developing your first application using FIWAREDeveloping your first application using FIWARE
Developing your first application using FIWARE
 
CTS Conference Web 2.0 Tutorial Part 2
CTS Conference Web 2.0 Tutorial Part 2CTS Conference Web 2.0 Tutorial Part 2
CTS Conference Web 2.0 Tutorial Part 2
 
Mobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhoneMobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhone
 
Ext JS Introduction
Ext JS IntroductionExt JS Introduction
Ext JS Introduction
 
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitJava Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
 
HTML5 and the dawn of rich mobile web applications pt 1
HTML5 and the dawn of rich mobile web applications pt 1HTML5 and the dawn of rich mobile web applications pt 1
HTML5 and the dawn of rich mobile web applications pt 1
 
Android L01 - Warm Up
Android L01 - Warm UpAndroid L01 - Warm Up
Android L01 - Warm Up
 
Silverlight Developer Introduction
Silverlight   Developer IntroductionSilverlight   Developer Introduction
Silverlight Developer Introduction
 
混搭移动开发:PhoneGap+JQurey+Dreamweaver
混搭移动开发:PhoneGap+JQurey+Dreamweaver混搭移动开发:PhoneGap+JQurey+Dreamweaver
混搭移动开发:PhoneGap+JQurey+Dreamweaver
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
 
Wt unit 2 ppts client sied technology
Wt unit 2 ppts client sied technologyWt unit 2 ppts client sied technology
Wt unit 2 ppts client sied technology
 

More from James Pearce

An Intro to Mobile HTML5
An Intro to Mobile HTML5An Intro to Mobile HTML5
An Intro to Mobile HTML5James Pearce
 
A Snapshot of the Mobile HTML5 Revolution
A Snapshot of the Mobile HTML5 RevolutionA Snapshot of the Mobile HTML5 Revolution
A Snapshot of the Mobile HTML5 RevolutionJames Pearce
 
HTML5 and the dawn of rich mobile web applications pt 2
HTML5 and the dawn of rich mobile web applications pt 2HTML5 and the dawn of rich mobile web applications pt 2
HTML5 and the dawn of rich mobile web applications pt 2James Pearce
 
Cross platform mobile web apps
Cross platform mobile web appsCross platform mobile web apps
Cross platform mobile web appsJames Pearce
 
City bars workshop
City bars workshopCity bars workshop
City bars workshopJames Pearce
 
San Diego Hackathon
San Diego HackathonSan Diego Hackathon
San Diego HackathonJames Pearce
 
Building Cross Platform Mobile Web Apps
Building Cross Platform Mobile Web AppsBuilding Cross Platform Mobile Web Apps
Building Cross Platform Mobile Web AppsJames Pearce
 
Creating and Distributing Mobile Web Applications with PhoneGap
Creating and Distributing Mobile Web Applications with PhoneGapCreating and Distributing Mobile Web Applications with PhoneGap
Creating and Distributing Mobile Web Applications with PhoneGapJames Pearce
 
Source Dev Con Keynote
Source Dev Con KeynoteSource Dev Con Keynote
Source Dev Con KeynoteJames Pearce
 
Building Cloud-Based Cross-Platform Mobile Web Apps
Building Cloud-Based Cross-Platform Mobile Web AppsBuilding Cloud-Based Cross-Platform Mobile Web Apps
Building Cloud-Based Cross-Platform Mobile Web AppsJames Pearce
 
Building cross platform mobile web apps
Building cross platform mobile web appsBuilding cross platform mobile web apps
Building cross platform mobile web appsJames Pearce
 
Building tomorrow's web with today's tools
Building tomorrow's web with today's toolsBuilding tomorrow's web with today's tools
Building tomorrow's web with today's toolsJames Pearce
 
HTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applicationsHTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applicationsJames Pearce
 
Sencha Touch for Rubyists
Sencha Touch for RubyistsSencha Touch for Rubyists
Sencha Touch for RubyistsJames Pearce
 
Serving Mobile Apps from Content Management Systems
Serving Mobile Apps from Content Management SystemsServing Mobile Apps from Content Management Systems
Serving Mobile Apps from Content Management SystemsJames Pearce
 

More from James Pearce (16)

An Intro to Mobile HTML5
An Intro to Mobile HTML5An Intro to Mobile HTML5
An Intro to Mobile HTML5
 
A Snapshot of the Mobile HTML5 Revolution
A Snapshot of the Mobile HTML5 RevolutionA Snapshot of the Mobile HTML5 Revolution
A Snapshot of the Mobile HTML5 Revolution
 
HTML5 and the dawn of rich mobile web applications pt 2
HTML5 and the dawn of rich mobile web applications pt 2HTML5 and the dawn of rich mobile web applications pt 2
HTML5 and the dawn of rich mobile web applications pt 2
 
Cross platform mobile web apps
Cross platform mobile web appsCross platform mobile web apps
Cross platform mobile web apps
 
City bars workshop
City bars workshopCity bars workshop
City bars workshop
 
San Diego Hackathon
San Diego HackathonSan Diego Hackathon
San Diego Hackathon
 
Building Cross Platform Mobile Web Apps
Building Cross Platform Mobile Web AppsBuilding Cross Platform Mobile Web Apps
Building Cross Platform Mobile Web Apps
 
Creating and Distributing Mobile Web Applications with PhoneGap
Creating and Distributing Mobile Web Applications with PhoneGapCreating and Distributing Mobile Web Applications with PhoneGap
Creating and Distributing Mobile Web Applications with PhoneGap
 
Theming and Sass
Theming and SassTheming and Sass
Theming and Sass
 
Source Dev Con Keynote
Source Dev Con KeynoteSource Dev Con Keynote
Source Dev Con Keynote
 
Building Cloud-Based Cross-Platform Mobile Web Apps
Building Cloud-Based Cross-Platform Mobile Web AppsBuilding Cloud-Based Cross-Platform Mobile Web Apps
Building Cloud-Based Cross-Platform Mobile Web Apps
 
Building cross platform mobile web apps
Building cross platform mobile web appsBuilding cross platform mobile web apps
Building cross platform mobile web apps
 
Building tomorrow's web with today's tools
Building tomorrow's web with today's toolsBuilding tomorrow's web with today's tools
Building tomorrow's web with today's tools
 
HTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applicationsHTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applications
 
Sencha Touch for Rubyists
Sencha Touch for RubyistsSencha Touch for Rubyists
Sencha Touch for Rubyists
 
Serving Mobile Apps from Content Management Systems
Serving Mobile Apps from Content Management SystemsServing Mobile Apps from Content Management Systems
Serving Mobile Apps from Content Management Systems
 

Recently uploaded

Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 

Recently uploaded (20)

Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 

Create a mobile web app with Sencha Touch

  • 1. Create A Mobile Web App with Sencha Touch @ jamespearce
  • 2. Single device Multi device Sedentary user Mobile user * Declarative Imperative Thin client Thick client Documents Applications * or supine, or sedentary, or passive, or...
  • 3. A badge for all these ways the web is changing
  • 4. HTML5 is a new version of HTML4, XHTML1, and DOM Level 2 HTML addressing many of the issues of those specifications while at the same time enhancing (X)HTML to more adequately address Web applications. - WHATWG Wiki
  • 5. What is an app?
  • 6. Consumption vs Creation Linkability User Experience Architecture
  • 7. WebFont Video Audio Graphics Device Access Camera CSS Styling & Layout Network Location HTTP JavaScript Contacts AJAX SMS Semantic HTML Events Orientation Sockets File Systems Workers & Cross-App Gyro Databases Parallel SSL Messaging App Caches Processing (all the elements of a modern application platform)
  • 8.
  • 9.
  • 11. A JavaScript framework for building rich mobile apps with web standards
  • 13. Components Lists
  • 15. Forms
  • 23.
  • 24. <!DOCTYPE  html> <html>    <head>            <title>Hello  World</title>        <script  src="lib/touch/sencha-­‐touch.js"></script>        <script  src="app/app.js"></script>                <link  href="lib/touch/resources/css/sencha-­‐touch.css"                      rel="stylesheet"  type="text/css"  />        </head>    <body></body> </html>
  • 25. new  Ext.Application({        launch:  function()  {                new  Ext.Panel({                        fullscreen:  true,                        dockedItems:  [{xtype:'toolbar',  title:'My  First  App'}],                        layout:  'fit',                        styleHtmlContent:  true,                        html:  '<h2>Hello  World!</h2>I  did  it!'                });        } });
  • 26.
  • 27. Lists var  list  =  new  Ext.List({        store:  store,        itemTpl:  '{firstName}  {lastName}',        grouped:  true,        indexBar:  true });
  • 28. Nested Lists var  list  =  new  Ext.NestedList({        store:  store,        displayField:  'name',        title:  'My  List',        updateTitleText:  true,        getDetailCard:                function(record,  parent)  {..} });
  • 29. Carousels var  carousel  =  new  Ext.Carousel({        direction:  'horizontal',        indicator:  true,        items:  [                ..        ] });
  • 30. Sheets var  sheet  =  new  Ext.ActionSheet({        items:  [                {                        text:  'Delete  draft',                        ui:  'decline'                },  {                        text:  'Save  draft'                },  {                        text:  'Cancel',                }        ] }); sheet.show();
  • 31. Common patterns 1 var  list  =  new  Ext.List({        store:  store,        itemTpl:  '{firstName}  {lastName}',        grouped:  true,        indexBar:  true }); var  panel  =  new  Ext.Panel({        fullscreen:  true,        layout:  'fit',        items:  [list] });
  • 32. Common patterns 2 var  panel  =  new  Ext.Panel({        fullscreen:  true,        layout:  'fit',        items:  [{                xtype:  'list',                store:  store,                itemTpl:  '{firstName}  {lastName}',                grouped:  true,                indexBar:  true        }] });
  • 34. Pre-requisites Sencha Touch SDK:   http://sencha.com/products/touch/  Yelp developer API key:   http://www.yelp.com/developers/getting_started/ api_overview  Install Sass and Compass:   http://sass-lang.com/download.html http://compass-style.org/install/
  • 37. Development sequence 1 Structure the app 5 Detail page 2 Layout the UI 6 Add a map 3 Model the data 7 More data 4 Load the list 8 Customize theme
  • 39. index.html <!doctype  html> <html>        <head>                <title>Valley  Guide</title>        </head> <body></body> </html>
  • 40. index.html <script  src="lib/touch/sencha-­‐touch.js"></script> <script  src="app/yelp.js"></script> <script  src="app/app.js"></script> <link  href="lib/touch/resources/css/sencha-­‐touch.css"              rel="stylesheet"  type="text/css"  />
  • 41. app.js va  =  new  Ext.Application({        launch:  function()  {                this.viewport  =  new  Ext.Panel({                        layout:  'card',                        fullscreen:  true,                        html:  "Hello  world!"                        });        } });
  • 42. 2 Layout the UI toolbar toolbar dataList listCard detailCard na.viewport
  • 43. The app... var  va  =  new  Ext.Application({        launch:  function()  {                this.listCard  =  new  Ext.Panel({                        html:  'I  am  the  list'                });                this.detailCard  =  new  Ext.Panel({                        html:  'I  am  the  detail'                });                this.viewport  =  new  Ext.Panel({                        layout:  'card',                        fullscreen:  true,                        cardSwitchAnimation:  'slide',                        items:  [this.listCard,  this.detailCard]                });        } });
  • 44. listCard this.listCardToolbar  =  new  Ext.Toolbar({        dock:  'top',        title:  'Valley  Guide' }); this.listCardDataList  =  new  Ext.List({        store:  null,        itemTpl:  '' }); this.listCard  =  new  Ext.Panel({        dockedItems:  [this.listCardToolbar],        items:  [this.listCardDataList],        layout:  'fit' });
  • 45. detailCard this.detailCardToolbar  =  new  Ext.Toolbar({        dock:  'top',        title:  '...' }); this.detailCard  =  new  Ext.Panel({        dockedItems:  [this.detailCardToolbar] });
  • 46. 3 Model the data http://api.yelp.com/business_review_search ?ywsid=YELP_KEY &term=Restaurants &location=Silicon%20Valley
  • 47.
  • 49. "businesses":  [        {          "rating_img_url"  :  "http://media4.px.yelpcdn.com/...",          "country_code"  :  "US",          "id"  :  "BHpAlynD9dIGIaQDRqHCTA",          "is_closed"  :  false,          "city"  :  "Nashville",          "mobile_url"  :  "http://mobile.yelp.com/biz/...",          "review_count"  :  50,          "zip"  :  "11231",          "state"  :  "TN",          "latitude"  :  40.675758,          "address1"  :  "253  Conover  St",          "address2"  :  "",          "address3"  :  "",          "phone"  :  "7186258211",          "state_code"  :  "TN",          "categories":  [            ...",          ],          ...
  • 51. The ‘Business’ model this.data.Business  =  Ext.regModel('',  {        fields:  [                {name:  "id",  type:  "int"},                {name:  "name",  type:  "string"},                {name:  "latitude",  type:  "string"},                {name:  "longitude",  type:  "string"},                {name:  "address1",  type:  "string"},                {name:  "address2",  type:  "string"},                {name:  "address3",  type:  "string"},                {name:  "phone",  type:  "string"},                {name:  "state_code",  type:  "string"},                {name:  "mobile_url",  type:  "string"},                {name:  "rating_img_url_small",  type:  "string"},                {name:  "photo_url",  type:  "string"},        ] });
  • 52. A store of those models this.data.restaurants  =  new  Ext.data.Store({        model:  this.data.Business,        autoLoad:  true,        proxy:  {                type:  'scripttag',                url:  'http://api.yelp.com/business_review_search'  +                        '?ywsid='  +  YELP_KEY  +                        '&term=Restaurant'  +                        '&location=Silicon%20Valley',                reader:  {                        type:  'json',                        root:  'businesses'                }        } });
  • 53. 4 Load the list this.listCardDataList  =  new  Ext.List({        store:  this.data.restaurants,        itemTpl:  '{name}' });
  • 54. A more interesting template itemTpl:        '<img  class="photo"  src="{photo_url}"  width="40"  height="40"/>'  +        '{name}<br/>'  +        '<img  src="{rating_img_url_small}"/>&nbsp;'  +        '<small>{address1}</small>'
  • 55. Hack the style <style>        .photo  {                float:left;                margin:0  8px  16px  0;                border:1px  solid  #ccc;                -­‐webkit-­‐box-­‐shadow:                        0  2px  4px  #777;        } </style>
  • 56. Get images resized... ...width="40"  height="40"  />
  • 58. 5 Detail page this.listCardDataList  =  new  Ext.List({        store:  this.data.restaurants,        itemTpl:  ...        listeners:  {                selectionchange:  function  (selectionModel,  records)  {                        if  (records[0])  {                                va.viewport.setActiveItem(va.detailCard);                                va.detailCardToolbar.setTitle(                                        records[0].get('name')                                );                        }                }        } });
  • 59. A back button this.detailCardToolbar  =  new  Ext.Toolbar({        dock:  'top',        title:  '...',        items:  [{                text:  'Back',                ui:  'back',                handler:  function  ()  {                        va.viewport.setActiveItem(                                va.listCard,                                {type:  'slide',  direction:  'right'}                        );                }        }] });
  • 60. Detail template this.detailCard  =  new  Ext.Panel({        dockedItems:  [this.detailCardToolbar],        styleHtmlContent:  true,        cls:  'detail',        tpl:  [                '<img  class="photo"  src="{photo_url}"                            width="100"  height="100"/>',                '<h2>{name}</h2>',                '<div  class="info">',                        '{address1}<br/>',                        '<img  src="{rating_img_url_small}"/>',                '</div>',                '<div  class="phone  x-­‐button">',                        '<a  href="tel:{phone}">{phone}</a>',                '</div>',                '<div  class="link  x-­‐button">',                        '<a  href="{mobile_url}">Read  more</a>',                '</div>'        ] });
  • 61. A little styling .x-­‐html  h2  {        margin-­‐bottom:0; } .phone,  .link  {        clear:both;        font-­‐weight:bold;        display:block;        text-­‐align:center;        margin-­‐top:8px; }
  • 62. 6 Add a map toolbar toolbar dataList dataList detailCard listCard detailTabs va.viewport
  • 63. 6 Add a map va.viewport.setActiveItem(va.detailTabs); ... this.detailMap  =  new  Ext.Map({}); this.detailTabs  =  new  Ext.TabPanel({        dockedItems:  [this.detailCardToolbar],        items:  [this.detailCard,  this.detailMap] }); va.viewport  =  new  Ext.Panel({        layout:  'card',        fullscreen:  true,        cardSwitchAnimation:  'slide',        items:  [this.listCard,  this.detailTabs] });
  • 64. Tab titles this.detailCard  =  new  Ext.Panel({        ...        title:  'Info' }); this.detailMap  =  new  Ext.Map({        title:  'Map' });
  • 65. Google Maps script <script  type="text/javascript"    src="http://maps.google.com/maps/api/js?sensor=true"> </script>
  • 66. Update the map location selectionchange:  function  (selectionModel,  records)  {        ...        var  map  =  va.detailMap.map;        if  (!map.marker)  {                map.marker  =  new  google.maps.Marker();                map.marker.setMap(map);        }        map.setCenter(                new  google.maps.LatLng(                        records[0].get('latitude'),                        records[0].get('longitude')                )        );        map.marker.setPosition(                map.getCenter()        );
  • 67. Improve the tab bar this.detailTabs  =  new  Ext.TabPanel({        dockedItems:  [this.detailCardToolbar],        items:  [this.detailCard,  this.detailMap],        tabBar:  {                ui:  'light',                layout:  {  pack:  'center'  }        } });
  • 69. More data... ['hotels',  'bars',  'restaurants'].forEach(  function  (type)  {        va.data[type]  =  new  Ext.data.Store({                model:  va.data.Business,                autoLoad:  true,                proxy:  {                        type:  'scripttag',                        url:  'http://api.yelp.com/business_review_search'  +                                '?ywsid='  +  YELP_KEY  +                                '&term='  +  type  +                                '&location=Silicon%20Valley',                        reader:  {                                type:  'json',                                root:  'businesses'                        }                }        }); });
  • 70. Make list into a ‘class’ this.ListCardDataList  =  Ext.extend(Ext.List,  {        store:  null,        itemTpl:                '<img  class="photo"  ...
  • 71. Instantiate that 3 times this.stayCardDataList  =  new  this.ListCardDataList({        store:  this.data.hotels }); this.eatCardDataList  =  new  this.ListCardDataList({        store:  this.data.restaurants }); this.drinkCardDataList  =  new  this.ListCardDataList({        store:  this.data.bars }); Consider lazy-loading...
  • 72. Turn container into tabs too this.listCard  =  new  Ext.TabPanel({        items:  [                this.stayCardDataList,                  this.eatCardDataList,                  this.drinkCardDataList        ],        tabBar:  {                ui:  'light',                layout:  {  pack:  'center'  },                dock:  'bottom'        },        cardSwitchAnimation:  'flip', ...
  • 73. And add titles & icons this.stayCardDataList  =  new  this.ListCardDataList({        store:  this.data.hotels,        title:  'Stay',        iconCls:  'home' }); this.eatCardDataList  =  new  this.ListCardDataList({        store:  this.data.restaurants,        title:  'Eat',        iconCls:  'locate' }); this.drinkCardDataList  =  new  this.ListCardDataList({        store:  this.data.bars,        title:  'Drink',        iconCls:  'star' });
  • 74. Pull-to-refresh this.ListCardDataList  =  Ext.extend(Ext.List,  {        ...        plugins:  [{                ptype:  'pullrefresh'        }] });
  • 77. Variables /* SCSS */ /* CSS */ $blue: #3bbfce; .content-navigation { $margin: 16px; border-color: #3bbfce; color: #2b9eab; .content-navigation { } border-color: $blue; color: .border { darken($blue, 9%); padding: 8px; } margin: 8px; border-color: #3bbfce; .border { } padding: $margin / 2; margin: $margin / 2; border-color: $blue; }
  • 78. $> sudo gem install compass http://rubyinstaller.org/
  • 79. $> compass -v Compass 0.11.1 (Antares) Copyright (c) 2008-2011 Chris Eppstein Released under the MIT License. $> sass -v Sass 3.1.1 (Brainy Betty)
  • 80. Start by copying sencha-touch.scss
  • 81. config.rb dir  =  File.dirname(__FILE__) load  File.join(dir,  '..',  'lib',  'touch',  'resources',   'themes') #  Compass  configurations sass_path        =  dir css_path          =  dir environment    =  :production output_style  =  :compressed #  or  :nested,  :expanded,  :compact
  • 82. Compile... $>  cd  theming $>  compass  compile  valley.scss            create  valley.css $>  compass  compile  valley.scss            identical  valley.css [edit  file] $>  compass  compile  valley.scss            overwrite  valley.css $>  compass  watch  valley.scss            >>>  Change  detected  to:  valley.scss            overwrite  valley.css
  • 83. Link... <link  href="theming/valley.css"  rel="stylesheet"            type="text/css"  />
  • 84. valley.scss @import  'sencha-­‐touch/default/all'; @include  sencha-­‐panel; @include  sencha-­‐buttons; @include  sencha-­‐sheet; @include  sencha-­‐tabs; @include  sencha-­‐toolbar; @include  sencha-­‐list; @include  sencha-­‐list-­‐pullrefresh; @include  sencha-­‐layout; @include  sencha-­‐loading-­‐spinner; ...
  • 85. valley.scss $base-­‐color:  #9D9E00; @import  'sencha-­‐touch/default/all'; @include  sencha-­‐panel; @include  sencha-­‐buttons; @include  sencha-­‐sheet; @include  sencha-­‐tabs; @include  sencha-­‐toolbar; @include  sencha-­‐list; @include  sencha-­‐list-­‐pullrefresh; @include  sencha-­‐layout; @include  sencha-­‐loading-­‐spinner;
  • 86.
  • 87. Choose own icons $base-­‐color:  #9D9E00; $include-­‐default-­‐icons:  false; @import  'sencha-­‐touch/default/all'; @include  sencha-­‐panel; @include  sencha-­‐buttons; ... @include  pictos-­‐iconmask('briefcase1'); @include  pictos-­‐iconmask('heart'); @include  pictos-­‐iconmask('music1');
  • 88. Specify iconCls this.stayCardDataList  =  new  this.ListCardDataList({        store:  this.data.hotels,        title:  'Stay',        iconCls:  'briefcase1' }); this.eatCardDataList  =  new  this.ListCardDataList({        store:  this.data.restaurants,        title:  'Eat',        iconCls:  'heart' }); this.drinkCardDataList  =  new  this.ListCardDataList({        store:  this.data.bars,        title:  'Drink',        iconCls:  'music1' });
  • 89. _variables.scss $include-html-style: true; $base-color: #354F6E; $include-default-icons: true; $base-gradient: 'matte'; $include-form-sliders: true; $alert-color: red; $include-floating-panels: true; $confirm-color: #92cf00; $include-default-uis: true; $page-bg-color: #eee; $include-highlights: true; $global-row-height: 2.6em; $include-border-radius: true; $active-color: darken( saturate($base-color, 55%), $basic-slider: false; 10%);
  • 91. Sass is a superset of CSS $base-­‐color:  #9D9E00; $include-­‐default-­‐icons:  false; @import  'sencha-­‐touch/default/all'; ... @include  pictos-­‐iconmask('briefcase1'); @include  pictos-­‐iconmask('heart'); @include  pictos-­‐iconmask('music1'); .photo  {        float:left;        margin:0  8px  16px  0;        border:1px  solid  #ccc;        -­‐webkit-­‐box-­‐shadow:                0  2px  4px  #777; } ...
  • 92. WebFonts @import  url(http://fonts.googleapis.com/css?family=Voltaire); .x-­‐toolbar-­‐title  {    font-­‐family:  Voltaire;    font-­‐weight:  normal;    font-­‐size:  1.7em;    line-­‐height:  1.7em;    letter-­‐spacing:  0.05em; }
  • 93. Done?
  • 94. Development sequence 1 Structure the app 5 Detail page 2 Layout the UI 6 Add a map 3 Model the data 7 More data 4 Load the list 8 Customize theme
  • 96. And if we’d had time... Add to home screen - Icon - Splash screen Hybrid app; PhoneGap / NimbleKit - Contacts API - Geolocation http://sencha.com/x/cy http://sencha.com/x/de
  • 97. O ine app $>  phantomjs  confess.js  http://github/valley/ CACHE  MANIFEST #  This  manifest  was  created  by  confess.js #                    Time:  Wed  Sep  14  2011  10:14:45  GMT-­‐0700  (PDT) #        User-­‐agent:  Mozilla/5.0  ... CACHE: app/app.js app/yelp.js http://cdn.sencha.io/touch/1.1.0/sencha-­‐touch.js http://maps.google.com/maps/api/js?sensor=true http://maps.gstatic.com/intl/en_us/mapfiles/api-­‐3/6/4/main.js theming/valley.css NETWORK: * http://github.com/jamesgpearce/confess
  • 98. O ine data Taking Yelp data o ine Taking images o ine - src.sencha.io to generate cross-origin B64 Detecting network connection changes http://sencha.com/x/df
  • 100. built with Apps vs Web technology