Permalink
Browse files

Merge branch 'master' of github.com:jquery/jquery-mobile

  • Loading branch information...
2 parents 7a7601a + 6fe7844 commit 43d3a0a9f5e01a937862815a3c9b0986fd22263e @jefflembeck committed Oct 26, 2012
Showing with 26,874 additions and 24 deletions.
  1. +0 −1 css/structure/jquery.mobile.forms.select.css
  2. +3 −1 css/structure/jquery.mobile.popup.css
  3. +83 −0 docs/pages/Backbone-Require/index.html
  4. +98 −0 docs/pages/Backbone-Require/js/collections/CategoriesCollection.js
  5. +1,431 −0 docs/pages/Backbone-Require/js/libs/backbone.js
  6. +9,440 −0 docs/pages/Backbone-Require/js/libs/jquery.js
  7. +9,162 −0 docs/pages/Backbone-Require/js/libs/jquerymobile.js
  8. +4,215 −0 docs/pages/Backbone-Require/js/libs/lodash.js
  9. +1,981 −0 docs/pages/Backbone-Require/js/libs/require.js
  10. +45 −0 docs/pages/Backbone-Require/js/mobile.js
  11. +15 −0 docs/pages/Backbone-Require/js/models/CategoryModel.js
  12. +83 −0 docs/pages/Backbone-Require/js/routers/mobileRouter.js
  13. +37 −0 docs/pages/Backbone-Require/js/views/CategoryView.js
  14. +184 −0 docs/pages/backbone-require.html
  15. +1 −0 docs/pages/index.html
  16. +1 −0 docs/pages/loader.html
  17. +1 −0 docs/pages/page-anatomy.html
  18. +1 −0 docs/pages/page-cache.html
  19. +1 −0 docs/pages/page-customtransitions.html
  20. +1 −0 docs/pages/page-dynamic.html
  21. +1 −0 docs/pages/page-links.html
  22. +1 −0 docs/pages/page-navmodel.html
  23. +1 −0 docs/pages/page-scripting.html
  24. +1 −0 docs/pages/page-titles.html
  25. +1 −0 docs/pages/page-transitions-flash-workaround.html
  26. +1 −0 docs/pages/page-transitions.html
  27. +1 −0 docs/pages/pages-themes.html
  28. +1 −0 docs/pages/phonegap.html
  29. +1 −0 docs/pages/touchoverflow.html
  30. +2 −1 js/index.php
  31. +3 −0 js/jquery.mobile.core.js
  32. +10 −1 js/widgets/forms/checkboxradio.js
  33. +23 −0 js/widgets/forms/reset.js
  34. +10 −1 js/widgets/forms/select.js
  35. +17 −3 js/widgets/forms/slider.js
  36. +12 −11 js/widgets/popup.js
  37. +1 −1 tests/unit/navigation/navigation_helpers.js
  38. +4 −4 tests/unit/select/select_core.js
@@ -34,7 +34,6 @@ label.ui-select { font-size: 16px; line-height: 1.4; font-weight: normal; margin
.ui-selectmenu { padding: 6px; min-width: 160px; }
.ui-selectmenu .ui-listview { margin: 0; }
.ui-selectmenu .ui-btn.ui-li-divider { cursor: default; }
-.ui-selectmenu-hidden { top: -99999px; left: -9999px; }
.ui-screen-hidden, .ui-selectmenu-list .ui-li .ui-icon { display: none; }
.ui-selectmenu-list .ui-li .ui-icon { display: block; }
.ui-li.ui-selectmenu-placeholder { display: none; }
@@ -169,4 +169,6 @@
.ui-popup.ui-corner-all > .ui-footer:only-child {
-webkit-border-radius: inherit;
border-radius: inherit;
-}
+}
+
+.ui-popup-hidden { top: -99999px; left: -9999px; }
@@ -0,0 +1,83 @@
+<!doctype html>
+<html class="no-js ui-mobile-rendering" lang="en">
+<head>
+ <title>Backbone.js, Require.js, and jQuery Mobile</title>
+ <meta name="description" content="">
+
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+
+ <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
+ <script src="js/libs/require.js" data-main="js/mobile"></script>
+</head>
+<body>
+
+<div id="categories" data-role="page" data-title="Categories">
+
+ <div data-role="header">
+ <h1>Categories</h1>
+ </div><!-- /header -->
+
+ <div data-role="content">
+ <h2>Select a Category Below:</h2>
+ <ul data-role="listview" data-inset="true">
+ <li><a href="#category?animals" class="animals">Animals</a></li>
+ <li><a href="#category?colors" class="colors">Colors</a></li>
+ <li><a href="#category?vehicles" class="vehicles">Vehicles</a></li>
+ </ul>
+ </div><!-- /content -->
+
+</div>
+
+<div id="animals" data-role="page" data-title="Animals">
+
+ <div data-role="header">
+ <h1>Animals</h1>
+ </div><!-- /header -->
+
+ <div data-role="content">
+ <ul data-role="listview" data-inset="true">
+ </ul>
+ </div><!-- /content -->
+</div>
+
+<div id="colors" data-role="page" data-title="Colors">
+
+ <div data-role="header">
+ <h1>Colors</h1>
+ </div><!-- /header -->
+
+ <div data-role="content">
+ <ul data-role="listview" data-inset="true">
+ </ul>
+ </div><!-- /content -->
+
+</div>
+
+<div id="vehicles" data-role="page" data-title="Vehicles">
+
+ <div data-role="header">
+ <h1>Vehicles</h1>
+ </div><!-- /header -->
+
+ <div data-role="content">
+ <ul data-role="listview" data-inset="true">
+ </ul>
+ </div><!-- /content -->
+
+</div>
+
+<!-- Underscore Template that is used to display all of the Category Models -->
+<script id="categoryItems" type="text/template">
+
+ <% _.each( collection.toJSON(), function( category, id ) { %>
+
+ <li class="ui-li ui-li-static ui-btn-up-c ui-corner-top">
+ <%= category.type %>
+ </li>
+
+ <% }); %>
+
+</script>
+
+</body>
+</html>
@@ -0,0 +1,98 @@
+// Category Collection
+// ===================
+
+// Includes file dependencies
+define([ "jquery","backbone","models/CategoryModel" ], function( $, Backbone, CategoryModel ) {
+
+ // Extends Backbone.Router
+ var Collection = Backbone.Collection.extend( {
+
+ // The Collection constructor
+ initialize: function( models, options ) {
+
+ // Sets the type instance property (ie. animals)
+ this.type = options.type;
+
+ },
+
+ // Sets the Collection model property to be a Category Model
+ model: CategoryModel,
+
+ // Sample JSON data that in a real app will most likely come from a REST web service
+ jsonArray: [
+
+ { "category": "animals", "type": "Pets" },
+
+ { "category": "animals", "type": "Farm Animals" },
+
+ { "category": "animals", "type": "Wild Animals" },
+
+ { "category": "colors", "type": "Blue" },
+
+ { "category": "colors", "type": "Green" },
+
+ { "category": "colors", "type": "Orange" },
+
+ { "category": "colors", "type": "Purple" },
+
+ { "category": "colors", "type": "Red" },
+
+ { "category": "colors", "type": "Yellow" },
+
+ { "category": "colors", "type": "Violet" },
+
+ { "category": "vehicles", "type": "Cars" },
+
+ { "category": "vehicles", "type": "Planes" },
+
+ { "category": "vehicles", "type": "Construction" }
+
+ ],
+
+ // Overriding the Backbone.sync method (the Backbone.fetch method calls the sync method when trying to fetch data)
+ sync: function( method, model, options ) {
+
+ // Local Variables
+ // ===============
+
+ // Instantiates an empty array
+ var categories = [],
+
+ // Stores the this context in the self variable
+ self = this,
+
+ // Creates a jQuery Deferred Object
+ deferred = $.Deferred();
+
+ // Uses a setTimeout to mimic a real world application that retrieves data asynchronously
+ setTimeout( function() {
+
+ // Filters the above sample JSON data to return an array of only the correct category type
+ categories = _.filter( self.jsonArray, function( row ) {
+
+ return row.category === self.type;
+
+ } );
+
+ // Calls the options.success method and passes an array of objects (Internally saves these objects as models to the current collection)
+ options.success( categories );
+
+ // Triggers the custom `added` method (which the Category View listens for)
+ self.trigger( "added" );
+
+ // Resolves the deferred object (this triggers the changePage method inside of the Category Router)
+ deferred.resolve();
+
+ }, 1000);
+
+ // Returns the deferred object
+ return deferred;
+
+ }
+
+ } );
+
+ // Returns the Model class
+ return Collection;
+
+} );
Oops, something went wrong.

0 comments on commit 43d3a0a

Please sign in to comment.