MDL-59382 calendar: rename repository and events

Renamed the calendar_repository and calendar_events to repository and
events respectively since they are already in the calendar namespace
there is no need for the redundant calendar prefix.
This commit is contained in:
Ryan Wyllie 2017-07-24 07:55:33 +00:00
parent 159a2bc1fe
commit 6103fd2efe
5 changed files with 29 additions and 7 deletions

View File

@ -1 +0,0 @@
define([],function(){return{deleted:"calendar-events:deleted"}});

1
calendar/amd/build/events.min.js vendored Normal file
View File

@ -0,0 +1 @@
define([],function(){return{created:"calendar-events:created",deleted:"calendar-events:deleted",updated:"calendar-events:updated",editEvent:"calendar-events:edit_event"}});

View File

@ -1 +1 @@
define(["jquery","core/ajax"],function(a,b){var c=function(a){var c={methodname:"core_calendar_delete_calendar_events",args:{events:[{eventid:a,repeat:1}]}};return b.call([c])[0]},d=function(a){var c={methodname:"core_calendar_get_calendar_event_by_id",args:{eventid:a}};return b.call([c])[0]};return{getEventById:d,deleteEvent:c}});
define(["jquery","core/ajax"],function(a,b){var c=function(a){var c={methodname:"core_calendar_delete_calendar_events",args:{events:[{eventid:a,repeat:1}]}};return b.call([c])[0]},d=function(a){var c={methodname:"core_calendar_get_calendar_event_by_id",args:{eventid:a}};return b.call([c])[0]},e=function(a){var c={methodname:"core_calendar_submit_create_update_form",args:{formdata:a}};return b.call([c])[0]};return{getEventById:d,deleteEvent:c,submitCreateUpdateForm:e}});

View File

@ -14,9 +14,9 @@
// 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>
@ -24,6 +24,9 @@
*/
define([], function() {
return {
deleted: 'calendar-events:deleted'
created: 'calendar-events:created',
deleted: 'calendar-events:deleted',
updated: 'calendar-events:updated',
editEvent: 'calendar-events:edit_event'
};
});

View File

@ -16,7 +16,7 @@
/**
* 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>
@ -65,8 +65,27 @@ define(['jquery', 'core/ajax'], function($, Ajax) {
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
};
});