diff --git a/app/assets/javascripts/darkswarm/services/enterprises.js.coffee b/app/assets/javascripts/darkswarm/services/enterprises.js.coffee index 84a3c2e7c2..0f8a6b2b16 100644 --- a/app/assets/javascripts/darkswarm/services/enterprises.js.coffee +++ b/app/assets/javascripts/darkswarm/services/enterprises.js.coffee @@ -1,4 +1,5 @@ Darkswarm.factory 'Enterprises', (enterprises, CurrentHub, Taxons, Dereferencer)-> + console.log enterprises[0].address new class Enterprises enterprises_by_id: {} # id/object pairs for lookup constructor: -> diff --git a/app/models/enterprise.rb b/app/models/enterprise.rb index e5250309b4..c74144446b 100644 --- a/app/models/enterprise.rb +++ b/app/models/enterprise.rb @@ -30,7 +30,6 @@ class Enterprise < ActiveRecord::Base validates_presence_of :address validates_associated :address - after_initialize :initialize_country before_validation :set_unused_address_fields after_validation :geocode_address @@ -207,11 +206,6 @@ class Enterprise < ActiveRecord::Base url.andand.sub /(https?:\/\/)?(www\.)?/, '' end - def initialize_country - self.address ||= Spree::Address.new - self.address.country = Spree::Country.find_by_id(Spree::Config[:default_country_id]) if self.address.new_record? - end - def set_unused_address_fields address.firstname = address.lastname = address.phone = 'unused' if address.present? end diff --git a/app/serializers/api/enterprise_serializer.rb b/app/serializers/api/enterprise_serializer.rb index 23aa2a7458..c7653db910 100644 --- a/app/serializers/api/enterprise_serializer.rb +++ b/app/serializers/api/enterprise_serializer.rb @@ -1,6 +1,4 @@ class Api::EnterpriseSerializer < ActiveModel::Serializer - # To improve this: http://hawkins.io/2013/06/caching_object_graphs_with_active_model_serializers/ - def serializable_hash cached_serializer_hash.merge uncached_serializer_hash end @@ -43,7 +41,7 @@ class Api::CachedEnterpriseSerializer < ActiveModel::Serializer has_many :distributors, key: :hubs, serializer: Api::IdSerializer has_many :suppliers, key: :producers, serializer: Api::IdSerializer - #has_one :address, serializer: Api::AddressSerializer + has_one :address, serializer: Api::AddressSerializer def pickup object.shipping_methods.where(:require_ship_address => false).present? diff --git a/app/views/producers/index.html.haml b/app/views/producers/index.html.haml index 5cde67a512..2d4c834191 100644 --- a/app/views/producers/index.html.haml +++ b/app/views/producers/index.html.haml @@ -1,35 +1,35 @@ = inject_enterprises -.producers{"ng-controller" => "ProducersCtrl"} - .row - .small-12.columns.text-center.pad-top - %h1 Producers - %div - Select a - %ofn-modal{title: "producer"} - = render partial: "modals/producers" - from the list below: +-#.producers{"ng-controller" => "ProducersCtrl"} + -#.row + -#.small-12.columns.text-center.pad-top + -#%h1 Producers + -#%div + -#Select a + -#%ofn-modal{title: "producer"} + -#= render partial: "modals/producers" + -#from the list below: - #active-table-search.row.pad-top - .small-12.columns - %i.ofn-i_020-search - %input{type: :text, - "ng-model" => "query", - placeholder: "Search postcode, suburb or producer name...", - "ng-debounce" => "150", - "ofn-disable-enter" => true} + -##active-table-search.row.pad-top + -#.small-12.columns + -#%i.ofn-i_020-search + -#%input{type: :text, + -#"ng-model" => "query", + -#placeholder: "Search postcode, suburb or producer name...", + -#"ng-debounce" => "150", + -#"ofn-disable-enter" => true} - .row{bindonce: true} - .small-12.columns - .active_table - %producer.active_table_node.row.animate-repeat{id: "{{producer.path}}", - "scroll-after-load" => true, - "ng-repeat" => "producer in filteredProducers = (Producers.visible | filterProducers:query)", - "ng-controller" => "ProducerNodeCtrl", - "ng-class" => "{'closed' : !open(), 'open' : open(), 'inactive' : !producer.active}", - id: "{{producer.hash}}"} + -#.row{bindonce: true} + -#.small-12.columns + -#.active_table + -#%producer.active_table_node.row.animate-repeat{id: "{{producer.path}}", + -#"scroll-after-load" => true, + -#"ng-repeat" => "producer in filteredProducers = (Producers.visible | filterProducers:query)", + -#"ng-controller" => "ProducerNodeCtrl", + -#"ng-class" => "{'closed' : !open(), 'open' : open(), 'inactive' : !producer.active}", + -#id: "{{producer.hash}}"} - .small-12.columns - = render partial: 'producers/skinny' - = render partial: 'producers/fat' + -#.small-12.columns + -#= render partial: 'producers/skinny' + -#= render partial: 'producers/fat' -= render partial: "shared/footer" +-#= render partial: "shared/footer"