Replace calendar component by vanilla javascript
This commit is contained in:
parent
5188ed8cfe
commit
a3bb27109d
|
|
@ -16,6 +16,23 @@ use Kanboard\Formatter\TaskCalendarFormatter;
|
|||
*/
|
||||
class CalendarHelper extends Base
|
||||
{
|
||||
/**
|
||||
* Render calendar component
|
||||
*
|
||||
* @param string $checkUrl
|
||||
* @param string $saveUrl
|
||||
* @return string
|
||||
*/
|
||||
public function render($checkUrl, $saveUrl)
|
||||
{
|
||||
$params = array(
|
||||
'checkUrl' => $checkUrl,
|
||||
'saveUrl' => $saveUrl,
|
||||
);
|
||||
|
||||
return '<div class="js-calendar" data-params=\''.json_encode($params, JSON_HEX_APOS).'\'></div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get formatted calendar task due events
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
<section id="main">
|
||||
<?= $this->projectHeader->render($project, 'CalendarController', 'show') ?>
|
||||
<calendar save-url="<?= $this->url->href('CalendarController', 'save', array('project_id' => $project['id'])) ?>"
|
||||
check-url="<?= $this->url->href('CalendarController', 'project', array('project_id' => $project['id'])) ?>">
|
||||
</calendar>
|
||||
|
||||
<?= $this->calendar->render(
|
||||
$this->url->href('CalendarController', 'project', array('project_id' => $project['id'])),
|
||||
$this->url->href('CalendarController', 'save', array('project_id' => $project['id']))
|
||||
) ?>
|
||||
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
<calendar check-url="<?= $this->url->href('CalendarController', 'user', array('user_id' => $user['id'])) ?>"
|
||||
save-url="<?= $this->url->href('CalendarController', 'save') ?>"></calendar>
|
||||
<?= $this->calendar->render(
|
||||
$this->url->href('CalendarController', 'user', array('user_id' => $user['id'])),
|
||||
$this->url->href('CalendarController', 'save')
|
||||
) ?>
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,9 +1,7 @@
|
|||
Vue.component('calendar', {
|
||||
props: ['saveUrl', 'checkUrl'],
|
||||
template: '<div id="calendar"></div>',
|
||||
ready: function() {
|
||||
var self = this;
|
||||
var calendar = $('#calendar');
|
||||
KB.component('calendar', function (containerElement, options) {
|
||||
|
||||
this.render = function () {
|
||||
var calendar = $(containerElement);
|
||||
|
||||
calendar.fullCalendar({
|
||||
locale: $("body").data("js-lang"),
|
||||
|
|
@ -18,7 +16,7 @@ Vue.component('calendar', {
|
|||
eventDrop: function(event) {
|
||||
$.ajax({
|
||||
cache: false,
|
||||
url: self.saveUrl,
|
||||
url: options.saveUrl,
|
||||
contentType: "application/json",
|
||||
type: "POST",
|
||||
processData: false,
|
||||
|
|
@ -29,7 +27,7 @@ Vue.component('calendar', {
|
|||
});
|
||||
},
|
||||
viewRender: function() {
|
||||
var url = self.checkUrl;
|
||||
var url = options.checkUrl;
|
||||
var params = {
|
||||
"start": calendar.fullCalendar('getView').start.format(),
|
||||
"end": calendar.fullCalendar('getView').end.format()
|
||||
|
|
@ -46,5 +44,5 @@ Vue.component('calendar', {
|
|||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue