-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalendar.js.coffee
More file actions
56 lines (49 loc) · 1.43 KB
/
calendar.js.coffee
File metadata and controls
56 lines (49 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
SM.Calendar = {}
SM.Calendar.Container = {}
SM.Calendar.Navigation = {}
SM.Calendar.Grid = {}
SM.Calendar.Form = {}
SM.Calendar.open = false
SM.Calendar.init = ->
setTimeout(SM.Calendar.Container.Store.init(),2000)
React.render(
React.createElement SM.Calendar.Container.View, null
document.getElementById('calendar')
)
SM.Calendar.show = ->
$.fancybox
content: "<div id='calendar'></div>"
centerOnScroll: true
autoSize: false
closeBtn: false
wrapCSS: 'sm-calendar'
titleShow: false
openEffect: 'none'
closeEffect: 'none'
overlayColor: '#fff'
width: $(document).width() - 50
height: $(document).height() - 50
beforeShow: ->
afterShow: ->
SM.Calendar.init()
SM.Calendar.open = true
$(document.body).addClass("calendar-mode")
afterClose: ->
SM.Calendar.hide = ->
SM.Calendar.Container.API.abortLoad()
$('#timeline_event_form').modal('hide')
$.fancybox.close()
SM.Calendar.open = false
$(document.body).removeClass("calendar-mode")
SM.Calendar.Container.hideLoader()
SM.Calendar.editEvent = (event_id) ->
if event_id
# edit
$.getJSON "/timeline_events/#{event_id}", (data) ->
evt = data['timeline_event']
evt.start_at = Date.parse evt.start_at
evt.end_at = Date.parse evt.end_at
SM.timeline.display_form_if_you_have_access evt
else
# new
SM.timeline.showForm user_id: SM.currentUser.id, created_by: SM.currentUser.id