");
- el.addClass(clazz);
- return el;
- }
-
- // The `Dialog` class represents a modal dialog. The dialog class can be invoked by providing an options object
- // containing at lest template or templateUrl and controller:
- //
- // var d = new Dialog({templateUrl: 'foo.html', controller: 'BarController'});
- //
- // Dialogs can also be created using templateUrl and controller as distinct arguments:
- //
- // var d = new Dialog('path/to/dialog.html', MyDialogController);
- function Dialog(opts) {
-
- var self = this, options = this.options = angular.extend({}, defaults, globalOptions, opts);
-
- this.backdropEl = createElement(options.backdropClass);
- if(options.backdropFade){
- this.backdropEl.addClass(options.transitionClass);
- this.backdropEl.removeClass(options.triggerClass);
- }
-
- this.modalEl = createElement(options.dialogClass);
- if(options.dialogFade){
- this.modalEl.addClass(options.transitionClass);
- this.modalEl.removeClass(options.triggerClass);
- }
-
- this.handledEscapeKey = function(e) {
- if (e.which === 27) {
- self.close();
- e.preventDefault();
- self.$scope.$apply();
- }
- };
-
- this.handleBackDropClick = function(e) {
- self.close();
- e.preventDefault();
- self.$scope.$apply();
- };
- }
-
- // The `isOpen()` method returns wether the dialog is currently visible.
- Dialog.prototype.isOpen = function(){
- return this._open;
- };
-
- // The `open(templateUrl, controller)` method opens the dialog.
- // Use the `templateUrl` and `controller` arguments if specifying them at dialog creation time is not desired.
- Dialog.prototype.open = function(templateUrl, controller){
- var self = this, options = this.options;
-
- if(templateUrl){
- options.templateUrl = templateUrl;
- }
- if(controller){
- options.controller = controller;
- }
-
- if(!(options.template || options.templateUrl)) {
- throw new Error('Dialog.open expected template or templateUrl, neither found. Use options or open method to specify them.');
- }
-
- this._loadResolves().then(function(locals) {
- var $scope = locals.$scope = self.$scope = locals.$scope ? locals.$scope : $rootScope.$new();
-
- self.modalEl.html(locals.$template);
-
- if (self.options.controller) {
- var ctrl = $controller(self.options.controller, locals);
- self.modalEl.contents().data('ngControllerController', ctrl);
- }
-
- $compile(self.modalEl)($scope);
- self._addElementsToDom();
- body.addClass(self.options.dialogOpenClass);
-
- // trigger tranisitions
- setTimeout(function(){
- if(self.options.dialogFade){ self.modalEl.addClass(self.options.triggerClass); }
- if(self.options.backdropFade){ self.backdropEl.addClass(self.options.triggerClass); }
- });
-
- self._bindEvents();
- });
-
- this.deferred = $q.defer();
- return this.deferred.promise;
- };
-
- // closes the dialog and resolves the promise returned by the `open` method with the specified result.
- Dialog.prototype.close = function(result){
- var self = this;
- var fadingElements = this._getFadingElements();
-
- body.removeClass(self.options.dialogOpenClass);
- if(fadingElements.length > 0){
- for (var i = fadingElements.length - 1; i >= 0; i--) {
- $transition(fadingElements[i], removeTriggerClass).then(onCloseComplete);
- }
- return;
- }
-
- this._onCloseComplete(result);
-
- function removeTriggerClass(el){
- el.removeClass(self.options.triggerClass);
- }
-
- function onCloseComplete(){
- if(self._open){
- self._onCloseComplete(result);
- }
- }
- };
-
- Dialog.prototype._getFadingElements = function(){
- var elements = [];
- if(this.options.dialogFade){
- elements.push(this.modalEl);
- }
- if(this.options.backdropFade){
- elements.push(this.backdropEl);
- }
-
- return elements;
- };
-
- Dialog.prototype._bindEvents = function() {
- if(this.options.keyboard){ body.bind('keydown', this.handledEscapeKey); }
- if(this.options.backdrop && this.options.backdropClick){ this.backdropEl.bind('click', this.handleBackDropClick); }
- };
-
- Dialog.prototype._unbindEvents = function() {
- if(this.options.keyboard){ body.unbind('keydown', this.handledEscapeKey); }
- if(this.options.backdrop && this.options.backdropClick){ this.backdropEl.unbind('click', this.handleBackDropClick); }
- };
-
- Dialog.prototype._onCloseComplete = function(result) {
- this._removeElementsFromDom();
- this._unbindEvents();
-
- this.deferred.resolve(result);
- };
-
- Dialog.prototype._addElementsToDom = function(){
- body.append(this.modalEl);
-
- if(this.options.backdrop) {
- if (activeBackdrops.value === 0) {
- body.append(this.backdropEl);
- }
- activeBackdrops.value++;
- }
-
- this._open = true;
- };
-
- Dialog.prototype._removeElementsFromDom = function(){
- this.modalEl.remove();
-
- if(this.options.backdrop) {
- activeBackdrops.value--;
- if (activeBackdrops.value === 0) {
- this.backdropEl.remove();
- }
- }
- this._open = false;
- };
-
- // Loads all `options.resolve` members to be used as locals for the controller associated with the dialog.
- Dialog.prototype._loadResolves = function(){
- var values = [], keys = [], templatePromise, self = this;
-
- if (this.options.template) {
- templatePromise = $q.when(this.options.template);
- } else if (this.options.templateUrl) {
- templatePromise = $http.get(this.options.templateUrl, {cache:$templateCache})
- .then(function(response) { return response.data; });
- }
-
- angular.forEach(this.options.resolve || [], function(value, key) {
- keys.push(key);
- values.push(angular.isString(value) ? $injector.get(value) : $injector.invoke(value));
- });
-
- keys.push('$template');
- values.push(templatePromise);
-
- return $q.all(values).then(function(values) {
- var locals = {};
- angular.forEach(values, function(value, index) {
- locals[keys[index]] = value;
- });
- locals.dialog = self;
- return locals;
- });
- };
-
- // The actual `$dialog` service that is injected in controllers.
- return {
- // Creates a new `Dialog` with the specified options.
- dialog: function(opts){
- return new Dialog(opts);
- },
- // creates a new `Dialog` tied to the default message box template and controller.
- //
- // Arguments `title` and `message` are rendered in the modal header and body sections respectively.
- // The `buttons` array holds an object with the following members for each button to include in the
- // modal footer section:
- //
- // * `result`: the result to pass to the `close` method of the dialog when the button is clicked
- // * `label`: the label of the button
- // * `cssClass`: additional css class(es) to apply to the button for styling
- messageBox: function(title, message, buttons){
- return new Dialog({templateUrl: 'template/dialog/message.html', controller: 'MessageBoxController', resolve:
- {model: function() {
- return {
- title: title,
- message: message,
- buttons: buttons
- };
- }
- }});
- }
- };
- }];
-});
-
-/*
- * dropdownToggle - Provides dropdown menu functionality in place of bootstrap js
- * @restrict class or attribute
- * @example:
-
- My Dropdown Menu
-
-
- */
-
-angular.module('ui.bootstrap.dropdownToggle', []).directive('dropdownToggle',
-['$document', '$location', '$window', function ($document, $location, $window) {
- var openElement = null, close;
- return {
- restrict: 'CA',
- link: function(scope, element, attrs) {
- scope.$watch(function dropdownTogglePathWatch(){return $location.path();}, function dropdownTogglePathWatchAction() {
- if (close) { close(); }
- });
-
- element.parent().bind('click', function(event) {
- if (close) { close(); }
- });
-
- element.bind('click', function(event) {
- event.preventDefault();
- event.stopPropagation();
-
- var iWasOpen = false;
-
- if (openElement) {
- iWasOpen = openElement === element;
- close();
- }
-
- if (!iWasOpen){
- element.parent().addClass('open');
- openElement = element;
-
- close = function (event) {
- if (event) {
- event.preventDefault();
- event.stopPropagation();
- }
- $document.unbind('click', close);
- element.parent().removeClass('open');
- close = null;
- openElement = null;
- };
-
- $document.bind('click', close);
- }
- });
- }
- };
-}]);
-
-angular.module('ui.bootstrap.modal', ['ui.bootstrap.dialog'])
-.directive('modal', ['$parse', '$dialog', function($parse, $dialog) {
- var backdropEl;
- var body = angular.element(document.getElementsByTagName('body')[0]);
- return {
- restrict: 'EA',
- terminal: true,
- link: function(scope, elm, attrs) {
- var opts = angular.extend({}, scope.$eval(attrs.uiOptions || attrs.bsOptions || attrs.options));
- var shownExpr = attrs.modal || attrs.show;
- var setClosed;
-
- // Create a dialog with the template as the contents of the directive
- // Add the current scope as the resolve in order to make the directive scope as a dialog controller scope
- opts = angular.extend(opts, {
- template: elm.html(),
- resolve: { $scope: function() { return scope; } }
- });
- var dialog = $dialog.dialog(opts);
-
- elm.remove();
-
- if (attrs.close) {
- setClosed = function() {
- $parse(attrs.close)(scope);
- };
- } else {
- setClosed = function() {
- if (angular.isFunction($parse(shownExpr).assign)) {
- $parse(shownExpr).assign(scope, false);
- }
- };
- }
-
- scope.$watch(shownExpr, function(isShown, oldShown) {
- if (isShown) {
- dialog.open().then(function(){
- setClosed();
- });
- } else {
- //Make sure it is not opened
- if (dialog.isOpen()){
- dialog.close();
- }
- }
- });
- }
- };
-}]);
-angular.module('ui.bootstrap.pagination', [])
-
-.constant('paginationConfig', {
- boundaryLinks: false,
- directionLinks: true,
- firstText: 'First',
- previousText: 'Previous',
- nextText: 'Next',
- lastText: 'Last'
-})
-
-.directive('pagination', ['paginationConfig', function(paginationConfig) {
- return {
- restrict: 'EA',
- scope: {
- numPages: '=',
- currentPage: '=',
- maxSize: '=',
- onSelectPage: '&'
- },
- templateUrl: 'template/pagination/pagination.html',
- replace: true,
- link: function(scope, element, attrs) {
-
- // Setup configuration parameters
- var boundaryLinks = angular.isDefined(attrs.boundaryLinks) ? scope.$eval(attrs.boundaryLinks) : paginationConfig.boundaryLinks;
- var directionLinks = angular.isDefined(attrs.directionLinks) ? scope.$eval(attrs.directionLinks) : paginationConfig.directionLinks;
- var firstText = angular.isDefined(attrs.firstText) ? attrs.firstText : paginationConfig.firstText;
- var previousText = angular.isDefined(attrs.previousText) ? attrs.previousText : paginationConfig.previousText;
- var nextText = angular.isDefined(attrs.nextText) ? attrs.nextText : paginationConfig.nextText;
- var lastText = angular.isDefined(attrs.lastText) ? attrs.lastText : paginationConfig.lastText;
-
- // Create page object used in template
- function makePage(number, text, isActive, isDisabled) {
- return {
- number: number,
- text: text,
- active: isActive,
- disabled: isDisabled
- };
- }
-
- scope.$watch('numPages + currentPage + maxSize', function() {
- scope.pages = [];
-
- //set the default maxSize to numPages
- var maxSize = ( scope.maxSize && scope.maxSize < scope.numPages ) ? scope.maxSize : scope.numPages;
- var startPage = scope.currentPage - Math.floor(maxSize/2);
-
- //adjust the startPage within boundary
- if(startPage < 1) {
- startPage = 1;
- }
- if ((startPage + maxSize - 1) > scope.numPages) {
- startPage = startPage - ((startPage + maxSize - 1) - scope.numPages );
- }
-
- // Add page number links
- for (var number = startPage, max = startPage + maxSize; number < max; number++) {
- var page = makePage(number, number, scope.isActive(number), false);
- scope.pages.push(page);
- }
-
- // Add previous & next links
- if (directionLinks) {
- var previousPage = makePage(scope.currentPage - 1, previousText, false, scope.noPrevious());
- scope.pages.unshift(previousPage);
-
- var nextPage = makePage(scope.currentPage + 1, nextText, false, scope.noNext());
- scope.pages.push(nextPage);
- }
-
- // Add first & last links
- if (boundaryLinks) {
- var firstPage = makePage(1, firstText, false, scope.noPrevious());
- scope.pages.unshift(firstPage);
-
- var lastPage = makePage(scope.numPages, lastText, false, scope.noNext());
- scope.pages.push(lastPage);
- }
-
-
- if ( scope.currentPage > scope.numPages ) {
- scope.selectPage(scope.numPages);
- }
- });
- scope.noPrevious = function() {
- return scope.currentPage === 1;
- };
- scope.noNext = function() {
- return scope.currentPage === scope.numPages;
- };
- scope.isActive = function(page) {
- return scope.currentPage === page;
- };
-
- scope.selectPage = function(page) {
- if ( ! scope.isActive(page) && page > 0 && page <= scope.numPages) {
- scope.currentPage = page;
- scope.onSelectPage({ page: page });
- }
- };
- }
- };
-}]);
-/**
- * The following features are still outstanding: popup delay, animation as a
- * function, placement as a function, inside, support for more triggers than
- * just mouse enter/leave, html popovers, and selector delegatation.
- */
-angular.module( 'ui.bootstrap.popover', [] )
-.directive( 'popoverPopup', function () {
- return {
- restrict: 'EA',
- replace: true,
- scope: { popoverTitle: '@', popoverContent: '@', placement: '@', animation: '&', isOpen: '&' },
- templateUrl: 'template/popover/popover.html'
- };
-})
-.directive( 'popover', [ '$compile', '$timeout', '$parse', '$window', function ( $compile, $timeout, $parse, $window ) {
-
- var template =
- '
'+
- '';
-
- return {
- scope: true,
- link: function ( scope, element, attr ) {
- var popover = $compile( template )( scope ),
- transitionTimeout;
-
- attr.$observe( 'popover', function ( val ) {
- scope.tt_popover = val;
- });
-
- attr.$observe( 'popoverTitle', function ( val ) {
- scope.tt_title = val;
- });
-
- attr.$observe( 'popoverPlacement', function ( val ) {
- // If no placement was provided, default to 'top'.
- scope.tt_placement = val || 'top';
- });
-
- attr.$observe( 'popoverAnimation', function ( val ) {
- scope.tt_animation = $parse( val );
- });
-
- // By default, the popover is not open.
- scope.tt_isOpen = false;
-
- // Calculate the current position and size of the directive element.
- function getPosition() {
- var boundingClientRect = element[0].getBoundingClientRect();
- return {
- width: element.prop( 'offsetWidth' ),
- height: element.prop( 'offsetHeight' ),
- top: boundingClientRect.top + $window.pageYOffset,
- left: boundingClientRect.left + $window.pageXOffset
- };
- }
-
- function show() {
- var position,
- ttWidth,
- ttHeight,
- ttPosition;
-
- // If there is a pending remove transition, we must cancel it, lest the
- // toolip be mysteriously removed.
- if ( transitionTimeout ) {
- $timeout.cancel( transitionTimeout );
- }
-
- // Set the initial positioning.
- popover.css({ top: 0, left: 0, display: 'block' });
-
- // Now we add it to the DOM because need some info about it. But it's not
- // visible yet anyway.
- element.after( popover );
-
- // Get the position of the directive element.
- position = getPosition();
-
- // Get the height and width of the popover so we can center it.
- ttWidth = popover.prop( 'offsetWidth' );
- ttHeight = popover.prop( 'offsetHeight' );
-
- // Calculate the popover's top and left coordinates to center it with
- // this directive.
- switch ( scope.tt_placement ) {
- case 'right':
- ttPosition = {
- top: (position.top + position.height / 2 - ttHeight / 2) + 'px',
- left: (position.left + position.width) + 'px'
- };
- break;
- case 'bottom':
- ttPosition = {
- top: (position.top + position.height) + 'px',
- left: (position.left + position.width / 2 - ttWidth / 2) + 'px'
- };
- break;
- case 'left':
- ttPosition = {
- top: (position.top + position.height / 2 - ttHeight / 2) + 'px',
- left: (position.left - ttWidth) + 'px'
- };
- break;
- default:
- ttPosition = {
- top: (position.top - ttHeight) + 'px',
- left: (position.left + position.width / 2 - ttWidth / 2) + 'px'
- };
- break;
- }
-
- // Now set the calculated positioning.
- popover.css( ttPosition );
-
- // And show the popover.
- scope.tt_isOpen = true;
- }
-
- // Hide the popover popup element.
- function hide() {
- // First things first: we don't show it anymore.
- //popover.removeClass( 'in' );
- scope.tt_isOpen = false;
-
- // And now we remove it from the DOM. However, if we have animation, we
- // need to wait for it to expire beforehand.
- // FIXME: this is a placeholder for a port of the transitions library.
- if ( angular.isDefined( scope.tt_animation ) && scope.tt_animation() ) {
- transitionTimeout = $timeout( function () { popover.remove(); }, 500 );
- } else {
- popover.remove();
- }
- }
-
- // Register the event listeners.
- element.bind( 'click', function() {
- if(scope.tt_isOpen){
- scope.$apply( hide );
- } else {
- scope.$apply( show );
- }
-
- });
- }
- };
-}]);
-
-
-angular.module('ui.bootstrap.tabs', [])
-.controller('TabsController', ['$scope', '$element', function($scope, $element) {
- var panes = $scope.panes = [];
-
- this.select = $scope.select = function selectPane(pane) {
- angular.forEach(panes, function(pane) {
- pane.selected = false;
- });
- pane.selected = true;
- };
-
- this.addPane = function addPane(pane) {
- if (!panes.length) {
- $scope.select(pane);
- }
- panes.push(pane);
- };
-
- this.removePane = function removePane(pane) {
- var index = panes.indexOf(pane);
- panes.splice(index, 1);
- //Select a new pane if removed pane was selected
- if (pane.selected && panes.length > 0) {
- $scope.select(panes[index < panes.length ? index : index-1]);
- }
- };
-}])
-.directive('tabs', function() {
- return {
- restrict: 'EA',
- transclude: true,
- scope: {},
- controller: 'TabsController',
- templateUrl: 'template/tabs/tabs.html',
- replace: true
- };
-})
-.directive('pane', ['$parse', function($parse) {
- return {
- require: '^tabs',
- restrict: 'EA',
- transclude: true,
- scope:{
- heading:'@'
- },
- link: function(scope, element, attrs, tabsCtrl) {
- var getSelected, setSelected;
- scope.selected = false;
- if (attrs.active) {
- getSelected = $parse(attrs.active);
- setSelected = getSelected.assign;
- scope.$watch(
- function watchSelected() {return getSelected(scope.$parent);},
- function updateSelected(value) {scope.selected = value;}
- );
- scope.selected = getSelected ? getSelected(scope.$parent) : false;
- }
- scope.$watch('selected', function(selected) {
- if(selected) {
- tabsCtrl.select(scope);
- }
- if(setSelected) {
- setSelected(scope.$parent, selected);
- }
- });
-
- tabsCtrl.addPane(scope);
- scope.$on('$destroy', function() {
- tabsCtrl.removePane(scope);
- });
- },
- templateUrl: 'template/tabs/pane.html',
- replace: true
- };
-}]);
-
-/**
- * The following features are still outstanding: popup delay, animation as a
- * function, placement as a function, inside, support for more triggers than
- * just mouse enter/leave, html tooltips, and selector delegatation.
- */
-angular.module( 'ui.bootstrap.tooltip', [] )
-.directive( 'tooltipPopup', function () {
- return {
- restrict: 'EA',
- replace: true,
- scope: { tooltipTitle: '@', placement: '@', animation: '&', isOpen: '&' },
- templateUrl: 'template/tooltip/tooltip-popup.html'
- };
-})
-.directive( 'tooltip', [ '$compile', '$timeout', '$parse', '$window', function ( $compile, $timeout, $parse, $window) {
-
- var template =
- '
'+
- '';
-
- return {
- scope: true,
- link: function ( scope, element, attr ) {
- var tooltip = $compile( template )( scope ),
- transitionTimeout;
-
- attr.$observe( 'tooltip', function ( val ) {
- scope.tt_tooltip = val;
- });
-
- attr.$observe( 'tooltipPlacement', function ( val ) {
- // If no placement was provided, default to 'top'.
- scope.tt_placement = val || 'top';
- });
-
- attr.$observe( 'tooltipAnimation', function ( val ) {
- scope.tt_animation = $parse( val );
- });
-
- // By default, the tooltip is not open.
- scope.tt_isOpen = false;
-
- // Calculate the current position and size of the directive element.
- function getPosition() {
- var boundingClientRect = element[0].getBoundingClientRect();
- return {
- width: element.prop( 'offsetWidth' ),
- height: element.prop( 'offsetHeight' ),
- top: boundingClientRect.top + $window.pageYOffset,
- left: boundingClientRect.left + $window.pageXOffset
- };
- }
-
- // Show the tooltip popup element.
- function show() {
- var position,
- ttWidth,
- ttHeight,
- ttPosition;
-
- //don't show empty tooltips
- if (!scope.tt_tooltip) {
- return;
- }
-
- // If there is a pending remove transition, we must cancel it, lest the
- // toolip be mysteriously removed.
- if ( transitionTimeout ) {
- $timeout.cancel( transitionTimeout );
- }
-
- // Set the initial positioning.
- tooltip.css({ top: 0, left: 0, display: 'block' });
-
- // Now we add it to the DOM because need some info about it. But it's not
- // visible yet anyway.
- element.after( tooltip );
-
- // Get the position of the directive element.
- position = getPosition();
-
- // Get the height and width of the tooltip so we can center it.
- ttWidth = tooltip.prop( 'offsetWidth' );
- ttHeight = tooltip.prop( 'offsetHeight' );
-
- // Calculate the tooltip's top and left coordinates to center it with
- // this directive.
- switch ( scope.tt_placement ) {
- case 'right':
- ttPosition = {
- top: (position.top + position.height / 2 - ttHeight / 2) + 'px',
- left: (position.left + position.width) + 'px'
- };
- break;
- case 'bottom':
- ttPosition = {
- top: (position.top + position.height) + 'px',
- left: (position.left + position.width / 2 - ttWidth / 2) + 'px'
- };
- break;
- case 'left':
- ttPosition = {
- top: (position.top + position.height / 2 - ttHeight / 2) + 'px',
- left: (position.left - ttWidth) + 'px'
- };
- break;
- default:
- ttPosition = {
- top: (position.top - ttHeight) + 'px',
- left: (position.left + position.width / 2 - ttWidth / 2) + 'px'
- };
- break;
- }
-
- // Now set the calculated positioning.
- tooltip.css( ttPosition );
-
- // And show the tooltip.
- scope.tt_isOpen = true;
- }
-
- // Hide the tooltip popup element.
- function hide() {
- // First things first: we don't show it anymore.
- //tooltip.removeClass( 'in' );
- scope.tt_isOpen = false;
-
- // And now we remove it from the DOM. However, if we have animation, we
- // need to wait for it to expire beforehand.
- // FIXME: this is a placeholder for a port of the transitions library.
- if ( angular.isDefined( scope.tt_animation ) && scope.tt_animation() ) {
- transitionTimeout = $timeout( function () { tooltip.remove(); }, 500 );
- } else {
- tooltip.remove();
- }
- }
-
- // Register the event listeners.
- element.bind( 'mouseenter', function() {
- scope.$apply( show );
- });
- element.bind( 'mouseleave', function() {
- scope.$apply( hide );
- });
- }
- };
-}]);
-
-
-angular.module('ui.bootstrap.transition', [])
-
-/**
- * $transition service provides a consistent interface to trigger CSS 3 transitions and to be informed when they complete.
- * @param {DOMElement} element The DOMElement that will be animated.
- * @param {string|object|function} trigger The thing that will cause the transition to start:
- * - As a string, it represents the css class to be added to the element.
- * - As an object, it represents a hash of style attributes to be applied to the element.
- * - As a function, it represents a function to be called that will cause the transition to occur.
- * @return {Promise} A promise that is resolved when the transition finishes.
- */
-.factory('$transition', ['$q', '$timeout', '$rootScope', function($q, $timeout, $rootScope) {
-
- var $transition = function(element, trigger, options) {
- options = options || {};
- var deferred = $q.defer();
- var endEventName = $transition[options.animation ? "animationEndEventName" : "transitionEndEventName"];
-
- var transitionEndHandler = function(event) {
- $rootScope.$apply(function() {
- element.unbind(endEventName, transitionEndHandler);
- deferred.resolve(element);
- });
- };
-
- if (endEventName) {
- element.bind(endEventName, transitionEndHandler);
- }
-
- // Wrap in a timeout to allow the browser time to update the DOM before the transition is to occur
- $timeout(function() {
- if ( angular.isString(trigger) ) {
- element.addClass(trigger);
- } else if ( angular.isFunction(trigger) ) {
- trigger(element);
- } else if ( angular.isObject(trigger) ) {
- element.css(trigger);
- }
- //If browser does not support transitions, instantly resolve
- if ( !endEventName ) {
- deferred.resolve(element);
- }
- });
-
- // Add our custom cancel function to the promise that is returned
- // We can call this if we are about to run a new transition, which we know will prevent this transition from ending,
- // i.e. it will therefore never raise a transitionEnd event for that transition
- deferred.promise.cancel = function() {
- if ( endEventName ) {
- element.unbind(endEventName, transitionEndHandler);
- }
- deferred.reject('Transition cancelled');
- };
-
- return deferred.promise;
- };
-
- // Work out the name of the transitionEnd event
- var transElement = document.createElement('trans');
- var transitionEndEventNames = {
- 'WebkitTransition': 'webkitTransitionEnd',
- 'MozTransition': 'transitionend',
- 'OTransition': 'oTransitionEnd',
- 'msTransition': 'MSTransitionEnd',
- 'transition': 'transitionend'
- };
- var animationEndEventNames = {
- 'WebkitTransition': 'webkitAnimationEnd',
- 'MozTransition': 'animationend',
- 'OTransition': 'oAnimationEnd',
- 'msTransition': 'MSAnimationEnd',
- 'transition': 'animationend'
- };
- function findEndEventName(endEventNames) {
- for (var name in endEventNames){
- if (transElement.style[name] !== undefined) {
- return endEventNames[name];
- }
- }
- }
- $transition.transitionEndEventName = findEndEventName(transitionEndEventNames);
- $transition.animationEndEventName = findEndEventName(animationEndEventNames);
- return $transition;
-}]);
-
-angular.module('ui.bootstrap.typeahead', [])
-
-/**
- * A helper service that can parse typeahead's syntax (string provided by users)
- * Extracted to a separate service for ease of unit testing
- */
- .factory('typeaheadParser', ['$parse', function ($parse) {
-
- // 00000111000000000000022200000000000000003333333333333330000000000044000
- var TYPEAHEAD_REGEXP = /^\s*(.*?)(?:\s+as\s+(.*?))?\s+for\s+(?:([\$\w][\$\w\d]*))\s+in\s+(.*)$/;
-
- return {
- parse:function (input) {
-
- var match = input.match(TYPEAHEAD_REGEXP), modelMapper, viewMapper, source;
- if (!match) {
- throw new Error(
- "Expected typeahead specification in form of '_modelValue_ (as _label_)? for _item_ in _collection_'" +
- " but got '" + input + "'.");
- }
-
- return {
- itemName:match[3],
- source:$parse(match[4]),
- viewMapper:$parse(match[2] || match[1]),
- modelMapper:$parse(match[1])
- };
- }
- };
-}])
-
- //options - min length
- .directive('typeahead', ['$compile', '$q', 'typeaheadParser', function ($compile, $q, typeaheadParser) {
-
- var HOT_KEYS = [9, 13, 27, 38, 40];
-
- return {
- require:'ngModel',
- link:function (originalScope, element, attrs, modelCtrl) {
-
- var selected = modelCtrl.$modelValue;
-
- //minimal no of characters that needs to be entered before typeahead kicks-in
- var minSearch = originalScope.$eval(attrs.typeaheadMinLength) || 1;
-
- //expressions used by typeahead
- var parserResult = typeaheadParser.parse(attrs.typeahead);
-
- //create a child scope for the typeahead directive so we are not polluting original scope
- //with typeahead-specific data (matches, query etc.)
- var scope = originalScope.$new();
- originalScope.$on('$destroy', function(){
- scope.$destroy();
- });
-
- var resetMatches = function() {
- scope.matches = [];
- scope.activeIdx = -1;
- };
-
- var getMatchesAsync = function(inputValue) {
-
- var locals = {$viewValue: inputValue};
- $q.when(parserResult.source(scope, locals)).then(function(matches) {
-
- //it might happen that several async queries were in progress if a user were typing fast
- //but we are interested only in responses that correspond to the current view value
- if (inputValue === modelCtrl.$viewValue) {
- if (matches.length > 0) {
-
- scope.activeIdx = 0;
- scope.matches.length = 0;
-
- //transform labels
- for(var i=0; i
= minSearch) {
- getMatchesAsync(inputValue);
- }
- }
-
- return undefined;
- });
-
- modelCtrl.$render = function () {
- var locals = {};
- locals[parserResult.itemName] = selected;
- element.val(parserResult.viewMapper(scope, locals) || modelCtrl.$viewValue);
- selected = undefined;
- };
-
- scope.select = function (activeIdx) {
- //called from within the $digest() cycle
- var locals = {};
- locals[parserResult.itemName] = selected = scope.matches[activeIdx].model;
-
- modelCtrl.$setViewValue(parserResult.modelMapper(scope, locals));
- modelCtrl.$render();
- };
-
- //bind keyboard events: arrows up(38) / down(40), enter(13) and tab(9), esc(9)
- element.bind('keydown', function (evt) {
-
- //typeahead is open and an "interesting" key was pressed
- if (scope.matches.length === 0 || HOT_KEYS.indexOf(evt.which) === -1) {
- return;
- }
-
- evt.preventDefault();
-
- if (evt.which === 40) {
- scope.activeIdx = (scope.activeIdx + 1) % scope.matches.length;
- scope.$digest();
-
- } else if (evt.which === 38) {
- scope.activeIdx = (scope.activeIdx ? scope.activeIdx : scope.matches.length) - 1;
- scope.$digest();
-
- } else if (evt.which === 13 || evt.which === 9) {
- scope.$apply(function () {
- scope.select(scope.activeIdx);
- });
-
- } else if (evt.which === 27) {
- scope.matches = [];
- scope.$digest();
- }
- });
-
- var tplElCompiled = $compile("")(scope);
- element.after(tplElCompiled);
- }
- };
-
-}])
-
- .directive('typeaheadPopup', function () {
- return {
- restrict:'E',
- scope:{
- matches:'=',
- query:'=',
- active:'=',
- select:'&'
- },
- replace:true,
- templateUrl:'template/typeahead/typeahead.html',
- link:function (scope, element, attrs) {
-
- scope.isOpen = function () {
- return scope.matches.length > 0;
- };
-
- scope.isActive = function (matchIdx) {
- return scope.active == matchIdx;
- };
-
- scope.selectActive = function (matchIdx) {
- scope.active = matchIdx;
- };
-
- scope.selectMatch = function (activeIdx) {
- scope.select({activeIdx:activeIdx});
- };
- }
- };
- })
-
- .filter('typeaheadHighlight', function() {
- return function(matchItem, query) {
- return (query) ? matchItem.replace(new RegExp(query, 'gi'), '$&') : query;
- };
- });
-angular.module("template/accordion/accordion-group.html", []).run(["$templateCache", function($templateCache){
- $templateCache.put("template/accordion/accordion-group.html",
- "");
-}]);
-
-angular.module("template/accordion/accordion.html", []).run(["$templateCache", function($templateCache){
- $templateCache.put("template/accordion/accordion.html",
- "");
-}]);
-
-angular.module("template/alert/alert.html", []).run(["$templateCache", function($templateCache){
- $templateCache.put("template/alert/alert.html",
- "");
-}]);
-
-angular.module("template/carousel/carousel.html", []).run(["$templateCache", function($templateCache){
- $templateCache.put("template/carousel/carousel.html",
- "" +
- "
" +
- " " +
- "
" +
- "
" +
- "
‹" +
- "
›" +
- "
" +
- "");
-}]);
-
-angular.module("template/carousel/slide.html", []).run(["$templateCache", function($templateCache){
- $templateCache.put("template/carousel/slide.html",
- "" +
- "");
-}]);
-
-angular.module("template/dialog/message.html", []).run(["$templateCache", function($templateCache){
- $templateCache.put("template/dialog/message.html",
- "" +
- "" +
- "
{{ message }}
" +
- "
" +
- "" +
- "");
-}]);
-
-angular.module("template/pagination/pagination.html", []).run(["$templateCache", function($templateCache){
- $templateCache.put("template/pagination/pagination.html",
- "" +
- "");
-}]);
-
-angular.module("template/popover/popover.html", []).run(["$templateCache", function($templateCache){
- $templateCache.put("template/popover/popover.html",
- "" +
- "
" +
- "" +
- "
" +
- "
" +
- "");
-}]);
-
-angular.module("template/tabs/pane.html", []).run(["$templateCache", function($templateCache){
- $templateCache.put("template/tabs/pane.html",
- "" +
- "");
-}]);
-
-angular.module("template/tabs/tabs.html", []).run(["$templateCache", function($templateCache){
- $templateCache.put("template/tabs/tabs.html",
- "" +
- "");
-}]);
-
-angular.module("template/tooltip/tooltip-popup.html", []).run(["$templateCache", function($templateCache){
- $templateCache.put("template/tooltip/tooltip-popup.html",
- "" +
- "");
-}]);
-
-angular.module("template/typeahead/typeahead.html", []).run(["$templateCache", function($templateCache){
- $templateCache.put("template/typeahead/typeahead.html",
- "" +
- "
" +
- " - " +
- " " +
- "
" +
- "
" +
- "
");
-}]);
diff --git a/src/main/java/com/commafeed/frontend/references/angularuibootstrap/ui-bootstrap-tpls-0.2.0.min.js b/src/main/java/com/commafeed/frontend/references/angularuibootstrap/ui-bootstrap-tpls-0.2.0.min.js
deleted file mode 100644
index 800bb73a..00000000
--- a/src/main/java/com/commafeed/frontend/references/angularuibootstrap/ui-bootstrap-tpls-0.2.0.min.js
+++ /dev/null
@@ -1 +0,0 @@
-angular.module("ui.bootstrap",["ui.bootstrap.tpls","ui.bootstrap.accordion","ui.bootstrap.alert","ui.bootstrap.buttons","ui.bootstrap.carousel","ui.bootstrap.collapse","ui.bootstrap.dialog","ui.bootstrap.dropdownToggle","ui.bootstrap.modal","ui.bootstrap.pagination","ui.bootstrap.popover","ui.bootstrap.tabs","ui.bootstrap.tooltip","ui.bootstrap.transition","ui.bootstrap.typeahead"]),angular.module("ui.bootstrap.tpls",["template/accordion/accordion-group.html","template/accordion/accordion.html","template/alert/alert.html","template/carousel/carousel.html","template/carousel/slide.html","template/dialog/message.html","template/pagination/pagination.html","template/popover/popover.html","template/tabs/pane.html","template/tabs/tabs.html","template/tooltip/tooltip-popup.html","template/typeahead/typeahead.html"]),angular.module("ui.bootstrap.accordion",["ui.bootstrap.collapse"]).constant("accordionConfig",{closeOthers:!0}).controller("AccordionController",["$scope","$attrs","accordionConfig",function(e,t,n){this.groups=[],this.closeOthers=function(r){var i=angular.isDefined(t.closeOthers)?e.$eval(t.closeOthers):n.closeOthers;i&&angular.forEach(this.groups,function(e){e!==r&&(e.isOpen=!1)})},this.addGroup=function(e){var t=this;this.groups.push(e),e.$on("$destroy",function(n){t.removeGroup(e)})},this.removeGroup=function(e){var t=this.groups.indexOf(e);t!==-1&&this.groups.splice(this.groups.indexOf(e),1)}}]).directive("accordion",function(){return{restrict:"EA",controller:"AccordionController",transclude:!0,replace:!1,templateUrl:"template/accordion/accordion.html"}}).directive("accordionGroup",["$parse","$transition","$timeout",function(e,t,n){return{require:"^accordion",restrict:"EA",transclude:!0,replace:!0,templateUrl:"template/accordion/accordion-group.html",scope:{heading:"@"},controller:["$scope",function(e){this.setHeading=function(e){this.heading=e}}],link:function(t,n,r,i){var s,o;i.addGroup(t),t.isOpen=!1,r.isOpen&&(s=e(r.isOpen),o=s.assign,t.$watch(function(){return s(t.$parent)},function(n){t.isOpen=n}),t.isOpen=s?s(t.$parent):!1),t.$watch("isOpen",function(e){e&&i.closeOthers(t),o&&o(t.$parent,e)})}}}]).directive("accordionHeading",function(){return{restrict:"E",transclude:!0,template:"",replace:!0,require:"^accordionGroup",compile:function(e,t,n){return function(t,r,i,s){s.setHeading(n(t,function(){}))}}}}).directive("accordionTransclude",function(){return{require:"^accordionGroup",link:function(e,t,n,r){e.$watch(function(){return r[n.accordionTransclude]},function(e){e&&(t.html(""),t.append(e))})}}}),angular.module("ui.bootstrap.alert",[]).directive("alert",function(){return{restrict:"EA",templateUrl:"template/alert/alert.html",transclude:!0,replace:!0,scope:{type:"=",close:"&"}}}),angular.module("ui.bootstrap.buttons",[]).constant("buttonConfig",{activeClass:"active",toggleEvent:"click"}).directive("btnRadio",["buttonConfig",function(e){var t=e.activeClass||"active",n=e.toggleEvent||"click";return{require:"ngModel",link:function(e,r,i,s){var o=e.$eval(i.btnRadio);e.$watch(function(){return s.$modelValue},function(e){angular.equals(e,o)?r.addClass(t):r.removeClass(t)}),r.bind(n,function(){r.hasClass(t)||e.$apply(function(){s.$setViewValue(o)})})}}}]).directive("btnCheckbox",["buttonConfig",function(e){var t=e.activeClass||"active",n=e.toggleEvent||"click";return{require:"ngModel",link:function(e,r,i,s){var o=e.$eval(i.btnCheckboxTrue),u=e.$eval(i.btnCheckboxFalse);o=angular.isDefined(o)?o:!0,u=angular.isDefined(u)?u:!1,e.$watch(function(){return s.$modelValue},function(e){angular.equals(e,o)?r.addClass(t):r.removeClass(t)}),r.bind(n,function(){e.$apply(function(){s.$setViewValue(r.hasClass(t)?u:o)})})}}}]),angular.module("ui.bootstrap.carousel",["ui.bootstrap.transition"]).controller("CarouselController",["$scope","$timeout","$transition","$q",function(e,t,n,r){function f(){function n(){a?(e.next(),f()):e.pause()}u&&t.cancel(u);var r=+e.interval;!isNaN(r)&&r>=0&&(u=t(n,r))}var i=this,s=i.slides=[],o=-1,u,a;i.currentSlide=null,i.select=function(r,u){function l(){i.currentSlide&&angular.isString(u)&&!e.noTransition&&r.$element?(r.$element.addClass(u),r.$element[0].offsetWidth=r.$element[0].offsetWidth,angular.forEach(s,function(e){angular.extend(e,{direction:"",entering:!1,leaving:!1,active:!1})}),angular.extend(r,{direction:u,active:!0,entering:!0}),angular.extend(i.currentSlide||{},{direction:u,leaving:!0}),e.$currentTransition=n(r.$element,{}),function(t,n){e.$currentTransition.then(function(){c(t,n)},function(){c(t,n)})}(r,i.currentSlide)):c(r,i.currentSlide),i.currentSlide=r,o=a,f()}function c(t,n){angular.extend(t,{direction:"",active:!0,leaving:!1,entering:!1}),angular.extend(n||{},{direction:"",active:!1,leaving:!1,entering:!1}),e.$currentTransition=null}var a=s.indexOf(r);u===undefined&&(u=a>o?"next":"prev"),r&&r!==i.currentSlide&&(e.$currentTransition?(e.$currentTransition.cancel(),t(l)):l())},i.indexOfSlide=function(e){return s.indexOf(e)},e.next=function(){var e=(o+1)%s.length;return i.select(s[e],"next")},e.prev=function(){var e=o-1<0?s.length-1:o-1;return i.select(s[e],"prev")},e.select=function(e){i.select(e)},e.isActive=function(e){return i.currentSlide===e},e.slides=function(){return s},e.$watch("interval",f),e.play=function(){a||(a=!0,f())},e.pause=function(){a=!1,u&&t.cancel(u)},i.addSlide=function(t,n){t.$element=n,s.push(t),s.length===1||t.active?(i.select(s[s.length-1]),s.length==1&&e.play()):t.active=!1},i.removeSlide=function(e){var t=s.indexOf(e);s.splice(t,1),s.length>0&&e.active&&(t>=s.length?i.select(s[t-1]):i.select(s[t]))}}]).directive("carousel",[function(){return{restrict:"EA",transclude:!0,replace:!0,controller:"CarouselController",require:"carousel",templateUrl:"template/carousel/carousel.html",scope:{interval:"=",noTransition:"="}}}]).directive("slide",[function(){return{require:"^carousel",restrict:"EA",transclude:!0,replace:!0,templateUrl:"template/carousel/slide.html",scope:{active:"="},link:function(e,t,n,r){r.addSlide(e,t),e.$on("$destroy",function(){r.removeSlide(e)}),e.$watch("active",function(t){t&&r.select(e)})}}}]),angular.module("ui.bootstrap.collapse",["ui.bootstrap.transition"]).directive("collapse",["$transition",function(e){var t=function(e,t,n){t.removeClass("collapse"),t.css({height:n});var r=t[0].offsetWidth;t.addClass("collapse")};return{link:function(n,r,i){var s,o=!0;n.$watch(function(){return r[0].scrollHeight},function(e){r[0].scrollHeight!==0&&(s||(o?t(n,r,r[0].scrollHeight+"px"):t(n,r,"auto")))}),n.$watch(i.collapse,function(e){e?l():f()});var u,a=function(t){return u&&u.cancel(),u=e(r,t),u.then(function(){u=undefined},function(){u=undefined}),u},f=function(){o?(o=!1,s||t(n,r,"auto")):a({height:r[0].scrollHeight+"px"}).then(function(){s||t(n,r,"auto")}),s=!1},l=function(){s=!0,o?(o=!1,t(n,r,0)):(t(n,r,r[0].scrollHeight+"px"),a({height:"0"}))}}}}]);var dialogModule=angular.module("ui.bootstrap.dialog",["ui.bootstrap.transition"]);dialogModule.controller("MessageBoxController",["$scope","dialog","model",function(e,t,n){e.title=n.title,e.message=n.message,e.buttons=n.buttons,e.close=function(e){t.close(e)}}]),dialogModule.provider("$dialog",function(){var e={backdrop:!0,dialogClass:"modal",backdropClass:"modal-backdrop",transitionClass:"fade",triggerClass:"in",dialogOpenClass:"modal-open",resolve:{},backdropFade:!1,dialogFade:!1,keyboard:!0,backdropClick:!0},t={},n={value:0};this.options=function(e){t=e},this.$get=["$http","$document","$compile","$rootScope","$controller","$templateCache","$q","$transition","$injector",function(r,i,s,o,u,a,f,l,c){function p(e){var t=angular.element("");return t.addClass(e),t}function d(n){var r=this,i=this.options=angular.extend({},e,t,n);this.backdropEl=p(i.backdropClass),i.backdropFade&&(this.backdropEl.addClass(i.transitionClass),this.backdropEl.removeClass(i.triggerClass)),this.modalEl=p(i.dialogClass),i.dialogFade&&(this.modalEl.addClass(i.transitionClass),this.modalEl.removeClass(i.triggerClass)),this.handledEscapeKey=function(e){e.which===27&&(r.close(),e.preventDefault(),r.$scope.$apply())},this.handleBackDropClick=function(e){r.close(),e.preventDefault(),r.$scope.$apply()}}var h=i.find("body");return d.prototype.isOpen=function(){return this._open},d.prototype.open=function(e,t){var n=this,r=this.options;e&&(r.templateUrl=e),t&&(r.controller=t);if(!r.template&&!r.templateUrl)throw new Error("Dialog.open expected template or templateUrl, neither found. Use options or open method to specify them.");return this._loadResolves().then(function(e){var t=e.$scope=n.$scope=e.$scope?e.$scope:o.$new();n.modalEl.html(e.$template);if(n.options.controller){var r=u(n.options.controller,e);n.modalEl.contents().data("ngControllerController",r)}s(n.modalEl)(t),n._addElementsToDom(),h.addClass(n.options.dialogOpenClass),setTimeout(function(){n.options.dialogFade&&n.modalEl.addClass(n.options.triggerClass),n.options.backdropFade&&n.backdropEl.addClass(n.options.triggerClass)}),n._bindEvents()}),this.deferred=f.defer(),this.deferred.promise},d.prototype.close=function(e){function i(e){e.removeClass(t.options.triggerClass)}function s(){t._open&&t._onCloseComplete(e)}var t=this,n=this._getFadingElements();h.removeClass(t.options.dialogOpenClass);if(n.length>0){for(var r=n.length-1;r>=0;r--)l(n[r],i).then(s);return}this._onCloseComplete(e)},d.prototype._getFadingElements=function(){var e=[];return this.options.dialogFade&&e.push(this.modalEl),this.options.backdropFade&&e.push(this.backdropEl),e},d.prototype._bindEvents=function(){this.options.keyboard&&h.bind("keydown",this.handledEscapeKey),this.options.backdrop&&this.options.backdropClick&&this.backdropEl.bind("click",this.handleBackDropClick)},d.prototype._unbindEvents=function(){this.options.keyboard&&h.unbind("keydown",this.handledEscapeKey),this.options.backdrop&&this.options.backdropClick&&this.backdropEl.unbind("click",this.handleBackDropClick)},d.prototype._onCloseComplete=function(e){this._removeElementsFromDom(),this._unbindEvents(),this.deferred.resolve(e)},d.prototype._addElementsToDom=function(){h.append(this.modalEl),this.options.backdrop&&(n.value===0&&h.append(this.backdropEl),n.value++),this._open=!0},d.prototype._removeElementsFromDom=function(){this.modalEl.remove(),this.options.backdrop&&(n.value--,n.value===0&&this.backdropEl.remove()),this._open=!1},d.prototype._loadResolves=function(){var e=[],t=[],n,i=this;return this.options.template?n=f.when(this.options.template):this.options.templateUrl&&(n=r.get(this.options.templateUrl,{cache:a}).then(function(e){return e.data})),angular.forEach(this.options.resolve||[],function(n,r){t.push(r),e.push(angular.isString(n)?c.get(n):c.invoke(n))}),t.push("$template"),e.push(n),f.all(e).then(function(e){var n={};return angular.forEach(e,function(e,r){n[t[r]]=e}),n.dialog=i,n})},{dialog:function(e){return new d(e)},messageBox:function(e,t,n){return new d({templateUrl:"template/dialog/message.html",controller:"MessageBoxController",resolve:{model:function(){return{title:e,message:t,buttons:n}}}})}}}]}),angular.module("ui.bootstrap.dropdownToggle",[]).directive("dropdownToggle",["$document","$location","$window",function(e,t,n){var r=null,i;return{restrict:"CA",link:function(n,s,o){n.$watch(function(){return t.path()},function(){i&&i()}),s.parent().bind("click",function(e){i&&i()}),s.bind("click",function(t){t.preventDefault(),t.stopPropagation();var n=!1;r&&(n=r===s,i()),n||(s.parent().addClass("open"),r=s,i=function(t){t&&(t.preventDefault(),t.stopPropagation()),e.unbind("click",i),s.parent().removeClass("open"),i=null,r=null},e.bind("click",i))})}}}]),angular.module("ui.bootstrap.modal",["ui.bootstrap.dialog"]).directive("modal",["$parse","$dialog",function(e,t){var n,r=angular.element(document.getElementsByTagName("body")[0]);return{restrict:"EA",terminal:!0,link:function(n,r,i){var s=angular.extend({},n.$eval(i.uiOptions||i.bsOptions||i.options)),o=i.modal||i.show,u;s=angular.extend(s,{template:r.html(),resolve:{$scope:function(){return n}}});var a=t.dialog(s);r.remove(),i.close?u=function(){e(i.close)(n)}:u=function(){angular.isFunction(e(o).assign)&&e(o).assign(n,!1)},n.$watch(o,function(e,t){e?a.open().then(function(){u()}):a.isOpen()&&a.close()})}}}]),angular.module("ui.bootstrap.pagination",[]).constant("paginationConfig",{boundaryLinks:!1,directionLinks:!0,firstText:"First",previousText:"Previous",nextText:"Next",lastText:"Last"}).directive("pagination",["paginationConfig",function(e){return{restrict:"EA",scope:{numPages:"=",currentPage:"=",maxSize:"=",onSelectPage:"&"},templateUrl:"template/pagination/pagination.html",replace:!0,link:function(t,n,r){function l(e,t,n,r){return{number:e,text:t,active:n,disabled:r}}var i=angular.isDefined(r.boundaryLinks)?t.$eval(r.boundaryLinks):e.boundaryLinks,s=angular.isDefined(r.directionLinks)?t.$eval(r.directionLinks):e.directionLinks,o=angular.isDefined(r.firstText)?r.firstText:e.firstText,u=angular.isDefined(r.previousText)?r.previousText:e.previousText,a=angular.isDefined(r.nextText)?r.nextText:e.nextText,f=angular.isDefined(r.lastText)?r.lastText:e.lastText;t.$watch("numPages + currentPage + maxSize",function(){t.pages=[];var e=t.maxSize&&t.maxSize
t.numPages&&(n-=n+e-1-t.numPages);for(var r=n,c=n+e;rt.numPages&&t.selectPage(t.numPages)}),t.noPrevious=function(){return t.currentPage===1},t.noNext=function(){return t.currentPage===t.numPages},t.isActive=function(e){return t.currentPage===e},t.selectPage=function(e){!t.isActive(e)&&e>0&&e<=t.numPages&&(t.currentPage=e,t.onSelectPage({page:e}))}}}}]),angular.module("ui.bootstrap.popover",[]).directive("popoverPopup",function(){return{restrict:"EA",replace:!0,scope:{popoverTitle:"@",popoverContent:"@",placement:"@",animation:"&",isOpen:"&"},templateUrl:"template/popover/popover.html"}}).directive("popover",["$compile","$timeout","$parse","$window",function(e,t,n,r){var i='';return{scope:!0,link:function(s,o,u){function l(){var e=o[0].getBoundingClientRect();return{width:o.prop("offsetWidth"),height:o.prop("offsetHeight"),top:e.top+r.pageYOffset,left:e.left+r.pageXOffset}}function c(){var e,n,r,i;f&&t.cancel(f),a.css({top:0,left:0,display:"block"}),o.after(a),e=l(),n=a.prop("offsetWidth"),r=a.prop("offsetHeight");switch(s.tt_placement){case"right":i={top:e.top+e.height/2-r/2+"px",left:e.left+e.width+"px"};break;case"bottom":i={top:e.top+e.height+"px",left:e.left+e.width/2-n/2+"px"};break;case"left":i={top:e.top+e.height/2-r/2+"px",left:e.left-n+"px"};break;default:i={top:e.top-r+"px",left:e.left+e.width/2-n/2+"px"}}a.css(i),s.tt_isOpen=!0}function h(){s.tt_isOpen=!1,angular.isDefined(s.tt_animation)&&s.tt_animation()?f=t(function(){a.remove()},500):a.remove()}var a=e(i)(s),f;u.$observe("popover",function(e){s.tt_popover=e}),u.$observe("popoverTitle",function(e){s.tt_title=e}),u.$observe("popoverPlacement",function(e){s.tt_placement=e||"top"}),u.$observe("popoverAnimation",function(e){s.tt_animation=n(e)}),s.tt_isOpen=!1,o.bind("click",function(){s.tt_isOpen?s.$apply(h):s.$apply(c)})}}}]),angular.module("ui.bootstrap.tabs",[]).controller("TabsController",["$scope","$element",function(e,t){var n=e.panes=[];this.select=e.select=function(t){angular.forEach(n,function(e){e.selected=!1}),t.selected=!0},this.addPane=function(r){n.length||e.select(r),n.push(r)},this.removePane=function(r){var i=n.indexOf(r);n.splice(i,1),r.selected&&n.length>0&&e.select(n[i0){c.activeIdx=0,c.matches.length=0;for(var r=0;r=f&&p(e),undefined)}),u.$render=function(){var e={};e[l.itemName]=a,s.val(l.viewMapper(c,e)||u.$viewValue),a=undefined},c.select=function(e){var t={};t[l.itemName]=a=c.matches[e].model,u.$setViewValue(l.modelMapper(c,t)),u.$render()},s.bind("keydown",function(e){if(c.matches.length===0||r.indexOf(e.which)===-1)return;e.preventDefault(),e.which===40?(c.activeIdx=(c.activeIdx+1)%c.matches.length,c.$digest()):e.which===38?(c.activeIdx=(c.activeIdx?c.activeIdx:c.matches.length)-1,c.$digest()):e.which===13||e.which===9?c.$apply(function(){c.select(c.activeIdx)}):e.which===27&&(c.matches=[],c.$digest())});var d=e("")(c);s.after(d)}}}]).directive("typeaheadPopup",function(){return{restrict:"E",scope:{matches:"=",query:"=",active:"=",select:"&"},replace:!0,templateUrl:"template/typeahead/typeahead.html",link:function(e,t,n){e.isOpen=function(){return e.matches.length>0},e.isActive=function(t){return e.active==t},e.selectActive=function(t){e.active=t},e.selectMatch=function(t){e.select({activeIdx:t})}}}}).filter("typeaheadHighlight",function(){return function(e,t){return t?e.replace(new RegExp(t,"gi"),"$&"):t}}),angular.module("template/accordion/accordion-group.html",[]).run(["$templateCache",function(e){e.put("template/accordion/accordion-group.html",'')}]),angular.module("template/accordion/accordion.html",[]).run(["$templateCache",function(e){e.put("template/accordion/accordion.html",'')}]),angular.module("template/alert/alert.html",[]).run(["$templateCache",function(e){e.put("template/alert/alert.html","")}]),angular.module("template/carousel/carousel.html",[]).run(["$templateCache",function(e){e.put("template/carousel/carousel.html",'')}]),angular.module("template/carousel/slide.html",[]).run(["$templateCache",function(e){e.put("template/carousel/slide.html","")}]),angular.module("template/dialog/message.html",[]).run(["$templateCache",function(e){e.put("template/dialog/message.html",'')}]),angular.module("template/pagination/pagination.html",[]).run(["$templateCache",function(e){e.put("template/pagination/pagination.html",'')}]),angular.module("template/popover/popover.html",[]).run(["$templateCache",function(e){e.put("template/popover/popover.html",'')}]),angular.module("template/tabs/pane.html",[]).run(["$templateCache",function(e){e.put("template/tabs/pane.html",'')}]),angular.module("template/tabs/tabs.html",[]).run(["$templateCache",function(e){e.put("template/tabs/tabs.html",'')}]),angular.module("template/tooltip/tooltip-popup.html",[]).run(["$templateCache",function(e){e.put("template/tooltip/tooltip-popup.html",'')}]),angular.module("template/typeahead/typeahead.html",[]).run(["$templateCache",function(e){e.put("template/typeahead/typeahead.html",'
')}]);
\ No newline at end of file
diff --git a/src/main/java/com/commafeed/frontend/references/bootstrap/BootstrapReference.java b/src/main/java/com/commafeed/frontend/references/bootstrap/BootstrapReference.java
new file mode 100644
index 00000000..f5bf5a0e
--- /dev/null
+++ b/src/main/java/com/commafeed/frontend/references/bootstrap/BootstrapReference.java
@@ -0,0 +1,41 @@
+package com.commafeed.frontend.references.bootstrap;
+
+import java.util.Arrays;
+
+import org.apache.wicket.markup.head.CssHeaderItem;
+import org.apache.wicket.markup.head.HeaderItem;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.head.JavaScriptHeaderItem;
+import org.apache.wicket.request.Url;
+import org.apache.wicket.request.resource.UrlResourceReference;
+
+import com.commafeed.frontend.references.jquery.JQueryReference;
+
+public class BootstrapReference extends UrlResourceReference {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final BootstrapReference INSTANCE = new BootstrapReference();
+
+ public BootstrapReference() {
+ super(
+ Url.parse("https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js"));
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Iterable extends HeaderItem> getDependencies() {
+ return Arrays
+ .asList(JavaScriptHeaderItem
+ .forReference(JQueryReference.INSTANCE),
+ CssHeaderItem.forReference(new UrlResourceReference(
+ Url.parse("https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css"))),
+ CssHeaderItem.forReference(new UrlResourceReference(
+ Url.parse("https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-responsive.min.css"))));
+ }
+
+ public static void renderHead(final IHeaderResponse response) {
+ response.render(JavaScriptHeaderItem.forReference(INSTANCE));
+ }
+
+}
diff --git a/src/main/java/com/commafeed/frontend/references/codemirror/CodeMirrorCssReference.java b/src/main/java/com/commafeed/frontend/references/codemirror/CodeMirrorCssReference.java
index 03d45ac1..9357e8fd 100644
--- a/src/main/java/com/commafeed/frontend/references/codemirror/CodeMirrorCssReference.java
+++ b/src/main/java/com/commafeed/frontend/references/codemirror/CodeMirrorCssReference.java
@@ -5,16 +5,17 @@ import java.util.Arrays;
import org.apache.wicket.markup.head.HeaderItem;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.head.JavaScriptHeaderItem;
+import org.apache.wicket.request.Url;
+import org.apache.wicket.request.resource.UrlResourceReference;
-import de.agilecoders.wicket.webjars.request.resource.WebjarsJavaScriptResourceReference;
-
-public class CodeMirrorCssReference extends WebjarsJavaScriptResourceReference {
+public class CodeMirrorCssReference extends UrlResourceReference {
private static final long serialVersionUID = 1L;
public static final CodeMirrorCssReference INSTANCE = new CodeMirrorCssReference();
private CodeMirrorCssReference() {
- super("/codemirror/current/mode/css/css.js");
+ super(
+ Url.parse("https://cdnjs.cloudflare.com/ajax/libs/codemirror/2.36.0/css.js"));
}
@Override
diff --git a/src/main/java/com/commafeed/frontend/references/codemirror/CodeMirrorReference.java b/src/main/java/com/commafeed/frontend/references/codemirror/CodeMirrorReference.java
index 1cc1cd1d..0a96427b 100644
--- a/src/main/java/com/commafeed/frontend/references/codemirror/CodeMirrorReference.java
+++ b/src/main/java/com/commafeed/frontend/references/codemirror/CodeMirrorReference.java
@@ -2,28 +2,28 @@ package com.commafeed.frontend.references.codemirror;
import java.util.Arrays;
+import org.apache.wicket.markup.head.CssHeaderItem;
import org.apache.wicket.markup.head.HeaderItem;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.head.JavaScriptHeaderItem;
+import org.apache.wicket.request.Url;
+import org.apache.wicket.request.resource.UrlResourceReference;
-import com.commafeed.frontend.utils.WicketUtils;
-
-import de.agilecoders.wicket.webjars.request.resource.WebjarsJavaScriptResourceReference;
-
-public class CodeMirrorReference extends WebjarsJavaScriptResourceReference {
+public class CodeMirrorReference extends UrlResourceReference {
private static final long serialVersionUID = 1L;
public static final CodeMirrorReference INSTANCE = new CodeMirrorReference();
private CodeMirrorReference() {
- super("/codemirror/current/lib/codemirror.js");
+ super(
+ Url.parse("https://cdnjs.cloudflare.com/ajax/libs/codemirror/2.36.0/codemirror.min.js"));
}
@Override
public Iterable extends HeaderItem> getDependencies() {
return Arrays
- .asList(WicketUtils
- .buildCssWebJarHeaderItem("/codemirror/current/lib/codemirror.css"));
+ .asList(CssHeaderItem.forReference(new UrlResourceReference(
+ Url.parse("https://cdnjs.cloudflare.com/ajax/libs/codemirror/2.36.0/codemirror.min.css"))));
}
public static void renderHead(final IHeaderResponse response) {
diff --git a/src/main/java/com/commafeed/frontend/references/jquery/JQueryReference.java b/src/main/java/com/commafeed/frontend/references/jquery/JQueryReference.java
new file mode 100644
index 00000000..9cda81eb
--- /dev/null
+++ b/src/main/java/com/commafeed/frontend/references/jquery/JQueryReference.java
@@ -0,0 +1,22 @@
+package com.commafeed.frontend.references.jquery;
+
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.head.JavaScriptHeaderItem;
+import org.apache.wicket.request.Url;
+import org.apache.wicket.request.resource.UrlResourceReference;
+
+public class JQueryReference extends UrlResourceReference {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final JQueryReference INSTANCE = new JQueryReference();
+
+ public JQueryReference() {
+ super(
+ Url.parse("https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"));
+ }
+
+ public static void renderHead(final IHeaderResponse response) {
+ response.render(JavaScriptHeaderItem.forReference(INSTANCE));
+ }
+}
diff --git a/src/main/java/com/commafeed/frontend/references/mousetrap/MouseTrapReference.java b/src/main/java/com/commafeed/frontend/references/mousetrap/MouseTrapReference.java
index 9c154a55..6d7159c8 100644
--- a/src/main/java/com/commafeed/frontend/references/mousetrap/MouseTrapReference.java
+++ b/src/main/java/com/commafeed/frontend/references/mousetrap/MouseTrapReference.java
@@ -2,16 +2,17 @@ package com.commafeed.frontend.references.mousetrap;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.head.JavaScriptHeaderItem;
+import org.apache.wicket.request.Url;
+import org.apache.wicket.request.resource.UrlResourceReference;
-import de.agilecoders.wicket.webjars.request.resource.WebjarsJavaScriptResourceReference;
-
-public class MouseTrapReference extends WebjarsJavaScriptResourceReference {
+public class MouseTrapReference extends UrlResourceReference {
private static final long serialVersionUID = 1L;
public static final MouseTrapReference INSTANCE = new MouseTrapReference();
private MouseTrapReference() {
- super("/mousetrap/current/mousetrap.js");
+ super(
+ Url.parse("https://cdnjs.cloudflare.com/ajax/libs/mousetrap/1.2.2/mousetrap.min.js"));
}
public static void renderHead(final IHeaderResponse response) {
diff --git a/src/main/java/com/commafeed/frontend/references/select2/Select2Reference.java b/src/main/java/com/commafeed/frontend/references/select2/Select2Reference.java
deleted file mode 100644
index 424c83d2..00000000
--- a/src/main/java/com/commafeed/frontend/references/select2/Select2Reference.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.commafeed.frontend.references.select2;
-
-import java.util.Arrays;
-
-import org.apache.wicket.markup.head.HeaderItem;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.JavaScriptHeaderItem;
-
-import com.commafeed.frontend.utils.WicketUtils;
-
-import de.agilecoders.wicket.webjars.request.resource.WebjarsJavaScriptResourceReference;
-
-public class Select2Reference extends WebjarsJavaScriptResourceReference {
- private static final long serialVersionUID = 1L;
-
- public static final Select2Reference INSTANCE = new Select2Reference();
-
- private Select2Reference() {
- super("/select2/current/select2.js");
- }
-
- @Override
- public Iterable extends HeaderItem> getDependencies() {
- return Arrays.asList(WicketUtils
- .buildCssWebJarHeaderItem("/select2/current/select2.css"));
- }
-
- public static void renderHead(final IHeaderResponse response) {
- response.render(JavaScriptHeaderItem.forReference(INSTANCE));
- }
-}
\ No newline at end of file
diff --git a/src/main/java/com/commafeed/frontend/references/spinjs/SpinJSReference.java b/src/main/java/com/commafeed/frontend/references/spinjs/SpinJSReference.java
index d6627a6b..bab8fd29 100644
--- a/src/main/java/com/commafeed/frontend/references/spinjs/SpinJSReference.java
+++ b/src/main/java/com/commafeed/frontend/references/spinjs/SpinJSReference.java
@@ -2,16 +2,17 @@ package com.commafeed.frontend.references.spinjs;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.head.JavaScriptHeaderItem;
+import org.apache.wicket.request.Url;
+import org.apache.wicket.request.resource.UrlResourceReference;
-import de.agilecoders.wicket.webjars.request.resource.WebjarsJavaScriptResourceReference;
-
-public class SpinJSReference extends WebjarsJavaScriptResourceReference {
+public class SpinJSReference extends UrlResourceReference {
private static final long serialVersionUID = 1L;
public static final SpinJSReference INSTANCE = new SpinJSReference();
private SpinJSReference() {
- super("/spin-js/current/spin.js");
+ super(
+ Url.parse("https://cdnjs.cloudflare.com/ajax/libs/spin.js/1.2.7/spin.min.js"));
}
public static void renderHead(final IHeaderResponse response) {
diff --git a/src/main/java/com/commafeed/frontend/utils/WicketUtils.java b/src/main/java/com/commafeed/frontend/utils/WicketUtils.java
index 48488392..535199a9 100644
--- a/src/main/java/com/commafeed/frontend/utils/WicketUtils.java
+++ b/src/main/java/com/commafeed/frontend/utils/WicketUtils.java
@@ -18,9 +18,6 @@ import org.apache.wicket.request.resource.JavaScriptResourceReference;
import org.apache.wicket.util.io.IOUtils;
import org.apache.wicket.util.template.PackageTextTemplate;
-import de.agilecoders.wicket.webjars.request.resource.WebjarsCssResourceReference;
-import de.agilecoders.wicket.webjars.request.resource.WebjarsJavaScriptResourceReference;
-
public class WicketUtils {
public static void loadJQuery(IHeaderResponse response) {
@@ -34,12 +31,6 @@ public class WicketUtils {
.getSimpleName() + ".js"));
}
- public static JavaScriptHeaderItem buildJavaScriptWebJarHeaderItem(
- String name) {
- return JavaScriptHeaderItem
- .forReference(new WebjarsJavaScriptResourceReference(name));
- }
-
public static void loadJS(IHeaderResponse response, Class> klass) {
response.render(buildJavaScriptHeaderItem(klass));
}
@@ -59,20 +50,11 @@ public class WicketUtils {
response.render(result);
}
- public static void loadWebJarJS(IHeaderResponse response, String name) {
- response.render(buildJavaScriptWebJarHeaderItem(name));
- }
-
public static CssHeaderItem buildCssHeaderItem(Class> klass) {
return CssHeaderItem.forReference(new CssResourceReference(klass, klass
.getSimpleName() + ".css"));
}
- public static CssHeaderItem buildCssWebJarHeaderItem(String name) {
- return CssHeaderItem
- .forReference(new WebjarsCssResourceReference(name));
- }
-
public static void loadCSS(IHeaderResponse response, Class> klass) {
response.render(buildCssHeaderItem(klass));
}
@@ -92,10 +74,6 @@ public class WicketUtils {
response.render(result);
}
- public static void loadWebJarCSS(IHeaderResponse response, String name) {
- response.render(buildCssWebJarHeaderItem(name));
- }
-
public static HttpServletRequest getHttpServletRequest() {
ServletWebRequest servletWebRequest = (ServletWebRequest) RequestCycle
.get().getRequest();
diff --git a/src/main/java/com/commafeed/frontend/utils/exception/DisplayExceptionPage.java b/src/main/java/com/commafeed/frontend/utils/exception/DisplayExceptionPage.java
index 716f4d1d..76ab7655 100644
--- a/src/main/java/com/commafeed/frontend/utils/exception/DisplayExceptionPage.java
+++ b/src/main/java/com/commafeed/frontend/utils/exception/DisplayExceptionPage.java
@@ -8,7 +8,7 @@ import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import de.agilecoders.wicket.Bootstrap;
+import com.commafeed.frontend.references.bootstrap.BootstrapReference;
public class DisplayExceptionPage extends WebPage {
@@ -41,7 +41,7 @@ public class DisplayExceptionPage extends WebPage {
@Override
public void renderHead(IHeaderResponse response) {
- Bootstrap.renderHead(response);
+ BootstrapReference.renderHead(response);
}
}
diff --git a/src/main/webapp/css/app.css b/src/main/webapp/css/app.css
index b44fb12b..1101fbba 100644
--- a/src/main/webapp/css/app.css
+++ b/src/main/webapp/css/app.css
@@ -1,3 +1,9 @@
+@import url(http://weloveiconfonts.com/api/?family=openwebicons);
+
+[class*="openwebicons-"]:before {
+ font-family: 'OpenWeb Icons', sans-serif;
+}
+
.pointer {
cursor: pointer;
}
diff --git a/src/main/webapp/templates/_subscribe.html b/src/main/webapp/templates/_subscribe.html
index decb6c3b..8deb5035 100644
--- a/src/main/webapp/templates/_subscribe.html
+++ b/src/main/webapp/templates/_subscribe.html
@@ -1,6 +1,6 @@