我正在尝试建立一个时段日历,预订经理可以从日历创建时间段。我在下面找到了一些例子:
想知道是否可以让xRTML与Ruby On Rails一起使用。我下载了.js文件并将其放在我的assets / javascript文件夹中。
我发现xRTML有自己的标签,并将演示代码放在index.html.erb中。但这似乎不起作用。
我的index.html.erb文件如下所示:
<xrtml:config debug="false">
<xrtml:connections>
<xrtml:connection appkey="myAppKey" authenticate="false"
authtoken="myDevToken" url="http://developers.realtime.livehtml.net">
<xrtml:channels>
<xrtml:channel name="myChannel" permission="write"/>
</xrtml:channels>
</xrtml:connection>
</xrtml:connections>
</xrtml:config>
<xrtml:calendar channelid="myChannel" dayonly="false"
enddate="2011-12-13" handlerurl="./handler/calendarTest.ashx"
id="calendarXPTO" lang="en" receiveownmessages="true"
startdate="2011-08-13" target="#divcalendar" userid="userxpto">
<xrtml:triggers>
<xrtml:trigger name="myTrigger"/>
</xrtml:triggers>
<xrtml:slots>
<xrtml:slot value="09:00 - 10:00|10:00 - 11:00|11:00 - 12:00|12:00 - 13:00|15:00 - 16:00|16:00 - 17:00|17:00 - 18:00"/>
<xrtml:slot value="09:00 - 18:00" weekday="Sat"/>
<xrtml:slot weekday="Sun"/>
</xrtml:slots>
</xrtml:calendar>
我还考虑过使用Jquery完整日历来帮助我实现我想要做的事情。然而事实证明这比我想象的要困难得多。有什么类似的东西就像我正在尝试做的那样
我最初的想法是制作某种日历,其中包含垂直列出的时间,并且水平设置插槽,使用户可以点击一个可以创建新插槽的加号。
答案 0 :(得分:1)
xRTML旨在与任何将HTML发送到浏览器的平台/框架一起使用 Ruby或Ruby on Rails没有限制。 你的代码中缺少四件事,Djj:
1)您的Connection标记仍然将值appkey
和authtoken
设置为文档随附的默认值,您需要使用开发工具包中提供的值...
<xrtml:connection appkey="myAppKey" authenticate="false" authtoken="myDevToken" url="http://developers.realtime.livehtml.net">
2)您没有将脚本包含在您的页面中(可能您只是没有将其粘贴到您的问题中,但是:)
<script type="text/javascript" src="path/to/xrtml.js"></script>
3)Calendar标记需要一个HTML容器来呈现它。在标签中,您会看到target =“#divcalendar”,这是一个div的Sizzle选择器,其中将呈现日历的html,因此您必须在某处包含:
<div id="divcalendar"></div>
4)持久性的处理程序......这是事情变得严重的地方。 Calendar标记需要服务器端处理程序和数据库来处理记录。所以,你必须在ruby中实现,这是日历所做的ajax调用的处理程序(你可以在http://docs.xrtml.org/markup/calendar.html的'3.2持久数据'部分找到它的文档。因此,在定义标记时:
<xrtml:calendar ... handlerurl="path/to/yourhandler" ...></xrtml:calendar>