Sha256: 77610a0c19bb883989807923f6c1dfaf746d79f31d8b4ffb5933354c56ff35d8
Contents?: true
Size: 1.93 KB
Versions: 23
Compression:
Stored size: 1.93 KB
Contents
I"ª(function() { this.app.controller('AssetFieldCtrl', [ '$scope', '$http', function($scope, $http) { $scope.$modal = null; $scope.assets = []; $scope.meta = {}; $scope.loadAssets = function(page) { var config, req; config = page != null ? { params: { page: page } } : null; req = $http.get($scope.assetsPath, config); return req.success(function(data) { $scope.assets = data.assets; $scope.meta = data.meta; if ($scope.hasAssets()) { return $scope.initPagination(); } }); }; $scope.hasAssets = function() { return $scope.assets.length; }; $scope.selectAsset = function(asset) { $scope.asset = asset; $scope.$modal.foundation('reveal', 'close'); return true; }; $scope.deselectAsset = function() { return $scope.asset = null; }; return $scope.afterUpload = function(asset) { $scope.loadAssets(); $scope.$modal.find('.tab-title a[data-success]').trigger('click'); return true; }; } ]); this.app.directive('paginateAssets', function() { return function($scope, $el, $attrs) { return $scope.initPagination = function() { return $el.pagination({ pages: $scope.meta.total_pages, currentPage: $scope.meta.current_page, hrefTextPrefix: '#/media/page-', onPageClick: function(page, e) { e.preventDefault(); return $scope.loadAssets(page); } }); }; }; }); $(document).on('ready page:load', function() { return $(document).on('open.fndtn.reveal', '.asset-field-modal', function() { var $scope; $scope = angular.element($(this)).scope(); $scope.$modal = $(this); $scope.loadAssets(); return $scope.$apply(); }); }); }).call(this); :ET
Version data entries
23 entries across 21 versions & 3 rubygems