Hi Simon. I wanted to do all the logic in my own widget, but I have to write in a columnfamily I created in cassandra. I see that the module is in the Hilary side. So my question is: how can I do this if I don't have the files that for example "creatediscussion" has?
Hope you can help me Jacqueline On Mon, Mar 31, 2014 at 1:21 PM, Simon Gaeremynck <gaeremyn...@gmail.com>wrote: > Hi Jacqueline, > > The frontend (3akai-ux) and the backend (Hilary) talk to each other over > REST (more specifically, HTTP). > This means that if the frontend needs some data (e.g.: discussion profile > data) it will perform a GET request to an api that is provided by Hilary. > > Have a look in the network tab of your browser's developer tools when > loading a page. > You'll see a lot of requests fly by. Among those, there should be a couple > of requests to `/api/...` > > In the frontend, we use jQuery's excellent ajax function [1] to achieve > this. As you said, this logic is located > in the `oae.api.discussion.js` [2] file under `/shared/oae/api`. > If you're writing your own widget however, it's probably not necessary to > add your own API, you can place that logic in your own > widget and use jQuery's ajax method directly. > > On the backend we expose a set of REST endpoints (all under `/api`) that > the UI can consume via jQuery's ajax method. > Each `oae-*` module will have a `/lib/rest.js` file that plugs the > endpoint in the expressjs [3] webserver. > Have a look at the discussion rest endpoints [4] for how this might work. > > Hope that helps, > > Simon > > [1] http://api.jquery.com/jQuery.ajax/ > [2] > https://github.com/oaeproject/3akai-ux/blob/master/shared/oae/api/oae.api.discussion.js#L32 > [3] http://expressjs.com/3x/api.html > [4] > https://github.com/oaeproject/Hilary/blob/master/node_modules/oae-discussions/lib/rest.js#L114 > > On 31 Mar 2014, at 18:25, Jacqueline Ramos <jackie.l...@gmail.com> wrote: > > Hi, I am trying to understand how the widget "creatediscussion" connects > with the module in Hilary "oae-discussion" to create a new discussion and > insert into cassandra > > I see that this code does it. > oae.api.discussion.createDiscussion(displayName, discussionTopic, > visibility, [], members, function (err, data) { > // If the creation succeeded, redirect to the discussion > profile > if (!err) { > window.location = data.profilePath; > } else { > oae.api.util.notification( > > oae.api.i18n.translate('__MSG__DISCUSSION_NOT_CREATED__', > 'creatediscussion'), > > oae.api.i18n.translate('__MSG__DISCUSSION_COULD_NOT_BE_CREATED__', > 'creatediscussion'), > 'error'); > } > }); > > and there is a oae.api.discussion.js in 3akai-ux/shared/oae/api that I > assume is the file that connects with Hilary. Am I wrong? > Also I am trying to create a "oae.api.meeting.js" and place it in the > oae.api,js file. It says there that the file is a plugin so I guess I have > to do something else for it work, right? > > Could you please help me? > > Jacqueline > > _______________________________________________ > oae-dev mailing list > oae-dev@collab.sakaiproject.org > http://collab.sakaiproject.org/mailman/listinfo/oae-dev > > > -- Liliana Ramos
_______________________________________________ oae-dev mailing list oae-dev@collab.sakaiproject.org http://collab.sakaiproject.org/mailman/listinfo/oae-dev