0

Meteorjs の初心者で、FullCalendar と meteor の実装をテストしていますが、特にこのモーダルで奇妙な問題が発生しました。編集用のモーダルです。パス内の他のアプリでテストに成功したイベントのリンクのリストをクリックするとトリガーされるはずです。このビューでイベントを作成するための別のモーダルが既にあり、正常に動作します。しかし、この場合、js の動作が正しく適用されていないようです。モーダルは表示されますが、効果はなく、閉じるボタンも送信ボタンも機能しません

この特定のケースでは、私は何かまたはいくつかのコードタグを失っているのでしょうか、それとも FullCalendar が競合しているのでしょうか?

これが meteor.com gbelot.todo3.meteor.comにあるデモです。

gitHub のコードは次のとおりです: https://github.com/gbelot2003/meteor-todo-bt3/blob/todo3-icalendar/client/home

そしてここにコントローラーとテンプレートコード:

Meteor.subscribe("events");

 Template.body.rendered = function () {
    var fc = this.$('.fc');
    this.autorun(function () {
    Events.find();
    fc.fullCalendar('refetchEvents');
 });
};

Template.calendarEdit.helpers({
  events: function(){
    var fc = $('.fc');
    return function (start, end, tz, callback) {
        //subscribe only to specified date range
        Meteor.subscribe('events', start, end, function () {
            //trigger event rendering when collection is downloaded
            fc.fullCalendar('refetchEvents');
        });

        var events = Events.find().map(function (it) {
            return {
                title: it.date,
                start: it.date,
                allDay: false
            };
        });
        callback(events);
    };
},

options: function() {
    return {
        id: 'myid2',
        class: 'myCalendars',
        lang: 'es',
        allDaySlot: false,
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,agendaWeek,agendaDay'
        },
        axisFormat: 'h:mm a',
        timeFormat: {
            agenda: 'h:mm a',
            month: 'h:mm a',
            agendaWeek: 'h:mm a'
        },
        firstHour: 7,
        editable: true,
        eventLimit: false,
        events: function (start, end, timezone, callback) {
            callback(Events.find({}).fetch());
        },
        defaultView: 'month'
    };
 }
});

Template.HomeTemplate.onRendered(function(){
 var fc = this.$('.fc');
 this.autorun(function () { 
    Events.find();
    fc.fullCalendar('refetchEvents');
 });
 this.$('.datetimepicker').datetimepicker({
    format: 'YYYY-MM-DD H:mm:ss'
 });
});

 Template.HomeTemplate.events({
 'submit #new-event': function(event){
    event.preventDefault();
    var title = event.target.title.value;
    var start = event.target.start.value;
    var end = event.target.end.value;
    var description = event.target.description.value;

    Meteor.call("addEvent", title, start, end, description);
    event.target.title.value = "";
    event.target.start.value = "";
    event.target.end.value = "";
    event.target.description.value = "";
    $("#createEvent").modal("hide");
 },

/** this modal works well **/
/***************************/
'click .create': function(e){
    e.preventDefault();
    $("#createEvent").modal("show");
 }
});

Template.HomeTemplate.helpers({
 event: function(){
    return Events.find();
 }
});

Template.eventList.events({

 'click .delete': function(event){
    event.preventDefault();
    id = this._id;
    Meteor.call('deleteEvent', id);
},

 /**** here is the call for the modal *****/
 /** with problems. Did I miss something? */
 /******************************************/
 'click .update': function(e){
    e.preventDefault();
    $(".updateModal").show();
 }
});

ホームテンプレートはこちら

<template name="HomeTemplate" id="home">
  <div class="container">
    <div class="row">
        <div class="col-sm-12">
            <h2>Todos & FullCalendar Test</h2>
            <hr/>
        </div>
    </div>
    <div class="row">
        <div class="col-md-6 col-sm-12">
            <h3>Full Calendar</h3>
            <!--<button class="refresh">Refresh</button>-->
            {{> calendarEdit }}
        </div>
        <div class="col-md-6 col-sm-12">
            <h3>Events todo App <a href="#" id="add-Event" class="create btn btn-Google pull-right"><span class="glyphicon glyphicon-plus-sign" aria-hidden="true"></span></a></h3>

            <ul class="list-group">
                {{#transition in="zoomIn" out="bounceOut"}}
                    {{#each event}}
                        {{> eventList}}
                    {{/each}}
                {{/transition}}
            </ul>
        </div>
    </div>
</div>
  {{> createEvent}}
  {{> updateModal}}
</template>

これは、リンクをクリックするテンプレートです

<template name="eventList">
  <li class="list-group-item">
    <h4 class="list-group-item-heading">
        <div class="row">
            <div class="col-sm-10">
                <a type="button" href="#" class="update">{{title}}</a>
            </div>
            <div class="col-sm-2">
                <a href="#" class="btn btn-default delete pull-right">  <span class=" glyphicon glyphicon-trash text-danger" aria-hidden="true"></span></a>
            </div>
        </div>
    </h4>
    <p>{{start}} | {{end}}</p>
    <p class="list-group-item-text">{{description}}</p>
 </li>
</template>
4

1 に答える 1

0

これは peppelg:bootstrap-3-modal を使用することで解決されました。そのパッケージは仕事をしました!!!

于 2015-10-19T01:58:08.513 に答える