[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(); |
---|
| 8 | var classes = $(this).attr('class').split(" "); |
---|
| 9 | var idCalendar = false; |
---|
| 10 | var idEvent = false; |
---|
| 11 | |
---|
| 12 | //recupera o id do calendar eo id do evento para tratamento |
---|
| 13 | for(var i = 0; i < classes.length; i++){ |
---|
| 14 | if(classes[i].indexOf("calendar-") >= 0 ){ |
---|
| 15 | idCalendar = classes[i].replace(/[a-zA-Z-]+/g, ''); |
---|
| 16 | }else if (classes[i].indexOf("event-id-") >= 0 ){ |
---|
| 17 | idEvent = classes[i].replace(/[a-zA-Z-]+/g, ''); |
---|
| 18 | } |
---|
| 19 | if(idCalendar && idEvent) |
---|
| 20 | break; |
---|
| 21 | }; |
---|
| 22 | |
---|
| 23 | var template = DataLayer.render( 'templates/menu_context_event.ejs', {event: idEvent,top: (event.clientY - 135), left: (event.clientX - 445), signature: Calendar.signatureOf[idCalendar], calendars: Calendar.calendars}); |
---|
| 24 | |
---|
| 25 | $('#context-menu-event').html(template); |
---|
| 26 | |
---|
| 27 | $('#context-menu-event').find('li.menu-item').hover( |
---|
| 28 | function () { |
---|
| 29 | $(this).addClass("li-hover").find('a').addClass('ui-state-hover'); |
---|
| 30 | if($(this).hasClass('copy') || $(this).hasClass('move')) { |
---|
| 31 | |
---|
| 32 | $(this).parents().find('.calendar-copy-move input[name="typeEvent"]').val( ($(this).hasClass('copy') ? '0' : '1' )); |
---|
| 33 | $(this).parents().find('.calendar-copy-move').show(); |
---|
| 34 | |
---|
| 35 | } |
---|
| 36 | }, |
---|
| 37 | function () { |
---|
| 38 | $(this).removeClass("li-hover").find('a').removeClass('ui-state-hover'); |
---|
| 39 | if(!$(this).hasClass('copy') && !$(this).hasClass('move') ) |
---|
| 40 | $(this).parents().find('.calendar-copy-move').hide() |
---|
| 41 | } |
---|
| 42 | ); |
---|
| 43 | |
---|
| 44 | $('#context-menu-event').find('li.calendar-list').hover( |
---|
| 45 | function () { |
---|
| 46 | $(this).addClass("li-hover").find('a').addClass('ui-state-hover'); |
---|
| 47 | }, |
---|
| 48 | function () { |
---|
| 49 | $(this).removeClass("li-hover").find('a').removeClass('ui-state-hover'); |
---|
| 50 | } |
---|
| 51 | ); |
---|
| 52 | |
---|
| 53 | event.preventDefault(); |
---|
| 54 | }); |
---|
| 55 | } |
---|