Permalink
Browse files

social icons and new template helper structure

  • Loading branch information...
kristianmandrup committed Jul 11, 2012
1 parent 4a86cec commit 42040446713e4777badd8bb2518399ab42d8271b
Showing with 2,206 additions and 309 deletions.
  1. +2 −2 www/app.js
  2. +3 −18 www/app.json
  3. +5 −3 www/app.rb
  4. +9 −0 www/app/helper/Mail.js
  5. +70 −0 www/app/helper/Property.js
  6. +114 −0 www/app/helper/property/Agent.js
  7. +90 −0 www/app/helper/property/Detail.js
  8. +15 −0 www/app/helper/search/Agent.js
  9. +114 −0 www/app/helper/search/Criteria.js
  10. +100 −0 www/app/util/XTemplater.js
  11. +11 −0 www/app/view/plugin/NavBar.js
  12. +2 −0 www/app/view/plugin/RangeSlider.js
  13. +32 −0 www/app/view/plugin/TooltipSlider.js
  14. +11 −0 www/app/view/plugin/TopBar.js
  15. +1 −1 www/app/view/search/favorites/Content.js
  16. +7 −1 www/lib/Mixin.js
  17. +57 −17 www/lib/plugins/XTemplater.js
  18. +0 −141 www/lib/templates/Helpers.js
  19. +2 −0 www/lib/templates/MailHelper.js
  20. +76 −0 www/lib/templates/PropertyHelper.js
  21. +70 −0 www/lib/templates/property/DetailHelper.js
  22. +100 −0 www/lib/ux/XTemplater.js
  23. +11 −0 www/lib/ux/component/NavBar.js
  24. +2 −0 www/lib/ux/component/RangeSlider.js
  25. +142 −0 www/lib/ux/component/SliderFieldInput.js
  26. +111 −0 www/lib/ux/component/SliderFieldText.js
  27. +32 −0 www/lib/ux/component/TooltipSlider.js
  28. +11 −0 www/lib/ux/component/TopBar.js
  29. +6 −0 www/lib/ux/helper/Mail.js
  30. +70 −0 www/lib/ux/helper/Property.js
  31. +63 −0 www/lib/ux/helper/property/Detail.js
  32. +100 −0 www/lib/ux/util/XTemplater.js
  33. +1 −0 www/resources/css/progress_bars.css
  34. +1 −0 www/resources/css/social_icons_aqua.css
  35. +34 −0 www/resources/css/social_icons_default_16.css
  36. +34 −0 www/resources/css/social_icons_default_48.css
  37. BIN www/resources/images/icons/social/facebook.png
  38. BIN www/resources/images/icons/social/feed.png
  39. BIN www/resources/images/icons/social/google.png
  40. BIN www/resources/images/icons/social/social.zip
  41. BIN www/resources/images/icons/social/social_icons_16.png
  42. BIN www/resources/images/icons/social/social_icons_48.png
  43. BIN www/resources/images/icons/social/social_icons_aqua_16.png
  44. BIN www/resources/images/icons/social/social_icons_aqua_24.png
  45. BIN www/resources/images/icons/social/social_icons_aqua_32.png
  46. BIN www/resources/images/icons/social/social_icons_aqua_64.png
  47. BIN www/resources/images/icons/social/twitter.png
  48. BIN www/resources/images/icons/social/vimeo.png
  49. BIN www/resources/images/icons/social/youtube.png
  50. +74 −0 www/resources/sass/progress_bars.scss
  51. +93 −0 www/resources/sass/social_icons_aqua.scss
  52. +1 −0 www/sandbox/Test.coffee
  53. +3 −0 www/sandbox/Test.js
  54. +18 −0 www/social.html
  55. +6 −1 www/src/app.coffee
  56. +5 −0 www/src/app/helper/Mail.coffee
  57. +33 −0 www/src/app/helper/Property.coffee
  58. +43 −0 www/src/app/helper/property/Detail.coffee
  59. +53 −0 www/src/app/helper/search/Criteria.coffee
  60. +63 −0 www/src/app/util/XTemplater.coffee
  61. +1 −1 www/src/app/view/search/favorites/Content.coffee
  62. +7 −1 www/src/lib/Mixin.coffee
  63. +0 −42 www/src/lib/plugins/XTemplater.coffee
  64. +0 −62 www/src/lib/templates/Helpers.coffee
  65. 0 www/src/lib/{plugins → ux/component}/NavBar.coffee
  66. 0 www/src/lib/{plugins → ux/component}/RangeSlider.coffee
  67. +116 −0 www/src/lib/ux/component/SliderFieldInput.coffee
  68. +97 −0 www/src/lib/ux/component/SliderFieldText.coffee
  69. 0 www/src/lib/{plugins → ux/component}/TooltipSlider.coffee
  70. 0 www/src/lib/{plugins → ux/component}/TopBar.coffee
  71. +63 −0 www/src/lib/ux/util/XTemplater.coffee
  72. +3 −0 www/templates/property/contact_requests.html
  73. +4 −0 www/templates/property/detail/costs.html
  74. +4 −0 www/templates/property/detail/description.html
  75. 0 www/templates/{property_monthlyCosts.html → property/detail/monthlyCosts.html}
  76. 0 www/templates/{property_onetimeCosts.html → property/detail/onetimeCosts.html}
  77. +5 −0 www/templates/property/details.html
  78. 0 www/templates/{property.html → property/favorite.html}
  79. 0 www/templates/{property_mainInfo.html → property/mainInfo.html}
  80. 0 www/templates/property/picture.html
  81. +1 −0 www/templates/property/rules.html
  82. +4 −0 www/templates/property/social.html
  83. +0 −6 www/templates/property_details.html
  84. +0 −13 www/templates/property_favorite.html
