diff options
Diffstat (limited to 'assets/js/components')
-rw-r--r-- | assets/js/components/calendar.js | 21 | ||||
-rw-r--r-- | assets/js/components/select-dropdown-autocomplete.js | 2 |
2 files changed, 20 insertions, 3 deletions
diff --git a/assets/js/components/calendar.js b/assets/js/components/calendar.js index d07c911d..ed6916b2 100644 --- a/assets/js/components/calendar.js +++ b/assets/js/components/calendar.js @@ -1,13 +1,23 @@ KB.component('calendar', function (containerElement, options) { + var modeMapping = { // Let's have bookable pretty mode names + month: 'month', + week: 'agendaWeek', + day: 'agendaDay' + }; this.render = function () { var calendar = $(containerElement); + var mode = 'month'; + if (window.location.hash) { // Check if hash contains mode + var hashMode = window.location.hash.substr(1); + mode = modeMapping[hashMode] || mode; + } calendar.fullCalendar({ locale: $("body").data("js-lang"), editable: true, eventLimit: true, - defaultView: "month", + defaultView: mode, header: { left: 'prev,next today', center: 'title', @@ -26,7 +36,14 @@ KB.component('calendar', function (containerElement, options) { }) }); }, - viewRender: function() { + viewRender: function(view) { + // Map view.name back and update location.hash + for (var id in modeMapping) { + if (modeMapping[id] === view.name) { // Found + window.location.hash = id; + break; + } + } var url = options.checkUrl; var params = { "start": calendar.fullCalendar('getView').start.format(), diff --git a/assets/js/components/select-dropdown-autocomplete.js b/assets/js/components/select-dropdown-autocomplete.js index c2c36f5b..188dd5e9 100644 --- a/assets/js/components/select-dropdown-autocomplete.js +++ b/assets/js/components/select-dropdown-autocomplete.js @@ -161,7 +161,7 @@ KB.component('select-dropdown-autocomplete', function(containerElement, options) var hasActiveItem = false; for (var i = 0; i < items.length; i++) { - if (text.length === 0 || items[i]['data-label'].toLowerCase().indexOf(text.toLowerCase()) === 0) { + if (text.length === 0 || items[i]['data-label'].toLowerCase().indexOf(text.toLowerCase()) > -1) { var item = items[i]; if (typeof options.defaultValue !== 'undefined' && String(options.defaultValue) === item['data-value']) { |