Commit e1ccaf44 by semenov

Оптимизация

parent 1b4e9d98
...@@ -39,6 +39,8 @@ class FullCalendarWidget extends Widget ...@@ -39,6 +39,8 @@ class FullCalendarWidget extends Widget
'editable' => false, 'editable' => false,
]; ];
public $clientOptionsJs = "{}";
/** /**
* Holds an array of Event Objects * Holds an array of Event Objects
* @var array events of yii2fullcalendar\models\Event * @var array events of yii2fullcalendar\models\Event
...@@ -176,7 +178,7 @@ class FullCalendarWidget extends Widget ...@@ -176,7 +178,7 @@ class FullCalendarWidget extends Widget
} }
$cleanOptions = $this->getClientOptions(); $cleanOptions = $this->getClientOptions();
$js[] = "$('#$id').fullCalendar($cleanOptions);"; /*$js[] = "$('#$id').fullCalendar(_.extend($cleanOptions, $this->clientOptionsJs));";
//lets check if we have an event for the calendar... //lets check if we have an event for the calendar...
if(count($this->events)>0) if(count($this->events)>0)
...@@ -187,7 +189,13 @@ class FullCalendarWidget extends Widget ...@@ -187,7 +189,13 @@ class FullCalendarWidget extends Widget
$isSticky = $this->stickyEvents; $isSticky = $this->stickyEvents;
$js[] = "$('#$id').fullCalendar('renderEvent',$jsonEvent,$isSticky);"; $js[] = "$('#$id').fullCalendar('renderEvent',$jsonEvent,$isSticky);";
} }
} }*/
//lets check if we have an event for the calendar...
$js[] = "$('#$id').fullCalendar(_.extend($cleanOptions, $this->clientOptionsJs));";
$view->registerJs(implode("\n", $js),View::POS_READY); $view->registerJs(implode("\n", $js),View::POS_READY);
} }
...@@ -211,6 +219,12 @@ class FullCalendarWidget extends Widget ...@@ -211,6 +219,12 @@ class FullCalendarWidget extends Widget
$options['eventAfterAllRender'] = new JsExpression($this->eventAfterAllRender); $options['eventAfterAllRender'] = new JsExpression($this->eventAfterAllRender);
} }
$options = array_merge($options, $this->clientOptions); $options = array_merge($options, $this->clientOptions);
if(count($this->events)>0)
{
$options['events'] = $this->events;
}
return Json::encode($options); return Json::encode($options);
} }
......
...@@ -25,6 +25,12 @@ class Event extends Model ...@@ -25,6 +25,12 @@ class Event extends Model
*/ */
public $title; public $title;
/**
* @var background
*/
public $rendering;
/** /**
* Whether an event occurs at a specific time-of-day. This property affects whether an event's time is shown. Also, in the agenda views, determines if it is displayed in the "all-day" section. * Whether an event occurs at a specific time-of-day. This property affects whether an event's time is shown. Also, in the agenda views, determines if it is displayed in the "all-day" section.
* If this value is not explicitly specified, allDayDefault will be used if it is defined. * If this value is not explicitly specified, allDayDefault will be used if it is defined.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment