Permalink
Browse files

Merge branch 'master' into tables

* master: (24 commits)
  [select] Implement _destroy() -- Fixes #4661
  Changing ok out to equal; it is more appropriate for this test
  Changing test to make sure it fails when code change is not there
  Renamed class ui-selectmenu-hidden to ui-popup-hidden -- Fixes #5217
  [popup] Rename function _maybeRefreshTimeout to _expectResizeEvent
  [popup] "detached retina" fix - the window height on iStuff with a retina display seems to fluctuate by one pixel during scroll, causing a spurious resize event right after popup open, even though window size is constant during the entire opening sequence
  Added "mobileinit" handler to set up options
  Whitespace
  Changed urlParseRE to ignore space at beginning. This is expected behavior in browsers. This used to result in pages changing to "%20destination.html" instead of the now "destination.html". Fixes issue #4882
  List autodividers: use trim() to avoid issues with newlines and spaces in markup. Fixes #5197. Thanks @demonslord !
  [popup] Initiate resize expectation during orientationchange -- Fixes #5153
  Select: headers of custom select menus shouldn't inherit the popup corner styling. Fixes #5215.
  [popup] Correctly handle the case when the fallback transition is "none" -- Fixes #5189
  [custom select] Mark as closed after dialog closes - Re: #5195 - Thanks martenbohlin
  [slider] Adding new behaviour to widget definition
  [select] Adding new behaviour to widget definition
  [checkboxradio] Adding new behaviour to widget definition
  [formReset] New behaviour that allows form widgets to become aware of the fact that the form they are in has been reset
  [popup] Only rapid-open the popup if it is open -- Fixes #5157
  Updated third-party libs for Backbone/Require Demo App
  ...
  • Loading branch information...
2 parents a9fa2a3 + 7273a5e commit ecec15c9fab84ba758da25e5f1da19b6666a5ef6 Scott Jehl committed Oct 31, 2012
Showing with 26,981 additions and 50 deletions.
  1. +1 −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. +1 −1 docs/toolbars/docs-navbar.html
  31. +2 −1 js/index.php
  32. +3 −0 js/jquery.mobile.core.js
  33. +1 −1 js/jquery.mobile.navigation.js
  34. +10 −1 js/widgets/forms/checkboxradio.js
  35. +23 −0 js/widgets/forms/reset.js
  36. +51 −6 js/widgets/forms/select.custom.js
  37. +18 −1 js/widgets/forms/select.js
  38. +17 −3 js/widgets/forms/slider.js
  39. +1 −1 js/widgets/listview.autodividers.js
  40. +42 −28 js/widgets/popup.js
  41. +14 −0 tests/unit/navigation/navigation_core.js
  42. +1 −1 tests/unit/navigation/navigation_helpers.js
  43. +4 −4 tests/unit/select/select_core.js
@@ -34,11 +34,11 @@ 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; }
.ui-selectmenu .ui-header { margin: 0; padding: 0; }
+.ui-selectmenu.ui-popup .ui-header { -webkit-border-top-left-radius: 0; border-top-left-radius: 0; -webkit-border-top-right-radius: 0; border-top-right-radius: 0; }
.ui-selectmenu .ui-header .ui-title { margin: 0.6em 46px 0.8em; }
@media all and (min-width: 450px){
@@ -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 ecec15c

Please sign in to comment.