Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

加入 Google Calendar 支持,并完成了一个包含前端逻辑的日程页面 #1167

Merged
merged 6 commits into from
Oct 18, 2016
Merged

Conversation

jimzenn
Copy link
Contributor

@jimzenn jimzenn commented Oct 13, 2016

这是一个可以实时显示一定时间范围内的日程的插件(比如4小时前~24小时后)。

我写了 layout/_scripts/third-party/schedule.swig 这个文件,可以在前端读取一个公开的 Google Calendar,并将一定时间范围内的日程展示在 schedule 页面上。只需要有 Google Calendar 的 api_key 和对应 calendar 的 calendar_id 即可。获取的数据暂时存储在 cal_data 这个变量中,merge 到 master 的时候可以去掉。

我没有做美化完全就是个骨架,我相信你对主题更了解,如果你喜欢,你能帮我完成吗?

相关的 API Doc:https://developers.google.com/google-apps/calendar/v3/reference/events/list
获取 API_KEY:https://console.developers.google.com/
如何设置公开的 Google 日历:https://support.google.com/calendar/answer/37083?hl=en

目前的效果
http://blog.zealoft.com/schedule/
screen shot 2016-10-14 at 00 16 38

TODO:

  • i18n
  • 主题适配

@iissnan
Copy link
Owner

iissnan commented Oct 14, 2016

建议将其默认设定改为 inactive 的状态,用户可以根据自己的需要开启。

@iissnan
Copy link
Owner

iissnan commented Oct 14, 2016

样式挺棒的

@jimzenn
Copy link
Contributor Author

jimzenn commented Oct 14, 2016

默认设定应该是disable的,我这两天还会继续改进。这其实是我第一次提交 pull request,希望你能帮我 review 一下,谢谢啦。

On Fri, Oct 14, 2016, 2:39 AM Vi [email protected] wrote:

样式挺棒的


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#1167 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AG8SG3iOn84og3YPeFNQrXuN8ri0lyr0ks5qz03ugaJpZM4KVnhU
.

@@ -33,6 +33,7 @@ menu:
#about: /about
archives: /archives
tags: /tags
schedule: /schedule
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Menu 这边默认是开启的,这个可以在 template 里面去判断是否 enable,然后显示隐藏

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, 好的。我在本地又做了大量优化,但没这两天太忙,没时间拆分支重新 commit,我可能下周再推一个 commit。这个会在下次改过来的。

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Nice

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我看了一下,这个 Menu 的 template 没有对其他的 menu-item 做判断,我觉得判断也有点冗余,我会默认注释掉这个菜单项,但不做逻辑判断了

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

@jimzenn
Copy link
Contributor Author

jimzenn commented Oct 18, 2016

请到 http://blog.zealoft.com/schedule/ 查看实际效果

Copy link
Owner

@iissnan iissnan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice,有一些小调整。希望能调整下,Thanks

@@ -47,6 +48,7 @@ menu_icons:
home: home
about: user
categories: th
#schedule: calendar
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Menu Icon 不注释没有关系


{% block title %} {{ __('title.schedule') }} | {{ config.title }} {% endblock %}

{% block page_class %}page-post-detail{% endblock %}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Page class 可以改成 page-calendar

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我其实不知道这个是什么,只是个 block name?

# API Documentation:
# https://developers.google.com/google-apps/calendar/v3/reference/events/list
calendar:
enable: false
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enable 为 false 之后,底下那些字段都可以 不用注释

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, ok. 我忘了把它关掉了。

@@ -33,6 +33,7 @@ menu:
#about: /about
archives: /archives
tags: /tags
schedule: /schedule
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

@jimzenn
Copy link
Contributor Author

jimzenn commented Oct 18, 2016

还有一个问题,就是因为我调用了 Google Calendar API,这导致了国内打开这个页面可能是空白的(仅仅是日程部分)。

@@ -3,7 +3,7 @@

{% block title %} {{ __('title.schedule') }} | {{ config.title }} {% endblock %}

{% block page_class %}page-post-detail{% endblock %}
{% block page_calendar %}page-post-detail{% endblock %}
Copy link
Owner

@iissnan iissnan Oct 18, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{% block page_class %}page-calendar{% endblock %}

@iissnan
Copy link
Owner

iissnan commented Oct 18, 2016

仅在这个页面调用就没有关系

@jimzenn
Copy link
Contributor Author

jimzenn commented Oct 18, 2016

没有问题的话,merge 入 5.1.0 吧~

@iissnan iissnan merged commit 5aa4418 into iissnan:master Oct 18, 2016
@iissnan
Copy link
Owner

iissnan commented Oct 18, 2016

Thanks. Good job.

@iissnan iissnan added the Docs label Oct 18, 2016
@jimzenn jimzenn deleted the schedule branch October 18, 2016 16:52
@iissnan iissnan added this to the v5.1.0 milestone Oct 19, 2016
@tonydeng
Copy link

tonydeng commented Nov 3, 2016

关注一下这个功能

habren pushed a commit to habren/hexo-theme-next that referenced this pull request Apr 9, 2017
加入 Google Calendar 支持,并完成了一个包含前端逻辑的日程页面
@Vincentqyw
Copy link

同关注!

@jimzenn
Copy link
Contributor Author

jimzenn commented May 2, 2017

这个功能暂时处于 broken 的状态,我现在比较忙,没有时间维护。未来可能会重新支持。
其实我已经实现过多日历共同显示的功能了,只是代码太乱了...

@ivan-nginx ivan-nginx added the Bug label May 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants