1angular.module('nefiksApp') 2 .directive('slidingLabel', function($timeout) { 3 return { 4 restrict: 'A', 5 scope: false, 6 link: function($scope, $element, attrs) { 7 var inp = $element.find('input,select').bind('focus', function() { 8 $element.addClass("floating-label-form-group-with-focus"); 9 }).bind('blur', function() { 10 $element.removeClass("floating-label-form-group-with-focus"); 11 var valEntered = !!this.value; 12 $element.toggleClass("floating-label-form-group-with-value", valEntered); 13 }).bind('keyup', function() { 14 var valEntered = !!this.value; 15 $element.toggleClass("floating-label-form-group-with-value", valEntered); 16 }); 17 18 $timeout(function() { 19 if(!!inp.val()) { 20 $element.addClass("floating-label-form-group-with-value"); 21 }; 22 }, 100); 23 } 24 }; 25 }).directive('includeReplace', function () { 26 return { 27 require: 'ngInclude', 28 restrict: 'A', 29 link: function (scope, el, attrs) { 30 el.replaceWith(el.children()); 31 } 32 }; 33 }).directive('alphaNumSort', function () { 34 return { 35 restrict: 'A', 36 scope: { 37 sortData: '=', 38 sortFn: '&' 39 }, 40 controller: function($scope) { 41 $scope.onSortClick = function(by) { 42 if($scope.sortData.by == by) { //Change order 43 $scope.sortData.asc = !$scope.sortData.asc; 44 } else { 45 $scope.sortData.by = by; 46 $scope.sortData.asc = true; 47 } 48 49 if(!!$scope.sortFn) { 50 $scope.sortFn(); 51 } 52 }; 53 }, 54 template: function($element, attrs) { 55 var tmp = ''; 56 var alphaSortVal = attrs.alphaVal || 'alpha'; 57 var numSortVal = attrs.numVal || 'num'; 58 59 tmp += '<div class="sub-header">'; 60 tmp += '<button class="btn btn-alt btn-sm" title="'+(attrs.alphaCaption||'Sort alphabetically')+'" ng-click="onSortClick(\''+alphaSortVal+'\')" ng-class="{\'non-active\':sortData.by!=\''+alphaSortVal+'\'}"><i class="fa" ng-class="{\'fa-sort-alpha-asc\':(sortData.by==\''+alphaSortVal+'\' && !!sortData.asc), \'fa-sort-alpha-desc\':(sortData.by!=\''+alphaSortVal+'\' || (sortData.by==\''+alphaSortVal+'\' && !sortData.asc))}"></i></button>'; 61 tmp += '<button class="btn btn-alt btn-sm" title="'+(attrs.numCaption||'Sort by date')+'" ng-click="onSortClick(\''+numSortVal+'\')" ng-class="{\'non-active\':sortData.by!=\''+numSortVal+'\'}"><i class="icon-calendar " ng-class="{\'\':(sortData.by==\''+numSortVal+'\' && !!sortData.asc), \'\':(sortData.by!=\''+numSortVal+'\' || (sortData.by==\''+numSortVal+'\' && !sortData.asc))}"></i></button>'; 62 tmp += '<div class="clear"></div>'; 63 tmp += '</div>'; 64 65 return tmp; 66 } 67 }; 68 }).directive('dateTitleSort', function () { 69 return { 70 restrict: 'A', 71 scope: { 72 sortBy: '=', 73 sortAsc: '=', 74 sortFn: '&' 75 }, 76 replace: true, 77 controller: function($scope) { 78 $scope.onSortClick = function(by) { 79 var newSortBy = by; 80 var newSortAsc = true; 81 82 if($scope.sortBy == by) { //Change order 83 newSortAsc = !$scope.sortAsc; 84 } 85 86 if(!!$scope.sortFn) { 87 $scope.sortFn({by: newSortBy, asc: newSortAsc}); 88 } 89 }; 90 }, 91 template: function($element, attrs) { 92 var tmp = ''; 93 var dateSortVal = attrs.dateVal || 'date'; 94 var ttlSortVal = attrs.ttlVal || 'ttl'; 95 96 97 tmp += '<div>'; 98 tmp += '<button class="btn btn-link" title="'+(attrs.dateCaption||'Uredi po datumu')+'" ng-click="onSortClick(\''+dateSortVal+'\')" ng-class="{\'active\':sortBy==\''+dateSortVal+'\'}"><i class="glyphicon " ng-class="{\'glyphicon-sort-by-attributes\':(sortBy==\''+d
98ateSortVal+'\' && !!sortAsc), \'glyphicon-sort-by-attributes-alt\':(sortBy!=\''+dateSortVal+'\' || (sortBy==\''+dateSortVal+'\' && !sortAsc))}"></i></button>'; 99 tmp += '<button class="btn btn-link" title="'+(attrs.ttlCaption||'Uredi po naslovu')+'" ng-click="onSortClick(\''+ttlSortVal+'\')" ng-class="{\'active\':sortBy==\''+ttlSortVal+'\'}"><i class="glyphicon " ng-class="{\'glyphicon-sort-by-alphabet\':(sortBy==\''+ttlSortVal+'\' && !!sortAsc), \'glyphicon-sort-by-alphabet-alt\':(sortBy!=\''+ttlSortVal+'\' || (sortBy==\''+ttlSortVal+'\' && !sortAsc))}"></i></button>'; 100 tmp += '</div>'; 101 102 return tmp; 103 } 104 }; 105 }).directive('angDatePicker', function() { 106 return { 107 restrict: 'A', 108 require: 'ngModel', 109 link: function(scope, element, attrs, ctrl) { 110 jQuery(element).datepicker({ 111 dateFormat: 'dd.mm.yy', 112 onSelect: function(date) { 113 ctrl.$setViewValue(date); 114 ctrl.$render(); 115 scope.$apply(); 116 }, 117 beforeShow: function() { 118 setTimeout(function(){ 119 $('.ui-datepicker').css('z-index', 99999999999999); 120 }, 0); 121 } 122 }); 123 } 124 }; 125 }).directive('topExpl', function () { 126 return { 127 restrict: 'A', 128 scope: { 129 msg: '=', 130 full: '=' 131 }, 132 controller: function($scope) { 133 }, 134 template: function($element, attrs) { 135 var tmp = ''; 136 tmp += '<div class="expl nm '+(!!attrs.full?'col-lg-12':'col-lg-8')+'" ng-bind-html="msg">'; 137 tmp += '</div>'; 138 tmp += '<div class="clear"></div>'; 139 140 return tmp; 141 } 142 }; 143 }).filter('newLinesBr', function() { 144 return function (txt) { 145 if(typeof txt === 'undefined' || txt == null) { 146 return ''; 147 } 148 return txt.replace(/\n/g,'<br/>'); 149 }; 150 }).directive('enterEscape', function() { 151 return { 152 restrict: 'A', 153 scope: { 154 onEnter:'&', 155 onEscape:'&' 156 }, 157 controller: function($scope) { 158 }, 159 link: function($scope, $element, attrs, ctrl) { 160 if(!!$scope.onEnter) { 161 $element.bind('keypress', function($event) { 162 if($event.keyCode == 13) { 163 $scope.$apply($scope.onEnter()); 164 $event.preventDefault(); 165 } 166 }); 167 } 168 if(!!$scope.onEscape) { 169 $element.bind('keyup', function($event) { 170 if($event.keyCode == 27) { 171 $scope.$apply($scope.onEscape()); 172 $event.preventDefault(); 173 } 174 }); 175 } 176 } 177 }; 178 }).filter('ppDate', function($filter) { 179 return function (date, frm) { 180 return $filter('date')(date, !!frm?frm:'dd.MM.yyyy'); 181 }; 182 }).filter('durationString', function($filter) { 183 return function (dateStart, dateEnd, parenthesis, onlyEnd) { 184 var tmp = !!parenthesis?'(':''; 185 186 if(!!dateStart && !!dateEnd) { 187 if(!!onlyEnd) { 188 tmp += $filter('ppDate')(dateEnd); 189 } else { 190 tmp += $filter('ppDate')(dateStart) + ' - ' + $filter('ppDate')(dateEnd); 191 } 192 } else if(!!dateStart) { 193 tmp += $filter('ppDate')(dateStart); 194 } else if(!!dateEnd) { 195 tmp += $filter('ppDate')(dateEnd); 196 } else { 197 return ''; 198 } 199 if(!!parenthesis) { 200 tmp += ')'; 201 } 202 203 return tmp; 204 }; 205 }).filter('addressFull' ,function() { 206 return function(user) { 207 var tmp = ''; 208 if(!!user.permanentAddress) { 209 tmp += user.permanentAddress; 210 } 211 if(!!user.permanentAddressPost) { 212 if(tmp.length > 0) { 213 tmp += ', '; 214 } 215 if(!!user.permanentAddressPostNumber) { 216 tmp += user.permanentAddressPostNumber + ' '; 217 } 218 tmp += user.permanentAddressPost; 219 } 220 return tmp.trim(); 221 }; 222 }).directive('focusMe', function($timeout) { 223 return { 224 restrict: 'A', 225 scope: { 226 focusProp: '=', 227 selectAlso: '=', 228 timeout: '=' 229 }, 230 link: function($scope, element, attrs, ctrl) { 231 var _focus = function(el) { 232 el.focus(); 233 if(!!$scope.selectAlso) { 234 el.setSelectionRange(0, el.value.length) 235 }
236 $scope.focusProp = false; 237 }; 238 $scope.$watch('focusProp', function(newValue) { 239 if(newValue == true) { 240 if(!!$scope.timeout) { 241 $timeout(function() { 242 _focus(element[0]); 243 }); 244 } else { 245 _focus(element[0]); 246 } 247 } 248 }); 249 } 250 }; 251 }).directive('stepsDir', function() { 252 return { 253 restrict: 'A', 254 scope: { 255 steps: '=', 256 currentStep: '=', 257 setStepFn: '&' 258 }, 259 templateUrl: 'angular/views/common/stepsDir.html', 260 controller: function($scope) { 261 $scope.Utf8 = Utf8; 262 263 $scope.onStepClick = function(stepNum) { 264 if(stepNum>$scope.currentStep) { //cannot go forward 265 return; 266 } 267 if(!!$scope.setStepFn) { 268 $scope.setStepFn({step: stepNum}); 269 } 270 }; 271 }, 272 link: function($scope, element, attrs, ctrl) { 273 } 274 }; 275 }).directive('stepHeaderDir', function() { 276 return { 277 restrict: 'A', 278 scope: { 279 backFn: '&', 280 nextFn: '&', 281 asDraftFn: '&', 282 steps: '=', 283 currentStep: '=', 284 asFooter: '=' 285 }, 286 replace: true, 287 templateUrl: 'angular/views/common/stepHeaderDir.html', 288 controller: function($scope) { 289 $scope.Utf8 = Utf8; 290 } 291 }; 292 }).filter('trustedHtml', function($sce){ 293 return function(html){ 294 return $sce.trustAsHtml(html) 295 }; 296 }).directive('ckEditor', function() { 297 return { 298 require: '?ngModel', 299 scope: { 300 ckProps: '=' 301 }, 302 link: function($scope, $elm, attr, ngModel) { 303 //Check if already exists 304 var ck = CKEDITOR.instances[$elm[0].name]; 305 if(!!ck) { 306 ck.destroy(true); 307 } 308 var ckConfig = { 309 /* 310 filebrowserBrowseUrl : '/ckfinder/ckfinder.html', 311 filebrowserImageBrowseUrl : '/ckfinder/ckfinder.html?type=Images', 312 filebrowserFlashBrowseUrl : '/ckfinder/ckfinder.html?type=Flash', 313 filebrowserUploadUrl : '/ckfinder/core/connector/java/connector.java?command=QuickUpload&type=Files', 314 filebrowserImageUploadUrl : '/ckfinder/core/connector/java/connector.java?command=QuickUpload&type=Images', 315 filebrowserFlashUploadUrl : '/ckfinder/core/connector/java/connector.java?command=QuickUpload&type=Flash', 316 filebrowserWindowWidth : '700', 317 filebrowserWindowHeight : '500' 318 */ 319 }; 320 if(!!$scope.ckProps) { 321 for(var key in $scope.ckProps) { 322 ckConfig[key] = $scope.ckProps[key]; 323 } 324 } 325 326 ck = CKEDITOR.replace($elm[0], ckConfig); 327 328 if (!ngModel) return; 329 330 ck.on('instanceReady', function() { 331 ck.setData(ngModel.$viewValue); 332 }); 333 334 function updateModel() { 335 $scope.$apply(function() { 336 ngModel.$setViewValue(ck.getData()); 337 }); 338 }; 339 340 ck.on('change', updateModel); 341 ck.on('dataReady', updateModel); 342 ck.on('key', updateModel); 343 ck.on('paste', updateModel); 344 ck.on('selectionChange', updateModel); 345 346 ngModel.$render = function(value) { 347 ck.setData(ngModel.$viewValue); 348 }; 349 } 350 }; 351 });
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.