candl 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +24 -21
- data/app/views/candl/calendar/_agenda.slim +38 -38
- data/app/views/candl/calendar/_frame.slim +8 -24
- data/app/views/candl/calendar/_month.slim +96 -99
- data/config/locales/de.yml +4 -1
- data/config/locales/en.yml +4 -1
- data/lib/candl/agenda_model.rb +16 -8
- data/lib/candl/event_loader_model.rb +3 -4
- data/lib/candl/month_model.rb +19 -13
- data/lib/candl/version.rb +1 -1
- data/spec/dummy/log/development.log +1112 -0
- data/spec/dummy/log/test.log +140 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/-O/-OuZyMXBCo53DWs3nzu-ipI_pam6RR6vKJXtxIIAmnU.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/-k/-K1Fie3NdcJf56jr8mPldRRDzJNTeh4_vsa18FqND1g.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/2Z/2Z6zeR9_pqCdf0-slDIQTyGsBCtCyrnE4qM0KzNCweY.cache +4 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/33/33qlMuCAp93zrmU4AXC7G1lZdUctPzy3V4yI_dz32DA.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/37/37t8cBi5Ot_JijeK-rrfF963M9V4uwRCiptinpqsSFs.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/3F/3FDl6PkuZftt2ARdyregr01TDi8FlvRFAzLhX-eJP1o.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/4Y/4YWxV6X8L-62hJaV5PwhEix-tMU7OJU9WvIixStA36A.cache +3 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/4u/4uQ6m4x3k5pOmK7CJLB8WHneQkRpVVXgwdZID-75Jak.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/5-/5-ZKN9F2fNqq_8bDZAMnRh3OM71eQRQQF3axD83UaMI.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/6O/6o5qh0hGcBLliuuH20gAF8DHPUrCHa1uJOvYpWHqRAE.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/7v/7VsB1HDDrp4xR8JFw9yUsUdIrIrxiIW3dAgQbYS_xqg.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/8G/8GWrnAJQ7ccsytI_X2A54ORHLB4rDZChfGHZcT0SMoE.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/8o/8O2-MaUZwyfEd7eWh2zCIjPZH_3F0ndH8gDniNlatYQ.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Ay/AyGtSALF4as4M7w8Q304gAgt2ML5UrR_lP611vN1lJg.cache +5 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/BC/bcPJvZScZPAXkLG5kDtk3w7NualOoo-RNea7jWvebgA.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/BM/bMOEJHuqNybAnN2e5H3KnhgDy5RiL6nldLnqqBJCZ7A.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Dg/Dgoulq6UX8tF4AeCtMtEqiAYekcoTRs2FcluLOEnfPg.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Ee/EE4TAIFWksex_ogwdswC1ECxNGs5MIZRMbGng-kD4Gg.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/GU/GUuXNH1ANl0JsukNOIO4Ip3xTqe9Rp832UROR6jCq-4.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/GZ/gziE_dXiUS6_CaXj4gKabwwdugLuAcBy5X4rWaEQNbo.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/HC/HCDOUd7-S45aJ_PjVAC_Vmjyud3i1aQv4cE3t9_Z3Dw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/HY/HY6x2AGLk1f80hwhHwmnj_urVb48VvyYpRaYbQTJiIA.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Id/IdAC_ahCxkVg27zpgOx_lm5udzBGEf-d9Ec4SJdsTVU.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Id/IdJMqrMJUYleQocklKpB10fNYrV29AGPrrzsRPfzmVw.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Iw/IWhWkrXh_r7aVAqUg7JG3RljMc1bcqZCS4RNchl_vFM.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/J8/J83sHh5VcDTYAkDTGUOP-wmL668UPV43ADTfCHWXxqk.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/JE/jEbf5bimr4w2CzQGLBSPEhEMr8ISRMpy7eWCvlE_EqU.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/JG/jGOhbZTT_6X6T6dS8ceQcWKbqtuTRDc-jKo85Sb1lxE.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/KQ/kQrjGUDXOGkcHuvasu7-Q8Ff1bwWyxjhbU-WwIgUrl4.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Kh/KhSdRxAd88HI_d-dtZnBQYzjj5RChfb7VeQcx32glx0.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/L5/l5R8zNFCkXYZ0mKCq-QxcSC7VPEHjYjOCmUOjxL3F6A.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Mh/MhQt37z9hIPIn_UguwqFB63T2daHmL9NlIVNjHzQERY.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Mk/MkV0xX3Lq7SrUcluuf68pak0sN7jRMjfq91ZHa23jhY.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/NU/NUNmx3PBFfclR8ANw7sgdGdrHh9Vmk--XKOaa4dmVv4.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Ph/pHGIOKGPqj6D4T4F_wjdQ0mjGVEz13NsXM36txEhtCw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Q_/Q_FbsoUpy0J0uLj5gPFAa5mtjH3BkzOTv9lMxJc0fNc.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Qq/QQBJATWTrd8yKJPrfVlhqrh3uW_VvmiMbcgBpQKThqI.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/S-/S--d5aRJDmwx9JFjVOHKq7S3fTnIwFuinx5ddJGJEeE.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/TA/TaUBVmOiKqEZ60C4U0MxmY3Im8nn_Lp68MupS6kkMgQ.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/TN/tnJAyKiYcFFyYPofhJTkzFED3UjfhJij29e55YN8Hzk.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/UG/uGzeN4BgbHvi4k4z-4WBvyqFeigTAmy7kRiRIeHu6-M.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Ui/UIRVAD8aR68kJgXhRwZSytLjgKOq0S2XbiLCQ6CdSVE.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/VZ/VZlUPWlEAaZAkUhO58ld86nnhnH5eoxuZ6vN_8yq_3o.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Vq/vQyL48kds8OYuMV4sQgv2sEwwYqWtl7ijVIL5xfLYpY.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Wa/wAKuCh03XLbw_n2QBQZKEiWsu2Q-G4yb41j9oB5hbbA.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/YI/YILD0GXU3KhA3St7SegqxM8-q2oLRUsp-QlJZe1jmvU.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/YI/YImdd_aFw47DKIk2D32E-zSf3xdXCC7JS8qsKrnO3Vg.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/YT/ytuZE33sIoG8-ZWJDaJA-Q91B2d5NEeJX0Y6gvLkdPQ.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Zm/ZmUCQt-mihVvmdXnAtl-mHl0Elg2_kCfpOSeznZBMp4.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Zx/zXXyNb20Py5YWBwoy5r6TgNtiWfpvkyuSDoKj-LxGZU.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/_6/_6cPQIIVPikBIM1TGMWjNoNVbCBlhRa4y7qFGvtnhn0.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ad/ADMeAkaJFzDXz8RNqDqQ9S4qc05Nmo7wLexbebBPXk8.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ba/badSeDdMvZ2LUpo9ZBjedqstJ5FeTa1TDa0WGLLfdjw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/bf/Bf0mwSzs9KfsYO0Q6xOADTYSgoZwQumAmGCHUwfhocI.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/bo/BOynRQJrySSqZJ7QPX3R9arjEoRbWhDPVXU68-4jDro.cache +3 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/cM/cMPW5PIW2be9y60C1f0Tcx_JlbSGxQsrGEvKe0TaxQI.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/cn/cngUxF1y3yln8cZd0TTy5vtmKjB6D_pG2wPUIpcfSiE.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/dH/Dh_HnJ90p1jVRbZeF8VIITXPE1ERfI_JV7xb3TjjK5s.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/dj/djDDOgRO3ImHwH-IWfbmrxJ4Uz8A_RNy4ayggV4Nu2o.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/dn/dnJf0eqwfaXXy8VOlOY--XQ_CzAJRUMcr7VF3MaYPL0.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/dn/dnk1PXaSsx8535n1YUelqcDTCe76x8ZDZ2rx9CFBKVI.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ep/ep7eFHGuQvnQENfjUjkA_uSE4UroidynVQhX4Q4TMRA.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/fM/fMKjz4OTeXFvqJ4wrz5dYcqb72q1qYLsi_xIKo_eP-Y.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/fv/FVUaEmQUfKzrSGelhhxhIMgDGa--Pwq7k5A-2wOquUg.cache +4 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/gR/gr5xKtK3Z16vB0IUAwXIyH0u4BhFxWRyo9N_yvuzj1c.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ga/gaqi__w9GfLCKQZMhFre_f8ptOHW3FQgu30K663f1aA.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/hx/hx3sTij9WJMEmtNYh7AmVx2EEo4_WHqGvMBQEV8HOWQ.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/i3/i3IRVdb5aQh7wlSFumMwLqf-ywVQ9r_I5YAexxiOcm0.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/iz/IzaofNv-1fZa6TILd9gFNykwfzygcX366Q68ng69N7k.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/jV/JVeQ30W8bgmwsx3sv2y3pA5HK0xj_jATaNohkBE7imM.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/m7/m73B2Qjp4zhTY2DBTU0_xLv9aPCPffaWjZmP106qgIo.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/nJ/nj-ghHcaclb76sY0R5gn4tIlUS577savQvgQTdTKJm0.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/na/na2eOzBQo1T309NBkEZ-W7G7HiTgHJ1z6QrsDXOm9bw.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/nf/nffP4GMWcn1fGhlLywhOooggtyLfbthuixLP32hpjUk.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/p7/p7ORDKCfHECYV7pyjA8vxk0qO4Abb3WSr_lKe52DcRQ.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/rY/rYpXNKnUBOApY5AN7Ju9cp8z4XogOarpjSdEqVo_uEo.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/sR/SroEa4R-5BKxQQdiynmGnok3z1Qg0hXhUPrBJs4vEgg.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/tK/tKYvw73bd8hShFOafL-_GThfNfIomo9mapduHjCPGQA.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ut/uTx-CCMEI2s7qS8xgYYoNMofIMzPfurFewEN1GsCQzc.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/vo/VonYUph2e4KyVCQx8J7eNEI3yixQi6RDCI2ZtAIuPis.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/wd/Wd8IeaewxVRi4eebpyGgnctORzjlLuO0NmqjbUDlk20.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/xf/xfMktSuZO9a6Kc_zS5VXZYinUJ7qDMXWdSGByNNfQDY.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/xo/xOoIvshwL_r5QAQeNDyUICSZQAcF9Gjrblr8XRoEZwE.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zL/zLh-QAeJ72_Lsz0dXWrGC6xql3Y4Rx58tf1FY8cS4To.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zO/ZOvSgEsWBXesgrkchzbdqDSSO0xIRbeByft93lW591E.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zY/ZYY_opCdnWzbhXSFbD1odo34MfyX7JaYQqvdovtpE2M.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/za/ZAuUfP5BGr4LY8sRMnPvQC2M9a3LxotLzNAL0PgKMJQ.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zu/zuQ-4u6haTFG6dmj__27YIVnPyHh7hueznjgdOqf9V0.cache +1 -0
- metadata +181 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae5b957c2eb6a2da21113e9fbd401c9e92670d59e2b7cb3bd179fa8330ff8b0d
|
4
|
+
data.tar.gz: 1b9f60b83fc4c6bfcd27c8624d0df0886434c996f544d2918178f9803e2e8739
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7cb797136db669b46393567c0eee45e2510097cc85ae63efe2aef5e00ada2efc00f09a5070f949791fcf6b7d19f76945c29ddb17aae86d13c734c19dc4b477d
|
7
|
+
data.tar.gz: 9f1da686f930b06667f7a59d5839a5d20619b94f0b4bb93c678d34fa5ee352f3f4b1153077b3652bcd8cff1dea2220cebc85b341a85e27e6be7a0e265e70899c
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Candl
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/hicknhack-software/candl.svg?branch=master)](https://travis-ci.org/hicknhack-software/candl)
|
4
|
+
|
3
5
|
This gem helps load and display a calendar from google calendar in an agenda or month style view.
|
4
6
|
|
5
7
|
## Usage
|
@@ -11,7 +13,7 @@ Find an example inclusion of the _frame.slim partial in the show.slim file in ca
|
|
11
13
|
The main steps to use this gem are:
|
12
14
|
- Initialize an agenda or month model object with a config that specifies these values:
|
13
15
|
|
14
|
-
|
16
|
+
```json
|
15
17
|
config = {
|
16
18
|
"calendar": {
|
17
19
|
"google_calendar_api_host_base_path": "https://www.googleapis.com/calendar/v3/calendars/",
|
@@ -31,7 +33,7 @@ config = {
|
|
31
33
|
"maps_query_parameter": "q"
|
32
34
|
}
|
33
35
|
}
|
34
|
-
|
36
|
+
```
|
35
37
|
|
36
38
|
- The node "calendar" holds all relevant information to the chosen calendar that you want to load events from.
|
37
39
|
- Under "general" there is the "maps_query_host" wich is the base url to a map service (like google maps in this example) and the "maps_query_parameter". (Maybe in the future there will be more map services, that let one search for a location just via the url and a parameter. But for now i only found gmaps to be able to do this. Like: https://www.google.de/maps/?q=Dresden+Hauptbahnhof)
|
@@ -67,25 +69,26 @@ require 'candl'
|
|
67
69
|
|
68
70
|
In the view you want the calendar to appear initialize a configuration hash like so:
|
69
71
|
```slim
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
72
|
+
ruby:
|
73
|
+
config = {
|
74
|
+
calendar: {
|
75
|
+
google_calendar_api_host_base_path: "https://www.googleapis.com/calendar/v3/calendars/",
|
76
|
+
calendar_id: "schau-hnh%40web.de",
|
77
|
+
api_key: "AIzaSyB5F1X5hBi8vPsmt1itZTpMluUAjytf6hI"
|
78
|
+
},
|
79
|
+
agenda: {
|
80
|
+
display_day_count: 14,
|
81
|
+
days_shift_coefficient: 7
|
82
|
+
},
|
83
|
+
month: {
|
84
|
+
summary_teaser_length_in_characters: 42,
|
85
|
+
delta_start_of_weekday_from_sunday: 1
|
86
|
+
},
|
87
|
+
general: {
|
88
|
+
maps_query_host: "https://www.google.de/maps",
|
89
|
+
maps_query_parameter: "q",
|
90
|
+
cache_update_interval_in_s: 7200
|
91
|
+
}
|
89
92
|
}
|
90
93
|
```
|
91
94
|
In this example done in a view that uses .slim instead of .erb but in the end config is just a ruby hash that needs to have the right key's and sensible values for them.
|
@@ -1,47 +1,47 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
.
|
4
|
-
|
5
|
-
|
6
|
-
- calendar_agenda.agenda_grouped_events[date].each do |event|
|
2
|
+
.agenda
|
3
|
+
- calendar_agenda.agenda_grouped_events.keys.sort.each do |date|
|
4
|
+
.row_head class=Candl::AgendaModel.emphasize_date(date, Date.today, 'today', 'not_today') = l(date, format: '%A, %e. %B %Y')
|
5
|
+
- calendar_agenda.agenda_grouped_events[date].each do |event|
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
7
|
+
.event_shell
|
8
|
+
.open_more data-id=""
|
9
|
+
.event
|
10
|
+
- if event.dtstart.instance_of?(DateTime)
|
11
|
+
span.time = event.dtstart.localtime.strftime('%k:%M')
|
12
|
+
- else
|
13
|
+
span.time ▶
|
14
|
+
span.flex_wrap_it.breakable.summary{ title = Candl::AgendaModel.summary_title(event) } == event.summary.to_s.force_encoding("UTF-8")
|
15
|
+
i class="material-icons auto_margin_left" arrow_drop_down
|
17
16
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
17
|
+
.details style="display: none;"
|
18
|
+
.timeframe title="Zeitraum"
|
19
|
+
.text
|
20
|
+
span.icon
|
21
|
+
i class="material-icons" date_range
|
22
|
+
span.content
|
23
|
+
- if event.dtstart.instance_of?(DateTime)
|
24
|
+
- if event.dtstart.to_date != event.dtend.to_date
|
25
|
+
= l(event.dtstart.localtime, format: :short) + " - " + l(event.dtend.localtime, format: :short)
|
26
26
|
- else
|
27
|
-
= l(event.dtstart, format: :short) + " - " + l(
|
28
|
-
|
29
|
-
|
30
|
-
.location title="Adresse"
|
31
|
-
.text
|
32
|
-
span.icon
|
33
|
-
i class="material-icons" location_on
|
34
|
-
span.content
|
35
|
-
a href=calendar_agenda.address_to_maps_path(event.location.to_s) target="_blank"
|
36
|
-
.flex_wrap_it.breakable = event.location.to_s.force_encoding("UTF-8")
|
27
|
+
= l(event.dtstart.localtime, format: :short) + " - " + l(event.dtend.localtime, format: :hnh_short)
|
28
|
+
- else
|
29
|
+
= l(event.dtstart, format: :short) + " - " + l((event.dtend - 1.day), format: :short)
|
37
30
|
|
38
|
-
|
39
|
-
.
|
31
|
+
- if !event.location.to_s.strip.empty?
|
32
|
+
.location title="Adresse"
|
40
33
|
.text
|
41
34
|
span.icon
|
42
|
-
i class="material-icons"
|
35
|
+
i class="material-icons" location_on
|
43
36
|
span.content
|
44
|
-
|
37
|
+
a href=calendar_agenda.address_to_maps_path(event.location.to_s) target="_blank"
|
38
|
+
.flex_wrap_it.breakable = event.location.to_s.force_encoding("UTF-8")
|
39
|
+
|
40
|
+
- if !event.description.to_s.strip.empty?
|
41
|
+
.description title="Weitere Beschreibung"
|
42
|
+
.text
|
43
|
+
span.icon
|
44
|
+
i class="material-icons" description
|
45
|
+
span.content
|
46
|
+
.flex_wrap_it.breakable = auto_link(event.description.to_s.force_encoding("UTF-8"), html: { target: '_blank' })
|
45
47
|
|
46
|
-
- else
|
47
|
-
p No upcoming events in the next week.
|
@@ -2,31 +2,16 @@
|
|
2
2
|
- is_month = params[:v] != 'a'
|
3
3
|
- current_shift_factor = params[:s] || 0
|
4
4
|
- date_today = Date.today
|
5
|
-
- update_interval = config[:general][:cache_update_interval_in_s]
|
5
|
+
- update_interval = config[:general][:cache_update_interval_in_s] ||= 2.hours
|
6
6
|
|
7
7
|
- if is_month
|
8
|
-
-
|
9
|
-
-
|
10
|
-
- Candl::MonthModel.new(config, current_shift_factor, date_today)
|
11
|
-
- rescue => exception
|
12
|
-
- events_error_free = false
|
13
|
-
- puts "\033[31mERROR - GOT EXCEPTION:\033[0m"
|
14
|
-
- puts exception
|
15
|
-
/ Maybe there is a beter way to signal the exception?
|
8
|
+
- model = Rails.cache.fetch("#month/#{current_shift_factor}/#{date_today}", expires_in: update_interval) do
|
9
|
+
- Candl::MonthModel.new(config, current_shift_factor, date_today)
|
16
10
|
- else
|
17
|
-
-
|
18
|
-
-
|
19
|
-
|
20
|
-
|
21
|
-
- events_error_free = false
|
22
|
-
- puts "\033[31mERROR - GOT EXCEPTION:\033[0m"
|
23
|
-
- puts exception
|
24
|
-
/ Maybe there is a beter way to signal the exception?
|
25
|
-
|
26
|
-
- if events_error_free
|
27
|
-
- model = (is_month ? month : agenda)
|
28
|
-
|
29
|
-
|
11
|
+
- model = Rails.cache.fetch("#agenda/#{current_shift_factor}/#{date_today}", expires_in: update_interval) do
|
12
|
+
- Candl::AgendaModel.new(config, current_shift_factor, date_today)
|
13
|
+
|
14
|
+
- if model.initialization_successful
|
30
15
|
.popover_backdrop.init_display_none
|
31
16
|
|
32
17
|
div
|
@@ -55,5 +40,4 @@
|
|
55
40
|
= render partial: "candl/calendar/agenda", locals: { calendar_agenda: model }
|
56
41
|
|
57
42
|
- else
|
58
|
-
.error_message
|
59
|
-
|
43
|
+
.error_message 'error.no_events_loaded'
|
@@ -1,97 +1,46 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
- 7
|
1
|
+
table.table.table-bordered.month_view
|
2
|
+
thead
|
3
|
+
colgroup span="7"
|
4
|
+
tr
|
5
|
+
th colspan="7" scope="colgroup" = l((calendar_month.view_dates.select{ |date| date.day == 14 }).first, format: '%B %Y')
|
6
|
+
tr
|
7
|
+
- calendar_month.weekday_dates.each do |date|
|
8
|
+
th.weekday_name_header scope="col" = l(date, format: '%A')
|
9
|
+
|
10
|
+
tbody
|
11
|
+
- Candl::MonthModel.weeks_in_months_view_dates(calendar_month.view_dates).times do |row|
|
12
|
+
tr.day_row
|
13
|
+
- 7.times do |collumn|
|
14
|
+
- current_day = calendar_month.view_dates[7 * row + collumn]
|
15
|
+
td class=Candl::MonthModel.emphasize_date(current_day, Date.today, 'bg-info', 'bg-default')
|
16
|
+
- if current_day.day == 1
|
17
|
+
.day_head = current_day.day.to_s + '. ' + l(current_day, format: '%b.')
|
18
|
+
- else
|
19
|
+
.day_head = current_day.day.to_s
|
20
|
+
|
21
|
+
- weekly_multiday_event_heap = calendar_month.grouped_multiday_events[row]
|
22
|
+
|
23
|
+
- until weekly_multiday_event_heap.empty?
|
24
|
+
tr
|
25
|
+
- collumn = 0
|
26
|
+
- while collumn < 7 do
|
15
27
|
- current_day = calendar_month.view_dates[7 * row + collumn]
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
- else
|
20
|
-
.day_head = current_day.day.to_s
|
28
|
+
- current_event = Candl::MonthModel.find_best_fit_for_day(calendar_month.view_dates[7 * row], current_day, weekly_multiday_event_heap)
|
29
|
+
- if current_event
|
30
|
+
- weekly_multiday_event_heap.delete_if{ |event| event.uid == current_event.uid }
|
21
31
|
|
22
|
-
|
32
|
+
- current_event_length_within_current_week = [(calendar_month.view_dates[7 * row + 6] + 1.day), current_event.dtend].min.to_date - current_day.to_date
|
23
33
|
|
24
|
-
|
25
|
-
tr
|
26
|
-
- collumn = 0
|
27
|
-
- while collumn < 7 do
|
28
|
-
- current_day = calendar_month.view_dates[7 * row + collumn]
|
29
|
-
- current_event = Candl::MonthModel.find_best_fit_for_day(calendar_month.view_dates[7 * row], current_day, weekly_multiday_event_heap)
|
30
|
-
- if current_event
|
31
|
-
- weekly_multiday_event_heap.delete_if{ |event| event.uid == current_event.uid }
|
34
|
+
- collumn += current_event_length_within_current_week - 1
|
32
35
|
|
33
|
-
|
36
|
+
- if current_event_length_within_current_week > 0
|
37
|
+
td.small_padding colspan=current_event_length_within_current_week
|
38
|
+
.multiday_event.onclick_open_backdrop class=Candl::MonthModel.multiday_event_cutoff(current_event.dtstart < current_day, current_event.dtend > (calendar_month.view_dates[7 * row + 6] + 1.day), 'multiday_event_leftcut', 'multiday_event_bothcut', 'multiday_event_rightcut')
|
34
39
|
|
35
|
-
- collumn += current_event_length_within_current_week - 1
|
36
|
-
|
37
|
-
- if current_event_length_within_current_week > 0
|
38
|
-
td.small_padding colspan=current_event_length_within_current_week
|
39
|
-
.multiday_event.onclick_open_backdrop class=Candl::MonthModel.multiday_event_cutoff(current_event.dtstart < current_day, current_event.dtend > (calendar_month.view_dates[7 * row + 6] + 1.day), 'multiday_event_leftcut', 'multiday_event_bothcut', 'multiday_event_rightcut')
|
40
|
-
|
41
|
-
.snowflake_popover[data-placement="bottom" data-toggle="popover" data-container="body" type="button" data-html="true" href="#"]
|
42
|
-
|
43
|
-
div
|
44
|
-
span.summary.breakable{ title = Candl::MonthModel.summary_title(current_event) } == current_event.summary.to_s.force_encoding("UTF-8").truncate(calendar_month.summary_teaser_length().to_i, seperator: ' ')
|
45
|
-
|
46
|
-
.popover_content.hide
|
47
|
-
.close_span
|
48
|
-
.close title='Schließen'
|
49
|
-
i.material-icons close
|
50
|
-
|
51
|
-
.summary title='Zusammenfassung'
|
52
|
-
.text
|
53
|
-
i.material-icons.icon_spacing subject
|
54
|
-
.breakable = current_event.summary.to_s.force_encoding('UTF-8')
|
55
|
-
hr
|
56
|
-
|
57
|
-
.from_to title='Zeitraum'
|
58
|
-
.text
|
59
|
-
i.material-icons.icon_spacing date_range
|
60
|
-
= l(current_event.dtstart, format: :short) + " - " + l((current_event.dtend - 1.day), format: :short)
|
61
|
-
hr
|
62
|
-
|
63
|
-
- if !current_event.location.to_s.strip.empty?
|
64
|
-
.location title='Adresse'
|
65
|
-
.text
|
66
|
-
i.material-icons.icon_spacing location_on
|
67
|
-
a href=calendar_month.address_to_maps_path(current_event.location.to_s).force_encoding('UTF-8') target='_blank'
|
68
|
-
.flex_wrap_it.breakable = current_event.location.to_s.force_encoding('UTF-8')
|
69
|
-
hr
|
70
|
-
|
71
|
-
- if !current_event.description.to_s.strip.empty?
|
72
|
-
.description title='Weitere Beschreibung'
|
73
|
-
.text
|
74
|
-
i.material-icons.icon_spacing description
|
75
|
-
.flex_wrap_it.breakable = auto_link(current_event.description.to_s.force_encoding("UTF-8"), html: { target: '_blank' })
|
76
|
-
- else
|
77
|
-
td
|
78
|
-
|
79
|
-
- collumn += 1
|
80
|
-
|
81
|
-
tr.events_row
|
82
|
-
- 7.times do |collumn|
|
83
|
-
- current_day = calendar_month.view_dates[7 * row + collumn]
|
84
|
-
td class=Candl::MonthModel.emphasize_date(current_day, Date.today, 'bg-info', 'bg-default')
|
85
|
-
|
86
|
-
- if calendar_month.grouped_events[current_day]
|
87
|
-
- calendar_month.grouped_events[current_day].sort_by{ |event| event.dtstart.localtime }.each do |event|
|
88
|
-
|
89
|
-
.event.onclick_open_backdrop
|
90
40
|
.snowflake_popover[data-placement="bottom" data-toggle="popover" data-container="body" type="button" data-html="true" href="#"]
|
91
41
|
|
92
42
|
div
|
93
|
-
span.
|
94
|
-
span.summary.breakable{ title = Candl::MonthModel.summary_title(event) } == event.summary.to_s.force_encoding("UTF-8").truncate(calendar_month.summary_teaser_length.to_i, seperator: ' ')
|
43
|
+
span.summary.breakable{ title = Candl::MonthModel.summary_title(current_event) } == current_event.summary.to_s.force_encoding("UTF-8").truncate(calendar_month.summary_teaser_length().to_i, seperator: ' ')
|
95
44
|
|
96
45
|
.popover_content.hide
|
97
46
|
.close_span
|
@@ -101,29 +50,77 @@
|
|
101
50
|
.summary title='Zusammenfassung'
|
102
51
|
.text
|
103
52
|
i.material-icons.icon_spacing subject
|
104
|
-
.breakable =
|
53
|
+
.breakable = current_event.summary.to_s.force_encoding('UTF-8')
|
105
54
|
hr
|
106
55
|
|
107
56
|
.from_to title='Zeitraum'
|
108
57
|
.text
|
109
58
|
i.material-icons.icon_spacing date_range
|
110
|
-
= l(
|
59
|
+
= l(current_event.dtstart, format: :short) + " - " + l((current_event.dtend - 1.day), format: :short)
|
60
|
+
hr
|
111
61
|
|
112
|
-
- if !
|
113
|
-
hr
|
62
|
+
- if !current_event.location.to_s.strip.empty?
|
114
63
|
.location title='Adresse'
|
115
64
|
.text
|
116
|
-
.icon_spacing
|
117
|
-
|
118
|
-
|
119
|
-
.flex_wrap_it.breakable = event.location.to_s.force_encoding('UTF-8')
|
120
|
-
|
121
|
-
- if !event.description.to_s.strip.empty?
|
65
|
+
i.material-icons.icon_spacing location_on
|
66
|
+
a href=calendar_month.address_to_maps_path(current_event.location.to_s).force_encoding('UTF-8') target='_blank'
|
67
|
+
.flex_wrap_it.breakable = current_event.location.to_s.force_encoding('UTF-8')
|
122
68
|
hr
|
69
|
+
|
70
|
+
- if !current_event.description.to_s.strip.empty?
|
123
71
|
.description title='Weitere Beschreibung'
|
124
72
|
.text
|
125
73
|
i.material-icons.icon_spacing description
|
126
|
-
.flex_wrap_it.breakable = auto_link(
|
74
|
+
.flex_wrap_it.breakable = auto_link(current_event.description.to_s.force_encoding("UTF-8"), html: { target: '_blank' })
|
75
|
+
- else
|
76
|
+
td
|
77
|
+
|
78
|
+
- collumn += 1
|
79
|
+
|
80
|
+
tr.events_row
|
81
|
+
- 7.times do |collumn|
|
82
|
+
- current_day = calendar_month.view_dates[7 * row + collumn]
|
83
|
+
td class=Candl::MonthModel.emphasize_date(current_day, Date.today, 'bg-info', 'bg-default')
|
84
|
+
|
85
|
+
- if calendar_month.grouped_events[current_day]
|
86
|
+
- calendar_month.grouped_events[current_day].sort_by{ |event| event.dtstart.localtime }.each do |event|
|
87
|
+
|
88
|
+
.event.onclick_open_backdrop
|
89
|
+
.snowflake_popover[data-placement="bottom" data-toggle="popover" data-container="body" type="button" data-html="true" href="#"]
|
90
|
+
|
91
|
+
div
|
92
|
+
span.time = event.dtstart.localtime.strftime('%k:%M')
|
93
|
+
span.summary.breakable{ title = Candl::MonthModel.summary_title(event) } == event.summary.to_s.force_encoding("UTF-8").truncate(calendar_month.summary_teaser_length.to_i, seperator: ' ')
|
94
|
+
|
95
|
+
.popover_content.hide
|
96
|
+
.close_span
|
97
|
+
.close title='Schließen'
|
98
|
+
i.material-icons close
|
99
|
+
|
100
|
+
.summary title='Zusammenfassung'
|
101
|
+
.text
|
102
|
+
i.material-icons.icon_spacing subject
|
103
|
+
.breakable = event.summary.to_s.force_encoding('UTF-8')
|
104
|
+
hr
|
105
|
+
|
106
|
+
.from_to title='Zeitraum'
|
107
|
+
.text
|
108
|
+
i.material-icons.icon_spacing date_range
|
109
|
+
= l(event.dtstart.localtime, format: :short) + " - " + l(event.dtend.localtime, format: :hnh_short)
|
110
|
+
|
111
|
+
- if !event.location.to_s.strip.empty?
|
112
|
+
hr
|
113
|
+
.location title='Adresse'
|
114
|
+
.text
|
115
|
+
.icon_spacing
|
116
|
+
i.material-icons location_on
|
117
|
+
a href=calendar_month.address_to_maps_path(event.location.to_s).force_encoding('UTF-8') target='_blank'
|
118
|
+
.flex_wrap_it.breakable = event.location.to_s.force_encoding('UTF-8')
|
119
|
+
|
120
|
+
- if !event.description.to_s.strip.empty?
|
121
|
+
hr
|
122
|
+
.description title='Weitere Beschreibung'
|
123
|
+
.text
|
124
|
+
i.material-icons.icon_spacing description
|
125
|
+
.flex_wrap_it.breakable = auto_link(event.description.to_s.force_encoding("UTF-8"), html: { target: '_blank' })
|
127
126
|
|
128
|
-
- else
|
129
|
-
p No upcoming events in the next week.
|
data/config/locales/de.yml
CHANGED
data/config/locales/en.yml
CHANGED
data/lib/candl/agenda_model.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
module Candl
|
2
2
|
class AgendaModel
|
3
3
|
# Attributes one needs to access from the "outside"
|
4
|
+
attr_reader :initialization_successful
|
5
|
+
|
4
6
|
attr_reader :display_day_count
|
5
7
|
attr_reader :days_shift_coefficient
|
6
8
|
|
@@ -28,20 +30,26 @@ module Candl
|
|
28
30
|
# } \
|
29
31
|
# }
|
30
32
|
def initialize(config, current_shift_factor, date_today = Date.today)
|
31
|
-
self.google_calendar_base_path = config[:calendar][:google_calendar_api_host_base_path]
|
33
|
+
self.google_calendar_base_path = config[:calendar][:google_calendar_api_host_base_path] ||= "https://www.googleapis.com/calendar/v3/calendars/"
|
32
34
|
self.calendar_id = config[:calendar][:calendar_id]
|
33
35
|
self.api_key = config[:calendar][:api_key]
|
34
36
|
|
35
|
-
self.display_day_count = config[:agenda][:display_day_count]
|
36
|
-
self.days_shift_coefficient = config[:agenda][:days_shift_coefficient]
|
37
|
+
self.display_day_count = config[:agenda][:display_day_count] ||= 14
|
38
|
+
self.days_shift_coefficient = config[:agenda][:days_shift_coefficient] ||= 7
|
37
39
|
|
38
|
-
self.maps_query_host = config[:general][:maps_query_host]
|
39
|
-
self.maps_query_parameter = config[:general][:maps_query_parameter]
|
40
|
+
self.maps_query_host = config[:general][:maps_query_host] ||= "https://www.google.de/maps"
|
41
|
+
self.maps_query_parameter = config[:general][:maps_query_parameter] ||= "q"
|
40
42
|
|
41
43
|
from = current_start_date(current_shift_factor, date_today)
|
42
44
|
to = current_end_date(current_shift_factor, date_today)
|
43
45
|
|
44
|
-
|
46
|
+
self.initialization_successful = true
|
47
|
+
begin
|
48
|
+
events = agenda_events(from, to)
|
49
|
+
rescue => exception
|
50
|
+
self.initialization_successful = false
|
51
|
+
logger.error "ERROR: #{exception}"
|
52
|
+
end
|
45
53
|
|
46
54
|
self.agenda_grouped_events = get_days_grouped_events(events)
|
47
55
|
end
|
@@ -101,8 +109,6 @@ module Candl
|
|
101
109
|
|
102
110
|
# build a google maps path from the adress details
|
103
111
|
def address_to_maps_path(address)
|
104
|
-
# URI::HTTP.build( host: maps_query_host, query: { q: address.force_encoding("UTF-8").gsub(" ", "+") }.to_query).to_s
|
105
|
-
|
106
112
|
ActionDispatch::Http::URL.path_for path: maps_query_host, params: Hash[maps_query_parameter.to_s, address.force_encoding("UTF-8").gsub(" ", "+")]
|
107
113
|
end
|
108
114
|
|
@@ -118,6 +124,8 @@ module Candl
|
|
118
124
|
events.group_by { |event| event.dtstart.to_date }
|
119
125
|
end
|
120
126
|
|
127
|
+
attr_writer :initialization_successful
|
128
|
+
|
121
129
|
attr_writer :display_day_count
|
122
130
|
attr_writer :days_shift_coefficient
|
123
131
|
|
@@ -44,7 +44,6 @@ module Candl
|
|
44
44
|
if requested_events["items"] != nil
|
45
45
|
restructured_events = requested_events["items"].map{ |e| e["start"]["dateTime"] != nil ? Event.new(DateTime.parse(e["start"]["dateTime"]), DateTime.parse(e["end"]["dateTime"]), e["summary"], e["description"], e["location"], e["id"]) : Event.new(Date.parse(e["start"]["date"]), Date.parse(e["end"]["date"]), e["summary"], e["description"], e["location"], e["id"]) }
|
46
46
|
else
|
47
|
-
# raise Exception.new("Calendar event request failed and responded with:\n #{requested_events}")
|
48
47
|
raise "Calendar event request failed and responded with:\n #{requested_events}"
|
49
48
|
end
|
50
49
|
|
@@ -55,11 +54,11 @@ module Candl
|
|
55
54
|
def self.spread_multiday_events(events, from, to)
|
56
55
|
unspreaded_events = events.select{ |event| (event.dtend - event.dtstart).to_i > 0 }
|
57
56
|
|
58
|
-
unspreaded_events.map do |event|
|
57
|
+
spreaded_events = unspreaded_events.map do |event|
|
59
58
|
([from, (event.dtstart + 1.day)].max .. [(event.dtend - 1.day), to].min).to_a.map do |date|
|
60
59
|
Event.new.tap do |e|
|
61
|
-
e.dtstart = date
|
62
|
-
e.dtend = event.dtend
|
60
|
+
e.dtstart = date.to_date
|
61
|
+
e.dtend = event.dtend.to_date
|
63
62
|
e.summary = event.summary
|
64
63
|
e.location = event.location
|
65
64
|
e.description = event.description
|
data/lib/candl/month_model.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
module Candl
|
2
2
|
class MonthModel
|
3
3
|
# Attributes one needs to access from the "outside"
|
4
|
+
attr_reader :initialization_successful
|
5
|
+
|
4
6
|
attr_reader :delta_start_of_weekday_from_sunday
|
5
7
|
attr_reader :summary_teaser_length
|
6
8
|
|
@@ -30,25 +32,30 @@ module Candl
|
|
30
32
|
# } \
|
31
33
|
# }
|
32
34
|
def initialize(config, current_shift_factor, date_today = Date.today)
|
33
|
-
self.google_calendar_base_path = config[:calendar][:google_calendar_api_host_base_path]
|
35
|
+
self.google_calendar_base_path = config[:calendar][:google_calendar_api_host_base_path] ||= "https://www.googleapis.com/calendar/v3/calendars/"
|
34
36
|
self.calendar_id = config[:calendar][:calendar_id]
|
35
37
|
self.api_key = config[:calendar][:api_key]
|
36
38
|
|
37
|
-
self.summary_teaser_length = config[:month][:summary_teaser_length_in_characters]
|
38
|
-
self.delta_start_of_weekday_from_sunday = config[:month][:delta_start_of_weekday_from_sunday]
|
39
|
+
self.summary_teaser_length = config[:month][:summary_teaser_length_in_characters] ||= 42
|
40
|
+
self.delta_start_of_weekday_from_sunday = config[:month][:delta_start_of_weekday_from_sunday] ||= 1
|
39
41
|
|
40
|
-
self.days_shift_coefficient = config[:agenda][:days_shift_coefficient]
|
42
|
+
self.days_shift_coefficient = config[:agenda][:days_shift_coefficient] ||= 7
|
41
43
|
|
42
|
-
self.maps_query_host = config[:general][:maps_query_host]
|
43
|
-
self.maps_query_parameter = config[:general][:maps_query_parameter]
|
44
|
-
self.cache_update_interval_in_ms = config[:general][:cache_update_interval_in_ms]
|
44
|
+
self.maps_query_host = config[:general][:maps_query_host] ||= "https://www.google.de/maps"
|
45
|
+
self.maps_query_parameter = config[:general][:maps_query_parameter] ||= "q"
|
45
46
|
|
46
47
|
date_month_start = MonthModel.current_month_start(current_shift_factor, date_today)
|
47
48
|
date_month_end = MonthModel.current_month_end(current_shift_factor, date_today)
|
48
49
|
|
49
50
|
self.view_dates = generate_months_view_dates(date_month_start, date_month_end)
|
50
51
|
|
51
|
-
|
52
|
+
self.initialization_successful = true
|
53
|
+
begin
|
54
|
+
events = get_month_events(view_dates.first, view_dates.last)
|
55
|
+
rescue => exception
|
56
|
+
self.initialization_successful = false
|
57
|
+
logger.error "ERROR: #{exception}"
|
58
|
+
end
|
52
59
|
|
53
60
|
self.grouped_events = MonthModel::group_events(events, view_dates.first, view_dates.last)
|
54
61
|
self.grouped_multiday_events = MonthModel::group_multiday_events(events, view_dates)
|
@@ -119,7 +126,6 @@ module Candl
|
|
119
126
|
|
120
127
|
# build a google maps path from the adress details
|
121
128
|
def address_to_maps_path(address)
|
122
|
-
# URI::HTTP.build( host: maps_query_host, query: { maps_query_parameter: address.force_encoding("UTF-8").gsub(" ", "+") }.to_query).to_s
|
123
129
|
ActionDispatch::Http::URL.path_for path: maps_query_host, params: Hash[maps_query_parameter.to_s, address.force_encoding("UTF-8").gsub(" ", "+")]
|
124
130
|
end
|
125
131
|
|
@@ -175,13 +181,12 @@ module Candl
|
|
175
181
|
|
176
182
|
# gets events within a day grouped by day
|
177
183
|
def self.group_events(events, from, to)
|
178
|
-
|
179
|
-
events.select { |event| event.dtstart.instance_of?(DateTime) }.sort_by{ |event| event.dtstart.localtime }.group_by { |event| event.dtstart.to_date }
|
184
|
+
events.select{ |event| (event.dtstart.to_date == event.dtend.to_date) }.sort_by{ |event| event.dtstart.localtime }.group_by{ |event| event.dtstart.to_date }
|
180
185
|
end
|
181
186
|
|
182
187
|
# gets events that are multiple day's long grouped by the week
|
183
188
|
def self.group_multiday_events(events, view_dates)
|
184
|
-
multiday_events = events.select { |event| event.dtstart.
|
189
|
+
multiday_events = events.select { |event| event.dtstart.to_date != event.dtend.to_date }
|
185
190
|
|
186
191
|
grouped_multiday_events = []
|
187
192
|
|
@@ -197,6 +202,8 @@ module Candl
|
|
197
202
|
grouped_multiday_events
|
198
203
|
end
|
199
204
|
|
205
|
+
attr_writer :initialization_successful
|
206
|
+
|
200
207
|
attr_writer :delta_start_of_weekday_from_sunday
|
201
208
|
attr_writer :summary_teaser_length
|
202
209
|
|
@@ -210,7 +217,6 @@ module Candl
|
|
210
217
|
attr_accessor :google_calendar_base_path
|
211
218
|
attr_accessor :maps_query_host
|
212
219
|
attr_accessor :maps_query_parameter
|
213
|
-
attr_accessor :cache_update_interval_in_ms
|
214
220
|
|
215
221
|
attr_accessor :days_shift_coefficient
|
216
222
|
|
data/lib/candl/version.rb
CHANGED