Permalink
Browse files

better template handling

  • Loading branch information...
kristianmandrup committed Jul 10, 2012
1 parent e5de1f6 commit 4a86cec2a372c10075f85c37a5f33004e35719ce
Showing with 2,265 additions and 115 deletions.
  1. +6 −3 www/app.js
  2. +9 −0 www/app.json
  3. +19 −0 www/app/view/property/Content.js
  4. +11 −0 www/app/view/property/Description.js
  5. +20 −0 www/app/view/property/Details.js
  6. +20 −0 www/app/view/property/details/cost/Monthly.js
  7. +18 −0 www/app/view/property/details/cost/OneTime.js
  8. +1 −2 www/app/view/search/favorites/Content.js
  9. +15 −0 www/lib/StringExt.js
  10. +1,082 −0 www/lib/Underscore.js
  11. +566 −0 www/lib/Underscore.string.js
  12. +60 −0 www/lib/plugins/XTemplater.js
  13. +107 −52 www/lib/templates/Helpers.js
  14. +0 −1 www/lib/touch
  15. +1 −1 www/resources/css/app.css
  16. +20 −0 www/resources/sass/app.scss
  17. +8 −5 www/src/app.coffee
  18. +23 −0 www/src/app/view/property/Content.coffee
  19. +18 −0 www/src/app/view/property/Details.coffee
  20. 0 www/src/app/view/property/MainInfo.coffee
  21. +40 −0 www/src/app/view/property/NavBar.coffee
  22. +16 −0 www/src/app/view/property/Page.coffee
  23. 0 www/src/app/view/property/Picture.coffee
  24. +9 −0 www/src/app/view/property/TopBar.coffee
  25. +21 −0 www/src/app/view/property/details/Cost.coffee
  26. +12 −0 www/src/app/view/property/details/cost/Monthly.coffee
  27. +12 −0 www/src/app/view/property/details/cost/OneTime.coffee
  28. +1 −6 www/src/app/view/search/favorites/Content.coffee
  29. +0 −2 www/src/app/view/settings/Navbar.coffee
  30. +8 −18 www/src/app/view/settings/TopBar.js
  31. +42 −0 www/src/lib/plugins/XTemplater.coffee
  32. +57 −25 www/src/lib/templates/Helpers.coffee
  33. +6 −0 www/templates/property_details.html
  34. +13 −0 www/templates/property_favorite.html
  35. +10 −0 www/templates/property_mainInfo.html
  36. +7 −0 www/templates/property_monthlyCosts.html
  37. +7 −0 www/templates/property_onetimeCosts.html
View
@@ -12,7 +12,7 @@ Ext.application({
models: [],
stores: ["Favorites", "Agents"],
controllers: ["FriendlyRent.controller.Home", "FriendlyRent.controller.Search"],
- views: ["FriendlyRent.view.home.Page", "FriendlyRent.view.search.Page", "FriendlyRent.view.search.favorites.Page"],
+ views: ["FriendlyRent.view.home.Page"],
icon: {
'57': 'resources/icons/Icon.png',
'72': 'resources/icons/Icon~ipad.png',
@@ -37,10 +37,13 @@ Ext.application({
manualLogin: true
}
},
+ initialize: function() {
+ return console.log('initialize app');
+ },
launch: function() {
var home_page;
- console.log('launch');
- home_page = Ext.create('FriendlyRent.view.search.favorites.Page');
+ console.log('launch app');
+ home_page = Ext.create('FriendlyRent.view.home.Page');
return Ext.Viewport.add(home_page);
},
onUpdated: function() {
View
@@ -38,6 +38,12 @@
{
"path": "sdk/sencha-touch-debug.js"
},
+ {
+ "path": "lib/Underscore.js"
+ },
+ {
+ "path": "lib/Underscore.string.js"
+ },
{
"path": "lib/jquery/jquery-1.7.2.js"
},
@@ -57,6 +63,9 @@
"path": "lib/i18n/i18n.js"
},
// Sencha plugins
+ {
+ "path": "lib/plugins/XTemplater.js"
+ },
{
"path": "lib/plugins/NavBar.js"
},
@@ -0,0 +1,19 @@
+
+Ext.define('FriendlyRent.view.property.Content', {
+ extend: 'Ext.Panel',
+ alias: 'widget.property_content',
+ requires: ['FriendlyRent.view.property.Picture', 'FriendlyRent.view.property.MainInfo', 'FriendlyRent.view.property.details.Cost'],
+ config: {
+ items: [
+ {
+ xtype: 'property_picture'
+ }, {
+ xtype: 'property_main_info'
+ }, {
+ xtype: 'property_costs'
+ }, {
+ xtype: 'property_description'
+ }
+ ]
+ }
+});
@@ -0,0 +1,11 @@
+
+Ext.define('FriendlyRent.view.property.Description', {
+ extend: 'Ext.Panel',
+ config: {
+ items: [
+ {
+ html: ''
+ }
+ ]
+ }
+});
@@ -0,0 +1,20 @@
+
+Ext.define('FriendlyRent.view.property.details', {
+ extend: 'Ext.DataView',
+ alias: 'widget.property_details',
+ requires: [],
+ config: {
+ store: {
+ itemTpl: Ext.XTemplate.from("property_details", new PropertyHelper.details),
+ fields: ['title', 'description', 'smoking', 'pets'],
+ data: [
+ {
+ title: 'Beautiful place',
+ description: "My money's in that office, right? If she start giving me some bullshit about it ain't there, and we got to go someplace else and get it, I'm gonna shoot you in the head then and there. Then I'm gonna shoot that bitch in the kneecaps, find out where my goddamn money is. She gonna tell me too. Hey, look at me when I'm talking to you, motherfucker. You listen: we go in there, and that nigga Winston or anybody else is in there, you the first motherfucker to get shot. You understand? My money's in that office, right? If she start giving me some bullshit about it ain't there, and we got to go someplace else and get it, I'm gonna shoot you in the head then and there. Then I'm gonna shoot that bitch in the kneecaps, find out where my goddamn money is. She gonna tell me too. Hey, look at me when I'm talking to you, motherfucker. You listen: we go in there, and that nigga Winston or anybody else is in there, you the first motherfucker to get shot. You understand?",
+ smoking: true,
+ pets: false
+ }
+ ]
+ }
+ }
+});
@@ -0,0 +1,20 @@
+
+Ext.define('FriendlyRent.view.property.details.cost.monthly', {
+ extend: 'Ext.DataView',
+ alias: 'widget.property_details_cost_monthly',
+ requires: [],
+ config: {
+ store: {
+ itemTpl: Ext.XTemplate.from("property_monthly_costs", new PropertyHelper.montlyCosts),
+ fields: ['rent', 'utilities', 'media', 'total'],
+ data: [
+ {
+ rent: 5500,
+ utilities: 1100,
+ media: 500,
+ total: 7100
+ }
+ ]
+ }
+ }
+});
@@ -0,0 +1,18 @@
+
+Ext.define('FriendlyRent.view.property.details.cost.onetime', {
+ extend: 'Ext.DataView',
+ alias: 'widget.property_details_cost_onetime',
+ requires: [],
+ config: {
+ store: {
+ itemTpl: Ext.XTemplate.from("property_onetime_costs", new PropertyHelper.ontimeCosts),
+ fields: ['deposit', 'prepaid'],
+ data: [
+ {
+ deposit: 14200,
+ prepaid: 7100
+ }
+ ]
+ }
+ }
+});
@@ -8,10 +8,9 @@ Ext.define('FriendlyRent.view.search.favorites.Content', {
itemId: 'favorites_list',
loadingText: 'Loading favorites...',
emptyText: '<div class="favorites-list empty-text">No favorites found.</div>',
- itemTpl: Ext.XTemplate.from("property", new PropertyHelper)
+ itemTpl: Ext.XTemplater.getRegisteredTemplate('favorite')
},
initialize: function() {
- console.log('initialize');
this.callParent();
return Ext.Function.defer(this.setFavorites, 200);
},
View
@@ -0,0 +1,15 @@
+String.prototype.trim = function(){
+ return this.replace(/^\s+|\s+$/g, "");
+};
+
+String.prototype.toCamel = function(){
+ return this.replace(/(\-[a-z])/g, function($1){return $1.toUpperCase().replace('-','');});
+};
+
+String.prototype.toDash = function(){
+ return this.replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();});
+};
+
+String.prototype.toUnderscore = function(){
+ return this.replace(/([A-Z])/g, function($1){return "_"+$1.toLowerCase();});
+};
Oops, something went wrong.

0 comments on commit 4a86cec

Please sign in to comment.