SlideShare a Scribd company logo
1 of 35
A Mobile App
                Development Toolkit
                Rebecca Murphey • BK.js • January 2012



Tuesday, January 17, 12
Tuesday, January 17, 12
Tuesday, January 17, 12
Tuesday, January 17, 12
Callback
                          Cordova
Tuesday, January 17, 12
command line tools create the structure for an
                app, plus all the pieces you’ll need
                application framework javascript, html
                templates, css via sass
                builder generates production-ready builds for
                Android, iOS


Tuesday, January 17, 12
bit.ly/toura-mulberry
                bit.ly/toura-mulberry-demos




Tuesday, January 17, 12
Storytime!
Tuesday, January 17, 12
Tuesday, January 17, 12
$('#btn-co-complete').live('click', function() {
             jobCompleted = true;
             $.mobile.changePage('#page-clockout-deficiency', {changeHash: false});
         });

         $('#btn-co-nocomplete').live('click', function() {
             jobCompleted = false;
             $.mobile.changePage('#page-clockout-deficiency', {changeHash: false});
         });

         $('#btn-co-nodef').live('click', function() {
             clockOut(activeJob, { completed:jobCompleted }, DW_JOB_COMPLETED);
         });

         $('#btn-co-otherdef').live('click', function() {
             $.mobile.changePage('#page-clockout-redtag', {changeHash: false});
         });

         $('#btn-co-redtag').live('click', function() {
             clockOut(activeJob, { completed:jobCompleted, redTag:true }, DW_JOB_FOLLOWUP);
         });

         $('#btn-co-noredtag').live('click', function() {
             $('#page-clockout-resolve').page();
             $.mobile.changePage('#page-clockout-resolve', {changeHash: false});
         });

               $('#btn-clockout-resolve').live('click', function() {
                       switch ($('#page-clockout-resolve :checked').val()) {
Tuesday, January 17, 12
                       case 'return':
Tuesday, January 17, 12
Mulberry apps are architected feels like
                We can write JavaScript thatfor change.this.

Tuesday, January 17, 12
command line interface create the structure
                for an app, plus all the pieces you’ll need
                application framework javascript, html
                templates, css via sass
                builder generates production-ready builds for
                Android, iOS




Tuesday, January 17, 12
Tuesday, January 17, 12
Tuesday, January 17, 12
routes manage high-level application state
                components receive and render data,
                and react to user input
                capabilities provide data to components,
                and broker communications between them
                page de nitions reusable groupings
                of components and capabilities
                stores persist data on the device, make that
                data query-able, and return model instances


Tuesday, January 17, 12
routes manage high-level application state




Tuesday, January 17, 12
$YOURAPP/javascript/routes.js

        mulberry.page('/todos', {
          name : 'Todos',
          pageDef : 'todos'
        }, true);

        mulberry.page('/completed', {
          name : 'Completed',
          pageDef : 'completed'
        });




                                        #/todos   #/completed

Tuesday, January 17, 12
stores persist data on the device, make that
                data query-able, and return model instances




Tuesday, January 17, 12
$YOURAPP/javascript/stores/todos.js

                mulberry.store('todos', {
                  model : 'Todo',

                    finish : function(id) {
                       this.invoke(id, 'finish');
                    },

                  unfinish : function(id) {
                    this.invoke(id, 'unfinish');
                  }
                });




Tuesday, January 17, 12
page de nitions reusable groupings
                of components and capabilities




Tuesday, January 17, 12
todos:
                            capabilities:
                            - name: PageTodos
                            screens:
                              - name: index
                                regions:
                                  - components:
                                     - custom.TodoForm
                                  - className: list
                                    scrollable: true
                                    components:
                                     - custom.TodoList
                                  - components:
                                     - custom.TodoTools




                          NB: You can define this with JavaScript, too,
                          using toura.pageDef(‘todos’, { ... }).




Tuesday, January 17, 12
components receive and render data,
                and react to user input




Tuesday, January 17, 12
$YOURAPP/javascript/components/TodoForm.js


           mulberry.component('TodoForm', {
             componentTemplate : dojo.cache('client.components', 'TodoForm/TodoForm.haml'),

               init : function() {
                 this.connect(this.domNode, 'submit', function(e) {
                   e.preventDefault();

                      var description = dojo.trim(this.descriptionInput.value),
                          item;

                      if (!description) { return; }

                      item = { description : description };
                      this.domNode.reset();
                      this.onAdd(item);
                    });
               },

             onAdd : function(item) { }
           });




Tuesday, January 17, 12
$YOURAPP/javascript/components/TodoForm/TodoForm.haml

                 %form.component.todo-form
                   %input{ placeholder : 'New todo', dojoAttachPoint : 'descriptionInput' }
                   %button{ dojoAttachPoint : 'saveButton' } Add




Tuesday, January 17, 12
$YOURAPP/javascript/components/TodoForm.js


           mulberry.component('TodoForm', {
             componentTemplate : dojo.cache('client.components', 'TodoForm/TodoForm.haml'),

               init : function() {
                 this.connect(this.domNode, 'submit', function(e) {
                   e.preventDefault();

                      var description = dojo.trim(this.descriptionInput.value),
                          item;

                      if (!description) { return; }

                      item = { description : description };
                      this.domNode.reset();
                      this.onAdd(item);
                    });
               },

             onAdd : function(item) { }
           });




Tuesday, January 17, 12
capabilities provide data to components,
                and broker communications between them




Tuesday, January 17, 12
mulberry.capability('PageTodos', {
            todos:
                                              requirements : {
              capabilities:
                                                 todoList : 'custom.TodoList',
              - name: PageTodos
                                                 todoForm : 'custom.TodoForm',
              screens:
                                                 todoTools : 'custom.TodoTools'
                - name: index
                                              },
                  regions:
                    - components:
                                              connects : [
                       - custom.TodoForm
                                                 [ 'todoForm', 'onAdd', '_add' ],
                    - className: list
                                                 [ 'todoList', 'onComplete', '_complete' ],
                      scrollable: true
                                                 [ 'todoList', 'onDelete', '_delete' ],
                      components:
                                                 [ 'todoTools', 'onCompleteAll', '_completeAll' ]
                       - custom.TodoList
                                              ],
                    - components:
                       - custom.TodoTools
                                              init : function() {
                                                 this.todos = client.stores.todos;
                                                 this._updateList();
                                              },

                                              _add : function(item) {
                                                 this.todos.add(item);
                                                 this._updateList();
                                              },

                                             _delete : function(id) {
                                                 this.todos.remove(id);
                                                 this._updateList();
                                              },


Tuesday, January 17, 12                       _complete : function(id) {
mulberry.capability('PageTodos', {
            todos:
                                              requirements : {
              capabilities:
                                                 todoList : 'custom.TodoList',
              - name: PageTodos
                                                 todoForm : 'custom.TodoForm',
              screens:
                                                 todoTools : 'custom.TodoTools'
                - name: index
                                              },
                  regions:
                    - components:
                                              connects : [
                       - custom.TodoForm
                                                 [ 'todoForm', 'onAdd', '_add' ],
                    - className: list
                                                 [ 'todoList', 'onComplete', '_complete' ],
                      scrollable: true
                                                 [ 'todoList', 'onDelete', '_delete' ],
                      components:
                                                 [ 'todoTools', 'onCompleteAll', '_completeAll' ]
                       - custom.TodoList
                                              ],
                    - components:
                       - custom.TodoTools
                                              init : function() {
                                                 this.todos = client.stores.todos;
                                                 this._updateList();
                                              },

                                              _add : function(item) {
                                                 this.todos.add(item);
                                                 this._updateList();
                                              },

                                             _delete : function(id) {
                                                 this.todos.remove(id);
                                                 this._updateList();
                                              },


Tuesday, January 17, 12                       _complete : function(id) {
mulberry.capability('PageTodos', {
            todos:
                                              requirements : {
              capabilities:
                                                 todoList : 'custom.TodoList',
              - name: PageTodos
                                                 todoForm : 'custom.TodoForm',
              screens:
                                                 todoTools : 'custom.TodoTools'
                - name: index
                                              },
                  regions:
                    - components:
                                              connects : [
                       - custom.TodoForm
                                                 [ 'todoForm', 'onAdd', '_add' ],
                    - className: list
                                                 [ 'todoList', 'onComplete', '_complete' ],
                      scrollable: true
                                                 [ 'todoList', 'onDelete', '_delete' ],
                      components:
                                                 [ 'todoTools', 'onCompleteAll', '_completeAll' ]
                       - custom.TodoList
                                              ],
                    - components:
                       - custom.TodoTools
                                              init : function() {
                                                 this.todos = client.stores.todos;
                                                 this._updateList();
                                              },

                                              _add : function(item) {
                                                 this.todos.add(item);
                                                 this._updateList();
                                              },

                                             _delete : function(id) {
                                                 this.todos.remove(id);
                                                 this._updateList();
                                              },


Tuesday, January 17, 12                       _complete : function(id) {
Tuesday, January 17, 12
mulberry serve




Tuesday, January 17, 12
mulberry test




Tuesday, January 17, 12
linkage
                              mulberry.toura.com
                             bit.ly/toura-mulberry
                          bit.ly/toura-mulberry-demos
                              slidesha.re/yiErGK




Tuesday, January 17, 12
@touradev @rmurphey


Tuesday, January 17, 12

More Related Content

What's hot

Taming that client side mess with Backbone.js
Taming that client side mess with Backbone.jsTaming that client side mess with Backbone.js
Taming that client side mess with Backbone.js
Jarod Ferguson
 
Delivering a Responsive UI
Delivering a Responsive UIDelivering a Responsive UI
Delivering a Responsive UI
Rebecca Murphey
 
Drupal Step-by-Step: How We Built Our Training Site, Part 1
Drupal Step-by-Step: How We Built Our Training Site, Part 1Drupal Step-by-Step: How We Built Our Training Site, Part 1
Drupal Step-by-Step: How We Built Our Training Site, Part 1
Acquia
 
jQuery 1.7 Events
jQuery 1.7 EventsjQuery 1.7 Events
jQuery 1.7 Events
dmethvin
 

What's hot (20)

BVJS
BVJSBVJS
BVJS
 
Virtual Madness @ Etsy
Virtual Madness @ EtsyVirtual Madness @ Etsy
Virtual Madness @ Etsy
 
jQuery Data Manipulate API - A source code dissecting journey
jQuery Data Manipulate API - A source code dissecting journeyjQuery Data Manipulate API - A source code dissecting journey
jQuery Data Manipulate API - A source code dissecting journey
 
jQuery Namespace Pattern
jQuery Namespace PatternjQuery Namespace Pattern
jQuery Namespace Pattern
 
How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony Apps
 
How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony Apps
 
Matters of State
Matters of StateMatters of State
Matters of State
 
Your Entity, Your Code
Your Entity, Your CodeYour Entity, Your Code
Your Entity, Your Code
 
Javascript in Plone
Javascript in PloneJavascript in Plone
Javascript in Plone
 
jQuery: Events, Animation, Ajax
jQuery: Events, Animation, AjaxjQuery: Events, Animation, Ajax
jQuery: Events, Animation, Ajax
 
Taming that client side mess with Backbone.js
Taming that client side mess with Backbone.jsTaming that client side mess with Backbone.js
Taming that client side mess with Backbone.js
 
Learning jQuery in 30 minutes
Learning jQuery in 30 minutesLearning jQuery in 30 minutes
Learning jQuery in 30 minutes
 
Write Less Do More
Write Less Do MoreWrite Less Do More
Write Less Do More
 
Delivering a Responsive UI
Delivering a Responsive UIDelivering a Responsive UI
Delivering a Responsive UI
 
Jquery plugin development
Jquery plugin developmentJquery plugin development
Jquery plugin development
 
Drupal Step-by-Step: How We Built Our Training Site, Part 1
Drupal Step-by-Step: How We Built Our Training Site, Part 1Drupal Step-by-Step: How We Built Our Training Site, Part 1
Drupal Step-by-Step: How We Built Our Training Site, Part 1
 
How kris-writes-symfony-apps-london
How kris-writes-symfony-apps-londonHow kris-writes-symfony-apps-london
How kris-writes-symfony-apps-london
 
Design how your objects talk through mocking
Design how your objects talk through mockingDesign how your objects talk through mocking
Design how your objects talk through mocking
 
jQuery 1.7 Events
jQuery 1.7 EventsjQuery 1.7 Events
jQuery 1.7 Events
 
Writing Maintainable JavaScript
Writing Maintainable JavaScriptWriting Maintainable JavaScript
Writing Maintainable JavaScript
 

Viewers also liked (7)

Vision Pacific Group Ltd
Vision Pacific Group LtdVision Pacific Group Ltd
Vision Pacific Group Ltd
 
Introducing Mulberry
Introducing MulberryIntroducing Mulberry
Introducing Mulberry
 
DojoConf: Building Large Apps
DojoConf: Building Large AppsDojoConf: Building Large Apps
DojoConf: Building Large Apps
 
Rse sd oiseau dans pétrole
Rse sd oiseau dans pétroleRse sd oiseau dans pétrole
Rse sd oiseau dans pétrole
 
Summa/Summon: Something something
Summa/Summon: Something somethingSumma/Summon: Something something
Summa/Summon: Something something
 
Ticer - What Is Summa
Ticer - What Is SummaTicer - What Is Summa
Ticer - What Is Summa
 
Getting Started with Mulberry
Getting Started with MulberryGetting Started with Mulberry
Getting Started with Mulberry
 

Similar to Mulberry: A Mobile App Development Toolkit

PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applications
elliando dias
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Paulo Ragonha
 
Big Data for each one of us
Big Data for each one of usBig Data for each one of us
Big Data for each one of us
OSCON Byrum
 
Dependency Management with RequireJS
Dependency Management with RequireJSDependency Management with RequireJS
Dependency Management with RequireJS
Aaronius
 
Functional programming using underscorejs
Functional programming using underscorejsFunctional programming using underscorejs
Functional programming using underscorejs
偉格 高
 
BlackBerry DevCon 2011 - PhoneGap and WebWorks
BlackBerry DevCon 2011 - PhoneGap and WebWorksBlackBerry DevCon 2011 - PhoneGap and WebWorks
BlackBerry DevCon 2011 - PhoneGap and WebWorks
mwbrooks
 

Similar to Mulberry: A Mobile App Development Toolkit (20)

Having Fun with Play
Having Fun with PlayHaving Fun with Play
Having Fun with Play
 
jQuery & 10,000 Global Functions: Working with Legacy JavaScript
jQuery & 10,000 Global Functions: Working with Legacy JavaScriptjQuery & 10,000 Global Functions: Working with Legacy JavaScript
jQuery & 10,000 Global Functions: Working with Legacy JavaScript
 
DrupalCon jQuery
DrupalCon jQueryDrupalCon jQuery
DrupalCon jQuery
 
Angular js - 4developers 12 kwietnia 2013
Angular js - 4developers 12 kwietnia 2013Angular js - 4developers 12 kwietnia 2013
Angular js - 4developers 12 kwietnia 2013
 
Bubbles & Trees with jQuery
Bubbles & Trees with jQueryBubbles & Trees with jQuery
Bubbles & Trees with jQuery
 
Beyond DOMReady: Ultra High-Performance Javascript
Beyond DOMReady: Ultra High-Performance JavascriptBeyond DOMReady: Ultra High-Performance Javascript
Beyond DOMReady: Ultra High-Performance Javascript
 
Javascript is your (Auto)mate
Javascript is your (Auto)mateJavascript is your (Auto)mate
Javascript is your (Auto)mate
 
Clean Javascript
Clean JavascriptClean Javascript
Clean Javascript
 
Intro to Ember.JS 2016
Intro to Ember.JS 2016Intro to Ember.JS 2016
Intro to Ember.JS 2016
 
PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applications
 
Backbone.js — Introduction to client-side JavaScript MVC
Backbone.js — Introduction to client-side JavaScript MVCBackbone.js — Introduction to client-side JavaScript MVC
Backbone.js — Introduction to client-side JavaScript MVC
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
 
React lecture
React lectureReact lecture
React lecture
 
Big Data for each one of us
Big Data for each one of usBig Data for each one of us
Big Data for each one of us
 
Dependency Management with RequireJS
Dependency Management with RequireJSDependency Management with RequireJS
Dependency Management with RequireJS
 
SE2016 Android Mikle Anokhin "Speed up application development with data bind...
SE2016 Android Mikle Anokhin "Speed up application development with data bind...SE2016 Android Mikle Anokhin "Speed up application development with data bind...
SE2016 Android Mikle Anokhin "Speed up application development with data bind...
 
Ultimate Node.js countdown: the coolest Application Express examples
Ultimate Node.js countdown: the coolest Application Express examplesUltimate Node.js countdown: the coolest Application Express examples
Ultimate Node.js countdown: the coolest Application Express examples
 
Functional programming using underscorejs
Functional programming using underscorejsFunctional programming using underscorejs
Functional programming using underscorejs
 
BlackBerry DevCon 2011 - PhoneGap and WebWorks
BlackBerry DevCon 2011 - PhoneGap and WebWorksBlackBerry DevCon 2011 - PhoneGap and WebWorks
BlackBerry DevCon 2011 - PhoneGap and WebWorks
 
Unittests für Dummies
Unittests für DummiesUnittests für Dummies
Unittests für Dummies
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

Mulberry: A Mobile App Development Toolkit

  • 1. A Mobile App Development Toolkit Rebecca Murphey • BK.js • January 2012 Tuesday, January 17, 12
  • 5. Callback Cordova Tuesday, January 17, 12
  • 6. command line tools create the structure for an app, plus all the pieces you’ll need application framework javascript, html templates, css via sass builder generates production-ready builds for Android, iOS Tuesday, January 17, 12
  • 7. bit.ly/toura-mulberry bit.ly/toura-mulberry-demos Tuesday, January 17, 12
  • 10. $('#btn-co-complete').live('click', function() { jobCompleted = true; $.mobile.changePage('#page-clockout-deficiency', {changeHash: false}); }); $('#btn-co-nocomplete').live('click', function() { jobCompleted = false; $.mobile.changePage('#page-clockout-deficiency', {changeHash: false}); }); $('#btn-co-nodef').live('click', function() { clockOut(activeJob, { completed:jobCompleted }, DW_JOB_COMPLETED); }); $('#btn-co-otherdef').live('click', function() { $.mobile.changePage('#page-clockout-redtag', {changeHash: false}); }); $('#btn-co-redtag').live('click', function() { clockOut(activeJob, { completed:jobCompleted, redTag:true }, DW_JOB_FOLLOWUP); }); $('#btn-co-noredtag').live('click', function() { $('#page-clockout-resolve').page(); $.mobile.changePage('#page-clockout-resolve', {changeHash: false}); }); $('#btn-clockout-resolve').live('click', function() { switch ($('#page-clockout-resolve :checked').val()) { Tuesday, January 17, 12 case 'return':
  • 12. Mulberry apps are architected feels like We can write JavaScript thatfor change.this. Tuesday, January 17, 12
  • 13. command line interface create the structure for an app, plus all the pieces you’ll need application framework javascript, html templates, css via sass builder generates production-ready builds for Android, iOS Tuesday, January 17, 12
  • 16. routes manage high-level application state components receive and render data, and react to user input capabilities provide data to components, and broker communications between them page de nitions reusable groupings of components and capabilities stores persist data on the device, make that data query-able, and return model instances Tuesday, January 17, 12
  • 17. routes manage high-level application state Tuesday, January 17, 12
  • 18. $YOURAPP/javascript/routes.js mulberry.page('/todos', { name : 'Todos', pageDef : 'todos' }, true); mulberry.page('/completed', { name : 'Completed', pageDef : 'completed' }); #/todos #/completed Tuesday, January 17, 12
  • 19. stores persist data on the device, make that data query-able, and return model instances Tuesday, January 17, 12
  • 20. $YOURAPP/javascript/stores/todos.js mulberry.store('todos', { model : 'Todo', finish : function(id) { this.invoke(id, 'finish'); }, unfinish : function(id) { this.invoke(id, 'unfinish'); } }); Tuesday, January 17, 12
  • 21. page de nitions reusable groupings of components and capabilities Tuesday, January 17, 12
  • 22. todos: capabilities: - name: PageTodos screens: - name: index regions: - components: - custom.TodoForm - className: list scrollable: true components: - custom.TodoList - components: - custom.TodoTools NB: You can define this with JavaScript, too, using toura.pageDef(‘todos’, { ... }). Tuesday, January 17, 12
  • 23. components receive and render data, and react to user input Tuesday, January 17, 12
  • 24. $YOURAPP/javascript/components/TodoForm.js mulberry.component('TodoForm', { componentTemplate : dojo.cache('client.components', 'TodoForm/TodoForm.haml'), init : function() { this.connect(this.domNode, 'submit', function(e) { e.preventDefault(); var description = dojo.trim(this.descriptionInput.value), item; if (!description) { return; } item = { description : description }; this.domNode.reset(); this.onAdd(item); }); }, onAdd : function(item) { } }); Tuesday, January 17, 12
  • 25. $YOURAPP/javascript/components/TodoForm/TodoForm.haml %form.component.todo-form %input{ placeholder : 'New todo', dojoAttachPoint : 'descriptionInput' } %button{ dojoAttachPoint : 'saveButton' } Add Tuesday, January 17, 12
  • 26. $YOURAPP/javascript/components/TodoForm.js mulberry.component('TodoForm', { componentTemplate : dojo.cache('client.components', 'TodoForm/TodoForm.haml'), init : function() { this.connect(this.domNode, 'submit', function(e) { e.preventDefault(); var description = dojo.trim(this.descriptionInput.value), item; if (!description) { return; } item = { description : description }; this.domNode.reset(); this.onAdd(item); }); }, onAdd : function(item) { } }); Tuesday, January 17, 12
  • 27. capabilities provide data to components, and broker communications between them Tuesday, January 17, 12
  • 28. mulberry.capability('PageTodos', { todos: requirements : { capabilities: todoList : 'custom.TodoList', - name: PageTodos todoForm : 'custom.TodoForm', screens: todoTools : 'custom.TodoTools' - name: index }, regions: - components: connects : [ - custom.TodoForm [ 'todoForm', 'onAdd', '_add' ], - className: list [ 'todoList', 'onComplete', '_complete' ], scrollable: true [ 'todoList', 'onDelete', '_delete' ], components: [ 'todoTools', 'onCompleteAll', '_completeAll' ] - custom.TodoList ], - components: - custom.TodoTools init : function() { this.todos = client.stores.todos; this._updateList(); }, _add : function(item) { this.todos.add(item); this._updateList(); }, _delete : function(id) { this.todos.remove(id); this._updateList(); }, Tuesday, January 17, 12 _complete : function(id) {
  • 29. mulberry.capability('PageTodos', { todos: requirements : { capabilities: todoList : 'custom.TodoList', - name: PageTodos todoForm : 'custom.TodoForm', screens: todoTools : 'custom.TodoTools' - name: index }, regions: - components: connects : [ - custom.TodoForm [ 'todoForm', 'onAdd', '_add' ], - className: list [ 'todoList', 'onComplete', '_complete' ], scrollable: true [ 'todoList', 'onDelete', '_delete' ], components: [ 'todoTools', 'onCompleteAll', '_completeAll' ] - custom.TodoList ], - components: - custom.TodoTools init : function() { this.todos = client.stores.todos; this._updateList(); }, _add : function(item) { this.todos.add(item); this._updateList(); }, _delete : function(id) { this.todos.remove(id); this._updateList(); }, Tuesday, January 17, 12 _complete : function(id) {
  • 30. mulberry.capability('PageTodos', { todos: requirements : { capabilities: todoList : 'custom.TodoList', - name: PageTodos todoForm : 'custom.TodoForm', screens: todoTools : 'custom.TodoTools' - name: index }, regions: - components: connects : [ - custom.TodoForm [ 'todoForm', 'onAdd', '_add' ], - className: list [ 'todoList', 'onComplete', '_complete' ], scrollable: true [ 'todoList', 'onDelete', '_delete' ], components: [ 'todoTools', 'onCompleteAll', '_completeAll' ] - custom.TodoList ], - components: - custom.TodoTools init : function() { this.todos = client.stores.todos; this._updateList(); }, _add : function(item) { this.todos.add(item); this._updateList(); }, _delete : function(id) { this.todos.remove(id); this._updateList(); }, Tuesday, January 17, 12 _complete : function(id) {
  • 34. linkage mulberry.toura.com bit.ly/toura-mulberry bit.ly/toura-mulberry-demos slidesha.re/yiErGK Tuesday, January 17, 12