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

Version Path
push_type_wysiwyg-0.6.0.beta.1 test/dummy/tmp/cache/assets/development/sprockets/v3.0/WzG6jRDGbAJ41fKtKf8Rmip8oknkkLAfWgvOd0kkgjY.cache
push_type_auth-0.6.0.beta.1 test/dummy/tmp/cache/assets/test/sprockets/v3.0/WzG6jRDGbAJ41fKtKf8Rmip8oknkkLAfWgvOd0kkgjY.cache
push_type_admin-0.6.0.beta.1 test/dummy/tmp/cache/assets/test/sprockets/v3.0/WzG6jRDGbAJ41fKtKf8Rmip8oknkkLAfWgvOd0kkgjY.cache
push_type_auth-0.5.3 test/dummy/tmp/cache/assets/test/sprockets/v3.0/WzG6jRDGbAJ41fKtKf8Rmip8oknkkLAfWgvOd0kkgjY.cache
push_type_admin-0.5.3 test/dummy/tmp/cache/assets/test/sprockets/v3.0/WzG6jRDGbAJ41fKtKf8Rmip8oknkkLAfWgvOd0kkgjY.cache
push_type_auth-0.5.2 test/dummy/tmp/cache/assets/test/sprockets/v3.0/WzG6jRDGbAJ41fKtKf8Rmip8oknkkLAfWgvOd0kkgjY.cache
push_type_admin-0.5.2 test/dummy/tmp/cache/assets/test/sprockets/v3.0/WzG6jRDGbAJ41fKtKf8Rmip8oknkkLAfWgvOd0kkgjY.cache
push_type_auth-0.5.1 test/dummy/tmp/cache/assets/test/sprockets/v3.0/WzG6jRDGbAJ41fKtKf8Rmip8oknkkLAfWgvOd0kkgjY.cache
push_type_admin-0.5.1 test/dummy/tmp/cache/assets/test/sprockets/v3.0/WzG6jRDGbAJ41fKtKf8Rmip8oknkkLAfWgvOd0kkgjY.cache
push_type_auth-0.5.0 test/dummy/tmp/cache/assets/test/sprockets/v3.0/WzG6jRDGbAJ41fKtKf8Rmip8oknkkLAfWgvOd0kkgjY.cache
push_type_admin-0.5.0 test/dummy/tmp/cache/assets/test/sprockets/v3.0/WzG6jRDGbAJ41fKtKf8Rmip8oknkkLAfWgvOd0kkgjY.cache
push_type_auth-0.5.0.alpha.5 test/dummy/tmp/cache/assets/test/sprockets/v3.0/nXqI9Sny6emC3qybt4jLHHyVuI8MKn9feiXsoGvyM5E.cache
push_type_admin-0.5.0.alpha.5 test/dummy/tmp/cache/assets/test/sprockets/v3.0/nXqI9Sny6emC3qybt4jLHHyVuI8MKn9feiXsoGvyM5E.cache
push_type_auth-0.5.0.alpha.4 test/dummy/tmp/cache/assets/test/sprockets/v3.0/nXqI9Sny6emC3qybt4jLHHyVuI8MKn9feiXsoGvyM5E.cache
push_type_admin-0.5.0.alpha.4 test/dummy/tmp/cache/assets/test/sprockets/v3.0/nXqI9Sny6emC3qybt4jLHHyVuI8MKn9feiXsoGvyM5E.cache
push_type_auth-0.5.0.alpha.3 test/dummy/tmp/cache/assets/test/sprockets/v3.0/nXqI9Sny6emC3qybt4jLHHyVuI8MKn9feiXsoGvyM5E.cache
push_type_admin-0.5.0.alpha.3 test/dummy/tmp/cache/assets/test/sprockets/v3.0/nXqI9Sny6emC3qybt4jLHHyVuI8MKn9feiXsoGvyM5E.cache
push_type_auth-0.5.0.alpha.2 test/dummy/tmp/cache/assets/test/sprockets/v3.0/nXqI9Sny6emC3qybt4jLHHyVuI8MKn9feiXsoGvyM5E.cache
push_type_admin-0.5.0.alpha.2 test/dummy/tmp/cache/assets/test/sprockets/v3.0/nXqI9Sny6emC3qybt4jLHHyVuI8MKn9feiXsoGvyM5E.cache
push_type_admin-0.5.0.alpha.2 test/dummy/tmp/cache/assets/development/sprockets/v3.0/nXqI9Sny6emC3qybt4jLHHyVuI8MKn9feiXsoGvyM5E.cache