date_book 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. checksums.yaml +7 -0
  2. data/.idea/vcs.xml +6 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +23 -0
  5. data/.rubocop_todo.yml +7 -0
  6. data/.ruby-gemset +1 -0
  7. data/.ruby-version +1 -0
  8. data/.travis.yml +3 -0
  9. data/Gemfile +94 -0
  10. data/Gemfile.lock +385 -0
  11. data/LICENSE.txt +20 -0
  12. data/README.md +64 -0
  13. data/Rakefile +30 -0
  14. data/VERSION +1 -0
  15. data/app/assets/images/date_book/.keep +0 -0
  16. data/app/assets/javascripts/date_book.js +21 -0
  17. data/app/assets/javascripts/date_book/calendar_events.js +57 -0
  18. data/app/assets/javascripts/date_book/event_form.js +31 -0
  19. data/app/assets/javascripts/date_book/popovers.js +3 -0
  20. data/app/assets/javascripts/date_book/wysiwyg.js +8 -0
  21. data/app/assets/stylesheets/date_book.css.scss +46 -0
  22. data/app/controllers/date_book/calendars_controller.rb +60 -0
  23. data/app/controllers/date_book/date_book_controller.rb +24 -0
  24. data/app/controllers/date_book/events_controller.rb +105 -0
  25. data/app/controllers/date_book/graphql_controller.rb +35 -0
  26. data/app/graphql/date_book_schema.rb +18 -0
  27. data/app/graphql/types/calendar_type.rb +14 -0
  28. data/app/graphql/types/date_time_type.rb +7 -0
  29. data/app/graphql/types/event_occurrence_type.rb +11 -0
  30. data/app/graphql/types/event_type.rb +19 -0
  31. data/app/graphql/types/mutation_type.rb +5 -0
  32. data/app/graphql/types/profile_type.rb +7 -0
  33. data/app/graphql/types/query_type.rb +57 -0
  34. data/app/helpers/date_book/application_helper.rb +35 -0
  35. data/app/helpers/date_book/calendar_helper.rb +4 -0
  36. data/app/helpers/date_book/events_helper.rb +42 -0
  37. data/app/jobs/date_book/application_job.rb +6 -0
  38. data/app/mailers/date_book/application_mailer.rb +9 -0
  39. data/app/views/date_book/application/_all_day_checkbox.html.haml +1 -0
  40. data/app/views/date_book/application/_date_range.html.haml +8 -0
  41. data/app/views/date_book/application/_wysiwyg.html.haml +65 -0
  42. data/app/views/date_book/calendars/_form.html.haml +6 -0
  43. data/app/views/date_book/calendars/edit.html.haml +5 -0
  44. data/app/views/date_book/calendars/index.html.haml +28 -0
  45. data/app/views/date_book/calendars/new.html.haml +5 -0
  46. data/app/views/date_book/calendars/show.html.haml +28 -0
  47. data/app/views/date_book/events/_event.json.jbuilder +12 -0
  48. data/app/views/date_book/events/_form.html.haml +16 -0
  49. data/app/views/date_book/events/_occurrence_dates.html.haml +11 -0
  50. data/app/views/date_book/events/edit.html.haml +5 -0
  51. data/app/views/date_book/events/fields/_date.html.haml +1 -0
  52. data/app/views/date_book/events/fields/_day.html.haml +1 -0
  53. data/app/views/date_book/events/fields/_day_of_week.html.haml +19 -0
  54. data/app/views/date_book/events/fields/_duration.html.haml +6 -0
  55. data/app/views/date_book/events/fields/_interval.html.haml +1 -0
  56. data/app/views/date_book/events/fields/_time.html.haml +1 -0
  57. data/app/views/date_book/events/index.html.haml +16 -0
  58. data/app/views/date_book/events/new.html.haml +5 -0
  59. data/app/views/date_book/events/popover.html.haml +7 -0
  60. data/app/views/date_book/events/rules/_daily.html.haml +4 -0
  61. data/app/views/date_book/events/rules/_monthly.html.haml +5 -0
  62. data/app/views/date_book/events/rules/_singular.html.haml +4 -0
  63. data/app/views/date_book/events/rules/_weekly.html.haml +5 -0
  64. data/app/views/date_book/events/show.html.haml +16 -0
  65. data/app/views/layouts/_date_book_scripts.html.haml +4 -0
  66. data/app/views/layouts/blank.html.haml +1 -0
  67. data/bin/rails +15 -0
  68. data/config/locales/en.yml +44 -0
  69. data/config/routes.rb +12 -0
  70. data/date_book.gemspec +337 -0
  71. data/db/migrate/20170807133845_create_calendars.rb +11 -0
  72. data/db/migrate/20170807133846_create_events.rb +20 -0
  73. data/db/migrate/20170807133847_create_schedules.rb +25 -0
  74. data/db/migrate/20170807133848_add_fields_to_schedule.rb +6 -0
  75. data/db/migrate/20170807133849_create_event_occurrences.rb +16 -0
  76. data/db/migrate/20170807133850_add_fields_to_event_occurrences.rb +5 -0
  77. data/lib/date_book.rb +40 -0
  78. data/lib/date_book/concerns/ability.rb +27 -0
  79. data/lib/date_book/concerns/acts_as_calendar.rb +29 -0
  80. data/lib/date_book/concerns/acts_as_event.rb +66 -0
  81. data/lib/date_book/concerns/acts_as_event_occurrence.rb +67 -0
  82. data/lib/date_book/concerns/acts_as_ownable.rb +29 -0
  83. data/lib/date_book/concerns/acts_as_owner.rb +18 -0
  84. data/lib/date_book/concerns/acts_as_schedule.rb +44 -0
  85. data/lib/date_book/configuration.rb +43 -0
  86. data/lib/date_book/engine.rb +40 -0
  87. data/lib/date_book/localization.rb +32 -0
  88. data/lib/date_book/version.rb +8 -0
  89. data/lib/generators/date_book/install/install_generator.rb +110 -0
  90. data/lib/generators/date_book/install/templates/app/models/ability.rb +16 -0
  91. data/lib/generators/date_book/install/templates/app/models/calendar.rb +3 -0
  92. data/lib/generators/date_book/install/templates/app/models/event.rb +3 -0
  93. data/lib/generators/date_book/install/templates/app/models/event_occurrence.rb +3 -0
  94. data/lib/generators/date_book/install/templates/app/models/schedule.rb +3 -0
  95. data/lib/generators/date_book/install/templates/config/initializers/date_book.rb +5 -0
  96. data/lib/generators/date_book/utils.rb +25 -0
  97. data/lib/tasks/date_book_tasks.rake +5 -0
  98. data/spec/abilities/calendar_spec.rb +39 -0
  99. data/spec/abilities/event_spec.rb +44 -0
  100. data/spec/controllers/date_book/calendars_controller_spec.rb +259 -0
  101. data/spec/controllers/date_book/events_controller_spec.rb +283 -0
  102. data/spec/dummy/Rakefile +9 -0
  103. data/spec/dummy/app/assets/config/manifest.js +5 -0
  104. data/spec/dummy/app/assets/images/.keep +0 -0
  105. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  106. data/spec/dummy/app/assets/stylesheets/application.css.scss +4 -0
  107. data/spec/dummy/app/assets/stylesheets/bootstrap-everything.scss +54 -0
  108. data/spec/dummy/app/controllers/application_controller.rb +21 -0
  109. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  110. data/spec/dummy/app/helpers/application_helper.rb +4 -0
  111. data/spec/dummy/app/mailers/application_mailer.rb +6 -0
  112. data/spec/dummy/app/models/ability.rb +16 -0
  113. data/spec/dummy/app/models/application_record.rb +5 -0
  114. data/spec/dummy/app/models/calendar.rb +3 -0
  115. data/spec/dummy/app/models/concerns/.keep +0 -0
  116. data/spec/dummy/app/models/event.rb +3 -0
  117. data/spec/dummy/app/models/event_occurrence.rb +3 -0
  118. data/spec/dummy/app/models/role.rb +13 -0
  119. data/spec/dummy/app/models/schedule.rb +3 -0
  120. data/spec/dummy/app/models/user.rb +9 -0
  121. data/spec/dummy/app/views/application/403.html.haml +9 -0
  122. data/spec/dummy/app/views/application/404.html.haml +9 -0
  123. data/spec/dummy/app/views/layouts/application.html.haml +43 -0
  124. data/spec/dummy/app/views/pages/index.html.haml +1 -0
  125. data/spec/dummy/bin/bundle +5 -0
  126. data/spec/dummy/bin/rails +6 -0
  127. data/spec/dummy/bin/rake +6 -0
  128. data/spec/dummy/bin/setup +36 -0
  129. data/spec/dummy/bin/update +31 -0
  130. data/spec/dummy/config.ru +7 -0
  131. data/spec/dummy/config/application.rb +38 -0
  132. data/spec/dummy/config/boot.rb +7 -0
  133. data/spec/dummy/config/cable.yml +9 -0
  134. data/spec/dummy/config/database.yml +25 -0
  135. data/spec/dummy/config/environment.rb +7 -0
  136. data/spec/dummy/config/environments/development.rb +60 -0
  137. data/spec/dummy/config/environments/test.rb +45 -0
  138. data/spec/dummy/config/initializers/application_controller_renderer.rb +7 -0
  139. data/spec/dummy/config/initializers/assets.rb +14 -0
  140. data/spec/dummy/config/initializers/backtrace_silencers.rb +10 -0
  141. data/spec/dummy/config/initializers/bootstrap_leather.rb +9 -0
  142. data/spec/dummy/config/initializers/cookies_serializer.rb +7 -0
  143. data/spec/dummy/config/initializers/date_book.rb +5 -0
  144. data/spec/dummy/config/initializers/devise.rb +277 -0
  145. data/spec/dummy/config/initializers/filter_parameter_logging.rb +6 -0
  146. data/spec/dummy/config/initializers/high_voltage.rb +3 -0
  147. data/spec/dummy/config/initializers/inflections.rb +17 -0
  148. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  149. data/spec/dummy/config/initializers/new_framework_defaults.rb +29 -0
  150. data/spec/dummy/config/initializers/rolify.rb +7 -0
  151. data/spec/dummy/config/initializers/session_store.rb +5 -0
  152. data/spec/dummy/config/initializers/wrap_parameters.rb +17 -0
  153. data/spec/dummy/config/locales/devise.en.yml +64 -0
  154. data/spec/dummy/config/locales/en.yml +23 -0
  155. data/spec/dummy/config/puma.rb +49 -0
  156. data/spec/dummy/config/routes.rb +15 -0
  157. data/spec/dummy/config/secrets.yml +22 -0
  158. data/spec/dummy/config/spring.rb +8 -0
  159. data/spec/dummy/db/migrate/20170728171103_create_users_table.rb +7 -0
  160. data/spec/dummy/db/migrate/20170807134122_add_devise_to_users.rb +49 -0
  161. data/spec/dummy/db/migrate/20170807134128_rolify_create_roles.rb +19 -0
  162. data/spec/dummy/db/migrate/20170807134137_create_calendars.date_book.rb +12 -0
  163. data/spec/dummy/db/migrate/20170807134138_create_events.date_book.rb +21 -0
  164. data/spec/dummy/db/migrate/20170807134139_create_schedules.date_book.rb +26 -0
  165. data/spec/dummy/db/migrate/20170807134140_add_fields_to_schedule.date_book.rb +7 -0
  166. data/spec/dummy/db/migrate/20170807134141_create_event_occurrences.date_book.rb +17 -0
  167. data/spec/dummy/db/migrate/20170807134142_add_fields_to_event_occurrences.date_book.rb +6 -0
  168. data/spec/dummy/db/schema.rb +101 -0
  169. data/spec/dummy/db/seeds.rb +0 -0
  170. data/spec/dummy/db/seeds/calendars.seeds.rb +22 -0
  171. data/spec/dummy/db/seeds/events.seeds.rb +89 -0
  172. data/spec/dummy/db/seeds/users.seeds.rb +16 -0
  173. data/spec/dummy/lib/assets/.keep +0 -0
  174. data/spec/dummy/lib/basic_benchmark.rb +9 -0
  175. data/spec/dummy/log/.keep +0 -0
  176. data/spec/factories/calendars.rb +11 -0
  177. data/spec/factories/events.rb +12 -0
  178. data/spec/factories/roles.rb +5 -0
  179. data/spec/factories/users.rb +9 -0
  180. data/spec/features/calendars_spec.rb +185 -0
  181. data/spec/features/events_spec.rb +201 -0
  182. data/spec/helpers/date_book/calendar_helper_spec.rb +17 -0
  183. data/spec/helpers/date_book/events_helper_spec.rb +17 -0
  184. data/spec/models/calendar_spec.rb +26 -0
  185. data/spec/models/event_spec.rb +67 -0
  186. data/spec/models/role_spec.rb +5 -0
  187. data/spec/rails_helper.rb +116 -0
  188. data/spec/requests/date_book/events_spec.rb +56 -0
  189. data/spec/routing/date_book/calendars_routing_spec.rb +49 -0
  190. data/spec/routing/date_book/events_routing_spec.rb +54 -0
  191. data/spec/spec_helper.rb +102 -0
  192. data/spec/support/controller_behaviors.rb +101 -0
  193. data/spec/support/controller_macros.rb +25 -0
  194. data/spec/support/factory_girl.rb +3 -0
  195. data/spec/support/feature_behaviors.rb +150 -0
  196. data/spec/support/loaded_site.rb +5 -0
  197. data/spec/support/loaded_site/calendars.rb +5 -0
  198. data/spec/support/loaded_site/events.rb +6 -0
  199. data/spec/support/loaded_site/users.rb +5 -0
  200. data/spec/support/request_behaviors.rb +89 -0
  201. data/spec/support/shared_connection.rb +14 -0
  202. data/spec/support/utilities.rb +53 -0
  203. metadata +817 -0
