vendor/assets/javascripts/fullcalendar.js in fullcalendar-bootstrap-rails-2.3.1.0 vs vendor/assets/javascripts/fullcalendar.js in fullcalendar-bootstrap-rails-2.3.1.1

- old
+ new

@@ -48,11 +48,11 @@ calendar = new fc.CalendarBase(element, options); element.data('fullCalendar', calendar); calendar.render(); } }); - + return res; }; var complexOptions = [ // names of options that are objects whose properties should be combined @@ -207,11 +207,11 @@ } // Given a total available height to fill, have `els` (essentially child rows) expand to accomodate. // By default, all elements that are shorter than the recommended height are expanded uniformly, not considering -// any other els that are already too tall. if `shouldRedistribute` is on, it considers these tall rows and +// any other els that are already too tall. if `shouldRedistribute` is on, it considers these tall rows and // reduces the available height. function distributeHeight(els, availableHeight, shouldRedistribute) { // *FLOORING NOTE*: we floor in certain places because zoom can give inaccurate floating-point dimensions, // and it is better to be shorter than taller, to avoid creating unnecessary scrollbars. @@ -5053,11 +5053,11 @@ titleHtml = '<span class="fc-title">' + (htmlEscape(event.title || '') || '&nbsp;') + // we always want one line of height '</span>'; - + return '<a class="' + classes.join(' ') + '"' + (event.url ? ' href="' + htmlEscape(event.url) + '"' : '' ) + @@ -5182,11 +5182,11 @@ var j; // Give preference to elements with certain criteria, so they have // a chance to be closer to the top. segs.sort(compareSegs); - + for (i = 0; i < segs.length; i++) { seg = segs[i]; // loop through levels, starting with the topmost, until the segment doesn't collide with other segments for (j = 0; j < levels.length; j++) { @@ -7657,11 +7657,11 @@ t.initOptions(overrides || {}); var options = this.options; - + // Exports // ----------------------------------------------------------------------------------- t.render = render; t.destroy = destroy; @@ -7830,11 +7830,11 @@ return (duration.locale || duration.lang).call(duration, options.lang) // works moment-pre-2.8 .humanize(); }; - + // Imports // ----------------------------------------------------------------------------------- EventManager.call(t, options); @@ -7857,37 +7857,37 @@ var suggestedViewHeight; var windowResizeProxy; // wraps the windowResize function var ignoreWindowResize = 0; var date; var events = []; - - - + + + // Main Rendering // ----------------------------------------------------------------------------------- if (options.defaultDate != null) { date = t.moment(options.defaultDate); } else { date = t.getNow(); } - - + + function render() { if (!content) { initialRender(); } else if (elementVisible()) { // mainly for the public API calcSize(); renderView(); } } - - + + function initialRender() { tm = options.theme ? 'ui' : 'fc'; element.addClass('fc'); if (options.isRTL) { @@ -7917,12 +7917,12 @@ if (options.handleWindowResize) { windowResizeProxy = debounce(windowResize, options.windowResizeDelay); // prevents rapid calls $(window).resize(windowResizeProxy); } } - - + + function destroy() { if (currentView) { currentView.removeElement(); @@ -7936,18 +7936,18 @@ if (windowResizeProxy) { $(window).unbind('resize', windowResizeProxy); } } - - + + function elementVisible() { return element.is(':visible'); } - - + + // View Rendering // ----------------------------------------------------------------------------------- // Renders a view because of a date change, view-type change, or for the first time. @@ -8002,12 +8002,12 @@ unfreezeContentHeight(); // undo any lone freezeContentHeight calls ignoreWindowResize--; } - + // Resizing // ----------------------------------------------------------------------------------- t.getSuggestedViewHeight = function() { @@ -8019,12 +8019,12 @@ t.isHeightAuto = function() { return options.contentHeight === 'auto' || options.height === 'auto'; }; - - + + function updateSize(shouldRecalc) { if (elementVisible()) { if (shouldRecalc) { _calcSize(); @@ -8042,12 +8042,12 @@ function calcSize() { if (elementVisible()) { _calcSize(); } } - - + + function _calcSize() { // assumes elementVisible if (typeof options.contentHeight === 'number') { // exists and not 'auto' suggestedViewHeight = options.contentHeight; } else if (typeof options.height === 'number') { // exists and not 'auto' @@ -8055,12 +8055,12 @@ } else { suggestedViewHeight = Math.round(content.width() / Math.max(options.aspectRatio, .5)); } } - - + + function windowResize(ev) { if ( !ignoreWindowResize && ev.target === window && // so we don't process jqui "resize" events that have bubbled up currentView.start // view has already been rendered @@ -8068,13 +8068,13 @@ if (updateSize(true)) { currentView.trigger('windowResize', _element); } } } - - - + + + /* Event Fetching/Rendering -----------------------------------------------------------------------------*/ // TODO: going forward, most of this stuff should be directly handled by the view @@ -8096,12 +8096,12 @@ function destroyEvents() { freezeContentHeight(); currentView.clearEvents(); unfreezeContentHeight(); } - + function getAndRenderEvents() { if (!options.lazyFetching || isFetchNeeded(currentView.start, currentView.end)) { fetchAndRenderEvents(); } else { @@ -8114,11 +8114,11 @@ fetchEvents(currentView.start, currentView.end); // ... will call reportEvents // ... which will call renderEvents } - + // called when event data arrives function reportEvents(_events) { events = _events; renderEvents(); } @@ -8147,17 +8147,17 @@ } else { header.enableButton('today'); } } - + /* Selection -----------------------------------------------------------------------------*/ - + function select(start, end) { start = t.moment(start); if (end) { end = t.moment(end); @@ -8169,60 +8169,60 @@ end = start.clone().add(t.defaultAllDayEventDuration); } currentView.select({ start: start, end: end }); // accepts a range } - + function unselect() { // safe to be called before renderView if (currentView) { currentView.unselect(); } } - - - + + + /* Date -----------------------------------------------------------------------------*/ - - + + function prev() { date = currentView.computePrevDate(date); renderView(); } - - + + function next() { date = currentView.computeNextDate(date); renderView(); } - - + + function prevYear() { date.add(-1, 'years'); renderView(); } - - + + function nextYear() { date.add(1, 'years'); renderView(); } - - + + function today() { date = t.getNow(); renderView(); } - - + + function gotoDate(dateInput) { date = t.moment(dateInput); renderView(); } - - + + function incrementDate(delta) { date.add(moment.duration(delta)); renderView(); } @@ -8236,12 +8236,12 @@ spec = t.getViewSpec(viewType) || t.getUnitViewSpec(viewType); date = newDate; renderView(spec ? spec.type : null); } - - + + function getDate() { return date.clone(); } @@ -8265,38 +8265,38 @@ width: '', height: '', overflow: '' }); } - - - + + + /* Misc -----------------------------------------------------------------------------*/ - + function getCalendar() { return t; } - + function getView() { return currentView; } - - + + function option(name, value) { if (value === undefined) { return options[name]; } if (name == 'height' || name == 'contentHeight' || name == 'aspectRatio') { options[name] = value; updateSize(true); // true = allow recalculation of height } } - - + + function trigger(name, thisObj) { if (options[name]) { return options[name].apply( thisObj || _element, Array.prototype.slice.call(arguments, 2) @@ -8329,13 +8329,13 @@ weekends: true, weekNumbers: false, weekNumberTitle: 'W', weekNumberCalculation: 'local', - + //editable: false, - + // event ajax lazyFetching: true, startParam: 'start', endParam: 'end', timezoneParam: 'timezone', @@ -8362,11 +8362,11 @@ prev: 'left-single-arrow', next: 'right-single-arrow', prevYear: 'left-double-arrow', nextYear: 'right-double-arrow' }, - + // jquery-ui theming theme: false, themeButtonIcons: { prev: 'circle-triangle-w', next: 'circle-triangle-e', @@ -8376,24 +8376,24 @@ //eventResizableFromStart: false, dragOpacity: .75, dragRevertDuration: 500, dragScroll: true, - + //selectable: false, unselectAuto: true, - + dropAccept: '*', eventLimit: false, eventLimitText: 'more', eventLimitClick: 'popover', dayPopoverFormat: 'LL', - + handleWindowResize: true, windowResizeDelay: 200 // milliseconds before an updateSize happens - + }; Calendar.englishDefaults = { // used by lang.js dayPopoverFormat: 'dddd, MMMM D' @@ -8626,21 +8626,21 @@ ----------------------------------------------------------------------------------------------------------------------*/ // TODO: rename all header-related things to "toolbar" function Header(calendar, options) { var t = this; - + // exports t.render = render; t.destroy = destroy; t.updateTitle = updateTitle; t.activateButton = activateButton; t.deactivateButton = deactivateButton; t.disableButton = disableButton; t.enableButton = enableButton; t.getViewsWithButtons = getViewsWithButtons; - + // locals var el = $(); var viewsWithButtons = []; var tm; @@ -8658,19 +8658,25 @@ .append('<div class="fc-clear"/>'); return el; } } - - + + function destroy() { el.remove(); } - - + + function renderSection(position) { - var sectionEl = $('<div class="fc-' + position + '"/>'); + var positioningClass; + if('center' == position) { + positioningClass = 'fc-' + position; + } else { + positioningClass = 'pull-' + position; + } + var sectionEl = $('<div class="' + positioningClass + '"/>'); var buttonStr = options.header[position]; if (buttonStr) { $.each(buttonStr.split(' '), function(i) { var groupChildren = $(); @@ -8729,12 +8735,14 @@ innerHtml = htmlEscape(defaultText); } classes = [ 'fc-' + buttonName + '-button', - tm + '-button', - tm + '-state-default' + // tm + '-button', + // tm + '-state-default' + 'btn', + 'btn-default' ]; button = $( // type="button" so that it doesn't submit a form '<button type="button" class="' + classes.join(' ') + '">' + innerHtml + @@ -8743,65 +8751,76 @@ .click(function() { // don't process clicks for disabled buttons if (!button.hasClass(tm + '-state-disabled')) { buttonClick(); - - // after the click action, if the button becomes the "active" tab, or disabled, - // it should never have a hover class, so remove it now. - if ( - button.hasClass(tm + '-state-active') || - button.hasClass(tm + '-state-disabled') - ) { - button.removeClass(tm + '-state-hover'); - } + // + // Bootstrap hadles disabled buttons gracefully enough. + // + // // after the click action, if the button becomes the "active" tab, or disabled, + // // it should never have a hover class, so remove it now. + // if ( + // button.hasClass(tm + '-state-active') || + // button.hasClass(tm + '-state-disabled') + // ) { + // button.removeClass(tm + '-state-hover'); + // } } - }) - .mousedown(function() { - // the *down* effect (mouse pressed in). - // only on buttons that are not the "active" tab, or disabled - button - .not('.' + tm + '-state-active') - .not('.' + tm + '-state-disabled') - .addClass(tm + '-state-down'); - }) - .mouseup(function() { - // undo the *down* effect - button.removeClass(tm + '-state-down'); - }) - .hover( - function() { - // the *hover* effect. - // only on buttons that are not the "active" tab, or disabled - button - .not('.' + tm + '-state-active') - .not('.' + tm + '-state-disabled') - .addClass(tm + '-state-hover'); - }, - function() { - // undo the *hover* effect - button - .removeClass(tm + '-state-hover') - .removeClass(tm + '-state-down'); // if mouseleave happens before mouseup - } - ); + }); + // + // Bootstrap hadles the *down* effect gracefully enough. + // + // .mousedown(function() { + // // the *down* effect (mouse pressed in). + // // only on buttons that are not the "active" tab, or disabled + // button + // .not('.' + tm + '-state-active') + // .not('.' + tm + '-state-disabled') + // .addClass(tm + '-state-down'); + // }) + // .mouseup(function() { + // // undo the *down* effect + // button.removeClass(tm + '-state-down'); + // }) + // + // Bootstrap hadles the *hover* effect gracefully enough. + // + // .hover( + // function() { + // // the *hover* effect. + // // only on buttons that are not the "active" tab, or disabled + // button + // .not('.' + tm + '-state-active') + // .not('.' + tm + '-state-disabled') + // .addClass(tm + '-state-hover'); + // }, + // function() { + // // undo the *hover* effect + // button + // .removeClass(tm + '-state-hover') + // .removeClass(tm + '-state-down'); // if mouseleave happens before mouseup + // } + // ); groupChildren = groupChildren.add(button); } } }); - if (isOnlyButtons) { - groupChildren - .first().addClass(tm + '-corner-left').end() - .last().addClass(tm + '-corner-right').end(); - } + // Using Bootstrap's btn-group, which handles automatically in CSS + // + // if (isOnlyButtons) { + // groupChildren + // .first().addClass(tm + '-corner-left').end() + // .last().addClass(tm + '-corner-right').end(); + // } if (groupChildren.length > 1) { groupEl = $('<div/>'); if (isOnlyButtons) { - groupEl.addClass('fc-button-group'); + // groupEl.addClass('fc-button-group'); + groupEl.addClass('btn-group'); } groupEl.append(groupChildren); sectionEl.append(groupEl); } else { @@ -8810,40 +8829,54 @@ }); } return sectionEl; } - - + + function updateTitle(text) { el.find('h2').text(text); } - - + + function activateButton(buttonName) { el.find('.fc-' + buttonName + '-button') - .addClass(tm + '-state-active'); + // .addClass(tm + '-state-active'); + .removeClass('btn-default') + .addClass('btn-primary'); } - - + + function deactivateButton(buttonName) { el.find('.fc-' + buttonName + '-button') - .removeClass(tm + '-state-active'); + // .removeClass(tm + '-state-active'); + .removeClass('btn-primary') + .addClass('btn-default'); } - - + + function disableButton(buttonName) { el.find('.fc-' + buttonName + '-button') .attr('disabled', 'disabled') - .addClass(tm + '-state-disabled'); + // .addClass(tm + '-state-disabled'); + // Such a hack! + // Just because of the Slate bootswatch + .removeClass('btn-default') + .addClass('btn-primary'); + // Hack over… for now! } - - + + function enableButton(buttonName) { el.find('.fc-' + buttonName + '-button') .removeAttr('disabled') - .removeClass(tm + '-state-disabled'); + // .removeClass(tm + '-state-disabled'); + // Such a hack! + // Just because of the Slate bootswatch + .removeClass('btn-primary') + .addClass('btn-default'); + // Hack over… } function getViewsWithButtons() { return viewsWithButtons; @@ -8864,12 +8897,12 @@ var eventGUID = 1; function EventManager(options) { // assumed to be a calendar var t = this; - - + + // exports t.isFetchNeeded = isFetchNeeded; t.fetchEvents = fetchEvents; t.addEventSource = addEventSource; t.removeEventSource = removeEventSource; @@ -8879,18 +8912,18 @@ t.clientEvents = clientEvents; t.mutateEvent = mutateEvent; t.normalizeEventRange = normalizeEventRange; t.normalizeEventRangeTimes = normalizeEventRangeTimes; t.ensureVisibleEventRange = ensureVisibleEventRange; - - + + // imports var trigger = t.trigger; var getView = t.getView; var reportEvents = t.reportEvents; - - + + // locals var stickySource = { events: [] }; var sources = [ stickySource ]; var rangeStart, rangeEnd; var currentFetchID = 0; @@ -8906,25 +8939,25 @@ if (source) { sources.push(source); } } ); - - - + + + /* Fetching -----------------------------------------------------------------------------*/ - - + + function isFetchNeeded(start, end) { return !rangeStart || // nothing has been fetched yet? // or, a part of the new range is outside of the old range? (after normalizing) start.clone().stripZone() < rangeStart.clone().stripZone() || end.clone().stripZone() > rangeEnd.clone().stripZone(); } - - + + function fetchEvents(start, end) { rangeStart = start; rangeEnd = end; cache = []; var fetchID = ++currentFetchID; @@ -8932,12 +8965,12 @@ pendingSourceCnt = len; for (var i=0; i<len; i++) { fetchEventSource(sources[i], fetchID); } } - - + + function fetchEventSource(source, fetchID) { _fetchEventSource(source, function(eventInputs) { var isArraySource = $.isArray(source.events); var i, eventInput; var abstractEvent; @@ -8969,12 +9002,12 @@ reportEvents(cache); } } }); } - - + + function _fetchEventSource(source, callback) { var i; var fetchers = fc.sourceFetchers; var res; @@ -9079,17 +9112,17 @@ }else{ callback(); } } } - - - + + + /* Sources -----------------------------------------------------------------------------*/ - + function addEventSource(sourceInput) { var source = buildEventSource(sourceInput); if (source) { sources.push(source); pendingSourceCnt++; @@ -9166,13 +9199,13 @@ (source.origArray || source.googleCalendarId || source.url || source.events) : // get the primitive null ) || source; // the given argument *is* the primitive } - - - + + + /* Manipulation -----------------------------------------------------------------------------*/ // Only ever called from the externally-facing API @@ -9210,11 +9243,11 @@ // non-date-related, non-id-related, non-secret function isMiscEventPropName(name) { return !/^_|^(id|allDay|start|end)$/.test(name); } - + // returns the expanded events that were created function renderEvent(eventInput, stick) { var abstractEvent = buildEventFromInput(eventInput); var events; var i, event; @@ -9239,12 +9272,12 @@ return events; } return []; } - - + + function removeEvents(filter) { var eventID; var i; if (filter == null) { // null or undefined. remove all events @@ -9269,12 +9302,12 @@ } } reportEvents(cache); } - - + + function clientEvents(filter) { if ($.isFunction(filter)) { return $.grep(cache, filter); } else if (filter != null) { // not null, not undefined. an event ID @@ -9283,32 +9316,32 @@ return e._id == filter; }); } return cache; // else, return all } - - - + + + /* Loading State -----------------------------------------------------------------------------*/ - - + + function pushLoading() { if (!(loadingLevel++)) { trigger('loading', null, true, getView()); } } - - + + function popLoading() { if (!(--loadingLevel)) { trigger('loading', null, false, getView()); } } - - - + + + /* Event Normalization -----------------------------------------------------------------------------*/ // Given a raw object with key/value properties, returns an "abstract" Event object. @@ -10784,6 +10817,6 @@ duration: { days: 1 } }; ;; return fc; // export for Node/CommonJS -}); \ No newline at end of file +});