calendarize 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +50 -0
  3. data/Rakefile +38 -0
  4. data/app/assets/javascripts/calendarize.js.coffee +84 -0
  5. data/app/helpers/calendarize_helper.rb +629 -0
  6. data/lib/calendarize.rb +5 -0
  7. data/lib/calendarize/engine.rb +11 -0
  8. data/lib/calendarize/version.rb +3 -0
  9. data/test/dummy/README.rdoc +261 -0
  10. data/test/dummy/Rakefile +7 -0
  11. data/test/dummy/app/assets/javascripts/application.js +5 -0
  12. data/test/dummy/app/assets/stylesheets/_variables.css.scss +117 -0
  13. data/test/dummy/app/assets/stylesheets/application.css +4 -0
  14. data/test/dummy/app/assets/stylesheets/calendarize.css.scss +48 -0
  15. data/test/dummy/app/assets/stylesheets/tables.css.scss +282 -0
  16. data/test/dummy/app/controllers/application_controller.rb +9 -0
  17. data/test/dummy/app/controllers/events_controller.rb +12 -0
  18. data/test/dummy/app/controllers/welcome_controller.rb +5 -0
  19. data/test/dummy/app/helpers/application_helper.rb +2 -0
  20. data/test/dummy/app/models/event.rb +5 -0
  21. data/test/dummy/app/views/layouts/application.html.haml +11 -0
  22. data/test/dummy/app/views/welcome/index.html.haml +40 -0
  23. data/test/dummy/config.ru +4 -0
  24. data/test/dummy/config/application.rb +17 -0
  25. data/test/dummy/config/boot.rb +10 -0
  26. data/test/dummy/config/database.yml +17 -0
  27. data/test/dummy/config/environment.rb +2 -0
  28. data/test/dummy/config/environments/development.rb +13 -0
  29. data/test/dummy/config/environments/production.rb +11 -0
  30. data/test/dummy/config/environments/test.rb +13 -0
  31. data/test/dummy/config/initializers/secret_token.rb +1 -0
  32. data/test/dummy/config/initializers/session_store.rb +1 -0
  33. data/test/dummy/config/initializers/wrap_parameters.rb +7 -0
  34. data/test/dummy/config/locales/en.yml +5 -0
  35. data/test/dummy/config/routes.rb +5 -0
  36. data/test/dummy/db/development.sqlite3 +0 -0
  37. data/test/dummy/db/migrate/20111213185551_create_events.rb +11 -0
  38. data/test/dummy/db/schema.rb +24 -0
  39. data/test/dummy/db/test.sqlite3 +0 -0
  40. data/test/dummy/log/development.log +23316 -0
  41. data/test/dummy/public/404.html +26 -0
  42. data/test/dummy/public/422.html +26 -0
  43. data/test/dummy/public/500.html +25 -0
  44. data/test/dummy/public/favicon.ico +0 -0
  45. data/test/dummy/script/rails +6 -0
  46. data/test/dummy/tmp/cache/assets/C73/050/sprockets%2Fd16f7f8d96d6856e11493371995e1963 +0 -0
  47. data/test/dummy/tmp/cache/assets/CBA/5C0/sprockets%2F99a55fcc61a90861078b64623dba7755 +0 -0
  48. data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  49. data/test/dummy/tmp/cache/assets/CEE/890/sprockets%2F3e5c71e7d965ac071af5e389981a9018 +0 -0
  50. data/test/dummy/tmp/cache/assets/D04/120/sprockets%2Fb90e31ee74700b7b9c651fd266108b0b +0 -0
  51. data/test/dummy/tmp/cache/assets/D1E/BC0/sprockets%2F080adab657299ba98a417cb866e5596d +0 -0
  52. data/test/dummy/tmp/cache/assets/D2C/470/sprockets%2Fc20be7f875105eb1090b45b4b45b3af4 +0 -0
  53. data/test/dummy/tmp/cache/assets/D32/5B0/sprockets%2F38ae1e43e5b0cd2272a36df6d0f09074 +0 -0
  54. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  55. data/test/dummy/tmp/cache/assets/D33/AD0/sprockets%2F7304efbb5a261ea5d15cc96030594f5a +0 -0
  56. data/test/dummy/tmp/cache/assets/D37/A50/sprockets%2F20f273b3aae704a026aaf9f8738b395c +0 -0
  57. data/test/dummy/tmp/cache/assets/D3A/3F0/sprockets%2F8db668af6e983e0f8d5679f1a968627f +0 -0
  58. data/test/dummy/tmp/cache/assets/D3E/310/sprockets%2F4bda6972b0c877d504d246e2cce4e183 +0 -0
  59. data/test/dummy/tmp/cache/assets/D3E/A90/sprockets%2F4059ec1ce475df14794877ba32b0cd3b +0 -0
  60. data/test/dummy/tmp/cache/assets/D44/E30/sprockets%2F139a3719f7f8361f76afefb710b1c5d3 +0 -0
  61. data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  62. data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  63. data/test/dummy/tmp/cache/assets/D71/BB0/sprockets%2F33958d26d9cad4b8311fae36cf2ff144 +0 -0
  64. data/test/dummy/tmp/cache/assets/DD0/480/sprockets%2Ffed1aeed65d2e88cb924a521cc431f68 +0 -0
  65. data/test/dummy/tmp/cache/assets/DD2/820/sprockets%2Ff62ac2c8d56b4409399c1831fbfabdfe +0 -0
  66. data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  67. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  68. metadata +194 -0
