clndr-rails 1.2.10.1 → 1.4.6.1.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +10 -10
- data/lib/clndr-rails.rb +230 -230
- data/lib/clndr-rails/config.rb +114 -114
- data/lib/clndr-rails/errors.rb +19 -19
- data/lib/clndr-rails/templates.rb +94 -94
- data/lib/clndr-rails/version.rb +1 -1
- data/test/dummy/config/initializers/clndr.rb +27 -27
- data/test/dummy/log/test.log +372 -16927
- data/test/dummy/spec/controllers/base_controller_spec.rb +12 -12
- data/test/dummy/spec/spec_helper.rb +93 -93
- data/test/spec/clndr-rails_spec.rb +28 -28
- data/test/spec/configuration_spec.rb +136 -136
- data/test/spec/events_spec.rb +62 -62
- data/test/spec/html_spec.rb +199 -199
- data/test/spec/spec_helper.rb +15 -15
- data/test/spec/templates_spec.rb +70 -70
- data/vendor/assets/javascripts/clndr-rails/clndr.min.js +2 -2
- metadata +26 -246
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/log/development (/320/232/320/276/320/275/321/204/320/273/320/270/320/272/321/202/321/203/321/216/321/211/320/260/321/217 /320/272/320/276/320/277/320/270/321/217 /321/201 /320/272/320/276/320/274/320/277/321/214/321/216/321/202/320/265/321/200/320/260 DELTAPC2 2014-12-25).log" +0 -19726
- data/test/dummy/log/development.log +0 -22099
- data/test/dummy/tmp/cache/assets/development/sass/7c98d0fae9192743d8c55a5e8e53de41ac6246a9/clndr-rails.css.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/003c68cd1f3ba2d6344147bb52d8fd1a +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/02c5e1a21d4a4605f8b34eca639a1f70 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/0687b70ce11a7e80dcd39da365dd5a8a +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/08b993c8e83ad57a4ecb8d753b4620d5 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/1223ac7ac3a460c3f9ce66e828acdc67 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/1cc60160d9e0a352994b8eb6b8313b1a +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/1d658adc7cb09c209c423c9138dbacee +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/28cfd59c37a42a9ea808d622b0177c86 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/2aeab94961f3936633223fba03e2a6ed +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/2be3a826c076d8c8854c94ebc3a6d773 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/2e471d0b6fa1aa6817c6d3e773648a43 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/3b526052e48eb4ad5375fb6432761828 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/4069980b5689edf29f7bc438d62f44e9 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/42927f6bcf2f320e08ea8ff02d5c8209 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/433724373619c6185a095523fd7c7fe0 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/460632c7db14d41cf7371b6b4bb64157 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/486f42c6c97c7a42b88dc91fc2d5a864 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/4a9158fb3a677a8253fa2a7e93551175 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/4ad6cd41e5b645f9ceef10b1e3baea77 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/4b2e05f2b06345dfee1d683a3fdd29e7 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/51408facf1bc7598eedca202daf4ba96 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/53eedf0ac9053fc3d462eabaf534bd05 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/580892b79dd41de64c62d07404cd1a12 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/58dc697381035be4d343e2b19720c10c +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/5a6cb5cfc573c611e29c2ac98103701f +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/5f78b3457def1d02bd3fb75d4e0cfb63 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/643ff98d256ca160a0cb4ca0fc83ffdb +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/684604af0ae58f9e55f2992fe9c466d7 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/6b158f7584f499d82165f5ccaf303d16 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/6c33e774b86f9ef5ba24ffbe52bed674 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/6c9c1cfb50b40b88dd14926792400890 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/6f78527844795b9b46156d0576fffe63 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/73938775f2e5bebe09996667ea3dd302 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/74efa8b198344d1b86c6531144584f3e +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/78573c83ee7596aaed9105a0ed816f5d +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/7b51783beb0f6f17617f87ef5d2688e3 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/7b60bb572e6a268c62e728ed79fb2cda +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/82eac1b4407ccfbc517558b830c67a53 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/8329b2874924fc312c31e87ef69a88bb +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/83ed9f0dcdd68efbed721b2b10fcda6b +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/9123d280fa9cc0d16a1ec96a3e44bcc1 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/93120bd88f1e2293fc55c191aeab678a +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/9334f44096c23e8904784b524e6ae750 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/954c1c7328e5b9c43abd84f4981286c7 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/9bd8392ddf2b52be4b455e52a628d169 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/9c89c900cca1bf92a5f29c304d323256 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/9e158358644b7e1cbee43defd7d7b449 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/a086b63b827c2bdef684cc4985c925fc +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/a4ce04494de7990c1b23b8498b2fb743 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/a62be18dea33018456ea9b72b4a9e10b +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/a780ea7d8044a1786c8bfd4b3df13491 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/a7f1637ae79393f95fd20936e91d62d0 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/ab8a19b4c942c018374d61f4f99235dc +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/ad861213dbd41ab02600f740c9bb1dee +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/ae0ae68c837285b67a4fc1df4dddb939 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/b419fd5d14fd53ae2fffa3026f0f4aa4 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/b6c986125db42513425f8a84e0021579 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/b85bb5a9001b8d932b99e152afc282b9 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/bb2f6a70a78dd0eb8181c7f495e82f57 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/bd28ee35f981cb10b9740ee6e6686b6d +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/be9637deb767f91f0193d4b0573f954e +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/c0f2a7bdc7a73db8bacf633cef4ec428 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/c4a0410f3ca8e859238c3b5a24ef0d98 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/c744c093e347d6c90bc75206f502a48e +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/c7effad0605334daea2929e656094580 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/c8fc1f981896d3bc3650f6dc2cdc3981 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/cbc61fb8910e489328c2cbf64a73c6ca +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/cc517e4ba5ef452b08d1ab48925b952d +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/d9282682f846f5b479288a298788e6c7 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/dc767a0bb27fb390899cd7e6ff34b310 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/dd041a66875b6a140cf105a32e88980b +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/de1001d906d7f009cc8b325d53aed152 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/de79a0cce913cf585100d02ad7b13bd2 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/e101b6a9f9eb86d3591c6075a3f59be4 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/e59e1f3e795e9486fffbc3b4ad0baaca +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/e7296c70ca399cdcc73806b4a9481fde +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/eabe02c282ba47d5bef91a603f0e8ddc +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/edf2dce367a4fbd2628ceef059dab88f +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/efbbf60292a32f735cfdcbd98f0a0dcb +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f1829681b5124c696fef4fd62c36f101 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f34be083c250d77494ecd0d35fd1099f +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f3c1e7e2d789b88a0b3e967365eefda2 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f56ceda2003be471c5e7a5ec2e355c9e +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/fb5e937723a7579bee0be03b0c5d9052 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/1cc60160d9e0a352994b8eb6b8313b1a +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/28cfd59c37a42a9ea808d622b0177c86 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/2aeab94961f3936633223fba03e2a6ed +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/42927f6bcf2f320e08ea8ff02d5c8209 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/53eedf0ac9053fc3d462eabaf534bd05 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/580892b79dd41de64c62d07404cd1a12 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/5a6cb5cfc573c611e29c2ac98103701f +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/5f78b3457def1d02bd3fb75d4e0cfb63 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/684604af0ae58f9e55f2992fe9c466d7 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/6c33e774b86f9ef5ba24ffbe52bed674 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/6f78527844795b9b46156d0576fffe63 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/74efa8b198344d1b86c6531144584f3e +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/bb2f6a70a78dd0eb8181c7f495e82f57 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/c8fc1f981896d3bc3650f6dc2cdc3981 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/de79a0cce913cf585100d02ad7b13bd2 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f1829681b5124c696fef4fd62c36f101 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
data/lib/clndr-rails/config.rb
CHANGED
@@ -1,115 +1,115 @@
|
|
1
|
-
class Clndr
|
2
|
-
|
3
|
-
# check date to available format
|
4
|
-
# if date is Time instance, convert to available string
|
5
|
-
def self.date_format(date)
|
6
|
-
if date.is_a?(Time)
|
7
|
-
date.strftime('%F')
|
8
|
-
elsif date.match(/\d{4}\-\d{2}\-\d{2}/)
|
9
|
-
date
|
10
|
-
else
|
11
|
-
raise Clndr::Error::WrongDateFormat
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
# default config
|
16
|
-
@@template = Clndr::Template::BLANK
|
17
|
-
@@week_offset = 1
|
18
|
-
@@start_with_month = nil
|
19
|
-
@@days_of_the_week = nil
|
20
|
-
@@click_events={}
|
21
|
-
@@targets={}
|
22
|
-
@@show_adjacent_months= true
|
23
|
-
@@adjacent_days_change_month=false
|
24
|
-
@@done_rendering=nil
|
25
|
-
@@constraints ={}
|
26
|
-
@@force_six_rows= true
|
27
|
-
@@custom_classes = {}
|
28
|
-
# todo check for available events and targets
|
29
|
-
# rails like config
|
30
|
-
def self.configure
|
31
|
-
yield self
|
32
|
-
end
|
33
|
-
|
34
|
-
def self.default_settings
|
35
|
-
@@template = Clndr::Template::BLANK
|
36
|
-
@@week_offset = 1
|
37
|
-
@@start_with_month = nil
|
38
|
-
@@days_of_the_week = nil
|
39
|
-
@@click_events={}
|
40
|
-
@@targets={}
|
41
|
-
@@show_adjacent_months= true
|
42
|
-
@@adjacent_days_change_month=false
|
43
|
-
@@done_rendering=nil
|
44
|
-
@@constraints ={}
|
45
|
-
@@force_six_rows= true
|
46
|
-
@@custom_classes = {}
|
47
|
-
self
|
48
|
-
end
|
49
|
-
|
50
|
-
|
51
|
-
def self.template=(template)
|
52
|
-
@@template ||= template
|
53
|
-
end
|
54
|
-
|
55
|
-
def self.week_offset=(offset)
|
56
|
-
|
57
|
-
# convert offset to CLNDR format
|
58
|
-
if offset
|
59
|
-
@@week_offset = 1
|
60
|
-
else
|
61
|
-
@@week_offset = 0
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def self.start_with_month=(date)
|
66
|
-
@@start_with_month = date_format date
|
67
|
-
end
|
68
|
-
|
69
|
-
def self.days_of_the_week=(array_of_days)
|
70
|
-
if array_of_days.length == 7
|
71
|
-
@@days_of_the_week=array_of_days
|
72
|
-
else
|
73
|
-
raise Clndr::Error::WrongDaysOfWeekArray
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
def self.show_adjacent_months=(boolean)
|
78
|
-
@@show_adjacent_months = boolean
|
79
|
-
end
|
80
|
-
|
81
|
-
# access to click_events hash
|
82
|
-
def self.click_events
|
83
|
-
yield @@click_events
|
84
|
-
end
|
85
|
-
|
86
|
-
# access to target hash
|
87
|
-
def self.targets
|
88
|
-
yield @@targets
|
89
|
-
end
|
90
|
-
|
91
|
-
def self.adjacent_days_change_month=(boolean)
|
92
|
-
@@adjacent_days_change_month= boolean
|
93
|
-
end
|
94
|
-
|
95
|
-
def self.done_rendering=(jsfunction)
|
96
|
-
@@done_rendering = jsfunction
|
97
|
-
end
|
98
|
-
|
99
|
-
def self.constraints_start=(date)
|
100
|
-
@@constraints[:startDate]= date_format date
|
101
|
-
end
|
102
|
-
|
103
|
-
def self.constraints_end=(date)
|
104
|
-
@@constraints[:endDate]= date_format date
|
105
|
-
end
|
106
|
-
|
107
|
-
def self.force_six_rows=(boolean)
|
108
|
-
@@force_six_rows= boolean
|
109
|
-
end
|
110
|
-
|
111
|
-
def self.classes
|
112
|
-
yield @@custom_classes
|
113
|
-
end
|
114
|
-
|
1
|
+
class Clndr
|
2
|
+
|
3
|
+
# check date to available format
|
4
|
+
# if date is Time instance, convert to available string
|
5
|
+
def self.date_format(date)
|
6
|
+
if date.is_a?(Time)
|
7
|
+
date.strftime('%F')
|
8
|
+
elsif date.match(/\d{4}\-\d{2}\-\d{2}/)
|
9
|
+
date
|
10
|
+
else
|
11
|
+
raise Clndr::Error::WrongDateFormat
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# default config
|
16
|
+
@@template = Clndr::Template::BLANK
|
17
|
+
@@week_offset = 1
|
18
|
+
@@start_with_month = nil
|
19
|
+
@@days_of_the_week = nil
|
20
|
+
@@click_events={}
|
21
|
+
@@targets={}
|
22
|
+
@@show_adjacent_months= true
|
23
|
+
@@adjacent_days_change_month=false
|
24
|
+
@@done_rendering=nil
|
25
|
+
@@constraints ={}
|
26
|
+
@@force_six_rows= true
|
27
|
+
@@custom_classes = {}
|
28
|
+
# todo check for available events and targets
|
29
|
+
# rails like config
|
30
|
+
def self.configure
|
31
|
+
yield self
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.default_settings
|
35
|
+
@@template = Clndr::Template::BLANK
|
36
|
+
@@week_offset = 1
|
37
|
+
@@start_with_month = nil
|
38
|
+
@@days_of_the_week = nil
|
39
|
+
@@click_events={}
|
40
|
+
@@targets={}
|
41
|
+
@@show_adjacent_months= true
|
42
|
+
@@adjacent_days_change_month=false
|
43
|
+
@@done_rendering=nil
|
44
|
+
@@constraints ={}
|
45
|
+
@@force_six_rows= true
|
46
|
+
@@custom_classes = {}
|
47
|
+
self
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
def self.template=(template)
|
52
|
+
@@template ||= template
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.week_offset=(offset)
|
56
|
+
|
57
|
+
# convert offset to CLNDR format
|
58
|
+
if offset
|
59
|
+
@@week_offset = 1
|
60
|
+
else
|
61
|
+
@@week_offset = 0
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.start_with_month=(date)
|
66
|
+
@@start_with_month = date_format date
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.days_of_the_week=(array_of_days)
|
70
|
+
if array_of_days.length == 7
|
71
|
+
@@days_of_the_week=array_of_days
|
72
|
+
else
|
73
|
+
raise Clndr::Error::WrongDaysOfWeekArray
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.show_adjacent_months=(boolean)
|
78
|
+
@@show_adjacent_months = boolean
|
79
|
+
end
|
80
|
+
|
81
|
+
# access to click_events hash
|
82
|
+
def self.click_events
|
83
|
+
yield @@click_events
|
84
|
+
end
|
85
|
+
|
86
|
+
# access to target hash
|
87
|
+
def self.targets
|
88
|
+
yield @@targets
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.adjacent_days_change_month=(boolean)
|
92
|
+
@@adjacent_days_change_month= boolean
|
93
|
+
end
|
94
|
+
|
95
|
+
def self.done_rendering=(jsfunction)
|
96
|
+
@@done_rendering = jsfunction
|
97
|
+
end
|
98
|
+
|
99
|
+
def self.constraints_start=(date)
|
100
|
+
@@constraints[:startDate]= date_format date
|
101
|
+
end
|
102
|
+
|
103
|
+
def self.constraints_end=(date)
|
104
|
+
@@constraints[:endDate]= date_format date
|
105
|
+
end
|
106
|
+
|
107
|
+
def self.force_six_rows=(boolean)
|
108
|
+
@@force_six_rows= boolean
|
109
|
+
end
|
110
|
+
|
111
|
+
def self.classes
|
112
|
+
yield @@custom_classes
|
113
|
+
end
|
114
|
+
|
115
115
|
end
|
data/lib/clndr-rails/errors.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
class Clndr
|
2
|
-
module Error
|
3
|
-
class CalendarNotFound <StandardError
|
4
|
-
|
5
|
-
#this error raise when calendar not found
|
6
|
-
end
|
7
|
-
|
8
|
-
class WrongDateFormat <StandardError
|
9
|
-
def message
|
10
|
-
"Clndr support Ruby Time object or date string format 'YYYY-MM-DD' "
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
class WrongDaysOfWeekArray <StandardError
|
15
|
-
def message
|
16
|
-
"Array of days must contain 7 elements"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
1
|
+
class Clndr
|
2
|
+
module Error
|
3
|
+
class CalendarNotFound <StandardError
|
4
|
+
|
5
|
+
#this error raise when calendar not found
|
6
|
+
end
|
7
|
+
|
8
|
+
class WrongDateFormat <StandardError
|
9
|
+
def message
|
10
|
+
"Clndr support Ruby Time object or date string format 'YYYY-MM-DD' "
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class WrongDaysOfWeekArray <StandardError
|
15
|
+
def message
|
16
|
+
"Array of days must contain 7 elements"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
20
|
end
|
@@ -1,95 +1,95 @@
|
|
1
|
-
class Clndr
|
2
|
-
module Template
|
3
|
-
|
4
|
-
extend ActionView::Helpers::TagHelper
|
5
|
-
extend ActionView::Context
|
6
|
-
|
7
|
-
# full template
|
8
|
-
FULL = "'#{
|
9
|
-
content_tag(:div,nil,class:'clndr-controls') do
|
10
|
-
content_tag(:div,'<',class: 'clndr-previous-button') +
|
11
|
-
content_tag(:div,'>',class: 'clndr-next-button') +
|
12
|
-
content_tag(:div,'<%= month %> <%= year %>'.html_safe,class: 'current-month')
|
13
|
-
end +
|
14
|
-
content_tag(:div,nil,class:'clndr-grid full') do
|
15
|
-
content_tag(:div,nil, class:'days-of-the-week clearfix') do
|
16
|
-
'<% _.each(daysOfTheWeek, function(day) { %>'.html_safe +
|
17
|
-
content_tag(:div,'<%= day %>'.html_safe,class:'header-day')+'<% }); %>'.html_safe
|
18
|
-
end +
|
19
|
-
content_tag(:div,nil,class:'days')do
|
20
|
-
'<% _.each(days, function(day) { %>'.html_safe +
|
21
|
-
'<div class=\"<%= day.classes %>\" id=\"<%= day.id %>\"><span class=\"day-number\"><%= day.day %></span></div> <% }); %>'.html_safe
|
22
|
-
end
|
23
|
-
end +
|
24
|
-
content_tag(:div,nil,class:'event-listing') do
|
25
|
-
content_tag(:div, 'EVENTS THIS MONTH', class: 'event-listing-title') +
|
26
|
-
'<% _.each(eventsThisMonth, function(event) { %>'.html_safe +
|
27
|
-
content_tag(:div,nil,class: 'event-item') do
|
28
|
-
content_tag(:div, '<%= event.title %>'.html_safe, class: 'event-item-name') +
|
29
|
-
content_tag(:div, '<%= event.location %>'.html_safe, class: 'event-item-location')
|
30
|
-
end +
|
31
|
-
'<% }); %>'.html_safe
|
32
|
-
end
|
33
|
-
}'"
|
34
|
-
|
35
|
-
# blank template
|
36
|
-
# CLNDR generate simple table
|
37
|
-
BLANK=nil
|
38
|
-
|
39
|
-
# mini template
|
40
|
-
MINI = "'#{
|
41
|
-
content_tag(:div,class:'controls') do
|
42
|
-
content_tag(:div, '<', class: 'clndr-previous-button')+
|
43
|
-
content_tag(:div, '<%= month %>'.html_safe, class: 'month')+
|
44
|
-
content_tag(:div,'>',class: 'clndr-next-button')
|
45
|
-
end+
|
46
|
-
content_tag(:div,class: 'days-container mini') do
|
47
|
-
content_tag(:div,class: 'days') do
|
48
|
-
content_tag(:div, class: 'headers') do
|
49
|
-
'<% _.each(daysOfTheWeek, function(day) { %>'.html_safe+
|
50
|
-
content_tag(:div, '<%= day %>'.html_safe, class: 'day-header')+
|
51
|
-
'<% }); %>'.html_safe+
|
52
|
-
'<% _.each(days, function(day) { %><div class="<%= day.classes %>" id="<%= day.id %>"><%= day.day %></div><% }); %>'.html_safe
|
53
|
-
end
|
54
|
-
end+
|
55
|
-
content_tag(:div,class: 'events') do
|
56
|
-
content_tag(:div,class: 'headers') do
|
57
|
-
content_tag(:div,'x',class: 'x-button')+
|
58
|
-
content_tag(:div,'EVENTS',class: 'event-header')
|
59
|
-
end+
|
60
|
-
content_tag(:div,class: 'events-list') do
|
61
|
-
'<% _.each(eventsThisMonth, function(event) { %>'.html_safe+
|
62
|
-
content_tag(:div,class: 'event') do
|
63
|
-
'<a href="<%= event.url %>"><%= moment(event.date).format("MMMM Do") %>: <%= event.title %></a>'.html_safe
|
64
|
-
end+
|
65
|
-
'<% }); %>'.html_safe
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
|
71
|
-
}'"
|
72
|
-
# simple template without month change control
|
73
|
-
SIMPLE="'#{
|
74
|
-
content_tag(:div,'<%= month %>'.html_safe,class: 'month-bar')+
|
75
|
-
content_tag(:div,class: 'clndr-grid simple')do
|
76
|
-
content_tag(:div, class: 'days-of-the-week clearfix') do
|
77
|
-
'<% _.each(daysOfTheWeek, function(day) { %>'.html_safe+
|
78
|
-
content_tag(:div,'<%= day %>'.html_safe,class: 'header-day')+
|
79
|
-
'<% }); %>'.html_safe
|
80
|
-
end+
|
81
|
-
content_tag(:div,class: 'days clearfix') do
|
82
|
-
'<% _.each(days, function(day) { %>'.html_safe+
|
83
|
-
'<div class="<%= day.classes %>" id="<%= day.id %>"><span class="day-number"><%= day.day %></span></div>'.html_safe+
|
84
|
-
'<% }); %>'.html_safe
|
85
|
-
end
|
86
|
-
end
|
87
|
-
}'"
|
88
|
-
|
89
|
-
# get template from html by selector
|
90
|
-
def self.from_html(selector)
|
91
|
-
"$(\"#{selector}\").html()".html_safe
|
92
|
-
end
|
93
|
-
|
94
|
-
end
|
1
|
+
class Clndr
|
2
|
+
module Template
|
3
|
+
|
4
|
+
extend ActionView::Helpers::TagHelper
|
5
|
+
extend ActionView::Context
|
6
|
+
|
7
|
+
# full template
|
8
|
+
FULL = "'#{
|
9
|
+
content_tag(:div,nil,class:'clndr-controls') do
|
10
|
+
content_tag(:div,'<',class: 'clndr-previous-button') +
|
11
|
+
content_tag(:div,'>',class: 'clndr-next-button') +
|
12
|
+
content_tag(:div,'<%= month %> <%= year %>'.html_safe,class: 'current-month')
|
13
|
+
end +
|
14
|
+
content_tag(:div,nil,class:'clndr-grid full') do
|
15
|
+
content_tag(:div,nil, class:'days-of-the-week clearfix') do
|
16
|
+
'<% _.each(daysOfTheWeek, function(day) { %>'.html_safe +
|
17
|
+
content_tag(:div,'<%= day %>'.html_safe,class:'header-day')+'<% }); %>'.html_safe
|
18
|
+
end +
|
19
|
+
content_tag(:div,nil,class:'days')do
|
20
|
+
'<% _.each(days, function(day) { %>'.html_safe +
|
21
|
+
'<div class=\"<%= day.classes %>\" id=\"<%= day.id %>\"><span class=\"day-number\"><%= day.day %></span></div> <% }); %>'.html_safe
|
22
|
+
end
|
23
|
+
end +
|
24
|
+
content_tag(:div,nil,class:'event-listing') do
|
25
|
+
content_tag(:div, 'EVENTS THIS MONTH', class: 'event-listing-title') +
|
26
|
+
'<% _.each(eventsThisMonth, function(event) { %>'.html_safe +
|
27
|
+
content_tag(:div,nil,class: 'event-item') do
|
28
|
+
content_tag(:div, '<%= event.title %>'.html_safe, class: 'event-item-name') +
|
29
|
+
content_tag(:div, '<%= event.location %>'.html_safe, class: 'event-item-location')
|
30
|
+
end +
|
31
|
+
'<% }); %>'.html_safe
|
32
|
+
end
|
33
|
+
}'"
|
34
|
+
|
35
|
+
# blank template
|
36
|
+
# CLNDR generate simple table
|
37
|
+
BLANK=nil
|
38
|
+
|
39
|
+
# mini template
|
40
|
+
MINI = "'#{
|
41
|
+
content_tag(:div,class:'controls') do
|
42
|
+
content_tag(:div, '<', class: 'clndr-previous-button')+
|
43
|
+
content_tag(:div, '<%= month %>'.html_safe, class: 'month')+
|
44
|
+
content_tag(:div,'>',class: 'clndr-next-button')
|
45
|
+
end+
|
46
|
+
content_tag(:div,class: 'days-container mini') do
|
47
|
+
content_tag(:div,class: 'days') do
|
48
|
+
content_tag(:div, class: 'headers') do
|
49
|
+
'<% _.each(daysOfTheWeek, function(day) { %>'.html_safe+
|
50
|
+
content_tag(:div, '<%= day %>'.html_safe, class: 'day-header')+
|
51
|
+
'<% }); %>'.html_safe+
|
52
|
+
'<% _.each(days, function(day) { %><div class="<%= day.classes %>" id="<%= day.id %>"><%= day.day %></div><% }); %>'.html_safe
|
53
|
+
end
|
54
|
+
end+
|
55
|
+
content_tag(:div,class: 'events') do
|
56
|
+
content_tag(:div,class: 'headers') do
|
57
|
+
content_tag(:div,'x',class: 'x-button')+
|
58
|
+
content_tag(:div,'EVENTS',class: 'event-header')
|
59
|
+
end+
|
60
|
+
content_tag(:div,class: 'events-list') do
|
61
|
+
'<% _.each(eventsThisMonth, function(event) { %>'.html_safe+
|
62
|
+
content_tag(:div,class: 'event') do
|
63
|
+
'<a href="<%= event.url %>"><%= moment(event.date).format("MMMM Do") %>: <%= event.title %></a>'.html_safe
|
64
|
+
end+
|
65
|
+
'<% }); %>'.html_safe
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
}'"
|
72
|
+
# simple template without month change control
|
73
|
+
SIMPLE="'#{
|
74
|
+
content_tag(:div,'<%= month %>'.html_safe,class: 'month-bar')+
|
75
|
+
content_tag(:div,class: 'clndr-grid simple')do
|
76
|
+
content_tag(:div, class: 'days-of-the-week clearfix') do
|
77
|
+
'<% _.each(daysOfTheWeek, function(day) { %>'.html_safe+
|
78
|
+
content_tag(:div,'<%= day %>'.html_safe,class: 'header-day')+
|
79
|
+
'<% }); %>'.html_safe
|
80
|
+
end+
|
81
|
+
content_tag(:div,class: 'days clearfix') do
|
82
|
+
'<% _.each(days, function(day) { %>'.html_safe+
|
83
|
+
'<div class="<%= day.classes %>" id="<%= day.id %>"><span class="day-number"><%= day.day %></span></div>'.html_safe+
|
84
|
+
'<% }); %>'.html_safe
|
85
|
+
end
|
86
|
+
end
|
87
|
+
}'"
|
88
|
+
|
89
|
+
# get template from html by selector
|
90
|
+
def self.from_html(selector)
|
91
|
+
"$(\"#{selector}\").html()".html_safe
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
95
|
end
|