From c081bd0a7db3f434e76c03a9ca0334539ee84470 Mon Sep 17 00:00:00 2001 From: "Christopher Lott (cl778h)" Date: Thu, 11 May 2017 09:38:56 -0400 Subject: [PORTAL-7] Features and repairs from 1707 This merges latest changes made to Raptor and other features. Change-Id: I3a58f88e988ddadf52e1c0c782cdccd2b2ecf5e9 Signed-off-by: Christopher Lott (cl778h) --- .../static/fusion/raptor/ebz/date_time_picker.js | 277 --------------------- 1 file changed, 277 deletions(-) delete mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/static/fusion/raptor/ebz/date_time_picker.js (limited to 'ecomp-sdk/epsdk-app-overlay/src/main/webapp/static') diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/static/fusion/raptor/ebz/date_time_picker.js b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/static/fusion/raptor/ebz/date_time_picker.js deleted file mode 100644 index ae69a913..00000000 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/static/fusion/raptor/ebz/date_time_picker.js +++ /dev/null @@ -1,277 +0,0 @@ - String.prototype.paddingLeft = function (paddingValue) { - return String(paddingValue + this).slice(-paddingValue.length); - }; - -angular.module("app/scripts/ng_js_att_tpls/datepicker/dateTimePickerPopup.html", []).run(["$templateCache", function($templateCache) { - $templateCache.put("app/scripts/ng_js_att_tpls/datepicker/dateTimePickerPopup.html", - "
\n" + - "
\n" + - " \n" + - - " \n" + - "
\n" + - - '
' - + '
' - - + '
    ' - + '
  • ' - + 'Date' - + '
  • ' - + '
  • ' - + 'Time' - + '
  • ' - + '
' - - + '
' - + '
' - +'
' - +'
' - + '
{{displayMonth}} {{year}}
' - + '
' - + '
' - + '
{{day | limitTo: 1}}
' - + '
{{d}}
' - + '
{{d}}
' - + '
{{d}}
' - + '
' - + '
' - - + '
' - + '
' - + '
{{hour}}:{{minute}}
' - + '
' - + '
' - + '
AM
' - + '
PM
' - + '
' - + '
' - + '
{{time}}
' - + '
' - + '
' - + '
{{time}}
' - + '
' - + '
' - + '
' - - + '
' - + '
' + - - "
\n" + - ""); -}]); - -angular.module('quantum').requires.push("app/scripts/ng_js_att_tpls/datepicker/dateTimePickerPopup.html"); - -angular.module('quantum') -.directive('dateTimePickerPopup', ['$document', 'datepickerService', '$isElement', '$documentBind', function($document, datepickerService, $isElement, $documentBind) { - var link = function (scope, elem, attr) { - datepickerService.bindScope(attr, scope); - - scope.isOpen = false; - - var toggle = scope.toggle = function (show) { - if(show === true || show === false) { - scope.isOpen = show; - } else { - scope.isOpen = !scope.isOpen; - } - }; - -// scope.$watch('current', function () { -// toggle(false); -// }); - - var outsideClick = function (e) { - var isElement = $isElement(angular.element(e.target), elem, $document); - if(!isElement) { - toggle(false); - scope.$apply(); - } - }; - - $documentBind.click('isOpen', outsideClick, scope); - - scope.tabs = [{ - title: 'DATE', - url: '#option1' - }, { - title: 'TIME', - url: '#option2', - selected: true - } - ]; - - //-------------------------------------- - - scope.state = false; - scope.tab = 'time'; - scope.setTab = function(tab){ - scope.tab = tab; - }; - scope.config = { - modal: true, - color:'rgba(5, 116, 172, 1)', - backgroundColor: 'rgba(0,0,0,0.75)' - }; - scope.months = ["January","February","March","April","May","June","July","Augusta","September","October","November","December"]; - scope.dayNames = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]; - scope.$watch('current',function(value){ - var m; - if(value) - m = moment(value); - else - m = moment(); - m = m.minute(5*Math.ceil(m.minute()/5)); - scope.display = m.format('YYYY-MM-DD hh:mm A'); - scope.days = scope.getDaysInMonth(m.year(),m.month()); - scope.minute = m.minute(); - scope.meridian = m.format('A'); - scope.hour = scope.meridian == 'PM' ? m.hour() - 12: m.hour(); - if(scope.hour==0) scope.hour = 12; - scope.datePreview = m.format('YYYY-MM-DD'); - scope.timePreview = m.format('hh:mm A'); - scope.displayMonth = scope.months[m.month()]; - scope.day = m.date(); - scope.year = m.year(); - - }); - - scope.setDay = function(date){ - scope.current = moment(scope.current).date(date).toDate(); - }; - - scope.setState = function(state){ - scope.state = false; - }; - - scope.setHour = function(hour){ - if(scope.meridian == 'PM' && hour < 12) - hour = hour + 12; - if(scope.meridian == 'AM' && hour == 12) - hour = hour - 12; - scope.current = moment(scope.current).hour(hour).toDate(); - }; - - scope.setMeridian = function(meridian){ - var m = moment(scope.current); - - if(meridian == 'AM'){ - if(m.hours()>=12){ - m = m.add(-12,'hours'); - scope.current = m.toDate(); - } - }else{ - if(m.hours()<12){ - m = m.add(12,'hours'); - scope.current = m.toDate(); - } - } - }; - - scope.setMinutes = function(minutes){ - scope.current = moment(scope.current).minute(minutes).toDate(); - }; - - var days = []; - for(var i=1;i<=31;i++){ - days.push(i); - } - scope.getDaysInMonth = function(year,month){ - var firstDayOfWeek = 0; - var firstDayOfMonth = new Date(year, month, 1), - lastDayOfMonth = new Date(year, month + 1, 0), - lastDayOfPreviousMonth = new Date(year, month, 0), - daysInMonth = lastDayOfMonth.getDate(), - daysInLastMonth = lastDayOfPreviousMonth.getDate(), - dayOfWeek = firstDayOfMonth.getDay(), - leadingDays = (dayOfWeek - firstDayOfWeek + 7) % 7 || 7, - trailingDays = days.slice(0, 6 * 7 - (leadingDays + daysInMonth)); - if (trailingDays.length > 7) { - trailingDays = trailingDays.slice(0, trailingDays.length-7); - } - - return { - year: year, - month: month, - days: days.slice(0, daysInMonth), - leadingDays: days.slice(- leadingDays - (31 - daysInLastMonth), daysInLastMonth), - trailingDays: trailingDays - }; - }; - - scope.addMonth = function(increment){ - scope.current = moment(scope.current).add(increment,'months').toDate(); - }; - - }; - - return { - restrict: 'EA', - replace: true, - transclude: true, - templateUrl: 'app/scripts/ng_js_att_tpls/datepicker/dateTimePickerPopup.html', - scope: { - current: "=current" - }, - compile: function (elem, attr) { - var wrapperElement = elem.find('span').eq(1); - wrapperElement.attr('current', 'current'); - datepickerService.setAttributes(attr, wrapperElement); - - return link; - } - }; -}]) -.directive('attDateTimePicker', ['$log', function($log) { - return { - restrict: 'A', - require: 'ngModel', - scope: {}, - controller: ['$scope', '$element', '$attrs', '$compile', 'datepickerConfig', 'datepickerService', function($scope, $element, $attrs, $compile, datepickerConfig, datepickerService) { - var dateFormatString = angular.isDefined($attrs.dateFormat) ? $scope.$parent.$eval($attrs.dateFormat) : datepickerConfig.dateFormat; - var selectedDateMessage = '
the date you selected is {{$parent.current | date : \'' + dateFormatString + '\'}}
'; - - $element.removeAttr('att-date-time-picker'); - $element.removeAttr('ng-model'); - $element.attr('ng-model', '$parent.current'); - $element.attr('aria-describedby', 'datepicker'); - $element.attr('format-date', dateFormatString); - $element.attr('att-input-deny', '[^0-9ampAMP \/:-]'); - $element.attr('maxlength', 20); - - var wrapperElement = angular.element('
'); - wrapperElement.attr('date-time-picker-popup', ''); - wrapperElement.attr('current', 'current'); - - datepickerService.setAttributes($attrs, wrapperElement); - datepickerService.bindScope($attrs, $scope); - - wrapperElement.html(''); - wrapperElement.append($element.prop('outerHTML')); - if (navigator.userAgent.match(/MSIE 8/) === null) { - wrapperElement.append(selectedDateMessage); - } - var elm = wrapperElement.prop('outerHTML'); - - elm = $compile(elm)($scope); - $element.replaceWith(elm); - }], - link: function(scope, elem, attr, ctrl) { - if (!ctrl) { - // do nothing if no ng-model - $log.error("ng-model is required."); - return; - } - - scope.$watch('current', function(value) { - ctrl.$setViewValue(value); - }); - ctrl.$render = function() { - scope.current = ctrl.$viewValue; - }; - } - }; -}]); - - -- cgit 1.2.3-korg