CC-2436: Save pulldown settings

For week and day views under Calendar page, save the change to pref db table when
user updates the interval dropdown. Same thing goes for the "show XXX entries"
dropdown found under Playlist Builder page.

When visiting these pages, we retrieves the entry from database for current user
and use those values. Defaults to 30m for interval and 10 entries for "show xxx entries"
if values were never set.
This commit is contained in:
Yuchen Wang 2011-10-18 10:10:35 -04:00
parent 3e441dc72f
commit d2fe46baf0
6 changed files with 135 additions and 9 deletions

View file

@ -308,6 +308,17 @@ function getTimeScalePreference(data) {
return timeScale;
}
/**
* Use user preference for time interval; defaults to 30m if preference was never set
*/
function getTimeIntervalPreference(data) {
var timeInterval = data.calendarInit.timeInterval;
if(timeInterval == '') {
timeInterval = '30';
}
return parseInt(timeInterval);
}
function createFullCalendar(data){
serverTimezoneOffset = data.calendarInit.timezoneOffset;
@ -321,6 +332,7 @@ function createFullCalendar(data){
right: 'agendaDay, agendaWeek, month'
},
defaultView: getTimeScalePreference(data),
slotMinutes: getTimeIntervalPreference(data),
editable: false,
allDaySlot: false,
axisFormat: 'H:mm',
@ -355,6 +367,17 @@ function createFullCalendar(data){
}
});
});
//Update time interval preference when dropdown is updated
$(".schedule_change_slots.input_select").change(function() {
var url = '/Schedule/set-time-interval/format/json';
$.post(url, {timeInterval: $(this).val()},
function(json){
if(json.error) {
alert(json.error);
}
});
});
}
$(window).load(function() {