refinerycms-bookings 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/Gemfile +71 -0
  2. data/Gemfile.lock +270 -0
  3. data/Guardfile +27 -0
  4. data/Rakefile +22 -0
  5. data/app/assets/.DS_Store +0 -0
  6. data/app/assets/images/.DS_Store +0 -0
  7. data/app/assets/images/refinery/.DS_Store +0 -0
  8. data/app/assets/images/refinery/bookings/.DS_Store +0 -0
  9. data/app/assets/images/refinery/bookings/field.png +0 -0
  10. data/app/assets/images/refinery/bookings/rails.png +0 -0
  11. data/app/assets/javascripts/refinery/bookings/admin/backend.js +90 -0
  12. data/app/assets/javascripts/refinery/bookings/datepicker.js +892 -0
  13. data/app/assets/javascripts/refinery/bookings/frontend.js +35 -0
  14. data/app/assets/stylesheets/refinery/bookings/_datepicker.css.scss +131 -0
  15. data/app/assets/stylesheets/refinery/bookings/backend.css.scss +17 -0
  16. data/app/assets/stylesheets/refinery/bookings/frontend.css.scss +31 -0
  17. data/app/controllers/refinery/bookings/admin/bookings_controller.rb +55 -0
  18. data/app/controllers/refinery/bookings/bookings_controller.rb +32 -0
  19. data/app/models/refinery/bookings/booking.rb +15 -0
  20. data/app/views/refinery/bookings/admin/bookings/_actions.html.erb +13 -0
  21. data/app/views/refinery/bookings/admin/bookings/_calendar.html.erb +11 -0
  22. data/app/views/refinery/bookings/admin/bookings/index.html.erb +7 -0
  23. data/app/views/refinery/bookings/bookings/index.html.erb +10 -0
  24. data/config/locales/da.yml +19 -0
  25. data/config/locales/en.yml +19 -0
  26. data/config/routes.rb +20 -0
  27. data/db/migrate/1_create_bookings_bookings.rb +28 -0
  28. data/db/seeds.rb +22 -0
  29. data/lib/generators/refinery/bookings/bookings_generator.rb +25 -0
  30. data/lib/generators/refinery/bookings/templates/config/initializers/refinery/bookings.rb.erb +3 -0
  31. data/lib/refinery/bookings.rb +28 -0
  32. data/lib/refinery/bookings/configuration.rb +9 -0
  33. data/lib/refinery/bookings/engine.rb +24 -0
  34. data/lib/refinery/bookings/version.rb +18 -0
  35. data/lib/refinerycms-bookings.rb +1 -0
  36. data/lib/tasks/refinery/bookings.rake +13 -0
  37. data/pkg/refinerycms-bookings-2.0.4.gem +0 -0
  38. data/readme.md +47 -0
  39. data/refinerycms-bookings.gemspec +26 -0
  40. data/script/rails +10 -0
  41. data/spec/models/refinery/bookings/booking_spec.rb +16 -0
  42. data/spec/requests/refinery/bookings/admin/bookings_spec.rb +13 -0
  43. data/spec/spec_helper.rb +57 -0
  44. data/spec/support/factories/refinery/bookings.rb +1 -0
  45. data/tasks/rspec.rake +6 -0
  46. data/tasks/testing.rake +8 -0
  47. metadata +132 -0
data/Gemfile ADDED
@@ -0,0 +1,71 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem 'refinerycms', '~> 2.0.3'
6
+
7
+ # Database Configuration
8
+ platforms :jruby do
9
+ gem 'activerecord-jdbcsqlite3-adapter'
10
+ gem 'activerecord-jdbcmysql-adapter'
11
+ gem 'activerecord-jdbcpostgresql-adapter'
12
+ gem 'jruby-openssl'
13
+ end
14
+
15
+ platforms :ruby do
16
+ gem 'sqlite3'
17
+ gem 'mysql2'
18
+ gem 'pg'
19
+ end
20
+
21
+ group :development, :test do
22
+ gem 'refinerycms-testing', '~> 2.0.3'
23
+ gem 'guard-rspec', '~> 0.7.0'
24
+
25
+ platforms :mswin, :mingw do
26
+ gem 'win32console', '~> 1.3.0'
27
+ gem 'rb-fchange', '~> 0.0.5'
28
+ gem 'rb-notifu', '~> 0.0.4'
29
+ end
30
+
31
+ platforms :ruby do
32
+ gem 'spork', '~> 0.9.0'
33
+ gem 'guard-spork', '~> 0.5.2'
34
+
35
+ unless ENV['TRAVIS']
36
+ require 'rbconfig'
37
+ if RbConfig::CONFIG['target_os'] =~ /darwin/i
38
+ gem 'rb-fsevent', '~> 0.9.0'
39
+ gem 'ruby_gntp', '~> 0.3.4'
40
+ end
41
+ if RbConfig::CONFIG['target_os'] =~ /linux/i
42
+ gem 'rb-inotify', '~> 0.8.8'
43
+ gem 'libnotify', '~> 0.7.2'
44
+ gem 'therubyracer', '~> 0.10.0'
45
+ end
46
+ end
47
+ end
48
+
49
+ platforms :jruby do
50
+ unless ENV['TRAVIS']
51
+ require 'rbconfig'
52
+ if RbConfig::CONFIG['target_os'] =~ /darwin/i
53
+ gem 'ruby_gntp', '~> 0.3.4'
54
+ end
55
+ if RbConfig::CONFIG['target_os'] =~ /linux/i
56
+ gem 'rb-inotify', '~> 0.8.8'
57
+ gem 'libnotify', '~> 0.7.2'
58
+ end
59
+ end
60
+ end
61
+ end
62
+
63
+ # Gems used only for assets and not required
64
+ # in production environments by default.
65
+ group :assets do
66
+ gem 'sass-rails'
67
+ gem 'coffee-rails'
68
+ gem 'uglifier'
69
+ end
70
+
71
+ gem 'jquery-rails', '~> 2.0.0'
@@ -0,0 +1,270 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ refinerycms-bookings (2.0.3)
5
+ refinerycms-core (~> 2.0.4)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ actionmailer (3.2.5)
11
+ actionpack (= 3.2.5)
12
+ mail (~> 2.4.4)
13
+ actionpack (3.2.5)
14
+ activemodel (= 3.2.5)
15
+ activesupport (= 3.2.5)
16
+ builder (~> 3.0.0)
17
+ erubis (~> 2.7.0)
18
+ journey (~> 1.0.1)
19
+ rack (~> 1.4.0)
20
+ rack-cache (~> 1.2)
21
+ rack-test (~> 0.6.1)
22
+ sprockets (~> 2.1.3)
23
+ activemodel (3.2.5)
24
+ activesupport (= 3.2.5)
25
+ builder (~> 3.0.0)
26
+ activerecord (3.2.5)
27
+ activemodel (= 3.2.5)
28
+ activesupport (= 3.2.5)
29
+ arel (~> 3.0.2)
30
+ tzinfo (~> 0.3.29)
31
+ activeresource (3.2.5)
32
+ activemodel (= 3.2.5)
33
+ activesupport (= 3.2.5)
34
+ activesupport (3.2.5)
35
+ i18n (~> 0.6)
36
+ multi_json (~> 1.0)
37
+ acts_as_indexed (0.7.8)
38
+ addressable (2.2.8)
39
+ arel (3.0.2)
40
+ awesome_nested_set (2.1.3)
41
+ activerecord (>= 3.0.0)
42
+ babosa (0.3.7)
43
+ bcrypt-ruby (3.0.1)
44
+ builder (3.0.0)
45
+ capybara (1.1.2)
46
+ mime-types (>= 1.16)
47
+ nokogiri (>= 1.3.3)
48
+ rack (>= 1.0.0)
49
+ rack-test (>= 0.5.4)
50
+ selenium-webdriver (~> 2.0)
51
+ xpath (~> 0.1.4)
52
+ childprocess (0.3.2)
53
+ ffi (~> 1.0.6)
54
+ coffee-rails (3.2.2)
55
+ coffee-script (>= 2.2.0)
56
+ railties (~> 3.2.0)
57
+ coffee-script (2.2.0)
58
+ coffee-script-source
59
+ execjs
60
+ coffee-script-source (1.3.3)
61
+ database_cleaner (0.7.2)
62
+ devise (2.0.4)
63
+ bcrypt-ruby (~> 3.0)
64
+ orm_adapter (~> 0.0.3)
65
+ railties (~> 3.1)
66
+ warden (~> 1.1.1)
67
+ diff-lcs (1.1.3)
68
+ dragonfly (0.9.12)
69
+ rack
70
+ erubis (2.7.0)
71
+ execjs (1.4.0)
72
+ multi_json (~> 1.0)
73
+ factory_girl (2.6.4)
74
+ activesupport (>= 2.3.9)
75
+ factory_girl_rails (1.7.0)
76
+ factory_girl (~> 2.6.0)
77
+ railties (>= 3.0.0)
78
+ ffi (1.0.11)
79
+ friendly_id (4.0.7)
80
+ globalize3 (0.2.0)
81
+ activemodel (>= 3.0.0)
82
+ activerecord (>= 3.0.0)
83
+ paper_trail (~> 2)
84
+ guard (1.1.1)
85
+ listen (>= 0.4.2)
86
+ thor (>= 0.14.6)
87
+ guard-rspec (0.7.3)
88
+ guard (>= 0.10.0)
89
+ guard-spork (0.5.2)
90
+ guard (>= 0.10.0)
91
+ spork (>= 0.8.4)
92
+ hike (1.2.1)
93
+ i18n (0.6.0)
94
+ journey (1.0.3)
95
+ jquery-rails (2.0.2)
96
+ railties (>= 3.2.0, < 5.0)
97
+ thor (~> 0.14)
98
+ json (1.7.3)
99
+ libwebsocket (0.1.3)
100
+ addressable
101
+ listen (0.4.3)
102
+ rb-fchange (~> 0.0.5)
103
+ rb-fsevent (~> 0.9.1)
104
+ rb-inotify (~> 0.8.8)
105
+ mail (2.4.4)
106
+ i18n (>= 0.4.0)
107
+ mime-types (~> 1.16)
108
+ treetop (~> 1.4.8)
109
+ mime-types (1.18)
110
+ multi_json (1.3.6)
111
+ mysql2 (0.3.11)
112
+ nokogiri (1.5.3)
113
+ orm_adapter (0.0.7)
114
+ paper_trail (2.6.3)
115
+ activerecord (~> 3.0)
116
+ railties (~> 3.0)
117
+ pg (0.13.2)
118
+ polyglot (0.3.3)
119
+ rack (1.4.1)
120
+ rack-cache (1.2)
121
+ rack (>= 0.4)
122
+ rack-ssl (1.3.2)
123
+ rack
124
+ rack-test (0.6.1)
125
+ rack (>= 1.0)
126
+ rails (3.2.5)
127
+ actionmailer (= 3.2.5)
128
+ actionpack (= 3.2.5)
129
+ activerecord (= 3.2.5)
130
+ activeresource (= 3.2.5)
131
+ activesupport (= 3.2.5)
132
+ bundler (~> 1.0)
133
+ railties (= 3.2.5)
134
+ railties (3.2.5)
135
+ actionpack (= 3.2.5)
136
+ activesupport (= 3.2.5)
137
+ rack-ssl (~> 1.3.2)
138
+ rake (>= 0.8.7)
139
+ rdoc (~> 3.4)
140
+ thor (>= 0.14.6, < 2.0)
141
+ rake (0.9.2.2)
142
+ rb-fchange (0.0.5)
143
+ ffi
144
+ rb-fsevent (0.9.1)
145
+ rb-inotify (0.8.8)
146
+ ffi (>= 0.5.0)
147
+ rdoc (3.12)
148
+ json (~> 1.4)
149
+ refinerycms (2.0.4)
150
+ bundler (~> 1.0)
151
+ refinerycms-authentication (= 2.0.4)
152
+ refinerycms-core (= 2.0.4)
153
+ refinerycms-dashboard (= 2.0.4)
154
+ refinerycms-images (= 2.0.4)
155
+ refinerycms-pages (= 2.0.4)
156
+ refinerycms-resources (= 2.0.4)
157
+ refinerycms-authentication (2.0.4)
158
+ devise (~> 2.0.0)
159
+ orm_adapter (~> 0.0.7)
160
+ refinerycms-core (= 2.0.4)
161
+ refinerycms-core (2.0.4)
162
+ acts_as_indexed (~> 0.7.7)
163
+ awesome_nested_set (~> 2.1.3)
164
+ coffee-rails (~> 3.2.1)
165
+ friendly_id (~> 4.0.1)
166
+ globalize3 (~> 0.2.0)
167
+ jquery-rails (~> 2.0.0)
168
+ rails (>= 3.1.3, < 3.3)
169
+ sass-rails (~> 3.2.3)
170
+ truncate_html (~> 0.5)
171
+ uglifier (>= 1.0.3)
172
+ will_paginate (~> 3.0.2)
173
+ refinerycms-dashboard (2.0.4)
174
+ refinerycms-core (= 2.0.4)
175
+ refinerycms-images (2.0.4)
176
+ dragonfly (~> 0.9.8)
177
+ rack-cache (>= 0.5.3)
178
+ refinerycms-core (= 2.0.4)
179
+ refinerycms-pages (2.0.4)
180
+ awesome_nested_set (~> 2.1.3)
181
+ babosa (!= 0.3.6)
182
+ refinerycms-core (= 2.0.4)
183
+ seo_meta (~> 1.3.0)
184
+ refinerycms-resources (2.0.4)
185
+ dragonfly (~> 0.9.8)
186
+ rack-cache (>= 0.5.3)
187
+ refinerycms-core (= 2.0.4)
188
+ refinerycms-testing (2.0.4)
189
+ capybara (~> 1.1.0)
190
+ database_cleaner (~> 0.7.1)
191
+ factory_girl_rails (~> 1.7.0)
192
+ rack-test (~> 0.6.0)
193
+ refinerycms-core (= 2.0.4)
194
+ rspec-rails (~> 2.8.1)
195
+ rspec (2.8.0)
196
+ rspec-core (~> 2.8.0)
197
+ rspec-expectations (~> 2.8.0)
198
+ rspec-mocks (~> 2.8.0)
199
+ rspec-core (2.8.0)
200
+ rspec-expectations (2.8.0)
201
+ diff-lcs (~> 1.1.2)
202
+ rspec-mocks (2.8.0)
203
+ rspec-rails (2.8.1)
204
+ actionpack (>= 3.0)
205
+ activesupport (>= 3.0)
206
+ railties (>= 3.0)
207
+ rspec (~> 2.8.0)
208
+ ruby_gntp (0.3.4)
209
+ rubyzip (0.9.8)
210
+ sass (3.1.19)
211
+ sass-rails (3.2.5)
212
+ railties (~> 3.2.0)
213
+ sass (>= 3.1.10)
214
+ tilt (~> 1.3)
215
+ selenium-webdriver (2.22.2)
216
+ childprocess (>= 0.2.5)
217
+ ffi (~> 1.0)
218
+ libwebsocket (~> 0.1.3)
219
+ multi_json (~> 1.0)
220
+ rubyzip
221
+ seo_meta (1.3.0)
222
+ railties (>= 3.0.0)
223
+ spork (0.9.2)
224
+ sprockets (2.1.3)
225
+ hike (~> 1.2)
226
+ rack (~> 1.0)
227
+ tilt (~> 1.1, != 1.3.0)
228
+ sqlite3 (1.3.6)
229
+ thor (0.15.2)
230
+ tilt (1.3.3)
231
+ treetop (1.4.10)
232
+ polyglot
233
+ polyglot (>= 0.3.1)
234
+ truncate_html (0.5.5)
235
+ tzinfo (0.3.33)
236
+ uglifier (1.2.4)
237
+ execjs (>= 0.3.0)
238
+ multi_json (>= 1.0.2)
239
+ warden (1.1.1)
240
+ rack (>= 1.0)
241
+ will_paginate (3.0.3)
242
+ xpath (0.1.4)
243
+ nokogiri (~> 1.3)
244
+
245
+ PLATFORMS
246
+ ruby
247
+
248
+ DEPENDENCIES
249
+ activerecord-jdbcmysql-adapter
250
+ activerecord-jdbcpostgresql-adapter
251
+ activerecord-jdbcsqlite3-adapter
252
+ coffee-rails
253
+ guard-rspec (~> 0.7.0)
254
+ guard-spork (~> 0.5.2)
255
+ jquery-rails (~> 2.0.0)
256
+ jruby-openssl
257
+ mysql2
258
+ pg
259
+ rb-fchange (~> 0.0.5)
260
+ rb-fsevent (~> 0.9.0)
261
+ rb-notifu (~> 0.0.4)
262
+ refinerycms (~> 2.0.3)
263
+ refinerycms-bookings!
264
+ refinerycms-testing (~> 2.0.3)
265
+ ruby_gntp (~> 0.3.4)
266
+ sass-rails
267
+ spork (~> 0.9.0)
268
+ sqlite3
269
+ uglifier
270
+ win32console (~> 1.3.0)
@@ -0,0 +1,27 @@
1
+ guard 'spork', :wait => 60, :cucumber => false, :rspec_env => { 'RAILS_ENV' => 'test' } do
2
+ watch('config/application.rb')
3
+ watch('config/environment.rb')
4
+ watch(%r{^config/environments/.+\.rb$})
5
+ watch(%r{^config/initializers/.+\.rb$})
6
+ watch('spec/spec_helper.rb')
7
+ watch(%r{^spec/support/.+\.rb$})
8
+ watch(%r{^vendor/extensions/(.+)/spec/support/.+\.rb$})
9
+ end
10
+
11
+ guard 'rspec', :version => 2, :cli => (['~/.rspec', '.rspec'].map{|f| File.read(File.expand_path(f)).split("\n").join(' ') if File.exists?(File.expand_path(f))}.join(' ')) do
12
+ watch(%r{^spec/.+_spec\.rb$})
13
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
14
+ watch('spec/spec_helper.rb') { "spec" }
15
+
16
+ # Rails example
17
+ watch(%r{^spec/.+_spec\.rb$})
18
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
19
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
20
+ watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/requests/#{m[1]}_spec.rb"] }
21
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
22
+ watch('spec/spec_helper.rb') { "spec" }
23
+ watch('config/routes.rb') { "spec/routing" }
24
+ watch('app/controllers/application_controller.rb') { "spec/controllers" }
25
+ # Capybara request specs
26
+ watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
27
+ end
@@ -0,0 +1,22 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ #!/usr/bin/env rake
4
+ begin
5
+ require 'bundler/setup'
6
+ rescue LoadError
7
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
8
+ end
9
+
10
+ ENGINE_PATH = File.dirname(__FILE__)
11
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
12
+
13
+ if File.exists?(APP_RAKEFILE)
14
+ load 'rails/tasks/engine.rake'
15
+ end
16
+
17
+ require "refinerycms-testing"
18
+ Refinery::Testing::Railtie.load_tasks
19
+ Refinery::Testing::Railtie.load_dummy_tasks(ENGINE_PATH)
20
+
21
+ load File.expand_path('../tasks/testing.rake', __FILE__)
22
+ load File.expand_path('../tasks/rspec.rake', __FILE__)
Binary file
@@ -0,0 +1,90 @@
1
+ $(document).ready(function() {
2
+
3
+ function drawCalendar(dates, startDate){
4
+ $('#calendar').html("").DatePicker({
5
+ flat: true,
6
+ date: [],
7
+ current: startDate,
8
+ format: 'd-m-Y',
9
+ calendars: 2,
10
+ mode: 'range',
11
+ onRender: function(date) {
12
+ return {
13
+ className: $.inArray(date.valueOf(), dates) != -1 ? 'datepickerBooked' : false
14
+ }
15
+ },
16
+ locale: {
17
+ days: ["Søndag", "Mandag", "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag", "Søndag"],
18
+ daysShort: ["Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør", "Søn"],
19
+ daysMin: ["Sø", "Ma", "Ti", "On", "To", "Fr", "Lø", "Sø"],
20
+ months: ["Januar", "Februar", "Marts", "April", "Maj", "Juni", "Juli", "August", "September", "Oktober", "November", "December"],
21
+ monthsShort: ["Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"],
22
+ weekMin: 'u.'
23
+ }
24
+ });
25
+
26
+ }
27
+
28
+ $.ajax({
29
+ url: "/refinery/bookings",
30
+ dataType: 'json',
31
+ type: "GET",
32
+ success: function(data, status, xhr) {
33
+ dateArray = []
34
+ for (i = 0; i < data.dates.length; i++){
35
+ date = data.dates[i].split(",");
36
+ dateArray.push(new Date(date[0], date[1], date[2]).valueOf());
37
+ }
38
+ drawCalendar(dateArray, data.start_date.toString());
39
+ }
40
+ });
41
+
42
+ $('#book_action').click(function(event){
43
+ event.preventDefault();
44
+ date = $('#calendar').DatePickerGetDate('d-m-Y')
45
+ $.ajax({
46
+ url: "/refinery/bookings/book",
47
+ dataType: 'json',
48
+ data: {from: date[0], to: date[1]},
49
+ type: "POST",
50
+ beforeSend: function(){
51
+ $('#book_action').addClass('loading');
52
+ },
53
+ complete: function(){
54
+ $('#book_action').removeClass('loading');
55
+ },
56
+ success: function(data, status, xhr) {
57
+ dateArray = []
58
+ for (i = 0; i < data.dates.length; i++){
59
+ dateArray.push(new Date(data.dates[i]).valueOf());
60
+ }
61
+ drawCalendar(dateArray, data.start_date.toString());
62
+ }
63
+ });
64
+ });
65
+
66
+ $('#release_action').click(function(event){
67
+ event.preventDefault();
68
+ date = $('#calendar').DatePickerGetDate('d-m-Y')
69
+ $.ajax({
70
+ url: "/refinery/bookings/release",
71
+ dataType: 'json',
72
+ data: {from: date[0], to: date[1]},
73
+ type: "POST",
74
+ beforeSend: function(){
75
+ $('#release_action').addClass('loading');
76
+ },
77
+ complete: function(){
78
+ $('#release_action').removeClass('loading');
79
+ },
80
+ success: function(data, status, xhr) {
81
+ dateArray = []
82
+ for (i = 0; i < data.dates.length; i++){
83
+ dateArray.push(new Date(data.dates[i]).valueOf());
84
+ }
85
+ drawCalendar(dateArray, data.start_date.toString());
86
+ }
87
+ });
88
+ });
89
+
90
+ });