Skip to content
Permalink
Browse files

Save agenda start date and view via cookie using JS see BT#13046

  • Loading branch information...
jmontoyaa committed Jul 27, 2017
1 parent 2fd0036 commit 7c289c86dd4d63b5b7579ef26ffcc273db3c903d
Showing with 14 additions and 1 deletion.
  1. +1 −0 main/calendar/agenda_js.php
  2. +13 −1 main/template/default/agenda/month.tpl
@@ -27,6 +27,7 @@
$htmlHeadXtra[] = api_get_asset('fullcalendar/dist/gcal.js');
$htmlHeadXtra[] = api_get_css_asset('fullcalendar/dist/fullcalendar.min.css');
$htmlHeadXtra[] = api_get_css_asset('qtip2/jquery.qtip.min.css');
$htmlHeadXtra[] = api_get_asset('js-cookie/src/js.cookie.js');
if (api_is_platform_admin() && ($type == 'admin' || $type == 'platform')) {
$type = 'admin';
@@ -26,6 +26,10 @@ function clean_user_select() {
var region_value = '{{ region_value }}';
$(document).ready(function() {
var cookieData = Cookies.getJSON('agenda_cookies');
var defaultView = (cookieData && cookieData.view) || '{{ default_view }}';
var defaultStartDate = (cookieData && cookieData.start) || moment.now();
// Reset button.
$("button[type=reset]").click(function() {
$("#session_id").find('option').removeAttr("selected");
@@ -229,7 +233,8 @@ $(document).ready(function() {
}
],
{% endif %}
defaultView: '{{ default_view }}',
defaultView: defaultView,
defaultDate: defaultStartDate,
firstHour: 8,
firstDay: 1,
selectable : true,
@@ -241,6 +246,13 @@ $(document).ready(function() {
api.destroy();
//api.render();
}*/
},
viewRender: function(view, element) {
var data = {
'view': view.name,
'start': view.intervalStart.format("YYYY-MM-DD")
};
Cookies.set('agenda_cookies', data, 1); // Expires 1 day
},
// Add event
select: function(start, end, jsEvent, view) {

0 comments on commit 7c289c8

Please sign in to comment.
You can’t perform that action at this time.