Odoo Website前端开发笔记

乱,笔记用

<html >
    <head></head>
    <body>
        <div id="wrapwrap">
            <header>
                
            </header>
            <main>
                <div id="wrap" ></div>
            </main>
            <footer>
                
            </footer>
        </div>
    </body>
</html>

上述主体框架建议别动,替换样式即可,测试过,改了其主题框架导致使用Odoo website编辑页面功能时无法添加区块。

Odoo Website多语言切换原生为,打开链接的方式,做成下拉式菜单时候,发现<a>不能取消其 class ="js_change_lang",否则会导致无法跳转,没有深究原因。

联系我们页面,自带的地图貌似py生成的带链接的图片,花了一天的时间,改了效果。使用了 gmaps.js,代码如下:

//在页面需要引用的库:
<script src="http://maps.google.com/maps/api/js?sensor=true" type="text/javascript"/>
<script src="/模块路径/static/lib/plugins/gmaps/gmaps.js" type="text/javascript"/>
<script type="text/javascript">
    jQuery(document).ready(function() {
        ContactUs.init();

    });
</script>

//实现方法
var ContactUs = function () {
    //取联系我们页面html元素
    var name = $("span[itemprop='name']").eq(0).text(); 
    var address = $("span[itemprop='streetAddress']").eq(0).text();
    var telephone = $("span[itemprop='telephone']").eq(0).text();
    var email = $("span[itemprop='email']").eq(0).text();


    return {
        //main function to initiate the module
        init: function () {
            var map;
            $(document).ready(function(){
                map = new GMaps({
                    el: '#map',
                    lat: 30.581084,
                    lng: 114.3162,
                    zoom: 15,
                    zoomControl: true,
                    zoomControlOptions: {
                        style: google.maps.ZoomControlStyle.SMALL,
                    },
                    panControl: false,
                    scaleControl:false,
                    mapTypeId: google.maps.MapTypeId.ROADMAP,
                    mapTypeControl: false
                });

                //lat:纬度;lng:经度
                $(function (){
                    GMaps.geocode({
                        address: address,
                        callback: function(results, status){
                            if(status=='OK'){
                                var latlng = results[0].geometry.location;
                                map.setCenter(latlng.lat(), latlng.lng());
                                var marker = map.addMarker({
                                    lat: latlng.lat(),
                                    lng: latlng.lng(),
                                    title: name,
                                    infoWindow: {
                                        content: "<b>"+name+"</b><br>"+address+"<br>"+telephone+"<br>"+ ""+email+""
                                    }
                                });
                                marker.infoWindow.open(map, marker);
                            }
                        }
                    });

                });

            });
        }
    };

}();

 

转载于:https://my.oschina.net/u/138005/blog/890004

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值