diff --git a/app/assets/javascripts/darkswarm/services/enterprises.js.coffee b/app/assets/javascripts/darkswarm/services/enterprises.js.coffee index 81baad7368..c3721f4896 100644 --- a/app/assets/javascripts/darkswarm/services/enterprises.js.coffee +++ b/app/assets/javascripts/darkswarm/services/enterprises.js.coffee @@ -8,7 +8,7 @@ Darkswarm.factory 'Enterprises', (enterprises, CurrentHub)-> @dereference() dereference: -> - if CurrentHub.hub + if CurrentHub.hub?.id CurrentHub.hub = @enterprises_by_id[CurrentHub.hub.id] for enterprise in @enterprises diff --git a/app/assets/javascripts/templates/partials/contact.html.haml b/app/assets/javascripts/templates/partials/contact.html.haml index b3dea0cfbb..3a64615be1 100644 --- a/app/assets/javascripts/templates/partials/contact.html.haml +++ b/app/assets/javascripts/templates/partials/contact.html.haml @@ -1,12 +1,13 @@ -%div.modal-centered{bindonce: true, "bo-if" => "enterprise.email || enterprise.website || enterprise.phone"} - %h5.modal-header Contact - %p{"ng-if" => "enterprise.phone"} - {{ enterprise.phone }} +%div{bindonce: true} + %div.modal-centered{"bo-if" => "enterprise.email || enterprise.website || enterprise.phone"} + %h5.modal-header Contact + %p{"ng-if" => "enterprise.phone"} + {{ enterprise.phone }} - %p{"bo-if" => "enterprise.email"} - %a{"ng-href" => "mailto:{{enterprise.email | stripUrl}}", target: "_blank" } - {{ enterprise.email | stripUrl }} + %p{"ng-if" => "enterprise.email"} + %a{"ng-href" => "mailto:{{enterprise.email | stripUrl}}", target: "_blank" } + {{ enterprise.email | stripUrl }} - %p{"ng-if" => "enterprise.website"} - %a{"ng-href" => "http://{{enterprise.website | stripUrl}}", target: "_blank" } - {{ enterprise.website | stripUrl }} + %p{"ng-if" => "enterprise.website"} + %a{"ng-href" => "http://{{enterprise.website | stripUrl}}", target: "_blank" } + {{ enterprise.website | stripUrl }} diff --git a/app/assets/javascripts/templates/partials/follow.html.haml b/app/assets/javascripts/templates/partials/follow.html.haml index 33ef1cf52b..4838296dd3 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" => "producer.twitter || producer.facebook || producer.linkedin || producer.instagram"} +%div.modal-centered{"ng-if" => "enterprise.twitter || enterprise.facebook || enterprise.linkedin || enterprise.instagram"} %h5.modal-header Follow .follow-icons{bindonce: true} - %span{"ng-if" => "producer.twitter"} - %a{"ng-href" => "http://twitter.com/{{producer.twitter}}", target: "_blank"} + %span{"ng-if" => "enterprise.twitter"} + %a{"ng-href" => "http://twitter.com/{{enterprise.twitter}}", target: "_blank"} %i.ofn-i_041-twitter - %span{"ng-if" => "producer.facebook"} - %a{"ng-href" => "http://{{producer.facebook | stripUrl}}", target: "_blank"} + %span{"ng-if" => "enterprise.facebook"} + %a{"ng-href" => "http://{{enterprise.facebook | stripUrl}}", target: "_blank"} %i.ofn-i_044-facebook - %span{"ng-if" => "producer.linkedin"} - %a{"ng-href" => "http://{{producer.linkedin | stripUrl}}", target: "_blank"} + %span{"ng-if" => "enterprise.linkedin"} + %a{"ng-href" => "http://{{enterprise.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{"ng-if" => "enterprise.instagram"} + %a{"ng-href" => "http://instagram.com/{{enterprise.instagram}}", target: "_blank"} %i.ofn-i_043-instagram diff --git a/app/views/modals/_producer.html.haml b/app/views/modals/_producer.html.haml index e9f94a1278..044cf3cdf0 100644 --- a/app/views/modals/_producer.html.haml +++ b/app/views/modals/_producer.html.haml @@ -1,23 +1,55 @@ %ofn-modal{title: "{{enterprise.name}}"} .highlight - .highlight-row + .highlight-top %p.right - {{ enterprise.address.city }} , {{enterprise.address.state}} + {{ [enterprise.address.city, enterprise.address.state] | printArray}} %h3 %i.ofn-i_036-producers {{ enterprise.name }} - %img.hero-img{"ng-src" => "{{enterprise.promo_image}}"} - .row.pad-top{bindonce: true} - .small-12.large-6.columns - %img.producer-logo{"bo-src" => "enterprise.logo", "bo-if" => "enterprise.logo"} - %h5.modal-header About - %p{"ng-bind-html" => "enterprise.long_description"} + .row{bindonce: true} + .small-12.large-8.columns + %div{"ng-show" => "enterprise.long_description.length > 0 || enterprise.logo"} + %h5.modal-header About + .about-container + %img.enterprise-logo{"bo-src" => "enterprise.logo", "bo-if" => "enterprise.logo"} + %p.text-small{"ng-bind-html" => "enterprise.long_description"} - .small-12.large-6.columns - %ng-include{src: "'partials/contact.html'"} - %ng-include{src: "'partials/follow.html'"} + .small-12.large-4.columns + %div.modal-centered{"bo-if" => "enterprise.email || enterprise.website || enterprise.phone"} + %h5.modal-header Contact + %p{"bo-if" => "enterprise.phone"} + {{ enterprise.phone }} + + %p{"bo-if" => "enterprise.email"} + %a{"ng-href" => "mailto:{{enterprise.email | stripUrl}}", target: "_blank" } + {{ enterprise.email | stripUrl }} + + %p{"bo-show" => "enterprise.website"} + %a{"ng-href" => "http://{{enterprise.website}}", target: "_blank" } + {{ enterprise.website | stripUrl }} + + %div.modal-centered{"bo-if" => "enterprise.twitter || enterprise.facebook || enterprise.linkedin || enterprise.instagram"} + %h5.modal-header Follow + .follow-icons{bindonce: true} + %span{"bo-show" => "enterprise.twitter"} + %a{"ng-href" => "http://twitter.com/{{enterprise.twitter}}", target: "_blank"} + %i.ofn-i_041-twitter + + %span{"bo-show" => "enterprise.facebook"} + %a{"ng-href" => "http://{{enterprise.facebook | stripUrl}}", target: "_blank"} + %i.ofn-i_044-facebook + + %span{"bo-show" => "enterprise.linkedin"} + %a{"ng-href" => "http://{{enterprise.linkedin | stripUrl}}", target: "_blank"} + %i.ofn-i_042-linkedin + + %span{"bo-show" => "enterprise.instagram"} + %a{"ng-href" => "http://instagram.com/{{enterprise.instagram}}", target: "_blank"} + %i.ofn-i_043-instagram %a.close-reveal-modal.outside{"ng-click" => "$close()"} %i.ofn-i_009-close + + diff --git a/spec/features/consumer/home_spec.rb b/spec/features/consumer/home_spec.rb index ae60766f30..1b28af1489 100644 --- a/spec/features/consumer/home_spec.rb +++ b/spec/features/consumer/home_spec.rb @@ -22,7 +22,7 @@ feature 'Home', js: true do it "should grey out hubs that are not in an order cycle" do create(:simple_product, distributors: [d1, d2]) visit root_path - page.should have_selector 'hub.inactive', text: d1.name + page.should have_selector 'hub.inactive' page.should have_selector 'hub.inactive', text: d2.name end