Sha256: 7cdf244f4ca7cff3c16740e72d12ba990f4c7a86dbddffb254de9c33fe74ab15

Contents?: true

Size: 1.97 KB

Versions: 12

Compression:

Stored size: 1.97 KB

Contents

I"Ô(function() {
  this.app.controller('AssetFieldCtrl', [
    '$scope', '$http', function($scope, $http) {
      $scope.$modal = null;
      $scope.assets = [];
      $scope.meta = {};
      $scope.uid = 'asset-' + Math.uid();
      $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

12 entries across 12 versions & 2 rubygems

Version Path
push_type_auth-0.7.0 test/dummy/tmp/cache/assets/test/sprockets/v3.0/n_dxARDjsj8WC0p-7BSAJ7dWqGc6Tfg3e3Esbb7IwP8.cache
push_type_admin-0.7.0 test/dummy/tmp/cache/assets/test/sprockets/v3.0/n_dxARDjsj8WC0p-7BSAJ7dWqGc6Tfg3e3Esbb7IwP8.cache
push_type_auth-0.7.0.beta.1 test/dummy/tmp/cache/assets/test/sprockets/v3.0/RZ7U3cmHsXIKt6ekhKZP6Pw8KEtCwk7Hy9HViUWfQj0.cache
push_type_admin-0.7.0.beta.1 test/dummy/tmp/cache/assets/test/sprockets/v3.0/RZ7U3cmHsXIKt6ekhKZP6Pw8KEtCwk7Hy9HViUWfQj0.cache
push_type_auth-0.6.0 test/dummy/tmp/cache/assets/test/sprockets/v3.0/RZ7U3cmHsXIKt6ekhKZP6Pw8KEtCwk7Hy9HViUWfQj0.cache
push_type_admin-0.6.0 test/dummy/tmp/cache/assets/test/sprockets/v3.0/RZ7U3cmHsXIKt6ekhKZP6Pw8KEtCwk7Hy9HViUWfQj0.cache
push_type_auth-0.6.0.beta.4 test/dummy/tmp/cache/assets/test/sprockets/v3.0/RZ7U3cmHsXIKt6ekhKZP6Pw8KEtCwk7Hy9HViUWfQj0.cache
push_type_admin-0.6.0.beta.4 test/dummy/tmp/cache/assets/test/sprockets/v3.0/RZ7U3cmHsXIKt6ekhKZP6Pw8KEtCwk7Hy9HViUWfQj0.cache
push_type_auth-0.6.0.beta.3 test/dummy/tmp/cache/assets/test/sprockets/v3.0/RZ7U3cmHsXIKt6ekhKZP6Pw8KEtCwk7Hy9HViUWfQj0.cache
push_type_admin-0.6.0.beta.3 test/dummy/tmp/cache/assets/test/sprockets/v3.0/RZ7U3cmHsXIKt6ekhKZP6Pw8KEtCwk7Hy9HViUWfQj0.cache
push_type_auth-0.6.0.beta.2 test/dummy/tmp/cache/assets/test/sprockets/v3.0/RZ7U3cmHsXIKt6ekhKZP6Pw8KEtCwk7Hy9HViUWfQj0.cache
push_type_admin-0.6.0.beta.2 test/dummy/tmp/cache/assets/test/sprockets/v3.0/RZ7U3cmHsXIKt6ekhKZP6Pw8KEtCwk7Hy9HViUWfQj0.cache