Advertisement
Guest User

Untitled

a guest
May 6th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.76 KB | None | 0 0
  1. (function() {
  2. 'use strict';
  3.  
  4. angular
  5. .module('talents')
  6. .controller('MyController', MyController);
  7.  
  8. MyController.$inject = ['UsersService'];
  9.  
  10. function MyController(UsersService) {
  11. var vm = this;
  12.  
  13. vm.talents = [];
  14. vm.loadTalents = loadTalents;
  15. vm.query = {
  16. query: ''
  17. };
  18.  
  19. // SCOPE FUNCTIONS
  20. function loadTalents() {
  21. var query = {
  22. limit: 5,
  23. offset: vm.currentOffset
  24. };
  25.  
  26. UsersService.get(query).$promise.then(
  27. _successResponseHandle
  28. );
  29. }
  30.  
  31. function nextPage() {
  32. loadTalents();
  33. }
  34.  
  35. // PRIVATE FUNCTIONS
  36. function _successResponseHandle(response) {
  37. if (vm.talents.length === 0) {
  38. vm.talents = response.docs;
  39. } else {
  40. vm.currentOffset += 1;
  41. var newItems = response.docs;
  42. vm.talents = vm.talents.concat(newItems);
  43. }
  44. }
  45.  
  46. function activate() {
  47. vm.currentOffset = 1;
  48. }
  49.  
  50. activate();
  51. }
  52. }());
  53.  
  54. (function() {
  55. 'use strict';
  56. /**
  57. * Cube Portfolio Fullwidth Directive
  58. */
  59. angular.module('core')
  60. .directive('fullPageGallery', fullPageGallery);
  61.  
  62. fullPageGallery.$inject = ['$timeout'];
  63.  
  64. function fullPageGallery($timeout) {
  65. var directive = {
  66. retrict: 'EA',
  67. link: link,
  68. transclude: false,
  69. scope: { data: '=' },
  70. templateUrl: 'modules/talents/client/views/tpl/gallery.full.html'
  71. };
  72.  
  73. return directive;
  74.  
  75. function link(scope, element, attrs) {
  76. var options = {
  77. filters: '#filters-container',
  78. loadMore: '#loadMore-container',
  79. loadMoreAction: 'click',
  80. layoutMode: 'grid',
  81. defaultFilter: '*',
  82. animationType: 'fadeOutTop',
  83. gapHorizontal: 0,
  84. gapVertical: 0,
  85. gridAdjustment: 'responsive',
  86. mediaQueries: [{
  87. width: 1600,
  88. cols: 5
  89. }, {
  90. width: 1200,
  91. cols: 4
  92. }, {
  93. width: 800,
  94. cols: 3
  95. }, {
  96. width: 500,
  97. cols: 2
  98. }, {
  99. width: 320,
  100. cols: 1
  101. }],
  102. caption: 'zoom',
  103. displayType: 'lazyLoading',
  104. displayTypeSpeed: 100,
  105.  
  106. // lightbox
  107. lightboxDelegate: '.cbp-lightbox',
  108. lightboxGallery: true,
  109. lightboxTitleSrc: 'data-title',
  110. lightboxCounter: '<div class="cbp-popup-lightbox-counter">{{current}} of {{total}}</div>',
  111. singlePageCallback: function(url, element) {
  112. console.log(scope.data);
  113. var t = this;
  114.  
  115. t.updateSinglePage(scope.data);
  116. }
  117. };
  118. var e = angular.element(document.querySelector('#grid-container'));
  119. $timeout(function() {
  120. e.cubeportfolio(options);
  121. }, 3000);
  122. }
  123. }
  124. }());
  125.  
  126. <div class="c-content-box c-size-md" ng-init="vm.loadTalents()" >
  127. <div id="grid-container" class="cbp" data="vm.talents" full-page-gallery>
  128.  
  129. </div>
  130. <div id="loadMore-container" class="cbp-l-loadMore-text">
  131. <button ng-model="vm.currentOffset" ng-click="vm.loadTalents()" class="btn btn-danger c-btn-square c-btn-border-2x c-btn-bold c-btn-uppercase cbp-singlePageInline">
  132. <span class="cbp-l-loadMore-defaultText">LOAD MORE</span>
  133. <span class="cbp-l-loadMore-loadingText">LOADING...</span>
  134. <span class="cbp-l-loadMore-noMoreLoading">NO MORE WORKS</span>
  135. </button>
  136. </div>
  137. </div>
  138.  
  139. <div class="cbp-item" ng-repeat="d in data">
  140. <a href="{{d.profileImageURL}}" class="cbp-caption cbp-lightbox">
  141. <div class="cbp-caption-defaultWrap c-d-i-container">
  142. <img src="{{d.profileImageURL}}" alt="">
  143. </div>
  144. <div class="cbp-caption-activeWrap">
  145. <div class="cbp-l-caption-alignLeft">
  146. <div class="cbp-l-caption-body">
  147. <div class="cbp-l-caption-title">{{d.displayName}}</div>
  148. </div>
  149. </div>
  150. </div>
  151. </a>
  152. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement