[5592] | 1 | function contentMenu(){ |
---|
| 2 | $('.fullcalendar-not-context-menu').bind('contextmenu', function(event){ |
---|
| 3 | event.preventDefault(); |
---|
| 4 | }); |
---|
| 5 | |
---|
| 6 | $('.fullcalendar-context-menu').bind('contextmenu', function(event){ |
---|
| 7 | event.preventDefault(); |
---|
[5746] | 8 | |
---|
[5592] | 9 | var classes = $(this).attr('class').split(" "); |
---|
| 10 | var idEvent = false; |
---|
[5746] | 11 | var idRecurrence = false; |
---|
| 12 | |
---|
[5592] | 13 | //recupera o id do calendar eo id do evento para tratamento |
---|
| 14 | for(var i = 0; i < classes.length; i++){ |
---|
[5746] | 15 | if (classes[i].indexOf("event-id-") >= 0 ){ |
---|
| 16 | idEvent = classes[i].replace(/[a-zA-Z-]+/g, ''); |
---|
| 17 | continue; |
---|
| 18 | }else if (classes[i].indexOf("Recurrence-id-") >= 0 ){ |
---|
| 19 | idRecurrence = classes[i].replace(/[a-zA-Z-]+/g, ''); |
---|
| 20 | continue; |
---|
| 21 | } |
---|
| 22 | } |
---|
| 23 | |
---|
| 24 | var schedulable = DataLayer.get('schedulable', idEvent); |
---|
| 25 | |
---|
[5863] | 26 | var isRecurrence = DataLayer.get('repeat', schedulable.repeat).frequency; |
---|
| 27 | |
---|
[5746] | 28 | var template = DataLayer.render( 'templates/menu_context_event.ejs', {event: schedulable.id , |
---|
| 29 | top: (event.clientY - 135), left: (event.clientX - 445), |
---|
| 30 | signature: Calendar.signatureOf[schedulable.calendar], |
---|
[5863] | 31 | calendars: Calendar.calendars, isRecurrence: isRecurrence == 'none' ? false : true, |
---|
[5746] | 32 | idRecurrence: idRecurrence |
---|
| 33 | }); |
---|
[5592] | 34 | |
---|
| 35 | $('#context-menu-event').html(template); |
---|
[5746] | 36 | |
---|
| 37 | var method = function(value){ |
---|
| 38 | switch (value){ |
---|
| 39 | case "ocurrency": |
---|
| 40 | return '2' |
---|
| 41 | case "copy": |
---|
| 42 | return '1'; |
---|
| 43 | case "move": |
---|
| 44 | return '0'; |
---|
| 45 | } |
---|
| 46 | } |
---|
[5592] | 47 | |
---|
| 48 | $('#context-menu-event').find('li.menu-item').hover( |
---|
| 49 | function () { |
---|
| 50 | $(this).addClass("li-hover").find('a').addClass('ui-state-hover'); |
---|
| 51 | if($(this).hasClass('copy') || $(this).hasClass('move')) { |
---|
| 52 | |
---|
[5746] | 53 | $(this).parents().find('.calendar-copy-move input[name="typeEvent"]').val( method($(this).attr('class').split(" ")[0])); |
---|
[5592] | 54 | $(this).parents().find('.calendar-copy-move').show(); |
---|
| 55 | |
---|
| 56 | } |
---|
| 57 | }, |
---|
| 58 | function () { |
---|
| 59 | $(this).removeClass("li-hover").find('a').removeClass('ui-state-hover'); |
---|
| 60 | if(!$(this).hasClass('copy') && !$(this).hasClass('move') ) |
---|
| 61 | $(this).parents().find('.calendar-copy-move').hide() |
---|
| 62 | } |
---|
| 63 | ); |
---|
| 64 | |
---|
| 65 | $('#context-menu-event').find('li.calendar-list').hover( |
---|
| 66 | function () { |
---|
| 67 | $(this).addClass("li-hover").find('a').addClass('ui-state-hover'); |
---|
| 68 | }, |
---|
| 69 | function () { |
---|
| 70 | $(this).removeClass("li-hover").find('a').removeClass('ui-state-hover'); |
---|
| 71 | } |
---|
| 72 | ); |
---|
| 73 | |
---|
| 74 | event.preventDefault(); |
---|
| 75 | }); |
---|
| 76 | } |
---|