Serhioromano / bootstrap-calendar

Full view calendar with year, month, week and day views based on templates with Twitter Bootstrap.
http://bootstrap-calendar.eivissapp.com/
MIT License
3.02k stars 1.29k forks source link

Calling the Modal from a list of links outside the Calendar #767

Closed EzequielGv83 closed 3 years ago

EzequielGv83 commented 4 years ago

I made a function that uses the GET values sent to the templates or using the position atribute of the calendar.

calendar.options.position.start calendar.options.position.end

I parse then on the unix format so i have then in the same format as the template (a UNIXdate for the start and end of each month, and there is a (undescore) GET with the current UNIX timestamp

$.ajax({
        type: "GET", 
        url: modules/demo.php?ini='+ini+ '&fim='+fim;,
        timeout: 3000,
        contentType: "application/json; charset=utf-8",
        cache: false,       
        error: function() {
            $("#eventos_mensais").html("O servidor não conseguiu processar o pedido");
        },
        success: function(retorno) {               
                var dados = JSON.parse(retorno);

                if(testa_empty(dados)){                  
                    //$("#eventos_mensais").hide();   
                    $("#eventos_mensais ul").empty();
                    var li = '<li>Sem Eventos Mensais</li>'; 

                    $('#eventos_mensais ul').append(li);                   
                }
                else{
                    $("#eventos_mensais").show();  
                    $("#eventos_mensais ul").empty();

                    $.each(dados,function(i, d){                       
                        var li =  '<li><i class="lista_icon fa fa-'+d.sec_icon+'"></i><a href="javascript:void(0)" data-event-id="'+d.id+'"><span class="lista_evento_mensal">' +d.title+'</span></a></li>';                     

                        $('#eventos_mensais ul').append(li); 
                    });  
                }       
        } 
        });  
    }

The code above just returns the events in a unerdored list with the data-event-id needed for the modal.

I've researched that i need to modify the calendar code removing the this.context on line 1077 $('a[data-event-id]', this.context).on('click', function(event) { REMOVE THIS CONTEXT so i can use the event outside the calendar (I guess this could be a option, like Click Events: Global or Calendar).

But it only activates on simple photo1 photo2

img Code

EzequielGv83 commented 4 years ago

I did some modifications on templates, so i can have font-awesome icons instead of the regular icon.

Serhioromano commented 3 years ago

Cool!