CC-2436: Save pulldown settings

Fixing the issue of "show entries" dropdown setting not being saved.
After some investigation, it seems like we're destroying the calendar
everytime we modify the dropdown value, and create a new one,
which explains why the new setting is not being saved.

Fixed by moving the code that handles the updating to the place after
we create the new calendar. This makes the code cleaner as well.
This commit is contained in:
Yuchen Wang 2011-11-16 15:52:05 -05:00
parent a5939afd3f
commit a0bf7c90ba
3 changed files with 28 additions and 44 deletions

View file

@ -306,26 +306,14 @@ function buildScheduleDialog(json){
* Use user preference for time scale; defaults to month if preference was never set
*/
function getTimeScalePreference(data) {
var timeScale = data.calendarInit.timeScale;
if(timeScale == 'day') {
timeScale = 'agendaDay';
} else if(timeScale == 'week') {
timeScale = 'agendaWeek';
} else {
timeScale = 'month';
}
return timeScale;
return data.calendarInit.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);
return parseInt(data.calendarInit.timeInterval);
}
function createFullCalendar(data){
@ -366,28 +354,6 @@ function createFullCalendar(data){
eventDrop: eventDrop,
eventResize: eventResize
});
//Update time scale preference when day/week/month button is clicked
$(".fc-button-content").click(function() {
var url = '/Schedule/set-time-scale/format/json';
$.post(url, {timeScale: $(this).text()},
function(json){
if(json.error) {
alert(json.error);
}
});
});
//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);
}
});
});
}
//Alert the error and reload the page