diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2016-08-25 14:04:32 +0200 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2016-08-25 16:33:23 +0200 |
| commit | c82b65c8552a2ddccb9ac9990366c03199ff9d29 (patch) | |
| tree | f46e2f342b4fcabe0321221c500efa557ab85811 /addons/website_customer | |
| parent | 251344903d1ddee1672c4030b87349cd29fdc934 (diff) | |
[IMP] website, website_{*}: Google Maps API Key
As of June 22 2016, the use of API key is required to access the
following:
- Google Maps JavaScript API
- Google Static Maps API
- Google Street View Image API
https://developers.google.com/maps/pricing-and-plans/standard-plan-2016-update
For domains accessing the API before June 22, it will still work without
an API key. Since Google advises to use the API key, we hide the Maps if
no API key is defined.
Diffstat (limited to 'addons/website_customer')
| -rw-r--r-- | addons/website_customer/controllers/main.py | 2 | ||||
| -rw-r--r-- | addons/website_customer/views/website_customer_templates.xml | 36 |
2 files changed, 21 insertions, 17 deletions
diff --git a/addons/website_customer/controllers/main.py b/addons/website_customer/controllers/main.py index 613f1969573..cba2b1cfbc6 100644 --- a/addons/website_customer/controllers/main.py +++ b/addons/website_customer/controllers/main.py @@ -79,6 +79,7 @@ class WebsiteCustomer(http.Controller): partners = Partner.sudo().search(domain, offset=pager['offset'], limit=self._references_per_page) google_map_partner_ids = ','.join(map(str, partners.ids)) + google_maps_api_key = request.env['ir.config_parameter'].sudo().get_param('google_maps_api_key') tags = Tag.search([('website_published', '=', True), ('partner_ids', 'in', partners.ids)], order='classname, name ASC') tag = tag_id and Tag.browse(tag_id) or False @@ -94,6 +95,7 @@ class WebsiteCustomer(http.Controller): 'search_path': "?%s" % werkzeug.url_encode(post), 'tag': tag, 'tags': tags, + 'google_maps_api_key': google_maps_api_key, } return request.render("website_customer.index", values) diff --git a/addons/website_customer/views/website_customer_templates.xml b/addons/website_customer/views/website_customer_templates.xml index 1f2e976334d..d4c743cdcd5 100644 --- a/addons/website_customer/views/website_customer_templates.xml +++ b/addons/website_customer/views/website_customer_templates.xml @@ -67,25 +67,27 @@ <!-- Option: left column: World Map --> <template id="opt_country" inherit_id="website_customer.index" customize_show="True" name="Show Map"> <xpath expr="//div[@id='ref_left_column']" position="inside"> - <!-- modal for large map --> - <div class="modal fade customer_map_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true"> - <div class="modal-dialog modal-lg"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> - <h4 class="modal-title">World Map</h4> + <t t-if="google_maps_api_key"> + <!-- modal for large map --> + <div class="modal fade customer_map_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true"> + <div class="modal-dialog modal-lg"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + <h4 class="modal-title">World Map</h4> + </div> + <iframe t-attf-src="/google_map/?width=898&height=485&partner_ids=#{ google_map_partner_ids }&partner_url=/customers/" + style="width:898px; height:485px; border:0; padding:0; margin:0;"></iframe> </div> - <iframe t-attf-src="/google_map/?width=898&height=485&partner_ids=#{ google_map_partner_ids }&partner_url=/customers/" - style="width:898px; height:485px; border:0; padding:0; margin:0;"></iframe> + </div> </div> - </div> - </div> - <!-- modal end --> - <h3>World Map<button class="btn btn-link" data-toggle="modal" data-target=".customer_map_modal"><span class="fa fa-external-link" /></button></h3> - <ul class="nav"> - <iframe t-attf-src="/google_map?width=260&height=240&partner_ids=#{ google_map_partner_ids }&partner_url=/customers/" - style="width:260px; height:240px; border:0; padding:0; margin:0;" scrolling="no"></iframe> - </ul> + <!-- modal end --> + <h3>World Map<button class="btn btn-link" data-toggle="modal" data-target=".customer_map_modal"><span class="fa fa-external-link" /></button></h3> + <ul class="nav"> + <iframe t-attf-src="/google_map?width=260&height=240&partner_ids=#{ google_map_partner_ids }&partner_url=/customers/" + style="width:260px; height:240px; border:0; padding:0; margin:0;" scrolling="no"></iframe> + </ul> + </t> </xpath> </template> |