@@ -0,0 +1,282 @@
1
+ @mixin gradient-background($from, $to) {
2
+ background-color: $from;
3
+ /* Safari 4-5, Chrome 1-9 */
4
+ background: -webkit-gradient(linear, 0% 0%, 0% 100%, from($from), to($to));
5
+ /* Safari 5.1, Chrome 10+ */
6
+ background: -webkit-linear-gradient(top, $from, $to);
7
+ /* Firefox 3.6+ */
8
+ background: -moz-linear-gradient(top, $from, $to);
9
+ /* IE 10 */
10
+ background: -ms-linear-gradient(top, $from, $to);
11
+ /* Opera 11.10+ */
12
+ background: -o-linear-gradient(top, $from, $to);
13
+ }
14
+
15
+ $width: 990px;
16
+ $sidebar: 320px;
17
+ $tdheight: 32px;
18
+ $completionSquare: 10px;
19
+ $highlight: #00647e;
20
+ /*$light: #e5e9ea; */
21
+ $light: #e7e9e9;
22
+ $gradient: #bababa;
23
+ $dark: #343434;
24
+ $grey: #6e6e6e;
25
+ $blue: #4ca6be;
26
+ $green: #00647e;
27
+ $orange: #c3613f;
28
+ $red: #992828;
29
+
30
+ table {
31
+ border-collapse: collapse;
32
+ border-spacing: 0px;
33
+ empty-cells: show;
34
+ border: none;
35
+ }
36
+
37
+ table.layout {
38
+ width: 100%;
39
+
40
+ tbody {
41
+ tr {
42
+ td {
43
+ vertical-align: top;
44
+
45
+ &.sidebar {
46
+ width: $sidebar;
47
+ background-color: $light;
48
+ border-right:solid 1px $highlight;
49
+ border-left:solid 1px $highlight;
50
+
51
+ ul {
52
+ height:100%;
53
+ padding: 0;
54
+ margin: 0 0 20px 0;
55
+ list-style: none;
56
+
57
+ li {
58
+
59
+ h1 {
60
+ text-align: center;
61
+ font-size: 13px;
62
+ line-height: 25px;
63
+ padding: 0;
64
+ margin: 0;
65
+ height: 25px;
66
+ @include gradient-background(#5dbedb, #2b7e94);
67
+ color: #fff;
68
+ text-shadow: none;
69
+ }
70
+
71
+ a {
72
+ padding: 8px 12px;
73
+ display: block;
74
+ color: $dark;
75
+ border-bottom: 1px solid #d4d8d9;
76
+
77
+ &.selected {
78
+ border-left: 4px solid $dark;
79
+ }
80
+
81
+ &:hover {
82
+ text-decoration: underline;
83
+ }
84
+
85
+ }
86
+
87
+ }
88
+
89
+ }
90
+ }
91
+ }
92
+ }
93
+ }
94
+ }
95
+
96
+ table.styled {
97
+ position: relative;
98
+ width: 100%;
99
+
100
+ thead, tbody {
101
+ tr.separator {
102
+ th, td {
103
+ background-color: $dark !important;
104
+ color: #ffffff;
105
+ text-align: center;
106
+ line-height: 14px;
107
+ height: 14px;
108
+ font-weight: normal;
109
+ border-style: dotted;
110
+ }
111
+ }
112
+ }
113
+
114
+ thead {
115
+ tr {
116
+ th, td {
117
+ border-width: 1px;
118
+ border-style: solid;
119
+ border-top-color: #ffffff;
120
+ border-left-color: #c1c1c1;
121
+ border-right-color: #c1c1c1;
122
+ border-bottom-color: #c1c1c1;
123
+ padding: 4px 8px;
124
+ text-align: center;
125
+
126
+ &.deletable {
127
+ width: 16px;
128
+ }
129
+ }
130
+
131
+ th.date {
132
+ width: 80px;
133
+ }
134
+
135
+ th.icon {
136
+ width: 16px;
137
+ }
138
+
139
+ th.handle {
140
+ width: 11px;
141
+ }
142
+
143
+ th a.ordered {
144
+ color: inherit;
145
+
146
+ span.order-icon {
147
+ float: right;
148
+ display: block;
149
+ right: 0;
150
+ width: 16px;
151
+ height: 16px;
152
+ background-image: url(jquery-ui-custom-theme/images/ui-icons_222222_256x240.png);
153
+ background-repeat: no-repeat;
154
+ background-position: -128px -16px;
155
+
156
+ &.asc {
157
+ background-position-x: 0px;
158
+ }
159
+
160
+ &.desc {
161
+ background-position-x: -64px;
162
+ }
163
+ }
164
+ }
165
+
166
+ td {
167
+ font-weight: normal;
168
+ }
169
+ }
170
+
171
+ tr:not(.separator) {
172
+ th, td {
173
+ @include gradient-background(#eeeeee, #dfe1e2);
174
+ color: $grey;
175
+ text-shadow: 0 1px 0 #fff;
176
+ }
177
+ }
178
+ }
179
+
180
+ tbody {
181
+ tr {
182
+ td, th {
183
+ text-align: left;
184
+ color: $grey;
185
+ border-width: 1px;
186
+ border-style: solid;
187
+ border-color: #dadada;
188
+ line-height: $tdheight;
189
+ padding: 4px 8px;
190
+
191
+ img {
192
+ vertical-align: middle;
193
+ }
194
+
195
+ &.handle {
196
+
197
+ }
198
+
199
+ a.inline-icon {
200
+ min-height: $tdheight;
201
+ line-height: $tdheight;
202
+ #border: solid red 1px;
203
+ }
204
+ }
205
+
206
+ td.handle {
207
+ width: 11px;
208
+ background-image: url(/assets/handle.gif);
209
+ background-repeat: no-repeat;
210
+ background-position: 8px 12px;
211
+ }
212
+ }
213
+
214
+ tr:nth-child(odd) {
215
+ th {
216
+ background-color: #eceeef;
217
+ }
218
+
219
+ td {
220
+ background-color: #f5f5f5;
221
+ }
222
+ }
223
+
224
+ tr:nth-child(even) {
225
+ th {
226
+ background-color: #f0f3f3;
227
+ }
228
+
229
+ td {
230
+ background-color: #ffffff;
231
+ }
232
+ }
233
+
234
+ tr.selected, tr:hover {
235
+ td, th {
236
+ color: #ffffff;
237
+ background-color: $blue;
238
+
239
+ a {
240
+ color: #ffffff;
241
+ }
242
+
243
+ .chzn-container {
244
+ a {
245
+ color: $dark;
246
+ }
247
+
248
+ color: $dark;
249
+ }
250
+ }
251
+ }
252
+ }
253
+ }
254
+
255
+ table.submenu {
256
+
257
+ width: 100%;
258
+
259
+ tbody {
260
+ tr {
261
+ td {
262
+ padding: 8px 12px;
263
+ }
264
+
265
+ td.parent {
266
+ width: 16px;
267
+ }
268
+
269
+ td.header {
270
+ h1 {
271
+ padding: 0;
272
+ margin: 0;
273
+ font-size: 16px;
274
+
275
+ &, & a {
276
+ color: $grey;
277
+ }
278
+ }
279
+ }
280
+ }
281
+ }
282
+ }
@@ -0,0 +1,9 @@
1
+ class ApplicationController < ActionController::Base
2
+
3
+ protect_from_forgery
4
+
5
+ def index
6
+
7
+ end
8
+
9
+ end
@@ -0,0 +1,12 @@
1
+ class EventsController < ApplicationController
2
+
3
+ def create
4
+
5
+ @event = Event.new(params[:event])
6
+
7
+ @event.save
8
+
9
+ redirect_to controller: :welcome, action: :index
10
+ end
11
+
12
+ end
@@ -0,0 +1,5 @@
1
+ class WelcomeController < ApplicationController
2
+
3
+ calendarize
4
+
5
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,5 @@
1
+ class Event < ActiveRecord::Base
2
+
3
+ acts_as_event
4
+
5
+ end
@@ -0,0 +1,11 @@
1
+ !!!
2
+
3
+ %html
4
+ %head
5
+ %title Calendarize
6
+
7
+ = stylesheet_link_tag :application, media: 'all'
8
+ = javascript_include_tag :application
9
+ = csrf_meta_tags
10
+ %body
11
+ = yield
@@ -0,0 +1,40 @@
1
+ - @event = Event.new
2
+
3
+ = form_for @event, url: events_path(calendar_current_params) do |f|
4
+ = f.label :start_time
5
+ = f.datetime_select :start_time
6
+ %br
7
+ = f.label :end_time
8
+ = f.datetime_select :end_time
9
+ %br
10
+ = f.label :title
11
+ = f.text_field :title
12
+ %br
13
+ = f.submit
14
+
15
+ %br
16
+
17
+ - switch_params = calendar_current_params
18
+ - switch_params[:calendar][:scope] = @calendar[:scope] == CalendarizeHelper::Scopes::DAILY ? CalendarizeHelper::Scopes::WEEKLY : CalendarizeHelper::Scopes::DAILY
19
+
20
+ = link_to switch_params[:calendar][:scope], request.path + '?' + switch_params.to_query
21
+
22
+ %br
23
+
24
+ - if @calendar[:scope] == CalendarizeHelper::Scopes::DAILY
25
+ = daily_calendar @calendar[:date], Event.for_day(@calendar[:date]), verbose: @calendar[:verbose] do |c|
26
+ = l(c.event.start_time, format: :short)
27
+ = ' - '
28
+ = l(c.event.end_time, format: :short)
29
+ = ' : '
30
+ = c.event.title
31
+
32
+
33
+ - elsif @calendar[:scope] == CalendarizeHelper::Scopes::WEEKLY
34
+ = weekly_calendar @calendar[:date], Event.for_week(@calendar[:date]), verbose: @calendar[:verbose] do |c|
35
+ = l(c.event.start_time, format: :short)
36
+ = ' - '
37
+ = l(c.event.end_time, format: :short)
38
+ = ' : '
39
+ = c.event.title
40
+
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
@@ -0,0 +1,17 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ Bundler.require
6
+ require 'calendarize'
7
+
8
+ module Dummy
9
+ class Application < Rails::Application
10
+ config.encoding = "utf-8"
11
+ config.time_zone = 'Eastern Time (US & Canada)'
12
+ config.filter_parameters += [:password]
13
+ config.assets.enabled = true
14
+ config.assets.version = '1.0'
15
+ end
16
+ end
17
+
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ if File.exist?(gemfile)
5
+ ENV['BUNDLE_GEMFILE'] = gemfile
6
+ require 'bundler'
7
+ Bundler.setup
8
+ end
9
+
10
+ $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,17 @@
1
+ development:
2
+ adapter: sqlite3
3
+ database: db/development.sqlite3
4
+ pool: 5
5
+ timeout: 5000
6
+
7
+ test:
8
+ adapter: sqlite3
9
+ database: db/test.sqlite3
10
+ pool: 5
11
+ timeout: 5000
12
+
13
+ production:
14
+ adapter: sqlite3
15
+ database: db/production.sqlite3
16
+ pool: 5
17
+ timeout: 5000
@@ -0,0 +1,2 @@
1
+ require File.expand_path('../application', __FILE__)
2
+ Dummy::Application.initialize!
@@ -0,0 +1,13 @@
1
+ Dummy::Application.configure do
2
+ config.cache_classes = false
3
+ config.whiny_nils = true
4
+ config.consider_all_requests_local = true
5
+ config.action_controller.perform_caching = false
6
+ config.action_mailer.raise_delivery_errors = false
7
+ config.active_support.deprecation = :log
8
+ config.action_dispatch.best_standards_support = :builtin
9
+ config.active_record.mass_assignment_sanitizer = :strict
10
+ config.active_record.auto_explain_threshold_in_seconds = 0.5
11
+ config.assets.compress = false
12
+ config.assets.debug = true
13
+ end