将完整的日历与Google日历集成在“where”/“location”字段中 [英] Integrating full calendar with Google calendar adding 'where' / 'location' field

查看:159
本文介绍了将完整的日历与Google日历集成在“where”/“location”字段中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将完整的日历与我的Google日历整合在一起,因为我不想在我的网站上与其他人分享活动的所有细节,所以我已经停止了每个活动的点击。我只是想在我忙碌的时候,当我自由时显示。
问题是我甚至想隐藏事件的标题,只显示一个google事件的'location'或'where'字段。虽然我得到的回应包括的位置,我不知道我应该如何得到它并显示。
这是我的代码:

I have integrated full calendar with my Google calendar, I have already disabled on click of each event, because I didn't want to share all the details of an event with others on my website. I just wanted to show when I am busy and when I am free. The problem is that I even want to hide titles of events, and only display the 'location' or 'where' field of a google event. although the response I get includes the location, I don't know how should I get it and display it. Here is my code:

    header: {
        left: 'prev,next today',
        center: 'title',
        right: 'month,agendaWeek,agendaDay'
    },
    events: {
        url: 'https://www.google.com/calendar/feeds/a06g3aano640bal6idonn44ves%40group.calendar.google.com/public/basic',
        className: 'gcal-event',
        color: 'yellow',   // an option!
        textColor: 'black'
    },
    eventRender: function (event, element, view) {
        if ( event.allDay) {
            element.css({'background-color': 'red',
                         'border':'1px solid red'});
        }
    },
    eventClick: function(event) {
        if (event.url) {
            return false;
        }
    },


推荐答案

这并不复杂,只需检查位置是否位于 eventRender 之内。如果是,将其显示为标题,否则显示默认文本:

It's not complicated, just check if the location is set inside eventRender. If it is, show it as title, otherwise show the default text:

var title = ( event.location ) ? event.location : 'Doing something';
element.html(title);

这篇关于将完整的日历与Google日历集成在“where”/“location”字段中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