kalindar 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Gemfile.lock +57 -0
- data/config.json +4 -2
- data/config.ru +2 -0
- data/kalindar.gemspec +1 -0
- data/lib/kalindar/app.rb +37 -4
- data/lib/kalindar/locales/de.yml +2 -0
- data/lib/kalindar/locales/en.yml +2 -0
- data/lib/kalindar/public/kalindar.css +37 -0
- data/lib/kalindar/public/kalindar.js +3 -0
- data/lib/kalindar/version.rb +1 -1
- data/lib/kalindar/views/edit_event.slim +5 -3
- data/lib/kalindar.rb +0 -2
- data/spec/kalindar_spec.rb +2 -3
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ODM4YWQ2ZWIxNzE4NjA1NmZlZmY0NDBhM2QwMTQ1ZWNmMzBlNTg2NQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Y2E2ZWNiYmI1YmU2NjNkZTdjNzFkZWI4NjEwNTRhNDBiMjBlODdjZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
N2JjZDQ1MWY1Mzk3OWVmODExYjNmMmU2NDEyMTNjNzFlYTFiYzA5YjRlNTQz
|
10
|
+
ODJmMDNiNzViYzNjZWRkNWU4OWYwYThjN2M3NDVmY2Q5YTQzN2VjMzljMmVm
|
11
|
+
OTFkMjg1YWFhZjNiMTZkOTcxNTYyY2Q5YmJjNjQ0OWJmOWZkYTA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MjRkYmNhYjE2YTg2Nzc2MDAyNTUzM2ExYjlhYzRjYmEwZWY5NjM3NTBlODY1
|
14
|
+
M2U2ODVmZDRhNmU4Y2I0NjM3Y2VlZDdmNWVmNzc4Njk2ZjJiMTRmMDllOWIz
|
15
|
+
M2JlZjk4ZDI1OTk4ZTE5ZDNhNWJlYjI4YmI5OWJlMjFjOTA4ZTg=
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
<<<<<<< Updated upstream
|
5
|
+
<<<<<<< Updated upstream
|
6
|
+
kalindar (0.1.1)
|
7
|
+
=======
|
8
|
+
kalindar (0.1.0)
|
9
|
+
>>>>>>> Stashed changes
|
10
|
+
=======
|
11
|
+
kalindar (0.1.0)
|
12
|
+
>>>>>>> Stashed changes
|
13
|
+
i18n (~> 0.6)
|
14
|
+
ri_cal (~> 0.8)
|
15
|
+
sinatra (~> 1.4)
|
16
|
+
slim (~> 2.0)
|
17
|
+
|
18
|
+
GEM
|
19
|
+
remote: https://rubygems.org/
|
20
|
+
specs:
|
21
|
+
diff-lcs (1.2.5)
|
22
|
+
i18n (0.6.9)
|
23
|
+
rack (1.5.2)
|
24
|
+
rack-protection (1.5.3)
|
25
|
+
rack
|
26
|
+
rake (10.3.2)
|
27
|
+
ri_cal (0.8.8)
|
28
|
+
rspec (3.0.0)
|
29
|
+
rspec-core (~> 3.0.0)
|
30
|
+
rspec-expectations (~> 3.0.0)
|
31
|
+
rspec-mocks (~> 3.0.0)
|
32
|
+
rspec-core (3.0.3)
|
33
|
+
rspec-support (~> 3.0.0)
|
34
|
+
rspec-expectations (3.0.3)
|
35
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
36
|
+
rspec-support (~> 3.0.0)
|
37
|
+
rspec-mocks (3.0.3)
|
38
|
+
rspec-support (~> 3.0.0)
|
39
|
+
rspec-support (3.0.3)
|
40
|
+
sinatra (1.4.5)
|
41
|
+
rack (~> 1.4)
|
42
|
+
rack-protection (~> 1.4)
|
43
|
+
tilt (~> 1.3, >= 1.3.4)
|
44
|
+
slim (2.0.3)
|
45
|
+
temple (~> 0.6.6)
|
46
|
+
tilt (>= 1.3.3, < 2.1)
|
47
|
+
temple (0.6.8)
|
48
|
+
tilt (1.4.1)
|
49
|
+
|
50
|
+
PLATFORMS
|
51
|
+
ruby
|
52
|
+
|
53
|
+
DEPENDENCIES
|
54
|
+
bundler (~> 1.6)
|
55
|
+
kalindar!
|
56
|
+
rake
|
57
|
+
rspec
|
data/config.json
CHANGED
@@ -5,8 +5,10 @@
|
|
5
5
|
// Specify one or more ics files.
|
6
6
|
// You can skip the list (['one.ics', 'two.ics']) syntax for single ones.
|
7
7
|
// The first calender is the one to be edited.
|
8
|
-
"calendar_files": "kalindar.ics",
|
8
|
+
"calendar_files": ["kalindar.ics", "spec/testcal.ics"],
|
9
9
|
|
10
10
|
// Specify the locale (currently 'de' or 'en').
|
11
|
-
"locale": "de"
|
11
|
+
"locale": "de",
|
12
|
+
|
13
|
+
"preset_locations": ["Kneipe", "gr. Seminarraum"]
|
12
14
|
}
|
data/config.ru
CHANGED
data/kalindar.gemspec
CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_dependency "sinatra", "~> 1.4"
|
23
23
|
spec.add_dependency "slim", "~> 2.0"
|
24
24
|
spec.add_dependency "i18n", "~> 0.6"
|
25
|
+
spec.add_dependency "listen"
|
25
26
|
|
26
27
|
spec.add_development_dependency "bundler", "~> 1.6"
|
27
28
|
spec.add_development_dependency "rake"
|
data/lib/kalindar/app.rb
CHANGED
@@ -5,17 +5,33 @@ require 'sinatra/base'
|
|
5
5
|
require 'slim'
|
6
6
|
require 'i18n'
|
7
7
|
require 'i18n/backend/fallbacks'
|
8
|
+
require 'listen'
|
8
9
|
|
9
10
|
# Sinatra App for Kalindar, show ics files.
|
10
11
|
class KalindarApp < Sinatra::Base
|
11
12
|
$conf = JSON.load(File.new('config.json'))
|
12
|
-
|
13
|
+
|
14
|
+
# Read in calendar files, fill global cal var.
|
15
|
+
def load_global_cal
|
16
|
+
$cal = EventCalendar.new($conf['calendar_files'])
|
17
|
+
end
|
18
|
+
|
19
|
+
load_global_cal
|
13
20
|
|
14
21
|
configure do
|
15
22
|
I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
|
16
23
|
I18n.load_path = Dir[File.join(settings.root, 'locales', '*.yml')]
|
17
24
|
I18n.backend.load_translations
|
18
25
|
I18n.default_locale = $conf['locale'].to_sym
|
26
|
+
|
27
|
+
# Watch for calendar file changes.
|
28
|
+
[*$conf['calendar_files']].each do |file|
|
29
|
+
path = Pathname.new(file).realpath
|
30
|
+
dir = path.dirname.to_s
|
31
|
+
base = path.basename.to_s
|
32
|
+
listener = Listen.to(dir, only: /#{base}/) { load_global_cal }
|
33
|
+
listener.start
|
34
|
+
end
|
19
35
|
end
|
20
36
|
|
21
37
|
# Will use http-verb PUT
|
@@ -69,11 +85,14 @@ class KalindarApp < Sinatra::Base
|
|
69
85
|
get '/events/twoday' do
|
70
86
|
@events = {}
|
71
87
|
# events from today to in 30 days
|
72
|
-
(DateTime.now .. DateTime.now +
|
88
|
+
(DateTime.now .. DateTime.now + 2).each do |day|
|
73
89
|
#@events[d] = $cal.events_for(d)
|
74
90
|
@events[day] = $cal.find_events day.to_date
|
75
91
|
end
|
76
|
-
|
92
|
+
|
93
|
+
#@events = @events.values.flatten.sort_by {|e| e.start_time}
|
94
|
+
@today = Date.today
|
95
|
+
@tomorrow = @today + 1
|
77
96
|
slim :twoday_list
|
78
97
|
end
|
79
98
|
|
@@ -85,7 +104,9 @@ class KalindarApp < Sinatra::Base
|
|
85
104
|
end
|
86
105
|
begin
|
87
106
|
event = Event.create_from_params params
|
88
|
-
rescue
|
107
|
+
rescue Exception => e
|
108
|
+
puts e.inspect
|
109
|
+
puts e.backtrace
|
89
110
|
return 502, "Eingabefehler"
|
90
111
|
end
|
91
112
|
|
@@ -140,4 +161,16 @@ class KalindarApp < Sinatra::Base
|
|
140
161
|
$cal.calendars.first.write_back!
|
141
162
|
redirect '/'
|
142
163
|
end
|
164
|
+
|
165
|
+
post '/events/full' do
|
166
|
+
params[:calendars]
|
167
|
+
@events = {}
|
168
|
+
# events from today to in 30 days
|
169
|
+
(DateTime.now .. DateTime.now + 30).each do |day|
|
170
|
+
#@events[d] = $cal.events_for(d)
|
171
|
+
# bring chosen calendars into equation
|
172
|
+
@events[day] = $cal.find_events day.to_date
|
173
|
+
end
|
174
|
+
slim :event_list
|
175
|
+
end
|
143
176
|
end
|
data/lib/kalindar/locales/de.yml
CHANGED
data/lib/kalindar/locales/en.yml
CHANGED
@@ -6,6 +6,11 @@
|
|
6
6
|
margin: 0 0 0 0;
|
7
7
|
padding: 0 0 0 0;
|
8
8
|
border-bottom: solid 1px black;
|
9
|
+
background-image: -moz-linear-gradient(
|
10
|
+
center top,
|
11
|
+
rgb(180,180,180) 0%,
|
12
|
+
rgb(220,220,220) 100%
|
13
|
+
);
|
9
14
|
}
|
10
15
|
ul.day_list {
|
11
16
|
list-style: none;
|
@@ -23,6 +28,20 @@ li.day {
|
|
23
28
|
border-right: solid 1px;
|
24
29
|
background-color: #F4F4F4;
|
25
30
|
margin-bottom: 0.5em;
|
31
|
+
background-image: -webkit-gradient(
|
32
|
+
linear,
|
33
|
+
left top,
|
34
|
+
left bottom,
|
35
|
+
color-stop(0.5, rgb(221,221,221)),
|
36
|
+
color-stop(0.5, rgb(255,255,255))
|
37
|
+
);
|
38
|
+
background-image: -moz-linear-gradient(
|
39
|
+
center top,
|
40
|
+
rgb(221,221,221) 50%,
|
41
|
+
rgb(255,255,255) 50%
|
42
|
+
);
|
43
|
+
-moz-box-shadow: inset 0 0 10px #000000;
|
44
|
+
box-shadow: inset 0 0 10px #000000;
|
26
45
|
}
|
27
46
|
|
28
47
|
li.saturday {
|
@@ -53,6 +72,18 @@ ul.event_list {
|
|
53
72
|
ul.event_list li {
|
54
73
|
margin-left: 0.1em;
|
55
74
|
clear: both;
|
75
|
+
background-image: -webkit-gradient(
|
76
|
+
linear,
|
77
|
+
left top,
|
78
|
+
left bottom,
|
79
|
+
color-stop(0.5, rgb(000,221,221)),
|
80
|
+
color-stop(0.5, rgb(255,255,255))
|
81
|
+
);
|
82
|
+
background-image: -moz-linear-gradient(
|
83
|
+
center top,
|
84
|
+
rgb(180,180,180) 0%,
|
85
|
+
rgb(220,220,220) 100%
|
86
|
+
);
|
56
87
|
}
|
57
88
|
|
58
89
|
#event {
|
@@ -86,3 +117,9 @@ ul.event_list li {
|
|
86
117
|
#edit_event_link {
|
87
118
|
margin-left: 1em;
|
88
119
|
}
|
120
|
+
|
121
|
+
ul.twoday_list {
|
122
|
+
}
|
123
|
+
|
124
|
+
ul.twoday_list {
|
125
|
+
}
|
@@ -18,6 +18,9 @@
|
|
18
18
|
"#show_new_event_link".onClick(function() {
|
19
19
|
console.log(this.parent().first('#day_hidden_input').value());
|
20
20
|
day = this.parent().first('#day_hidden_input').value();
|
21
|
+
/*
|
22
|
+
* this.parent().first('.new_event_mask').load('/event/new/' + day);
|
23
|
+
*/
|
21
24
|
this.parent().first('.hidden_new_event_mask').fade();
|
22
25
|
return false;
|
23
26
|
});
|
data/lib/kalindar/version.rb
CHANGED
@@ -28,10 +28,12 @@ form.pure-form.pure-form-stacked action="/event/edit/#{event.uid}" method="post"
|
|
28
28
|
option value="60m" = t '60m'
|
29
29
|
option value="90m" = t '90m'
|
30
30
|
option value="120m" = t '120m'
|
31
|
-
option value="whole" = t 'whole_day'
|
31
|
+
/option value="whole" = t 'whole_day'
|
32
32
|
option value="1d" = t '1d'
|
33
33
|
option value="2d" = t '2d'
|
34
34
|
option value="5d" = t '5d'
|
35
35
|
option value="1w" = t '1w'
|
36
|
-
button.pure-button name="submitbutton" type="submit" value="save"
|
37
|
-
|
36
|
+
button.pure-button name="submitbutton" type="submit" value="save"
|
37
|
+
= t 'save'
|
38
|
+
button.pure-button name="submitbutton" type="submit" value="cancel"
|
39
|
+
= t 'cancel'
|
data/lib/kalindar.rb
CHANGED
data/spec/kalindar_spec.rb
CHANGED
@@ -60,15 +60,13 @@ describe EventCalendar do
|
|
60
60
|
event_names = events.map(&:summary)
|
61
61
|
expect(event_names).to eq ["allday", "onehour", "daily", "daily"]
|
62
62
|
end
|
63
|
-
end
|
64
|
-
|
65
|
-
describe "#events_in" do
|
66
63
|
it '#events_in by day' do
|
67
64
|
events = subject.events_in(Date.new(2014, 7, 27), Date.new(2014, 7, 28))
|
68
65
|
event_names = events.map(&:summary)
|
69
66
|
expect(event_names).to eq ["allday", "onehour", "daily", "allday", "daily"]
|
70
67
|
expect(event_names.class).to eq({}.class)
|
71
68
|
end
|
69
|
+
# multiday events!
|
72
70
|
it 'wraps in Event Delegate' do
|
73
71
|
events = subject.events_in(Date.new(2014, 7, 27), Date.new(2014, 7, 28))
|
74
72
|
expect(events.collect{|e| e.is_a? Event}.length).to eq events.length
|
@@ -124,6 +122,7 @@ describe "Event" do
|
|
124
122
|
expect(multiday_event.time_f Date.new(2014, 7, 27)).to eq "..."
|
125
123
|
end
|
126
124
|
end
|
125
|
+
|
127
126
|
describe "#from_to_f" do
|
128
127
|
it "returns the from to time" do
|
129
128
|
expect(events[0].from_to_f).to eq "27.08. 12:00 - 28.08. 13:00"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kalindar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felix Wolfsteller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ri_cal
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.6'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: listen
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: bundler
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -119,6 +133,7 @@ files:
|
|
119
133
|
- .rspec
|
120
134
|
- .travis.yml
|
121
135
|
- Gemfile
|
136
|
+
- Gemfile.lock
|
122
137
|
- LICENSE.txt
|
123
138
|
- Procfile
|
124
139
|
- README.md
|
@@ -177,3 +192,4 @@ test_files:
|
|
177
192
|
- spec/kalindar_spec.rb
|
178
193
|
- spec/spec_helper.rb
|
179
194
|
- spec/testcal.ics
|
195
|
+
has_rdoc:
|