@@ -0,0 +1,283 @@
1
+ require 'rails_helper'
2
+
3
+ module DateBook
4
+ RSpec.describe EventsController, folder: :controllers do
5
+ routes { DateBook::Engine.routes }
6
+
7
+ include_context 'loaded site'
8
+ include ControllerMacros
9
+
10
+ # This should return the minimal set of attributes required to create a valid
11
+ # Event. As you add validations to Event, be sure to
12
+ # adjust the attributes here as well.
13
+ let(:valid_attributes) {
14
+ { name: 'Test Event', schedule_attributes: { date: 1.hour.ago.to_date, time: 1.hour.ago} }
15
+ }
16
+
17
+ let(:invalid_attributes) {
18
+ { name: nil, schedule_attributes: nil }
19
+ }
20
+
21
+ describe 'GET #index' do
22
+ describe 'without a query' do
23
+ before do
24
+ get :index, params: { calendar_id: 'admin-calendar' }
25
+ end
26
+ it_should_behave_like 'a successful page', which_renders: 'index'
27
+
28
+ describe 'loads events into @events' do
29
+ subject { assigns(:events) }
30
+ it { should include yesterdays_event }
31
+ it { should include tomorrows_event }
32
+ end
33
+ end
34
+ describe 'with a query' do
35
+ before do
36
+ get :index, params: { start: Time.zone.now, calendar_id: 'admin-calendar' }
37
+ end
38
+ it_should_behave_like 'a successful page', which_renders: 'index'
39
+
40
+ describe 'loads events into @events' do
41
+ subject { assigns(:events) }
42
+ it { should_not include yesterdays_event }
43
+ it { should include tomorrows_event }
44
+ end
45
+ end
46
+ end
47
+
48
+ describe 'GET #show' do
49
+ before do
50
+ get :show, params: { id: 'the-work-week', calendar_id: 'admin-calendar' }
51
+ end
52
+ it_should_behave_like 'a successful page', which_renders: 'show'
53
+ end
54
+
55
+ describe 'GET #popover' do
56
+ before do
57
+ get :popover, params: { id: 'the-work-week', calendar_id: 'admin-calendar' }
58
+ end
59
+ it_should_behave_like 'a successful page', which_renders: 'popover'
60
+ end
61
+
62
+ describe 'GET #new' do
63
+ describe 'when not logged in' do
64
+ before do
65
+ # Here's where we are *not* logging in
66
+ get :new, params: { calendar_id: 'regular-calendar'}
67
+ end
68
+ it_should_behave_like 'a redirect to the home page'
69
+ end
70
+ describe 'when logged in' do
71
+ before do
72
+ login_user regular_user
73
+ get :new, params: { calendar_id: 'regular-calendar'}
74
+ end
75
+ it_should_behave_like 'a successful page', which_renders: 'new'
76
+
77
+ describe 'loads a new event into @event' do
78
+ subject { assigns(:event) }
79
+ it { should be_a_new Event }
80
+ its(:schedule) { should be_a_new Schedule }
81
+ end
82
+ end
83
+ end
84
+
85
+ describe 'GET #edit' do
86
+ describe 'when not logged in' do
87
+ before do
88
+ # Here's where we are *not* logging in
89
+ get :edit, params: { id: 'the-work-week', calendar_id: 'admin-calendar' }
90
+ end
91
+ it_should_behave_like 'a redirect to the home page'
92
+ end
93
+ describe 'when logged in' do
94
+ describe 'as someone other than the owner' do
95
+ before do
96
+ login_user regular_user
97
+ get :edit, params: { id: 'the-work-week', calendar_id: 'admin-calendar' }
98
+ end
99
+ it_should_behave_like 'a 403 Forbidden error'
100
+ end
101
+ describe 'as the owner' do
102
+ before do
103
+ login_user regular_user
104
+ get :edit, params: { id: 'science-fiction-club', calendar_id: 'regular-calendar' }
105
+ end
106
+ it_should_behave_like 'a successful page', which_renders: 'edit'
107
+
108
+ describe 'loads requested event into @event' do
109
+ subject { assigns(:event) }
110
+ it { should eq science_fiction_club_event }
111
+ end
112
+ end
113
+ end
114
+ end
115
+
116
+
117
+ describe 'POST #create' do
118
+ describe 'when not logged in' do
119
+ before do
120
+ # Here's where we are *not* logging in
121
+ post :create, params: { event: valid_attributes, calendar_id: 'regular-calendar' }
122
+ end
123
+ it_should_behave_like 'a redirect to the home page'
124
+ end
125
+ describe 'when logged in' do
126
+ describe 'with valid params' do
127
+ before do
128
+ login_user regular_user
129
+ post :create, params: { event: valid_attributes, calendar_id: 'regular-calendar' }
130
+ end
131
+ it_should_behave_like(
132
+ 'a redirect to',
133
+ '/date_book/calendars/regular-calendar/events/test-event'
134
+ )
135
+ describe "sets the flash with a notice of the event's creation" do
136
+ subject { flash[:notice] }
137
+ it { should eq 'Event was successfully created.' }
138
+ end
139
+ end
140
+ describe 'with valid params, counting' do
141
+ before do
142
+ login_user regular_user
143
+ end
144
+ it 'results in a new event' do
145
+ expect { post(:create, params: { event: valid_attributes, calendar_id: 'regular-calendar' }) }
146
+ .to change { Event.count(:id) }.by(1)
147
+ end
148
+ end
149
+ describe 'with invalid params' do
150
+ before do
151
+ login_user regular_user
152
+ post :create, params: { event: invalid_attributes, calendar_id: 'regular-calendar' }
153
+ end
154
+ it_should_behave_like 'a successful page', which_renders: 'new'
155
+
156
+ describe "sets the flash with the event's errors" do
157
+ subject { flash[:error] }
158
+ it { should eq "Name can't be blank" }
159
+ end
160
+ end
161
+ describe 'with invalid params, counting' do
162
+ before do
163
+ login_user regular_user
164
+ end
165
+ it 'does not result in a new event' do
166
+ expect { post(:create, params: { event: invalid_attributes, calendar_id: 'regular-calendar' }) }
167
+ .to_not change { Event.count(:id) }
168
+ end
169
+ end
170
+ end
171
+ end
172
+
173
+ describe 'PUT #update' do
174
+ describe 'when not logged in' do
175
+ before do
176
+ # Here's where we are *not* logging in
177
+ put :update, params: { id: 'science-fiction-club', event: valid_attributes, calendar_id: 'regular-calendar' }
178
+ end
179
+ it_should_behave_like 'a redirect to the home page'
180
+ end
181
+ describe 'when logged in' do
182
+ describe 'as someone other than the owner' do
183
+ before do
184
+ login_user other_user
185
+ put :update, params: { id: 'science-fiction-club', event: valid_attributes, calendar_id: 'regular-calendar' }
186
+ end
187
+ it_should_behave_like 'a 403 Forbidden error'
188
+ end
189
+ describe 'as the owner' do
190
+ describe 'with valid params' do
191
+ before do
192
+ login_user regular_user
193
+ put :update, params: { id: 'science-fiction-club', event: valid_attributes, calendar_id: 'regular-calendar' }
194
+ end
195
+ # Note that slug does not change
196
+ it_should_behave_like 'a redirect to', '/date_book/calendars/regular-calendar/events/science-fiction-club'
197
+
198
+ describe 'updates @event' do
199
+ subject { science_fiction_club_event.reload }
200
+ its(:name) { should eq 'Test Event' }
201
+ end
202
+
203
+ describe "sets the flash with a notice of the event's update" do
204
+ subject { flash[:notice] }
205
+ it { should eq 'Event was successfully updated.' }
206
+ end
207
+ end
208
+ describe 'with invalid params' do
209
+ before do
210
+ login_user regular_user
211
+ put(
212
+ :update,
213
+ params: {
214
+ id: 'science-fiction-club',
215
+ event: invalid_attributes,
216
+ calendar_id: 'regular-calendar'
217
+ }
218
+ )
219
+ end
220
+ it_should_behave_like 'a successful page', which_renders: 'edit'
221
+
222
+ describe 'loads the given event into @event' do
223
+ subject { assigns(:event) }
224
+ it { should eq science_fiction_club_event }
225
+ end
226
+
227
+ describe 'does not update @event' do
228
+ subject { science_fiction_club_event.reload }
229
+ its(:name) { should eq 'Science Fiction Club' }
230
+ end
231
+
232
+ describe "sets the flash with the event's errors" do
233
+ subject { flash[:error] }
234
+ it { should eq "Name can't be blank" }
235
+ end
236
+ end
237
+ end
238
+ end
239
+ end
240
+
241
+ describe 'DELETE #destroy' do
242
+ describe 'when not logged in' do
243
+ before do
244
+ # Here's where we are *not* logging in
245
+ delete :destroy, params: { id: 'science-fiction-club', calendar_id: 'regular-calendar' }
246
+ end
247
+ it_should_behave_like 'a redirect to the home page'
248
+ end
249
+ describe 'when logged in' do
250
+ describe 'as someone other than the owner' do
251
+ before do
252
+ login_user other_user
253
+ delete :destroy, params: { id: 'science-fiction-club', calendar_id: 'regular-calendar' }
254
+ end
255
+ it_should_behave_like 'a 403 Forbidden error'
256
+ end
257
+ describe 'as the owner' do
258
+ before do
259
+ login_user regular_user
260
+ delete :destroy, params: { id: 'science-fiction-club', calendar_id: 'regular-calendar' }
261
+ end
262
+ # Note that slug does not change
263
+ it_should_behave_like 'a redirect to', '/date_book/calendars/regular-calendar/events'
264
+
265
+ describe "sets the flash with a notice of the event's removal" do
266
+ subject { flash[:notice] }
267
+ it { should eq 'Event was successfully removed.' }
268
+ end
269
+ end
270
+ describe 'as the owner, counting' do
271
+ before do
272
+ login_user regular_user
273
+ end
274
+ it 'results one less event' do
275
+ expect { delete(:destroy, params: { id: 'science-fiction-club', calendar_id: 'regular-calendar' }) }
276
+ .to change { Event.count(:id) }.by(-1)
277
+ end
278
+ end
279
+ end
280
+ end
281
+
282
+ end
283
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
4
+ # for example lib/tasks/capistrano.rake, and they will automatically be
5
+ # available to Rake.
6
+
7
+ require_relative 'config/application'
8
+
9
+ Rails.application.load_tasks
@@ -0,0 +1,5 @@
1
+
2
+ //= link_tree ../images
3
+ //= link_directory ../javascripts .js
4
+ //= link_directory ../stylesheets .css
5
+ //= link date_book_manifest.js
File without changes
@@ -0,0 +1,15 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require bootstrap-sprockets
@@ -0,0 +1,4 @@
1
+ // 'bootstrap-sprockets' must be imported before 'bootstrap' and 'bootstrap/variables'
2
+ @import 'bootstrap-sprockets';
3
+ @import 'bootstrap-everything';
4
+ @import 'bootstrap/theme';
@@ -0,0 +1,54 @@
1
+ /*!
2
+ * This file exists to fix a naming conflict.
3
+ */
4
+
5
+ // Core variables and mixins
6
+ @import 'bootstrap/variables';
7
+ @import 'bootstrap/mixins';
8
+
9
+ // Reset and dependencies
10
+ @import 'bootstrap/normalize';
11
+ @import 'bootstrap/print';
12
+ @import 'bootstrap/glyphicons';
13
+
14
+ // Core CSS
15
+ @import 'bootstrap/scaffolding';
16
+ @import 'bootstrap/type';
17
+ @import 'bootstrap/code';
18
+ @import 'bootstrap/grid';
19
+ @import 'bootstrap/tables';
20
+ @import 'bootstrap/forms';
21
+ @import 'bootstrap/buttons';
22
+
23
+ // Components
24
+ @import 'bootstrap/component-animations';
25
+ @import 'bootstrap/dropdowns';
26
+ @import 'bootstrap/button-groups';
27
+ @import 'bootstrap/input-groups';
28
+ @import 'bootstrap/navs';
29
+ @import 'bootstrap/navbar';
30
+ @import 'bootstrap/breadcrumbs';
31
+ @import 'bootstrap/pagination';
32
+ @import 'bootstrap/pager';
33
+ @import 'bootstrap/labels';
34
+ @import 'bootstrap/badges';
35
+ @import 'bootstrap/jumbotron';
36
+ @import 'bootstrap/thumbnails';
37
+ @import 'bootstrap/alerts';
38
+ @import 'bootstrap/progress-bars';
39
+ @import 'bootstrap/media';
40
+ @import 'bootstrap/list-group';
41
+ @import 'bootstrap/panels';
42
+ @import 'bootstrap/responsive-embed';
43
+ @import 'bootstrap/wells';
44
+ @import 'bootstrap/close';
45
+
46
+ // Components w/ JavaScript
47
+ @import 'bootstrap/modals';
48
+ @import 'bootstrap/tooltip';
49
+ @import 'bootstrap/popovers';
50
+ @import 'bootstrap/carousel';
51
+
52
+ // Utility classes
53
+ @import 'bootstrap/utilities';
54
+ @import 'bootstrap/responsive-utilities';
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationController < ActionController::Base
4
+ protect_from_forgery with: :exception
5
+
6
+ rescue_from CanCan::AccessDenied do |exception|
7
+ if user_signed_in?
8
+ Rails.logger.debug "Access denied on #{exception.action} "\
9
+ "#{exception.subject.inspect}"
10
+ flash.now[:error] = exception.message
11
+ render '403', status: :forbidden, layout: 'application'
12
+ else
13
+ redirect_to(
14
+ main_app.root_url,
15
+ flash: {
16
+ error: 'You must sign in or sign up to access this content.'
17
+ }
18
+ )
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ApplicationHelper
4
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationMailer < ActionMailer::Base
4
+ default from: 'from@example.com'
5
+ layout 'mailer'
6
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ # CanCanCan Ability class
4
+ class Ability
5
+ include CanCan::Ability
6
+ include DateBook::Ability
7
+
8
+ def initialize(user)
9
+ user ||= User.new # anonymous user (not logged in)
10
+
11
+ # Rails Application's initialization could go here.
12
+ # can :manage, Group, user: user
13
+
14
+ initialize_date_book(user)
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationRecord < ActiveRecord::Base
4
+ self.abstract_class = true
5
+ end
@@ -0,0 +1,3 @@
1
+ class Calendar < ApplicationRecord
2
+ acts_as_calendar
3
+ end
File without changes