bootstrap_calendar_rails 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.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2013 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,3 @@
1
+ = BootstrapCalendarRails
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'BootstrapCalendarRails'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.md')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,14 @@
1
+ # Author:: Nikita Vasiliev (mailto:sharpyfox@gmail.com)
2
+ # Encoding:: utf-8
3
+ # License:: Distributes under the same terms as Ruby
4
+
5
+ require 'bootstrap_calendar_rails/view_helper'
6
+
7
+ # Tell to the world about ViewHelpers module
8
+ module BootstrapCalendarRails
9
+ class Railtie < Rails::Railtie
10
+ initializer "placehold.view_helpers" do |app|
11
+ ActionView::Base.send :include, ViewHelpers
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,7 @@
1
+ # Author:: Nikita Vasiliev (mailto:sharpyfox@gmail.com)
2
+ # Encoding:: utf-8
3
+ # License:: Distributes under the same terms as Ruby
4
+
5
+ module BootstrapCalendarRails
6
+ VERSION = "0.0.1"
7
+ end
@@ -0,0 +1,128 @@
1
+ # Author:: Nikita Vasiliev (mailto:sharpyfox@gmail.com)
2
+ # Encoding:: utf-8
3
+ # License:: Distributes under the same terms as Ruby
4
+
5
+ # Helper for the calendar building
6
+ module BootstrapCalendarRails
7
+ module ViewHelpers
8
+ def bootstrap_calendar(date = Date.today, options = {}, &block)
9
+ BootstrapCalendar.new(self, date, options, block).build
10
+ end
11
+
12
+ class BootstrapCalendar
13
+ DAY_NAMES = %w[Sunday Monday Tuesday Wednesday Thursday Friday Saturday]
14
+ MOBILE_DAY_NAMES = %w[Sun Mon Tues Wed Thur Fri Sat]
15
+
16
+ delegate :content_tag, to: :view
17
+ attr_reader :view, :date, :callback, :options
18
+
19
+ # build calendar
20
+ def build
21
+ result = content_tag :div, class: 'cal-month-box' do
22
+ week_rows
23
+ end
24
+ header << result
25
+ end
26
+
27
+ # you can pass some extra options in "options" parameter
28
+ def initialize(view, date, options = {}, callback)
29
+ @view = view
30
+ @date = date
31
+ @options = options.symbolize_keys
32
+ @callback = callback
33
+ end
34
+
35
+ protected
36
+ # build one week
37
+ def build_week(week)
38
+ content_tag :div, class: "cal-row-fluid" do
39
+ week.map { |day| day_cell(day) }.join.html_safe
40
+ end
41
+ end
42
+
43
+ # build one day cell
44
+ def day_cell(day)
45
+ content_tag :div, class: "cal-span1 cal-cell" do
46
+ content_tag :div, class: day_classes(day) do
47
+ view.capture(day, &callback)
48
+ end
49
+ end
50
+ end
51
+
52
+ # collect classes for day cell
53
+ def day_classes(day)
54
+ classes = ["cal-month-day"]
55
+ classes << "cal-day-today" if day == Date.today
56
+ classes << "cal-day-outmonth cal-month-first-row" if day.month != date.month
57
+ classes << "cal-day-inmonth" if day.month == date.month
58
+ classes << "cal-day-weekend" if day.saturday? || day.sunday?
59
+
60
+ options[:extra_day_classes].call(classes, day) unless options[:extra_day_classes].nil?
61
+ classes.join(" ") unless classes.empty?
62
+ end
63
+
64
+ # return day names resorted form start_day
65
+ def day_names
66
+ get_day_names(DAY_NAMES)
67
+ end
68
+
69
+ # return day names for mobile resorted form start_day
70
+ def mobile_day_names
71
+ get_day_names(MOBILE_DAY_NAMES)
72
+ end
73
+
74
+ # return header, which contains both desktop and mobile day names
75
+ def header
76
+ content_tag 'div', class: "cal-row-fluid cal-row-head" do
77
+ build_header(day_names, "cal-span1 visible-desktop") +
78
+ build_header(mobile_day_names, "cal-span1 hidden-desktop")
79
+ end
80
+ end
81
+
82
+ # return start day, provided by start_day option
83
+ # it's :monday by default
84
+ def start_day
85
+ if options[:start_day] && DAY_NAMES.include?(options[:start_day].to_s.humanize)
86
+ @start_day ||= options[:start_day].to_s.downcase.to_sym
87
+ else
88
+ @start_day ||= :monday
89
+ end
90
+ end
91
+
92
+ # return start day index in DAY_NAMES array
93
+ def start_day_index
94
+ @start_day_index ||= DAY_NAMES.index { |n| n.downcase == start_day.to_s } || 0
95
+ end
96
+
97
+ # build week rows
98
+ def week_rows
99
+ weeks.map { |week| build_week(week) }.join.html_safe
100
+ end
101
+
102
+ # return weeks of month
103
+ def weeks
104
+ first = date.beginning_of_month.beginning_of_week(start_day)
105
+ last = date.end_of_month.end_of_week(start_day)
106
+ (first..last).to_a.in_groups_of(7)
107
+ end
108
+
109
+ private
110
+ # common for modile and desktop days function
111
+ def build_header(days_array, classes)
112
+ days_array.map do |day|
113
+ content_tag :div, class: classes do
114
+ I18n.translate day
115
+ end
116
+ end.join.html_safe
117
+ end
118
+
119
+ # common for modile and desktop days function
120
+ # resort days using start day index
121
+ def get_day_names(days_array)
122
+ return days_array if start_day_index.zero?
123
+ days_array[start_day_index, days_array.size - start_day_index] +
124
+ days_array[0, start_day_index]
125
+ end
126
+ end
127
+ end
128
+ end
@@ -0,0 +1,6 @@
1
+ # Author:: Nikita Vasiliev (mailto:sharpyfox@gmail.com)
2
+ # Encoding:: utf-8
3
+ # License:: Distributes under the same terms as Ruby
4
+
5
+ require 'bootstrap_calendar_rails/version'
6
+ require 'bootstrap_calendar_rails/railtie' if defined? Rails
@@ -0,0 +1,52 @@
1
+ module Calendar
2
+ class InstallGenerator < Rails::Generators::NamedBase
3
+ source_root File.expand_path('../templates', __FILE__)
4
+ desc "This generator creates an initializer file at config/initializers"
5
+ argument :stylesheets_type, :type => :string, :default => 'less', :banner => '*less or static'
6
+
7
+ def add_assets
8
+
9
+ css_manifest = 'app/assets/stylesheets/application.css'
10
+
11
+ if File.exist?(css_manifest)
12
+ # Add our own require:
13
+ content = File.read(css_manifest)
14
+ if content.match(/require_calendar\s+\.\s*$/)
15
+ # Good enough - that'll include our calendar.css.less
16
+ else
17
+ style_require_block = " *= require_calendar\n"
18
+ insert_into_file css_manifest, style_require_block, :after => "require_self\n"
19
+ end
20
+ else
21
+ copy_file "application.css", "app/assets/stylesheets/application.css"
22
+ end
23
+
24
+ # styles
25
+ if use_less?
26
+ copy_file "calendar.css.less", "app/assets/stylesheets/calendar.css.less"
27
+ copy_file "events.css.less", "app/assets/stylesheets/events.css.less"
28
+ copy_file "grid.css.less", "app/assets/stylesheets/grid.css.less"
29
+ copy_file "month.css.less", "app/assets/stylesheets/month.css.less"
30
+ copy_file "theme.css.less", "app/assets/stylesheets/theme.css.less"
31
+ copy_file "variables.css.less", "app/assets/stylesheets/variables.css.less"
32
+ copy_file "week.css.less", "app/assets/stylesheets/week.css.less"
33
+ else
34
+ copy_file "calendar.css", "app/assets/stylesheets/calendar.css"
35
+ end
36
+ end
37
+
38
+ def add_locale
39
+ if File.exist?("config/locales/en.calendar.yml")
40
+ localez = File.read(File.expand_path('../templates', __FILE__) + "/en.calendar.yml")
41
+ insert_into_file "config/locales/en.calendar.yml", localez, :after => "en\n"
42
+ else
43
+ copy_file "en.calendar.yml", "config/locales/en.calendar.yml"
44
+ end
45
+ end
46
+
47
+ private
48
+ def use_less?
49
+ (defined?(Less) && (stylesheets_type!='static') ) || (stylesheets_type=='less')
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require bootstrap_and_overrides
13
+ *= require_tree
14
+ *= require_calendar
15
+ */
@@ -0,0 +1,402 @@
1
+ [class*="cal-span"] {
2
+ float: left;
3
+ margin-left: 0;
4
+ min-height: 1px;
5
+ }
6
+ .cal-row-fluid {
7
+ width: 100%;
8
+ *zoom: 1;
9
+ }
10
+ .cal-row-fluid:before,
11
+ .cal-row-fluid:after {
12
+ display: table;
13
+ content: "";
14
+ line-height: 0;
15
+ }
16
+ .cal-row-fluid:after {
17
+ clear: both;
18
+ }
19
+ .cal-row-fluid [class*="cal-span"] {
20
+ display: block;
21
+ width: 100%;
22
+ -webkit-box-sizing: border-box;
23
+ -moz-box-sizing: border-box;
24
+ box-sizing: border-box;
25
+ float: left;
26
+ margin-left: 0%;
27
+ *margin-left: -0.05213764337851929%;
28
+ }
29
+ .cal-row-fluid [class*="cal-span"]:first-child {
30
+ margin-left: 0;
31
+ }
32
+ .cal-row-fluid .controls-row [class*="cal-span"] + [class*="cal-span"] {
33
+ margin-left: 0%;
34
+ }
35
+ .cal-row-fluid .cal-span7 {
36
+ width: 100%;
37
+ *width: 99.94669509594883%;
38
+ }
39
+ .cal-row-fluid .cal-span6 {
40
+ width: 85.71428571428571%;
41
+ *width: 85.66098081023453%;
42
+ }
43
+ .cal-row-fluid .cal-span5 {
44
+ width: 71.42857142857142%;
45
+ *width: 71.37526652452024%;
46
+ }
47
+ .cal-row-fluid .cal-span4 {
48
+ width: 57.14285714285714%;
49
+ *width: 57.089552238805965%;
50
+ }
51
+ .cal-row-fluid .cal-span3 {
52
+ width: 42.857142857142854%;
53
+ *width: 42.80383795309168%;
54
+ }
55
+ .cal-row-fluid .cal-span2 {
56
+ width: 28.57142857142857%;
57
+ *width: 28.518123667377395%;
58
+ }
59
+ .cal-row-fluid .cal-span1 {
60
+ width: 14.285714285714285%;
61
+ *width: 14.232409381663112%;
62
+ }
63
+ .cal-week-box .cal-offset7,
64
+ .cal-row-fluid .cal-offset7,
65
+ .cal-row-fluid .cal-offset7:first-child {
66
+ margin-left: 100%;
67
+ *margin-left: 99.89339019189765%;
68
+ }
69
+ .cal-week-box .cal-offset6,
70
+ .cal-row-fluid .cal-offset6,
71
+ .cal-row-fluid .cal-offset6:first-child {
72
+ margin-left: 85.71428571428571%;
73
+ *margin-left: 85.60767590618336%;
74
+ }
75
+ .cal-week-box .cal-offset5,
76
+ .cal-row-fluid .cal-offset5,
77
+ .cal-row-fluid .cal-offset5:first-child {
78
+ margin-left: 71.42857142857142%;
79
+ *margin-left: 71.32196162046907%;
80
+ }
81
+ .cal-week-box .cal-offset4,
82
+ .cal-row-fluid .cal-offset4,
83
+ .cal-row-fluid .cal-offset4:first-child {
84
+ margin-left: 57.14285714285714%;
85
+ *margin-left: 57.03624733475479%;
86
+ }
87
+ .cal-week-box .cal-offset3,
88
+ .cal-row-fluid .cal-offset3,
89
+ .cal-row-fluid .cal-offset3:first-child {
90
+ margin-left: 42.857142857142854%;
91
+ *margin-left: 42.750533049040506%;
92
+ }
93
+ .cal-week-box .cal-offset2,
94
+ .cal-row-fluid .cal-offset2,
95
+ .cal-row-fluid .cal-offset2:first-child {
96
+ margin-left: 28.57142857142857%;
97
+ *margin-left: 28.46481876332622%;
98
+ }
99
+ .cal-week-box .cal-offset1,
100
+ .cal-row-fluid .cal-offset1,
101
+ .cal-row-fluid .cal-offset1:first-child {
102
+ margin-left: 14.285714285714285%;
103
+ *margin-left: 14.17910447761194%;
104
+ }
105
+ .cal-row-fluid .cal-span1 {
106
+ width: 14.285714285714285%;
107
+ *width: 14.233576642335766%;
108
+ }
109
+ [class*="cal-span"].hide,
110
+ .cal-row-fluid [class*="cal-span"].hide {
111
+ display: none;
112
+ }
113
+ [class*="cal-span"].pull-right,
114
+ .cal-row-fluid [class*="cal-span"].pull-right {
115
+ float: right;
116
+ }
117
+ .cal-row-head [class*="cal-span"]:first-child,
118
+ .cal-row-head [class*="cal-span"] {
119
+ min-height: auto;
120
+ }
121
+ .cal-year-box [class*="span"] {
122
+ position: relative;
123
+ }
124
+ .cal-events-num {
125
+ margin-top: 20px;
126
+ }
127
+ .cal-month-day {
128
+ position: relative;
129
+ display: block;
130
+ width: 100%;
131
+ }
132
+ #cal-week-box {
133
+ position: absolute;
134
+ width: 50px;
135
+ left: -61px;
136
+ top: -1px;
137
+ padding: 8px 5px;
138
+ cursor: pointer;
139
+ }
140
+ #cal-day-box {
141
+ position: absolute;
142
+ right: 50%;
143
+ bottom: -21px;
144
+ padding: 0px 5px;
145
+ cursor: pointer;
146
+ z-index: 5;
147
+ text-align: center;
148
+ width: 20px;
149
+ margin-right: -17px;
150
+ }
151
+ .cal-year-box #cal-day-box {
152
+ margin-right: -7px;
153
+ }
154
+ #cal-slide-box {
155
+ position: relative;
156
+ }
157
+ #cal-slide-tick {
158
+ position: absolute;
159
+ width: 16px;
160
+ margin-left: -7px;
161
+ height: 9px;
162
+ top: -1px;
163
+ z-index: 1;
164
+ }
165
+ #cal-slide-tick.tick-month1 {
166
+ left: 12.5%;
167
+ }
168
+ #cal-slide-tick.tick-month2 {
169
+ left: 37.5%;
170
+ }
171
+ #cal-slide-tick.tick-month3 {
172
+ left: 62.5%;
173
+ }
174
+ #cal-slide-tick.tick-month4 {
175
+ left: 87.5%;
176
+ }
177
+ #cal-slide-tick.tick-day1 {
178
+ left: 7.14285714285715%;
179
+ }
180
+ #cal-slide-tick.tick-day2 {
181
+ left: 21.42857142857143%;
182
+ }
183
+ #cal-slide-tick.tick-day3 {
184
+ left: 35.71428571428572%;
185
+ }
186
+ #cal-slide-tick.tick-day4 {
187
+ left: 50%;
188
+ }
189
+ #cal-slide-tick.tick-day5 {
190
+ left: 64.2857142857143%;
191
+ }
192
+ #cal-slide-tick.tick-day6 {
193
+ left: 78.57142857142859%;
194
+ }
195
+ #cal-slide-tick.tick-day7 {
196
+ left: 92.85714285714285%;
197
+ }
198
+ .events-list {
199
+ position: absolute;
200
+ bottom: 0;
201
+ left: 0;
202
+ overflow: hidden;
203
+ }
204
+ .event {
205
+ display: block;
206
+ background-color: #c3c3c3;
207
+ width: 12px;
208
+ height: 12px;
209
+ margin-right: 2px;
210
+ margin-bottom: 2px;
211
+ -webkit-box-shadow: inset 0px 0px 5px 0px rgba(0, 0, 0, 0.4);
212
+ box-shadow: inset 0px 0px 5px 0px rgba(0, 0, 0, 0.4);
213
+ border-radius: 8px;
214
+ border: 1px solid #ffffff;
215
+ }
216
+ #cal-slide-content .event.pull-left {
217
+ margin-top: 5px;
218
+ }
219
+ .event-important {
220
+ background-color: #ad2121;
221
+ }
222
+ .event-info {
223
+ background-color: #1e90ff;
224
+ }
225
+ .event-warning {
226
+ background-color: #e3bc08;
227
+ }
228
+ .event-inverse {
229
+ background-color: #1b1b1b;
230
+ }
231
+ .event-success {
232
+ background-color: #006400;
233
+ }
234
+ .event-special {
235
+ background-color: #800080;
236
+ }
237
+ .day-highlight:hover,
238
+ .day-highlight {
239
+ background-color: #dddddd;
240
+ }
241
+ .day-highlight.dh-event-important:hover,
242
+ .day-highlight.dh-event-important {
243
+ background-color: #fae3e3;
244
+ }
245
+ .day-highlight.dh-event-warning:hover,
246
+ .day-highlight.dh-event-warning {
247
+ background-color: #fdf1ba;
248
+ }
249
+ .day-highlight.dh-event-info:hover,
250
+ .day-highlight.dh-event-info {
251
+ background-color: #d1e8ff;
252
+ }
253
+ .day-highlight.dh-event-inverse:hover,
254
+ .day-highlight.dh-event-inverse {
255
+ background-color: #c1c1c1;
256
+ }
257
+ .day-highlight.dh-event-success:hover,
258
+ .day-highlight.dh-event-success {
259
+ background-color: #caffca;
260
+ }
261
+ .day-highlight.dh-event-special:hover,
262
+ .day-highlight.dh-event-special {
263
+ background-color: #ffe6ff;
264
+ }
265
+ .cal-week-box [class*="cal-span"] {
266
+ white-space: nowrap;
267
+ overflow: hidden;
268
+ text-overflow: ellipsis;
269
+ }
270
+ .cal-column {
271
+ position: absolute;
272
+ height: 100%;
273
+ z-index: -1;
274
+ }
275
+ .cal-row-head [class*="cal-span"]:first-child,
276
+ .cal-row-head [class*="cal-span"] {
277
+ font-weight: bolder;
278
+ text-align: center;
279
+ border: 0px solid;
280
+ padding: 5px 0;
281
+ }
282
+ .cal-row-head [class*="cal-span"] small {
283
+ font-weight: normal;
284
+ }
285
+ .cal-year-box .row-fluid:hover,
286
+ .cal-row-fluid:hover {
287
+ background-color: #fafafa;
288
+ }
289
+ .cal-month-day {
290
+ height: 100px;
291
+ }
292
+ [class*="cal-span"]:hover {
293
+ background-color: #ededed;
294
+ }
295
+ .cal-year-box [class*="span"],
296
+ .cal-month-box [class*="cal-span"] {
297
+ min-height: 100px;
298
+ border-right: 1px solid #e1e1e1;
299
+ }
300
+ .cal-year-box [class*="span"] {
301
+ min-height: 60px;
302
+ }
303
+ .cal-year-box .row-fluid [class*="span"]:last-child,
304
+ .cal-month-box .cal-row-fluid [class*="cal-span"]:last-child {
305
+ border-right: 0px;
306
+ }
307
+ .cal-year-box .row-fluid,
308
+ .cal-month-box .cal-row-fluid {
309
+ border-bottom: 1px solid #e1e1e1;
310
+ }
311
+ .cal-year-box .row-fluid:last-child,
312
+ .cal-month-box .cal-row-fluid:last-child {
313
+ border-bottom: 0px;
314
+ }
315
+ .cal-month-box,
316
+ .cal-year-box,
317
+ .cal-week-box {
318
+ border-top: 1px solid #e1e1e1;
319
+ border-bottom: 1px solid #e1e1e1;
320
+ border-right: 1px solid #e1e1e1;
321
+ border-left: 1px solid #e1e1e1;
322
+ border-radius: 2px;
323
+ }
324
+ span[data-cal-date] {
325
+ font-size: 1.2em;
326
+ font-weight: normal;
327
+ opacity: 0.5;
328
+ cursor: pointer;
329
+ transition: all 0.3s ease-in-out;
330
+ -webkit-transition: all 0.1s ease-in-out;
331
+ -moz-transition: all 0.1s ease-in-out;
332
+ -ms-transition: all 0.1s ease-in-out;
333
+ -o-transition: all 0.1s ease-in-out;
334
+ margin-top: 15px;
335
+ margin-right: 15px;
336
+ }
337
+ span[data-cal-date]:hover {
338
+ opacity: 1;
339
+ }
340
+ .cal-day-outmonth span[data-cal-date] {
341
+ opacity: 0.1;
342
+ cursor: default;
343
+ }
344
+ .cal-day-today {
345
+ background-color: #e8fde7;
346
+ }
347
+ .cal-day-today span[data-cal-date] {
348
+ color: darkgreen;
349
+ font-size: 1.9em;
350
+ }
351
+ .cal-day-holiday span[data-cal-date] {
352
+ color: #800080;
353
+ }
354
+ .cal-day-weekend span[data-cal-date] {
355
+ color: darkred;
356
+ }
357
+ #cal-week-box {
358
+ border: 1px solid #e1e1e1;
359
+ border-right: 0px;
360
+ border-radius: 5px 0 0 5px;
361
+ background-color: #fafafa;
362
+ text-align: right;
363
+ }
364
+ #cal-day-box {
365
+ border: 1px solid #e1e1e1;
366
+ border-top: 0px solid;
367
+ border-radius: 0 0 5px 5px;
368
+ background-color: #ededed;
369
+ text-align: center;
370
+ }
371
+ #cal-slide-box {
372
+ border-top: 0px solid #8c8c8c;
373
+ }
374
+ #cal-slide-content {
375
+ padding: 20px;
376
+ color: #ffffff;
377
+ background-image: url("../img/dark_wood.png");
378
+ -webkit-box-shadow: inset 0px 0px 15px 0px rgba(0, 0, 0, 0.5);
379
+ box-shadow: inset 0px 0px 15px 0px rgba(0, 0, 0, 0.5);
380
+ }
381
+ #cal-slide-tick {
382
+ background-image: url("../img/tick.png?2");
383
+ }
384
+ #cal-slide-content:hover {
385
+ background-color: transparent;
386
+ }
387
+ #cal-slide-content a.event-item {
388
+ color: #ffffff;
389
+ font-weight: normal;
390
+ line-height: 22px;
391
+ }
392
+ .events-list {
393
+ max-height: 47px;
394
+ padding-left: 5px;
395
+ }
396
+ .cal-column {
397
+ border-left: 1px solid #e1e1e1;
398
+ }
399
+ a.cal-event-week {
400
+ text-decoration: none;
401
+ color: #151515;
402
+ }
@@ -0,0 +1,6 @@
1
+ @import "variables.css.less";
2
+ @import "grid.css.less";
3
+ @import "month.css.less";
4
+ @import "events.css.less";
5
+ @import "week.css.less";
6
+ @import "theme.css.less";
@@ -0,0 +1,11 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ Monday: "Monday"
6
+ Tuesday: "Tuesday"
7
+ Wednesday: "Wednesday"
8
+ Thursday: "Thursday"
9
+ Friday: "Friday"
10
+ Saturday: "Saturday"
11
+ Sunday: "Sunday"
@@ -0,0 +1,77 @@
1
+ @import "variables.css.less";
2
+
3
+ .event {
4
+ display: block;
5
+ background-color: @eventStandardColor;
6
+ width: @eventSize;
7
+ height: @eventSize;
8
+ margin-right: @eventMargin;
9
+ margin-bottom: @eventMargin;
10
+ -webkit-box-shadow: inset 0px 0px 5px 0px rgba(0, 0, 0, 0.4);
11
+ box-shadow: inset 0px 0px 5px 0px rgba(0, 0, 0, 0.4);
12
+ border-radius: @eventBorderRadius;
13
+ border: @eventBorderSize solid @eventBorderColor;
14
+ }
15
+
16
+ #cal-slide-content .event.pull-left {
17
+ margin-top: 5px;
18
+ }
19
+
20
+ .event-important {
21
+ background-color: @eventImportantColor;
22
+ }
23
+
24
+ .event-info {
25
+ background-color: @eventInfoColor;
26
+ }
27
+
28
+ .event-warning {
29
+ background-color: @eventWarningColor;
30
+ }
31
+
32
+ .event-inverse {
33
+ background-color: @eventInverseColor;
34
+ }
35
+
36
+ .event-success {
37
+ background-color: @eventSuccessColor;
38
+ }
39
+
40
+ .event-special {
41
+ background-color: @eventSpecialColor;
42
+ }
43
+
44
+ .day-highlight:hover,
45
+ .day-highlight {
46
+ background-color: @eventHiliteStandart;
47
+ }
48
+
49
+ .day-highlight.dh-event-important:hover,
50
+ .day-highlight.dh-event-important {
51
+ background-color: @eventHiliteImportant;
52
+ }
53
+
54
+ .day-highlight.dh-event-warning:hover,
55
+ .day-highlight.dh-event-warning {
56
+ background-color: @eventHiliteWarning;
57
+ }
58
+
59
+ .day-highlight.dh-event-info:hover,
60
+ .day-highlight.dh-event-info {
61
+ background-color: @eventHiliteInfo;
62
+ }
63
+
64
+ .day-highlight.dh-event-inverse:hover,
65
+ .day-highlight.dh-event-inverse {
66
+ background-color: @eventHiliteInverse;
67
+ }
68
+
69
+ .day-highlight.dh-event-success:hover,
70
+ .day-highlight.dh-event-success {
71
+ background-color: @eventHiliteSuccess;
72
+ }
73
+
74
+ .day-highlight.dh-event-special:hover,
75
+ .day-highlight.dh-event-special {
76
+ background-color: @eventHiliteSpecial;
77
+ }
@@ -0,0 +1,127 @@
1
+ [class*="cal-span"] {
2
+ float: left;
3
+ margin-left: 0;
4
+ min-height: 1px;
5
+ }
6
+
7
+ .cal-row-fluid {
8
+ width: 100%;
9
+ *zoom: 1;
10
+ }
11
+
12
+ .cal-row-fluid:before,
13
+ .cal-row-fluid:after {
14
+ display: table;
15
+ content: "";
16
+ line-height: 0;
17
+ }
18
+
19
+ .cal-row-fluid:after {
20
+ clear: both;
21
+ }
22
+
23
+ .cal-row-fluid [class*="cal-span"] {
24
+ display: block;
25
+ width: 100%;
26
+ -webkit-box-sizing: border-box;
27
+ -moz-box-sizing: border-box;
28
+ box-sizing: border-box;
29
+ float: left;
30
+ margin-left: 0%;
31
+ *margin-left: -0.05213764337851929%;
32
+ }
33
+
34
+ .cal-row-fluid [class*="cal-span"]:first-child {
35
+ margin-left: 0;
36
+ }
37
+
38
+ .cal-row-fluid .controls-row [class*="cal-span"] + [class*="cal-span"] {
39
+ margin-left: 0%;
40
+ }
41
+ .cal-row-fluid .cal-span7 {
42
+ width: 100%;
43
+ *width: 99.94669509594883%;
44
+ }
45
+ .cal-row-fluid .cal-span6 {
46
+ width: 85.71428571428571%;
47
+ *width: 85.66098081023453%;
48
+ }
49
+ .cal-row-fluid .cal-span5 {
50
+ width: 71.42857142857142%;
51
+ *width: 71.37526652452024%;
52
+ }
53
+ .cal-row-fluid .cal-span4 {
54
+ width: 57.14285714285714%;
55
+ *width: 57.089552238805965%;
56
+ }
57
+ .cal-row-fluid .cal-span3 {
58
+ width: 42.857142857142854%;
59
+ *width: 42.80383795309168%;
60
+ }
61
+ .cal-row-fluid .cal-span2 {
62
+ width: 28.57142857142857%;
63
+ *width: 28.518123667377395%;
64
+ }
65
+ .cal-row-fluid .cal-span1 {
66
+ width: 14.285714285714285%;
67
+ *width: 14.232409381663112%;
68
+ }
69
+ .cal-week-box .cal-offset7,
70
+ .cal-row-fluid .cal-offset7,
71
+ .cal-row-fluid .cal-offset7:first-child {
72
+ margin-left: 100%;
73
+ *margin-left: 99.89339019189765%;
74
+ }
75
+
76
+ .cal-week-box .cal-offset6,
77
+ .cal-row-fluid .cal-offset6,
78
+ .cal-row-fluid .cal-offset6:first-child {
79
+ margin-left: 85.71428571428571%;
80
+ *margin-left: 85.60767590618336%;
81
+ }
82
+ .cal-week-box .cal-offset5,
83
+ .cal-row-fluid .cal-offset5,
84
+ .cal-row-fluid .cal-offset5:first-child {
85
+ margin-left: 71.42857142857142%;
86
+ *margin-left: 71.32196162046907%;
87
+ }
88
+ .cal-week-box .cal-offset4,
89
+ .cal-row-fluid .cal-offset4,
90
+ .cal-row-fluid .cal-offset4:first-child {
91
+ margin-left: 57.14285714285714%;
92
+ *margin-left: 57.03624733475479%;
93
+ }
94
+ .cal-week-box .cal-offset3,
95
+ .cal-row-fluid .cal-offset3,
96
+ .cal-row-fluid .cal-offset3:first-child {
97
+ margin-left: 42.857142857142854%;
98
+ *margin-left: 42.750533049040506%;
99
+ }
100
+ .cal-week-box .cal-offset2,
101
+ .cal-row-fluid .cal-offset2,
102
+ .cal-row-fluid .cal-offset2:first-child {
103
+ margin-left: 28.57142857142857%;
104
+ *margin-left: 28.46481876332622%;
105
+ }
106
+ .cal-week-box .cal-offset1,
107
+ .cal-row-fluid .cal-offset1,
108
+ .cal-row-fluid .cal-offset1:first-child {
109
+ margin-left: 14.285714285714285%;
110
+ *margin-left: 14.17910447761194%;
111
+ }
112
+
113
+
114
+ .cal-row-fluid .cal-span1 {
115
+ width: 14.285714285714285%;
116
+ *width: 14.233576642335766%;
117
+ }
118
+
119
+ [class*="cal-span"].hide,
120
+ .cal-row-fluid [class*="cal-span"].hide {
121
+ display: none;
122
+ }
123
+
124
+ [class*="cal-span"].pull-right,
125
+ .cal-row-fluid [class*="cal-span"].pull-right {
126
+ float: right;
127
+ }
@@ -0,0 +1,92 @@
1
+ .cal-row-head [class*="cal-span"]:first-child,
2
+ .cal-row-head [class*="cal-span"] {
3
+ min-height: auto;
4
+ }
5
+ .cal-year-box [class*="span"] {
6
+ position: relative;
7
+ }
8
+ .cal-events-num {
9
+ margin-top: 20px;
10
+ }
11
+ .cal-month-day {
12
+ position: relative;
13
+ display: block;
14
+ width: 100%;
15
+ }
16
+
17
+ #cal-week-box {
18
+ position: absolute;
19
+ width: 50px;
20
+ left: -61px;
21
+ top: -1px;
22
+ padding: 8px 5px;
23
+ cursor: pointer;
24
+ }
25
+
26
+ #cal-day-box {
27
+ position: absolute;
28
+ right: 50%;
29
+ bottom: -21px;
30
+ padding: 0px 5px;
31
+ cursor: pointer;
32
+ z-index: 5;
33
+ text-align: center;
34
+ width: 20px;
35
+ margin-right: -17px;
36
+ }
37
+ .cal-year-box #cal-day-box {
38
+ margin-right: -7px;
39
+ }
40
+
41
+ #cal-slide-box {
42
+ position: relative;
43
+ }
44
+
45
+ #cal-slide-tick {
46
+ position: absolute;
47
+ width: 16px;
48
+ margin-left: -7px;
49
+ height: 9px;
50
+ top: -1px;
51
+ z-index: 1;
52
+ }
53
+ #cal-slide-tick.tick-month1 {
54
+ left: 12.5%;
55
+ }
56
+ #cal-slide-tick.tick-month2 {
57
+ left: 37.5%;
58
+ }
59
+ #cal-slide-tick.tick-month3 {
60
+ left: 62.5%;
61
+ }
62
+ #cal-slide-tick.tick-month4 {
63
+ left: 87.5%;
64
+ }
65
+
66
+ #cal-slide-tick.tick-day1 {
67
+ left: 7.14285714285715%;
68
+ }
69
+ #cal-slide-tick.tick-day2 {
70
+ left: 21.42857142857143%;
71
+ }
72
+ #cal-slide-tick.tick-day3 {
73
+ left: 35.71428571428572%;
74
+ }
75
+ #cal-slide-tick.tick-day4 {
76
+ left: 50%;
77
+ }
78
+ #cal-slide-tick.tick-day5 {
79
+ left: 64.2857142857143%;
80
+ }
81
+ #cal-slide-tick.tick-day6 {
82
+ left: 78.57142857142859%;
83
+ }
84
+ #cal-slide-tick.tick-day7 {
85
+ left: 92.85714285714285%;
86
+ }
87
+ .events-list {
88
+ position: absolute;
89
+ bottom: 0;
90
+ left: 0;
91
+ overflow: hidden;
92
+ }
@@ -0,0 +1,140 @@
1
+ @import "variables.css.less";
2
+
3
+ .cal-row-head [class*="cal-span"]:first-child,
4
+ .cal-row-head [class*="cal-span"] {
5
+ font-weight: bolder;
6
+ text-align: center;
7
+ border: 0px solid;
8
+ padding: 5px 0;
9
+ }
10
+ .cal-row-head [class*="cal-span"] small {
11
+ font-weight: normal;
12
+ }
13
+ .cal-year-box .row-fluid:hover,
14
+ .cal-row-fluid:hover {
15
+ background-color: @rowHover;
16
+ }
17
+ .cal-month-day {
18
+ height: @rowHeightMonth;
19
+ }
20
+ [class*="cal-span"]:hover {
21
+ background-color: @dayHover;
22
+ }
23
+ .cal-year-box [class*="span"],
24
+ .cal-month-box [class*="cal-span"] {
25
+ min-height: @rowHeightMonth;
26
+ border-right: @borderSizevert @borderStyle @borderColor;
27
+ }
28
+ .cal-year-box [class*="span"]{
29
+ min-height: @rowHeightYear;
30
+ }
31
+ .cal-year-box .row-fluid [class*="span"]:last-child,
32
+ .cal-month-box .cal-row-fluid [class*="cal-span"]:last-child {
33
+ border-right: 0px;
34
+ }
35
+ .cal-year-box .row-fluid,
36
+ .cal-month-box .cal-row-fluid {
37
+ border-bottom: @borderSizehoriz @borderStyle @borderColor;
38
+ }
39
+ .cal-year-box .row-fluid:last-child,
40
+ .cal-month-box .cal-row-fluid:last-child {
41
+ border-bottom: 0px;
42
+ }
43
+ .cal-month-box,
44
+ .cal-year-box,
45
+ .cal-week-box {
46
+ border-top: @borderSizehoriz @borderStyle @borderColor;
47
+ border-bottom: @borderSizehoriz @borderStyle @borderColor;
48
+ border-right: @borderSizevert @borderStyle @borderColor;
49
+ border-left: @borderSizevert @borderStyle @borderColor;
50
+ border-radius: 2px;
51
+ }
52
+ span[data-cal-date] {
53
+ font-size: 1.2em;
54
+ font-weight: normal;
55
+ opacity: 0.5;
56
+ cursor: pointer;
57
+ transition: all .3s ease-in-out;
58
+ -webkit-transition: all .1s ease-in-out;
59
+ -moz-transition: all .1s ease-in-out;
60
+ -ms-transition: all .1s ease-in-out;
61
+ -o-transition: all .1s ease-in-out;
62
+ margin-top: 15px;
63
+ margin-right: 15px;
64
+ }
65
+ span[data-cal-date]:hover {
66
+ opacity: 1;
67
+ }
68
+
69
+ .cal-day-outmonth span[data-cal-date] {
70
+ opacity: 0.1;
71
+ cursor: default;
72
+ }
73
+
74
+ .cal-day-today {
75
+ background-color: #e8fde7;
76
+ }
77
+
78
+ .cal-day-today span[data-cal-date] {
79
+ color: darkgreen;
80
+ font-size: 1.9em;
81
+ }
82
+
83
+ .cal-day-holiday span[data-cal-date] {
84
+ color: #800080;
85
+ }
86
+
87
+ .cal-day-weekend span[data-cal-date] {
88
+ color: darkred;
89
+ }
90
+
91
+ #cal-week-box {
92
+ border: @borderSize @borderStyle @borderColor;
93
+ border-right: 0px;
94
+ border-radius: 5px 0 0 5px;
95
+ background-color: @rowHover;
96
+ text-align: right;
97
+ }
98
+
99
+ #cal-day-box {
100
+ border: @borderSize @borderStyle @borderColor;
101
+ border-top: 0px solid;
102
+ border-radius: 0 0 5px 5px;
103
+ background-color: @dayHover;
104
+ text-align: center;
105
+ }
106
+
107
+ #cal-slide-box {
108
+ border-top: 0px solid #8c8c8c;
109
+ }
110
+
111
+ #cal-slide-content {
112
+ padding: 20px;
113
+ color: #ffffff;
114
+ background-image: url("../img/dark_wood.png");
115
+ -webkit-box-shadow: inset 0px 0px 15px 0px rgba(0, 0, 0, 0.5);
116
+ box-shadow: inset 0px 0px 15px 0px rgba(0, 0, 0, 0.5);
117
+ }
118
+
119
+ #cal-slide-tick {
120
+ background-image: url("../img/tick.png?2");
121
+ }
122
+ #cal-slide-content:hover {
123
+ background-color: transparent;
124
+ }
125
+ #cal-slide-content a.event-item {
126
+ color: #ffffff;
127
+ font-weight: normal;
128
+ line-height: 22px;
129
+ }
130
+ .events-list {
131
+ max-height: @rowHeightMonth - 53px;
132
+ padding-left: 5px;
133
+ }
134
+ .cal-column {
135
+ border-left: @borderSize @borderStyle @borderColor;
136
+ }
137
+ a.cal-event-week {
138
+ text-decoration: none;
139
+ color: #151515;
140
+ }
@@ -0,0 +1,35 @@
1
+ @rowHeightMonth: 100px;
2
+ @rowHeightYear: 60px;
3
+
4
+ // Events
5
+
6
+ @eventStandardColor: #c3c3c3;
7
+ @eventImportantColor: #ad2121;
8
+ @eventInfoColor: dodgerblue;
9
+ @eventWarningColor: #e3bc08;
10
+ @eventSuccessColor: darkgreen;
11
+ @eventInverseColor: #1b1b1b;
12
+ @eventSpecialColor: #800080;
13
+
14
+ @eventHiliteStandart: #dddddd;
15
+ @eventHiliteImportant: lighten(@eventImportantColor, 53%);
16
+ @eventHiliteInfo: lighten(@eventInfoColor, 35%);
17
+ @eventHiliteWarning: lighten(@eventWarningColor, 40%);
18
+ @eventHiliteSuccess: lighten(@eventSuccessColor, 70%);
19
+ @eventHiliteInverse: lighten(@eventInverseColor, 65%);
20
+ @eventHiliteSpecial: lighten(@eventSpecialColor, 70%);
21
+
22
+ // MONTH
23
+ @rowHover: #fafafa;
24
+ @dayHover: darken(@rowHover, 5%);
25
+ @borderColor: darken(@rowHover, 10%);
26
+ @borderSize: 1px;
27
+ @borderSizehoriz: 1px;
28
+ @borderSizevert: 1px;
29
+ @borderStyle: solid;
30
+
31
+ @eventBorderSize: 1px;
32
+ @eventBorderColor: #ffffff;
33
+ @eventBorderRadius:8px;
34
+ @eventMargin: 2px;
35
+ @eventSize: 12px;
@@ -0,0 +1,11 @@
1
+ .cal-week-box [class*="cal-span"] {
2
+ white-space: nowrap;
3
+ overflow: hidden;
4
+ text-overflow: ellipsis;
5
+ }
6
+
7
+ .cal-column {
8
+ position: absolute;
9
+ height: 100%;
10
+ z-index: -1;
11
+ }
@@ -0,0 +1,8 @@
1
+ # Author:: Nikita Vasiliev (mailto:sharpyfox@gmail.com)
2
+ # Encoding:: utf-8
3
+ # License:: Distributes under the same terms as Ruby
4
+
5
+ # desc "Explaining what the task does"
6
+ # task :bootstrap_calendar_rails do
7
+ # # Task goes here
8
+ # end
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bootstrap_calendar_rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Nikita Vasiliev
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-06-14 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '3'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: sqlite3
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec-rails
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ description: bootstrap_calendar_rails allow you to build beautiful calendars with
63
+ Twitter Bootstrap and Rails
64
+ email:
65
+ - sharpyfox@gmail.com
66
+ executables: []
67
+ extensions: []
68
+ extra_rdoc_files: []
69
+ files:
70
+ - lib/tasks/bootstrap_calendar_rails_tasks.rake
71
+ - lib/bootstrap_calendar_rails/railtie.rb
72
+ - lib/bootstrap_calendar_rails/view_helper.rb
73
+ - lib/bootstrap_calendar_rails/version.rb
74
+ - lib/generators/calendar/install/templates/month.css.less
75
+ - lib/generators/calendar/install/templates/application.css
76
+ - lib/generators/calendar/install/templates/grid.css.less
77
+ - lib/generators/calendar/install/templates/variables.css.less
78
+ - lib/generators/calendar/install/templates/events.css.less
79
+ - lib/generators/calendar/install/templates/theme.css.less
80
+ - lib/generators/calendar/install/templates/calendar.css
81
+ - lib/generators/calendar/install/templates/week.css.less
82
+ - lib/generators/calendar/install/templates/calendar.css.less
83
+ - lib/generators/calendar/install/templates/en.calendar.yml
84
+ - lib/generators/calendar/install/install_generator.rb
85
+ - lib/bootstrap_calendar_rails.rb
86
+ - MIT-LICENSE
87
+ - Rakefile
88
+ - README.md
89
+ homepage: https://github.com/sharpyfox/bootstrap_calendar_rails
90
+ licenses: []
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ! '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ! '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 1.8.25
110
+ signing_key:
111
+ specification_version: 3
112
+ summary: calendar helper for Twitter Bootstrap
113
+ test_files: []