ns/ace-bundle

此包提供ace管理员的引导模板

安装数量: 16,063

依赖项: 1

建议者: 1

安全性: 0

星标: 1

关注者: 2

分支: 2

公开问题: 0

语言:JavaScript

类型:symfony-bundle

7.0.6 2024-07-18 13:40 UTC

This package is auto-updated.

Last update: 2024-09-25 06:44:08 UTC


README

Build Status

#功能

AJAX链接

向目标添加类'ajaxForm'和'data-update',以便在AJAX调用返回时更新。

<form action="..." method="post" class="ajaxForm" data-update="#divToUpdate">...</form>

然后,表单将通过AJAX提交,如果成功,返回的内容将作为具有id 'divToUpdate'的元素的HTML内容。 (通过Jquery $element.html(response))。

FullCalendar

添加路由配置

#app/config/routing.yml
ns_ace:
  resource: "@NSAceBundle/Resources/config/routing.yml"

在希望使用日历的页面上包含以下内容

{% block javascripts %}
    {{ parent() }}
    <script src="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.5.1/fullcalendar.min.js"></script>
{% endblock %}

{% block stylesheets %}
    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.5.1/fullcalendar.min.css" />
    <link rel="stylesheet" media="print" href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.5.1/fullcalendar.print.css" />
    {{ parent() }}
{% endblock %}

{% block inlinescripts %}
    <script type="text/javascript">
        $(document).ready(function(){
            var date = new Date();
            var d = date.getDate();
            var m = date.getMonth();
            var y = date.getFullYear();

            $('#calendar-holder').fullCalendar({
                header: {
                    left: 'prev, next',
                    center: 'title',
                    right: 'month, basicWeek, basicDay,'
                },
                lazyFetching: true,
                timeFormat: {
                    // for agendaWeek and agendaDay
                    agenda: 'h:mmt',    // 5:00 - 6:30

                    // for all other views
                    '': 'h:mmt'         // 7p
                },
                eventSources: [
                    {
                        url: '{{path('ace_calendar_loader')}}',
                        type: 'POST',
                        // A way to add custom filters to your event listeners
                        data: {
                        },
                        error: function() {
                            //alert('There was an error while fetching Google Calendar!');
                        }
                    }
                ]
            });
        });
    </script>
{% endblock %}

{% block body %}
... 
<div id="calendar-holder"></div>
...
{% endblock %}