// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Contain the events a modal can fire.
+ * Contain the events the calendar component can fire.
*
- * @module core_calendar/calendar_events
+ * @module core_calendar/events
* @class calendar_events
* @package core_calendar
* @copyright 2017 Simey Lameze <simey@moodle.com>
*/
define([], function() {
return {
- deleted: 'calendar-events:deleted'
+ created: 'calendar-events:created',
+ deleted: 'calendar-events:deleted',
+ updated: 'calendar-events:updated',
+ editEvent: 'calendar-events:edit_event'
};
});
/**
* A javascript module to handle calendar ajax actions.
*
- * @module core_calendar/calendar_repository
+ * @module core_calendar/repository
* @class repository
* @package core_calendar
* @copyright 2017 Simey Lameze <lameze@moodle.com>
return Ajax.call([request])[0];
};
+ /**
+ * Submit the form data for the event form.
+ *
+ * @method submitCreateUpdateForm
+ * @param {string} formdata The URL encoded values from the form
+ * @return {promise} Resolved with the new or edited event
+ */
+ var submitCreateUpdateForm = function(formdata) {
+ var request = {
+ methodname: 'core_calendar_submit_create_update_form',
+ args: {
+ formdata: formdata
+ }
+ };
+
+ return Ajax.call([request])[0];
+ };
+
return {
getEventById: getEventById,
- deleteEvent: deleteEvent
+ deleteEvent: deleteEvent,
+ submitCreateUpdateForm: submitCreateUpdateForm
};
});