From a3664d44483909916dfa2b40fb8e516db739eed8 Mon Sep 17 00:00:00 2001 From: Rick Giner Date: Sun, 3 May 2015 12:51:59 +1000 Subject: [PATCH 1/7] Added bindonce and ng-if improvements to Producers templates --- app/views/producers/_fat.html.haml | 56 +++++++++++++-------------- app/views/producers/_skinny.html.haml | 12 +++--- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/app/views/producers/_fat.html.haml b/app/views/producers/_fat.html.haml index 17304abbe3..a6d6661501 100644 --- a/app/views/producers/_fat.html.haml +++ b/app/views/producers/_fat.html.haml @@ -1,68 +1,68 @@ -.row.active_table_row{"ng-show" => "open()", "ng-click" => "toggle()", "ng-class" => "{'open' : !ofn-i_032-closed-sign()}"} +.row.active_table_row{"ng-if" => "open()", "ng-click" => "toggle()", "ng-class" => "{'open' : !ofn-i_032-closed-sign()}"} .columns.small-12.medium-7.large-7.fat / Will add in long description available once clean up HTML formatting producer.long_description %div{"bo-if" => "producer.description"} %label About us - %img.right.show-for-medium-up{"ng-src" => "{{producer.logo}}" } - %p.text-small - {{ producer.description }} + %img.right.show-for-medium-up{"bo-src" => "producer.logo" } + %p.text-small{ "bo-text" => "producer.description"} %div.show-for-medium-up{"bo-if" => "producer.description.length==0"} %label   .columns.small-12.medium-5.large-5.fat - %div{"ng-if" => "producer.supplied_taxons"} + %div{"bo-if" => "producer.supplied_taxons"} %label Shop for %p.trans-sentence %span.fat-taxons{"ng-repeat" => "taxon in producer.supplied_taxons"} %render-svg{path: "{{taxon.icon}}"} - {{taxon.name}} + %span{"bo-text" => "taxon.name"} %div.show-for-medium-up{"ng-if" => "producer.supplied_taxons.length==0"}   - %div{"ng-if" => "producer.email || producer.website || producer.phone"} + %div{"bo-if" => "producer.email || producer.website || producer.phone"} %label Contact - %p.word-wrap{"ng-if" => "producer.phone"} - Call {{ producer.phone }} + %p.word-wrap{"bo-if" => "producer.phone"} + Call + %span{"bo-text" => "producer.phone"} - %p.word-wrap{"ng-if" => "producer.email"} - %a{"ng-href" => "{{producer.email | stripUrl}}", target: "_blank", mailto: true} - %span.email {{ producer.email | stripUrl }} + %p.word-wrap{"bo-if" => "producer.email"} + %a{"bo-href" => "producer.email | stripUrl", target: "_blank", mailto: true} + %span.email{"bo-bind" => "producer.email | stripUrl"} - %p.word-wrap{"ng-if" => "producer.website"} - %a{"ng-href" => "http://{{producer.website | stripUrl}}", target: "_blank" } - %span {{ producer.website | stripUrl }} + %p.word-wrap{"bo-if" => "producer.website"} + %a{"bo-href-i" => "http://{{producer.website | stripUrl}}", target: "_blank" } + %span{"bo-bind" => "producer.website | stripUrl"} - %div{"ng-if" => "producer.twitter || producer.facebook || producer.linkedin || producer.instagram"} + %div{"bo-if" => "producer.twitter || producer.facebook || producer.linkedin || producer.instagram"} %label Follow .follow-icons{bindonce: true} - %span{"ng-if" => "producer.twitter"} - %a{"ng-href" => "http://twitter.com/{{producer.twitter}}", target: "_blank"} + %span{"bo-if" => "producer.twitter"} + %a{"bo-href-i" => "http://twitter.com/{{producer.twitter}}", target: "_blank"} %i.ofn-i_041-twitter - %span{"ng-if" => "producer.facebook"} - %a{"ng-href" => "http://{{producer.facebook | stripUrl}}", target: "_blank"} + %span{"bo-if" => "producer.facebook"} + %a{"bo-href-i" => "http://{{producer.facebook | stripUrl}}", target: "_blank"} %i.ofn-i_044-facebook - %span{"ng-if" => "producer.linkedin"} - %a{"ng-href" => "http://{{producer.linkedin | stripUrl}}", target: "_blank"} + %span{"bo-if" => "producer.linkedin"} + %a{"bo-href-i" => "http://{{producer.linkedin | stripUrl}}", target: "_blank"} %i.ofn-i_042-linkedin - %span{"ng-if" => "producer.instagram"} - %a{"ng-href" => "http://instagram.com/{{producer.instagram}}", target: "_blank"} + %span{"bo-if" => "producer.instagram"} + %a{"bo-href-i" => "http://instagram.com/{{producer.instagram}}", target: "_blank"} %i.ofn-i_043-instagram -.row.active_table_row.pad-top{"ng-show" => "open()", "bo-if" => "producer.hubs"} +.row.active_table_row.pad-top{"ng-if" => "open()", "bo-if" => "producer.hubs"} .columns.small-12 .row .columns.small-12.fat %div{"bo-if" => "producer.name"} %label Shop for - %span.turquoise {{ producer.name }} + %span.turquoise{"bo-text" => "producer.name"} products at: %div.show-for-medium-up{"bo-if" => "!producer.name"}   @@ -73,6 +73,6 @@ "bo-class" => "{primary: hub.active, secondary: !hub.active}"} %i.ofn-i_033-open-sign{"bo-if" => "hub.active"} %i.ofn-i_032-closed-sign{"bo-if" => "!hub.active"} - .hub-name {{hub.name}} - .button-address {{ [hub.address.city, hub.address.state_name] | printArray }} + .hub-name{"bo-text" => "hub.name"} + .button-address{"bo-bind" => "[hub.address.city, hub.address.state_name] | printArray"} diff --git a/app/views/producers/_skinny.html.haml b/app/views/producers/_skinny.html.haml index aaa59b20e8..49ab0a35be 100644 --- a/app/views/producers/_skinny.html.haml +++ b/app/views/producers/_skinny.html.haml @@ -2,19 +2,19 @@ .columns.small-12.medium-4.large-4.skinny-head %span{"bo-if" => "producer.is_distributor" } %a.is_distributor{"bo-href" => "producer.path" } - %i{ng: {class: "producer.producer_icon_font"}} + %i{bo: {class: "producer.producer_icon_font"}} %span.margin-top - %strong {{ producer.name }} + %strong{"bo-text" => "producer.name"} %span.producer-name{"bo-if" => "!producer.is_distributor" } - %i{ng: {class: "producer.producer_icon_font"}} + %i{bo: {class: "producer.producer_icon_font"}} %span.margin-top - %strong {{ producer.name }} + %strong{"bo-text" => "producer.name"} .columns.small-6.medium-3.large-3 - %span.margin-top {{ producer.address.city }} + %span.margin-top{"bo-text" => "producer.address.city"} .columns.small-4.medium-3.large-4 - %span.margin-top {{ producer.address.state_name | uppercase }} + %span.margin-top{"bo-bind" => "producer.address.state_name | uppercase"} .columns.small-2.medium-2.large-1.text-right %span.margin-top %i{"ng-class" => "{'ofn-i_005-caret-down' : !open(), 'ofn-i_006-caret-up' : open()}"} From 16e9f0545ba52e7ac6d8caf015f636d30680a491 Mon Sep 17 00:00:00 2001 From: Rick Giner Date: Sun, 3 May 2015 14:02:33 +1000 Subject: [PATCH 2/7] bind-once in products --- app/views/shop/products/_summary.html.haml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/views/shop/products/_summary.html.haml b/app/views/shop/products/_summary.html.haml index 392d7ef31d..dec398f80f 100644 --- a/app/views/shop/products/_summary.html.haml +++ b/app/views/shop/products/_summary.html.haml @@ -7,14 +7,13 @@ .small-10.medium-10.large-11.columns.summary-header %h3 %a{"ng-click" => "triggerProductModal()"} - {{ product.name }} + %span{"bo-text" => "product.name"} %i.ofn-i_057-expand %small %em from %span %enterprise-modal - %i.ofn-i_036-producers - {{ enterprise.name }} + %i.ofn-i_036-producers{"bo-text" => "enterprise.name"} .small-2.medium-2.large-1.columns.text-center .taxon-flag %render-svg{path: "{{product.primary_taxon.icon}}"} From 3fc616cdff059a6beb5d8e4bc8add848dc83099b Mon Sep 17 00:00:00 2001 From: Rick Giner Date: Sun, 3 May 2015 14:11:09 +1000 Subject: [PATCH 3/7] bind-once on hubs --- app/views/home/_fat.html.haml | 5 ++--- app/views/home/_skinny.html.haml | 17 +++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/views/home/_fat.html.haml b/app/views/home/_fat.html.haml index b3741e5aec..6796601637 100644 --- a/app/views/home/_fat.html.haml +++ b/app/views/home/_fat.html.haml @@ -5,7 +5,7 @@ .trans-sentence %span.fat-taxons{"ng-repeat" => "taxon in hub.taxons"} %render-svg{path: "{{taxon.icon}}"} - {{taxon.name}} + %span{"bo-text" => "taxon.name"} %div.show-for-medium-up{"bo-if" => "hub.taxons.length==0"}   .columns.small-12.medium-3.large-2.fat @@ -25,7 +25,6 @@ %li{"ng-repeat" => "enterprise in hub.producers"} %enterprise-modal %i.ofn-i_036-producers - %span - {{ enterprise.name }} + %span{"bo-text" => "enterprise.name"} %div.show-for-medium-up{"bo-if" => "hub.producers.length==0"}   diff --git a/app/views/home/_skinny.html.haml b/app/views/home/_skinny.html.haml index aeaae0cae4..cf001371f7 100644 --- a/app/views/home/_skinny.html.haml +++ b/app/views/home/_skinny.html.haml @@ -2,20 +2,21 @@ .columns.small-12.medium-6.large-5.skinny-head %a.hub{"bo-href" => "hub.path", "ng-class" => "{primary: hub.active, secondary: !hub.active}", "ofn-empties-cart" => "hub"} - %i{ng: {class: "hub.icon_font"}} - %span.margin-top.hub-name-listing {{ hub.name | truncate:40}} + %i{bo: {class: "hub.icon_font"}} + %span.margin-top.hub-name-listing{"bo-bind" => "hub.name | truncate:40"} .columns.small-4.medium-2.large-2 - %span.margin-top {{ hub.address.city }} + %span.margin-top{"bo-text" => "hub.address.city"} .columns.small-2.medium-1.large-1 - %span.margin-top {{ hub.address.state_name | uppercase }} + %span.margin-top{"bo-bind" => "hub.address.state_name | uppercase"} .columns.small-6.medium-3.large-4.text-right{"bo-if" => "hub.active"} %a.hub.open_closed{"bo-href" => "hub.path", "ng-class" => "{primary: hub.active, secondary: !hub.active}", "ofn-empties-cart" => "hub"} %i.ofn-i_033-open-sign %span.margin-top{ bo: { if: "current()" } } %em Shopping here - %span.margin-top{ bo: { if: "!current()" } } {{ hub.orders_close_at | sensible_timeframe }} + %span.margin-top{ bo: { if: "!current()" } } + %span{"bo-bind" => "hub.orders_close_at | sensible_timeframe"} .columns.small-6.medium-3.large-4.text-right{"bo-if" => "!hub.active"} %a.hub.open_closed{"bo-href" => "hub.path", "ng-class" => "{primary: hub.active, secondary: !hub.active}", "ofn-empties-cart" => "hub"} @@ -28,12 +29,12 @@ .columns.small-12.medium-6.large-5.skinny-head %a.hub{"ng-click" => "openModal(hub)", "ng-class" => "{primary: hub.active, secondary: !hub.active}"} %i{ng: {class: "hub.icon_font"}} - %span.margin-top.hub-name-listing {{ hub.name | truncate:40}} + %span.margin-top.hub-name-listing{"bo-bind" => "hub.name | truncate:40"} .columns.small-4.medium-2.large-2 - %span.margin-top {{ hub.address.city }} + %span.margin-top{"bo-text" => "hub.address.city"} .columns.small-2.medium-1.large-1 - %span.margin-top {{ hub.address.state_name | uppercase }} + %span.margin-top{"bo-bind" => "hub.address.state_name | uppercase"} .columns.small-6.medium-3.large-4.text-right %span.margin-top{ bo: { if: "!current()" } } From 9c26b3ebb24a5f43c6a288f7b876f1a8fb8bec25 Mon Sep 17 00:00:00 2001 From: Rick Giner Date: Sun, 3 May 2015 14:34:42 +1000 Subject: [PATCH 4/7] bind-once in partials --- .../templates/partials/contact.html.haml | 11 ++++------ .../partials/enterprise_header.html.haml | 12 +++++------ .../templates/partials/follow.html.haml | 20 +++++++++---------- .../templates/partials/hub_actions.html.haml | 6 +++--- .../templates/partials/hub_details.html.haml | 4 ++-- 5 files changed, 25 insertions(+), 28 deletions(-) diff --git a/app/assets/javascripts/templates/partials/contact.html.haml b/app/assets/javascripts/templates/partials/contact.html.haml index caa3bc5e65..165fd69d80 100644 --- a/app/assets/javascripts/templates/partials/contact.html.haml +++ b/app/assets/javascripts/templates/partials/contact.html.haml @@ -1,14 +1,11 @@ %div.contact-container{bindonce: true} %div.modal-centered{"bo-if" => "enterprise.email || enterprise.website || enterprise.phone"} %p.modal-header Contact - %p{"ng-if" => "enterprise.phone"} - {{ enterprise.phone }} + %p{"bo-if" => "enterprise.phone", "bo-text" => "enterprise.phone"} %p.word-wrap{"ng-if" => "enterprise.email"} - %a{"ng-href" => "{{enterprise.email | stripUrl}}", target: "_blank", mailto: true} - %span.email - {{ enterprise.email | stripUrl }} + %a{"bo-href" => "enterprise.email | stripUrl", target: "_blank", mailto: true} + %span.email{"bo-bind" => "enterprise.email | stripUrl"} %p.word-wrap{"ng-if" => "enterprise.website"} - %a{"ng-href" => "http://{{enterprise.website | stripUrl}}", target: "_blank" } - {{ enterprise.website | stripUrl }} + %a{"bo-href-i" => "http://{{enterprise.website | stripUrl}}", target: "_blank", "bo-bind" => "enterprise.website | stripUrl"} diff --git a/app/assets/javascripts/templates/partials/enterprise_header.html.haml b/app/assets/javascripts/templates/partials/enterprise_header.html.haml index 27a57ed90b..c0d9d5d9e0 100644 --- a/app/assets/javascripts/templates/partials/enterprise_header.html.haml +++ b/app/assets/javascripts/templates/partials/enterprise_header.html.haml @@ -1,13 +1,13 @@ -.highlight{"ng-class" => "{'is_distributor' : enterprise.is_distributor}"} +.highlight{bindonce: true, "ng-class" => "{'is_distributor' : enterprise.is_distributor}"} .highlight-top.row .small-12.medium-7.large-8.columns %h3{"ng-if" => "enterprise.is_distributor"} - %a{"bo-href" => "enterprise.path", "ofn-empties-cart" => "enterprise", bindonce: true} + %a{"bo-href" => "enterprise.path", "ofn-empties-cart" => "enterprise"} %i{"ng-class" => "enterprise.icon_font"} - %span {{ enterprise.name }} + %span{"bo-text" => "enterprise.name"} %h3{"ng-if" => "!enterprise.is_distributor", "ng-class" => "{'is_producer' : enterprise.is_primary_producer}"} %i{"ng-class" => "enterprise.icon_font"} - %span {{ enterprise.name }} + %span{"bo-text" => "enterprise.name"} .small-12.medium-5.large-4.columns.text-right.small-only-text-left - %p {{ [enterprise.address.city, enterprise.address.state_name] | printArray}} - %img.hero-img{"ng-src" => "{{enterprise.promo_image}}"} + %p{"bo-bind" => "[enterprise.address.city, enterprise.address.state_name] | printArray"} + %img.hero-img{"bo-src" => "enterprise.promo_image"} diff --git a/app/assets/javascripts/templates/partials/follow.html.haml b/app/assets/javascripts/templates/partials/follow.html.haml index 1f7bd5702b..4e2a00086a 100644 --- a/app/assets/javascripts/templates/partials/follow.html.haml +++ b/app/assets/javascripts/templates/partials/follow.html.haml @@ -1,19 +1,19 @@ -%div.modal-centered{"ng-if" => "enterprise.twitter || enterprise.facebook || enterprise.linkedin || enterprise.instagram"} +%div.modal-centered{bindonce: true, "bo-if" => "enterprise.twitter || enterprise.facebook || enterprise.linkedin || enterprise.instagram"} %p.modal-header Follow - .follow-icons{bindonce: true} - %span{"ng-if" => "enterprise.twitter"} - %a{"ng-href" => "http://twitter.com/{{enterprise.twitter}}", target: "_blank"} + .follow-icons + %span{"bo-if" => "enterprise.twitter"} + %a{"bo-href-i" => "http://twitter.com/{{enterprise.twitter}}", target: "_blank"} %i.ofn-i_041-twitter - %span{"ng-if" => "enterprise.facebook"} - %a{"ng-href" => "http://{{enterprise.facebook | stripUrl}}", target: "_blank"} + %span{"bo-if" => "enterprise.facebook"} + %a{"bo-href-i" => "http://{{enterprise.facebook | stripUrl}}", target: "_blank"} %i.ofn-i_044-facebook - %span{"ng-if" => "enterprise.linkedin"} - %a{"ng-href" => "http://{{enterprise.linkedin | stripUrl}}", target: "_blank"} + %span{"bo-if" => "enterprise.linkedin"} + %a{"bo-href-i" => "http://{{enterprise.linkedin | stripUrl}}", target: "_blank"} %i.ofn-i_042-linkedin - %span{"ng-if" => "enterprise.instagram"} - %a{"ng-href" => "http://instagram.com/{{enterprise.instagram}}", target: "_blank"} + %span{"bo-if" => "enterprise.instagram"} + %a{"bo-href-i" => "http://instagram.com/{{enterprise.instagram}}", target: "_blank"} %i.ofn-i_043-instagram diff --git a/app/assets/javascripts/templates/partials/hub_actions.html.haml b/app/assets/javascripts/templates/partials/hub_actions.html.haml index 61e74afb42..f5b451ef3c 100644 --- a/app/assets/javascripts/templates/partials/hub_actions.html.haml +++ b/app/assets/javascripts/templates/partials/hub_actions.html.haml @@ -2,7 +2,7 @@ .cta-container.small-12.columns %label Shop for - %strong {{enterprise.name}} + %strong{"bo-text" => "enterprise.name"} products at: %a.cta-hub{"ng-repeat" => "hub in enterprise.hubs", "bo-href" => "hub.path", @@ -10,7 +10,7 @@ "ofn-empties-cart" => "hub"} %i.ofn-i_033-open-sign{"bo-if" => "hub.active"} %i.ofn-i_032-closed-sign{"bo-if" => "!hub.active"} - .hub-name {{hub.name}} - .button-address {{ hub.address.city }} , {{hub.address.state_name}} + .hub-name{"bo-text" => "hub.name"} + .button-address{"bo-bind" => "[hub.address.city, hub.address.state_name] | printArray"} / %i.ofn-i_007-caret-right diff --git a/app/assets/javascripts/templates/partials/hub_details.html.haml b/app/assets/javascripts/templates/partials/hub_details.html.haml index 815200821a..8be5ceddac 100644 --- a/app/assets/javascripts/templates/partials/hub_details.html.haml +++ b/app/assets/javascripts/templates/partials/hub_details.html.haml @@ -19,6 +19,6 @@ "ofn-empties-cart" => "enterprise"} %i.ofn-i_033-open-sign{"bo-if" => "enterprise.active"} %i.ofn-i_032-closed-sign{"bo-if" => "!enterprise.active"} - .hub-name {{enterprise.name}} - .button-address {{ enterprise.address.city }} , {{enterprise.address.state_name}} + .hub-name{"bo-text" => "enterprise.name"} + .button-address{"bo-bind" => "[enterprise.address.city, enterprise.address.state_name] | printArray"} / %i.ofn-i_007-caret-right From 8fb11defdb1689415ed87305a48c5dc78b40ed42 Mon Sep 17 00:00:00 2001 From: Rick Giner Date: Sun, 3 May 2015 14:41:34 +1000 Subject: [PATCH 5/7] bind-once in groups home page --- app/views/groups/index.html.haml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/views/groups/index.html.haml b/app/views/groups/index.html.haml index 262e188e3c..901cb17ad9 100644 --- a/app/views/groups/index.html.haml +++ b/app/views/groups/index.html.haml @@ -20,13 +20,11 @@ .row.pad-top{bindonce: true} .small-12.medium-6.columns .groups-header - %a{"ng-href" => "/groups/{{group.id}}"} + %a{"bo-href-i" => "/groups/{{group.id}}"} %i.ofn-i_035-groups - %span.group-name - {{ group.name }} + %span.group-name{"bo-text" => "group.name"} .small-3.medium-2.columns - %p - {{ group.state }} + %p{"bo-text" => "group.state"} .small-9.medium-4.columns.groups-icons %p %link-to-service.ofn-i_050-mail-circle{service: '""', ref: 'group.email.split("").reverse().join("")', mailto: true} From 9e70c80d1d29a5088755e75b0b6d7297a58b3262 Mon Sep 17 00:00:00 2001 From: Rick Giner Date: Sun, 3 May 2015 14:48:27 +1000 Subject: [PATCH 6/7] bind-once in product modal --- .../javascripts/templates/product_modal.html.haml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/templates/product_modal.html.haml b/app/assets/javascripts/templates/product_modal.html.haml index bf66bd4aea..3db8035acc 100644 --- a/app/assets/javascripts/templates/product_modal.html.haml +++ b/app/assets/javascripts/templates/product_modal.html.haml @@ -1,10 +1,10 @@ -.row +.row{bindonce: true} .columns.small-12.large-6.product-header - %h3 {{product.name}} + %h3{"bo-text" => "product.name"} %span %em from - %span.avenir {{ enterprise.name }} + %span.avenir{"bo-text" => "enterprise.name"} %br @@ -18,11 +18,11 @@ %div{"ng-if" => "product.description"} %hr - %p.text-small {{product.description}} + %p.text-small{"bo-text" => "product.description"} %hr .columns.small-12.large-6 - %img.product-img{"ng-src" => "{{product.largeImage}}", "ng-if" => "product.largeImage"} - %img.product-img.placeholder{"ng-src" => "/assets/noimage/large.png", "ng-if" => "!product.largeImage"} + %img.product-img{"bo-src" => "product.largeImage", "bo-if" => "product.largeImage"} + %img.product-img.placeholder{"bo-src" => "'/assets/noimage/large.png'", "bo-if" => "!product.largeImage"} %ng-include{src: "'partials/close.html'"} From 368402f115586014fd872d1f60f8a36fc8f5f69e Mon Sep 17 00:00:00 2001 From: Rick Giner Date: Sun, 3 May 2015 15:24:16 +1000 Subject: [PATCH 7/7] Changed selectors' ng-repeat. Using existing variable instead of method call --- app/assets/javascripts/templates/filter_selector.html.haml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/templates/filter_selector.html.haml b/app/assets/javascripts/templates/filter_selector.html.haml index ecd4fb7d6d..c6990c369f 100644 --- a/app/assets/javascripts/templates/filter_selector.html.haml +++ b/app/assets/javascripts/templates/filter_selector.html.haml @@ -1,4 +1,4 @@ -%div{ style: "display: inline-block" } - %active-selector{ ng: { repeat: "selector in selectors()", show: "ifDefined(selector.fits, true)" } } +%div{bindonce:true, style: "display: inline-block" } + %active-selector{ ng: { repeat: "selector in allSelectors", show: "ifDefined(selector.fits, true)" } } %render-svg{path: "{{selector.object.icon}}", ng: { if: "selector.object.icon"} } - %span {{ selector.object.name }} + %span{"bo-text" => "selector.object.name"}