summaryrefslogtreecommitdiff
path: root/frontend/js/forms.js
diff options
context:
space:
mode:
authormarudor <marudor@marudor.de>2018-08-03 13:58:25 +0200
committermarudor <marudor@marudor.de>2018-08-03 13:58:33 +0200
commitdb16772d01a68fe1eaafbf0b50bda2ad93c0d897 (patch)
tree4b984c85d04ee18c729fd77195ce273e239d6fb5 /frontend/js/forms.js
parent608fb3dad69e9f79283dd350639c2596379539a0 (diff)
Explose form Functions as globals
Diffstat (limited to 'frontend/js/forms.js')
-rw-r--r--frontend/js/forms.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/frontend/js/forms.js b/frontend/js/forms.js
index 5aa4f25a..67b14b32 100644
--- a/frontend/js/forms.js
+++ b/frontend/js/forms.js
@@ -4,7 +4,7 @@
* @param {string} id Id of the element containing all the checkboxes
* @param {bool} checked True if the checkboxes should be checked
*/
-function checkAll(id, checked) {
+global.checkAll = (id, checked) => {
$("#" + id + " input[type='checkbox']").each(function () {
this.checked = checked;
});
@@ -16,7 +16,7 @@ function checkAll(id, checked) {
* @param {string} id The elements ID
* @param {list} shifts_list A list of numbers
*/
-function checkOwnTypes(id, shifts_list) {
+global.checkOwnTypes = (id, shifts_list) => {
$("#" + id + " input[type='checkbox']").each(function () {
this.checked = $.inArray(parseInt(this.value), shifts_list) != -1;
});
@@ -25,14 +25,14 @@ function checkOwnTypes(id, shifts_list) {
/**
* @param {moment} date
*/
-function formatDay(date) {
+global.formatDay = (date) => {
return date.format("YYYY-MM-DD");
}
/**
* @param {moment} date
*/
-function formatTime(date) {
+global.formatTime = (date) => {
return date.format("HH:mm");
}
@@ -40,7 +40,7 @@ function formatTime(date) {
* @param {moment} from
* @param {moment} to
*/
-function setInput(from, to) {
+global.setInput = (from, to) => {
var fromDay = $("#start_day"), fromTime = $("#start_time"), toDay = $("#end_day"), toTime = $("#end_time");
fromDay.val(formatDay(from));
@@ -50,7 +50,7 @@ function setInput(from, to) {
toTime.val(formatTime(to));
}
-function setDay(days) {
+global.setDay = (days) => {
days = days || 0;
var from = moment();
@@ -64,7 +64,7 @@ function setDay(days) {
setInput(from, to);
}
-function setHours(hours) {
+global.setHours = (hours) => {
hours = hours || 1;
var from = moment();