Xrtml and Ruby on Rails, calendar slot

I am trying to create a time slot calendar where a reservation manager can create time slots from a calendar. I found some examples below:

Time Calendar

XRTML Calendar Reservation

I wonder if it is possible to work with xRTML with Ruby On Rails. I downloaded the .js file and put it in my / javascript resources folder.

I found that xRTML has its own tags and puts the demo code in index.html.erb. But that didn't seem to work.

My index.html.erb file looked like this:

<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> 

I also looked at using a full jquery calendar to help me achieve what I'm trying to do. However, this turned out to be more complicated than I thought. Is there something similar out there that looks like what I'm trying to do

My initial idea is to have some kind of calendar with the time indicated vertically, and have slots horizontally, allowing the user to click the plus sign, which will create new slots.

+4
source share
1 answer

xRTML is designed to work with any platform / framework that sends HTML to the browser, so there are no restrictions on Ruby or Ruby on Rails. There are four things in the code: Djj:

1) your Connection tag still has the appkey and authtoken values ​​set by default, which come with the documentation, you need to use the ones that are provided in the development kit ...

 <xrtml:connection appkey="myAppKey" authenticate="false" authtoken="myDevToken" url="http://developers.realtime.livehtml.net"> 

2) you do not include the script in your page (perhaps you just did not embed it in your question, but :)

 <script type="text/javascript" src="path/to/xrtml.js"></script> 

3) the Calendar tag needs an HTML container in which it will be displayed. In the tag, you see target = "# divcalendar", that is, the Sizzle selector for the div where the html of the calendar will be displayed, so you should specify somewhere:

 <div id="divcalendar"></div> 

4) a handler for perseverance ... that's where things get serious. The Calendar tag requires a server-side handler and database. therefore, you must implement in ruby ​​a handler for ajax calls made by the calendar (you can find the documentation for it in http://docs.xrtml.org/markup/calendar.html , under "3.2. Saving Data"). So, when defining a tag:

 <xrtml:calendar ... handlerurl="path/to/yourhandler" ...></xrtml:calendar> 
+1
source

Source: https://habr.com/ru/post/1395243/


All Articles