1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 08:12:40 +01:00
phorge-phorge/webroot/rsrc/js/application/calendar/behavior-event-all-day.js
epriestley f7b0c09ac4 Make the "All Day Event" control use a checkbox instead of a dropdown
Summary:
This feels a little cleaner:

  - Clean up transaction log a bit.
  - Use a checkbox instead of a two-option dropdown.

This is a little messy because the browser doesn't send anything if the user submits a form with an un-clicked checkbox.

We now send a dummy value ("Hey, there's definitely a checkbox in this form!") so the server can figure out what to do.

Test Plan:
  - Edited all-dayness of an event.
  - Viewed transaction log.

Reviewers: chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D16776
2016-10-31 14:18:59 -07:00

17 lines
419 B
JavaScript

/**
* @provides javelin-behavior-event-all-day
*/
JX.behavior('event-all-day', function(config) {
var all_day = JX.$(config.allDayID);
JX.DOM.listen(all_day, 'change', null, function() {
var is_all_day = !!all_day.checked;
for (var ii = 0; ii < config.controlIDs.length; ii++) {
var control = JX.$(config.controlIDs[ii]);
JX.DOM.alterClass(control, 'no-time', is_all_day);
}
});
});