Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
c56f56b1
Commit
c56f56b1
authored
Jan 14, 2020
by
bbaer
Browse files
added fullcalendar.js basis implementation
parent
612fc161
Pipeline
#3134
passed with stages
in 1 minute and 58 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
javascript/src/Helper/fullCalendar.js
0 → 100644
View file @
c56f56b1
/**
* @author Benjamin Baer <benjamin.baer@math.uzh.ch>
*/
/* global console */
/* global FullCalendar */
/* global $ */
/**
* Qfq Namespace
*
* @namespace QfqNS
*/
var
QfqNS
=
QfqNS
||
{};
/**
* Qfq Helper Namespace
*
* @namespace QfqNS.Helper
*/
QfqNS
.
Helper
=
QfqNS
.
Helper
||
{};
(
function
(
n
)
{
'
use strict
'
;
/**
* Initializes fullcalendar.js.
*
* The Full Calendar configuration has to be provided in the `data-config` attribute as JSON. E.g.
*
* <div class="qfq-calendar" data-config='{ "plugins": [ 'dayGrid' ] }'></textarea>
*
* @function
*/
var
fullCalendar
=
function
()
{
if
(
typeof
FullCalendar
===
'
undefined
'
)
{
QfqNS
.
log
.
error
(
"
FullCalendar Plugin wasn't loaded correctly.
"
);
return
;
}
$
(
"
div.qfq-calendar
"
).
each
(
function
()
{
var
config
=
{};
var
$this
=
$
(
this
);
var
element
=
document
.
getElementById
(
$this
.
attr
(
'
id
'
));
var
configData
=
$this
.
data
(
'
config
'
);
if
(
configData
)
{
if
(
configData
instanceof
Object
)
{
// jQuery takes care of decoding data-config to JavaScript object.
config
=
configData
;
}
else
{
QfqNS
.
Log
.
warning
(
"
'data-config' is invalid:
"
+
configData
);
}
}
var
calendar
=
new
FullCalendar
.
Calendar
(
element
,
configData
);
calendar
.
render
();
calendar
.
on
(
'
change
'
,
(
function
(
$form
,
$textArea
)
{
return
function
(
instance
,
changeObj
)
{
$textArea
.
val
(
instance
.
getValue
());
$form
.
change
();
};
})(
$
(
this
).
closest
(
'
form
'
),
$this
));
}
);
};
n
.
calendar
=
fullCalendar
;
})(
QfqNS
.
Helper
);
\ No newline at end of file
javascript/src/QfqForm.js
View file @
c56f56b1
...
...
@@ -153,6 +153,7 @@ var QfqNS = QfqNS || {};
//n.Helper.jqxEditor();
n
.
Helper
.
tinyMce
();
n
.
Helper
.
codemirror
();
n
.
Helper
.
calendar
();
this
.
form
.
on
(
'
form.submit.before
'
,
n
.
Helper
.
tinyMce
.
prepareSave
);
this
.
form
.
on
(
'
form.validation.before
'
,
n
.
Helper
.
tinyMce
.
prepareSave
);
this
.
form
.
on
(
'
form.validation.failed
'
,
this
.
validationError
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment