<commit_before>angular.module("productPage", [
    'resources.users',
    'resources.products',
    'resources.embedly',
    'profileAward.profileAward',
    'services.page',
    'profile',
    'services.loading',
    'ui.bootstrap',
    'angularFileUpload',
    'pdf',
    'security'
  ])



  .config(['$routeProvider', function ($routeProvider) {

    $routeProvider.when("/:url_slug/product/:tiid", {
      templateUrl:'product-page/product-page.tpl.html',
      controller:'ProductPageCtrl',
      resolve: {
        product: function(Product, $route){
          return Product.get({
            user_id: $route.current.params.url_slug,
            tiid: $route.current.params.tiid
          }).$promise
        },
        profileWithoutProducts: function(ProfileWithoutProducts, $route){
          return ProfileWithoutProducts.get({
            profile_id: $route.current.params.url_slug
          }).$promise
        }
      }
    });

  }])

  .factory('productPage', function(){
    return {

    }
  })

  .controller('ProductPageCtrl', function (
    $scope,
    $routeParams,
    $location,
    $modal,
    $cacheFactory,
    $compile,
    $sce,
    security,
    UsersProduct,
    UsersProducts,
    UserProfile,
    Product,
    Loading,
    TiMixpanel,
    ProductBiblio,
    ProductInteraction,
    Embedly,
    product,
    profileWithoutProducts,
    Page) {


    console.log("we got a profile!", profileWithoutProducts)

    Page.setHeaderFullName(
      profileWithoutProducts.given_name
    )

    var slug = $routeParams.url_slug
    window.scrollTo(0,0)  // hack. not sure why this is needed.

    UserProfile.useCache(true)


    $scope.userSlug = slug
    $scope.loading = Loading
    $scope.aliases = product.aliases
    $scope.biblio = product.biblio
    $scope.metrics = product.metrics
    $scope.displayGenrePlural = product.display_genre_plural


    // these are just for testing!
    // once we've got a product.file_url set by the server,
    // delete them.
    // product.file_url = "http://www.slideshare.net/hpiwowar/right-time-right-place-to-change-the-world"
    product.file_url = "http://jasonpriem.org/self-archived/data-for-free.pdf"
    // product.file_url = "http://www.slideshare.net/hpiwowar/7-data-citation-challenges-illustrated-with-data-includes-elephants"
    // product.file_url = "https://gitprint.com/hpiwowar/Kira/blob/master/README.md?download"

    if (product.file_url){
      Embedly.get(
        {url: product.file_url},
        function(resp){
          console.log("successful resp from embedly: ", resp)
          if (resp.html) {
            $scope.iframeToEmbed = resp.html.replace("http://docs.google", "https://docs.google")
          } else {
            $scope.iframeToEmbed = '<iframe>' + resp.thumbnail + '</iframe>'   
            // http://api.embed.ly/1/oembed?url=https%3A%2F%2Fgithub.com%2Fhpiwowar%2FKira&maxwidth=500                 
          }
        },
        function(resp){
          console.log("error response from embedly: ", resp)
        }
      )
    }


<commit_msg>remove test pdf<commit_after>angular.module("productPage", [
    'resources.users',
    'resources.products',
    'resources.embedly',
    'profileAward.profileAward',
    'services.page',
    'profile',
    'services.loading',
    'ui.bootstrap',
    'angularFileUpload',
    'pdf',
    'security'
  ])



  .config(['$routeProvider', function ($routeProvider) {

    $routeProvider.when("/:url_slug/product/:tiid", {
      templateUrl:'product-page/product-page.tpl.html',
      controller:'ProductPageCtrl',
      resolve: {
        product: function(Product, $route){
          return Product.get({
            user_id: $route.current.params.url_slug,
            tiid: $route.current.params.tiid
          }).$promise
        },
        profileWithoutProducts: function(ProfileWithoutProducts, $route){
          return ProfileWithoutProducts.get({
            profile_id: $route.current.params.url_slug
          }).$promise
        }
      }
    });

  }])

  .factory('productPage', function(){
    return {

    }
  })

  .controller('ProductPageCtrl', function (
    $scope,
    $routeParams,
    $location,
    $modal,
    $cacheFactory,
    $compile,
    $sce,
    security,
    UsersProduct,
    UsersProducts,
    UserProfile,
    Product,
    Loading,
    TiMixpanel,
    ProductBiblio,
    ProductInteraction,
    Embedly,
    product,
    profileWithoutProducts,
    Page) {


    console.log("we got a profile!", profileWithoutProducts)

    Page.setHeaderFullName(
      profileWithoutProducts.given_name
    )

    var slug = $routeParams.url_slug
    window.scrollTo(0,0)  // hack. not sure why this is needed.

    UserProfile.useCache(true)


    $scope.userSlug = slug
    $scope.loading = Loading
    $scope.aliases = product.aliases
    $scope.biblio = product.biblio
    $scope.metrics = product.metrics
    $scope.displayGenrePlural = product.display_genre_plural


    // these are just for testing!
    // once we've got a product.file_url set by the server,
    // delete them.
    // product.file_url = "http://www.slideshare.net/hpiwowar/right-time-right-place-to-change-the-world"
//    product.file_url = "http://jasonpriem.org/self-archived/data-for-free.pdf"
    // product.file_url = "http://www.slideshare.net/hpiwowar/7-data-citation-challenges-illustrated-with-data-includes-elephants"
    // product.file_url = "https://gitprint.com/hpiwowar/Kira/blob/master/README.md?download"

    if (product.file_url){
      Embedly.get(
        {url: product.file_url},
        function(resp){
          console.log("successful resp from embedly: ", resp)
          if (resp.html) {
            $scope.iframeToEmbed = resp.html.replace("http://docs.google", "https://docs.google")
          } else {
            $scope.iframeToEmbed = '<iframe>' + resp.thumbnail + '</iframe>'   
            // http://api.embed.ly/1/oembed?url=https%3A%2F%2Fgithub.com%2Fhpiwowar%2FKira&maxwidth=500                 
          }
        },
        function(resp){
          console.log("error response from embedly: ", resp)
        }
      )
    }



{'fraction_non_alphanumeric': 0.13511749347258487, 'fraction_numerical': 0.0039164490861618795, 'mean_word_length': 2.433613445378151, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7150051', 'n_tokens_mistral': 2016, 'n_tokens_neox': 1934, 'n_words': 292}