View
@@ -3,7 +3,7 @@ Ext.Loader.setPath({
'Ext.io': 'sdk/sencha-io-0.3.3/src/io',
'Ext.cf': 'sdk/sencha-io-0.3.3/src/cf',
'Ext': 'sdk/src',
- 'Ux': 'lib/Ux'
+ 'Ux': 'lib/ux'
});
Ext.application({
@@ -12,7 +12,7 @@ Ext.application({
models: [],
stores: ["Favorites", "Agents"],
controllers: ["FriendlyRent.controller.Home", "FriendlyRent.controller.Search"],
- views: ["FriendlyRent.view.home.Page"],
+ views: ["FriendlyRent.view.plugin.NavBar", "FriendlyRent.view.plugin.TopBar", "FriendlyRent.view.home.Page"],
icon: {
'57': 'resources/icons/Icon.png',
'72': 'resources/icons/Icon~ipad.png',
View
@@ -56,28 +56,10 @@
{
"path": "lib/Mixin.js"
},
- {
- "path": "lib/templates/Helpers.js"
- },
{
"path": "lib/i18n/i18n.js"
},
// Sencha plugins
- {
- "path": "lib/plugins/XTemplater.js"
- },
- {
- "path": "lib/plugins/NavBar.js"
- },
- {
- "path": "lib/plugins/TopBar.js"
- },
- {
- "path": "lib/plugins/SliderFieldInput.js"
- },
- {
- "path": "lib/plugins/SliderFieldText.js"
- },
{
"path": "app.js",
"bundle": true, /* Indicates that all class dependencies are concatenated into this file when build */
@@ -102,6 +84,9 @@
{
"path": "lib/jquery/rateit/rateit.css"
},
+ {
+ "path": "resources/css/social_icons_aqua.css"
+ },
{
"path": "resources/css/app.css",
"update": "delta"
View
@@ -23,9 +23,11 @@
helpers do
def templates
- Dir.glob("templates/**").map do |template|
- name = File.basename(template, ".html")
- content = open(template).read
+ Dir.glob("templates/**/*.html").map do |template|
+ dirname = File.dirname(template).gsub(/\//, '_').sub(/^templates_/, '')
+ basename = File.basename template, ".html"
+ name = [dirname, basename].join('_')
+ content = File.open(template).read
"<textarea id='#{name}' class='x-hidden-display'>#{content}</textarea>"
end.join("\n")
end
View
@@ -0,0 +1,9 @@
+var mailHelper;
+
+Ext.define('FriendlyRent.helper.Mail', {
+ constructor: function() {
+ return TemplateHelper.prototype.augment(this);
+ }
+});
+
+mailHelper = new FriendlyRent.helper.Mail;
View
@@ -0,0 +1,70 @@
+var propertyHelper;
+
+Ext.define('FriendlyRent.helper.Property', {
+ constructor: function() {
+ return TemplateHelper.prototype.augment(this);
+ },
+ contact: {
+ contactReqDesc: function(requests) {
+ return "" + requests + " have contacted the landlord";
+ }
+ },
+ mainInfo: {
+ mainDesc: function(item) {
+ return "" + (this.sizeDesc(item)) + " " + item.type + " " + (this.floorDesc(item));
+ },
+ secondaryDesc: function(item) {
+ return "" + (this.roomDesc(item));
+ },
+ sizeDesc: function(item) {
+ return "" + item.size + " m2";
+ },
+ roomDesc: function(item) {
+ var room;
+ room = item.rooms > 1 ? "rooms" : "room";
+ return "" + item.rooms + "/" + item.bedrooms + " " + (this.furnishedDesc(item)) + " " + room;
+ },
+ floorDesc: function(item) {
+ var adj;
+ adj = (function() {
+ switch (item.floor) {
+ case 1:
+ return "st";
+ case 2:
+ return "nd";
+ case 3:
+ return "rd";
+ default:
+ return "th";
+ }
+ })();
+ if (item.floor > 0) {
+ return "on " + item.floor + adj + " floor";
+ } else {
+ return "";
+ }
+ },
+ furnishedDesc: function(item) {
+ if (item.furnished) {
+ return "furnished";
+ } else {
+ return "";
+ }
+ },
+ costDesc: function(cost) {
+ return "" + cost + " DKK";
+ },
+ locationDesc: function(item) {
+ return "" + item.city + " (" + item.region + ", " + item.countryCode + ")";
+ },
+ periodDesc: function(period) {
+ if (period) {
+ return "" + period.start_date + " to " + period.end_date;
+ } else {
+ return "";
+ }
+ }
+ }
+});
+
+propertyHelper = new FriendlyRent.helper.Property;
@@ -0,0 +1,114 @@
+
+Ext.define('FriendlyRent.helper.search.criteria', {
+ constructor: function() {
+ return TemplateHelper.prototype.augment(this);
+ },
+ mainInfo: propertyHelper.mainInfo,
+ criteria: function(criteria) {
+ return "" + (this.locationDesc(criteria)) + " " + (this.sizeDesc(criteria)) + " " + (this.typeDesc(criteria)) + " " + (this.roomDesc(criteria));
+ },
+ locationDesc: function(criteria) {
+ if (_.isBlank(criteria.location)) {
+ return "anywhere";
+ } else {
+ return this.mainInfo.locationDesc(criteria);
+ }
+ },
+ roomsDesc: function(criteria) {
+ if (_.isBlank(criteria.rooms)) {
+ return "any rooms";
+ } else {
+ return this.mainInfo.roomDesc(criteria);
+ }
+ },
+ sizeDesc: function(criteria) {
+ if (_.isBlank(criteria.size)) {
+ return "any size";
+ } else {
+ return this.mainInfo.sizeDesc(criteria);
+ }
+ },
+ typeDesc: function(criteria) {
+ if (_.isBlank(criteria.type)) {
+ return "any property type";
+ } else {
+ return criteria.type;
+ }
+ },
+ periodDesc: function(criteria) {
+ if (_.isBlank(criteria.period)) {
+ return "any period";
+ } else {
+ return this.helper.periodRangeDesc(criteria);
+ }
+ },
+ costDesc: function(criteria) {
+ if (_.isBlank(criteria.period)) {
+ return "any cost";
+ } else {
+ return this.helper.costRangeDesc(criteria);
+ }
+ },
+ rulesDesc: function(criteria) {
+ if (_.isBlank(criteria.period)) {
+ return "any rules";
+ } else {
+ return this.mainInfo.rulesDesc(criteria);
+ }
+ },
+ furnishedDesc: function(criteria) {
+ if (_.isBlank(criteria.furnished)) {
+ return "";
+ } else {
+ return this.furnishDesc(criteria);
+ }
+ },
+ helper: {
+ furnishDesc: function(criteria) {
+ if (criteria.furnished) {
+ return "furnished";
+ } else {
+ return "not furnished";
+ }
+ },
+ periodRangeDesc: function(criteria) {
+ return [this.helper.startTimeDesc(criteria), this.helper.durationDesc(criteria)].join(' ');
+ },
+ costRangeDesc: function(criteria) {
+ var max, min;
+ min = criteria.cost.min;
+ max = criteria.cost.max;
+ if (_.isBlank(min)) {
+ return "max " + max;
+ }
+ if (_.isBlank(max)) {
+ return "min " + min;
+ }
+ return "" + min + " - " + max + " DKK";
+ },
+ startTimeDesc: function(criteria) {
+ var start;
+ start = criteria.period.start;
+ if (_.isBlank(criteria.period.start)) {
+ return "starting any time";
+ }
+ if (start === 'asap') {
+ return 'ASAP';
+ }
+ return "in " + (this.timeDesc(criteria.period.start));
+ },
+ durationDesc: function(criteria) {
+ if (_.isBlank(criteria.period.duration)) {
+ return "lasting any duration";
+ }
+ return "for at least " + (this.timeDesc(criteria.period.duration));
+ },
+ timeDesc: function(time) {
+ var number, unit;
+ unit = time.match(/m$/) ? 'month' : 'week';
+ number = Number(time.match(/\d/));
+ unit = number > 1 ? "" + unit + "s" : unit;
+ return [number, unit].join(' ');
+ }
+ }
+});
@@ -0,0 +1,90 @@
+var propertyDetailHelper;
+
+Ext.define('FriendlyRent.helper.property.Detail', {
+ constructor: function() {
+ return TemplateHelper.prototype.augment(this);
+ },
+ description: {
+ desc: function(desc) {
+ if (_.isBlank(desc)) {
+ return "No description";
+ } else {
+ return desc;
+ }
+ }
+ },
+ facilities: {
+ desc: function(facilities) {
+ if (!facilities.length) {
+ return "No facilities";
+ } else {
+ return desc;
+ }
+ }
+ },
+ locationDetails: {
+ desc: function(locations) {
+ if (!locations.length) {
+ return "No locations";
+ } else {
+ return desc;
+ }
+ }
+ },
+ monthlyCosts: {
+ costDesc: function(label, cost, currency) {
+ if (currency == null) {
+ currency = 'DKK';
+ }
+ return '<div class="label">#{label}</div><div class="cost">#{cost}</cost>';
+ },
+ rentDesc: function(cost) {
+ return this.costDesc('Rent', cost);
+ },
+ utilitiesDesc: function(cost) {
+ return this.costDesc('Utilities', cost);
+ },
+ mediaDesc: function(cost) {
+ return this.costDesc('Media', cost);
+ },
+ totalDesc: function(cost) {
+ return this.costDesc('Total', cost);
+ }
+ },
+ onetimeCosts: {
+ costDesc: function(label, cost, currency) {
+ if (currency == null) {
+ currency = 'DKK';
+ }
+ return '<div class="label">#{label}</div><div class="cost">#{cost}</cost>';
+ },
+ depositDesc: function(cost) {
+ return this.costDesc('Deposit', cost);
+ },
+ prepaidDesc: function(cost) {
+ return this.costDesc('Prepaid', cost);
+ }
+ },
+ details: {
+ rulesDesc: function(item) {
+ return "" + (this.petsDesc(item)) + " <br/> " + (this.smokingDesc(item));
+ },
+ petsDesc: function(item) {
+ return this.ruleDesc('pets', item.pets);
+ },
+ smokingDesc: function(item) {
+ return this.ruleDesc('smoking', item.smoking);
+ },
+ ruleDesc: function(type, rule) {
+ var line;
+ line = "" + type + " allowed";
+ if (!rule) {
+ return "no " + line;
+ } else {
+ return line;
+ }
+ }
+ }
+});
+
+propertyDetailHelper = new FriendlyRent.helper.property.Detail;
@@ -0,0 +1,15 @@
+
+Ext.define('FriendlyRent.helper.search.agent', {
+ constructor: function() {
+ return TemplateHelper.prototype.augment(this);
+ },
+ description: {
+ desc: function(desc) {
+ if (_.isBlank(desc)) {
+ return "No description";
+ } else {
+ return desc;
+ }
+ }
+ }
+});
Oops, something went wrong.

0 comments on commit 4204044

Please sign in to comment.