Commit f4b390dc32aeac311f56927632efecf228c26c69

Authored by Braulio Bhavamitra
1 parent b859be43

metadata: use country_name from environment

app/models/environment.rb
... ... @@ -282,7 +282,10 @@ class Environment < ActiveRecord::Base
282 282 settings_items :activation_blocked_text, :type => String
283 283 settings_items :message_for_disabled_enterprise, :type => String,
284 284 :default => _('This enterprise needs to be enabled.')
  285 +
285 286 settings_items :location, :type => String
  287 + settings_items :country_name, :type => String
  288 +
286 289 settings_items :layout_template, :type => String, :default => 'default'
287 290 settings_items :homepage, :type => String
288 291 settings_items :description, :type => String, :default => '<div style="text-align: center"><a href="http://noosfero.org/"><img src="/images/noosfero-network.png" alt="Noosfero"/></a></div>'
... ...
plugins/metadata/lib/ext/enterprise.rb
... ... @@ -9,12 +9,13 @@ class Enterprise
9 9  
10 10 metadata_spec namespace: 'business:contact_data', tags: {
11 11 email: proc{ |e, plugin| e.contact_email },
12   - phone_number: proc{ |e, plugin| e.contact_phone },
13   - street_address: proc{ |e, plugin| e.address },
14   - locality: proc{ |e, plugin| e.city },
15   - region: proc{ |e, plugin| e.state },
16   - postal_code: proc{ |e, plugin| e.zip_code },
17   - country_name: proc{ |e, plugin| e.country },
  12 + phone_number: proc{ |e, plugin| e.contact_phone },
  13 + street_address: proc{ |e, plugin| e.address },
  14 + locality: proc{ |e, plugin| e.city },
  15 + region: proc{ |e, plugin| e.state },
  16 + postal_code: proc{ |e, plugin| e.zip_code },
  17 + # required
  18 + country_name: proc{ |e, plugin| e.country || e.environment.country_name || 'Unknown' },
18 19 }
19 20  
20 21 end
... ...