<commit_before>_ = require 'underscore'
Backbone = require 'backbone'
# Poller = require 'backbone-poller'
sd = require("sharify").data
mediator = require '../../../lib/mediator.coffee'
InfiniteView = require '../../../components/pagination/infinite_view.coffee'
Blocks = require '../../../collections/blocks.coffee'
BlockCollectionView = require '../../../components/block_collection/client/block_collection_view.coffee'
BlockView = require '../../../components/block_collection/client/block_view.coffee'
User = require '../../../models/user.coffee'


feedTemplate = -> require('../../../components/feed/templates/feed.jade') arguments...

module.exports = class FeedView extends Backbone.View
  count: 0

  initialize: ->
    mediator.trigger 'load:start'

    @collection.fetch success: @initialFetch
    @collection.on "sync", @render, @

    @current_user = new User sd.CURRENT_USER

  initialFetch: =>
    @setSharedBlocks()
    # @startPolling()

    mediator.trigger 'load:stop'

    _.defer => @count = mediator.shared.blocks.length

    if sd.FEED_TYPE is 'primary'
      # notifications api updates to be paginated :/
      @infinite_view = new InfiniteView
        context: @$el
        collection: @collection
        itemSelector: @$el

  startPolling: ->
    # poller = Poller.get(@collection,
    #   delay: [3000]
    #   delayed: 10000
    # ).start()

  render: ->
    @$el.html feedTemplate(feed: @collection.models, user: @current_user)

    @setSharedBlocks()

    @$('.grid__block').each @initBlockView

  updateTitle: (diff) =><commit_msg>inject iconic after block load<commit_after>_ = require 'underscore'
Backbone = require 'backbone'
# Poller = require 'backbone-poller'
sd = require("sharify").data
mediator = require '../../../lib/mediator.coffee'
InfiniteView = require '../../../components/pagination/infinite_view.coffee'
Blocks = require '../../../collections/blocks.coffee'
BlockCollectionView = require '../../../components/block_collection/client/block_collection_view.coffee'
BlockView = require '../../../components/block_collection/client/block_view.coffee'
User = require '../../../models/user.coffee'
IconicJS = require '../../../components/iconic/client/iconic.min.js'

feedTemplate = -> require('../../../components/feed/templates/feed.jade') arguments...

module.exports = class FeedView extends Backbone.View
  count: 0

  initialize: ->
    mediator.trigger 'load:start'

    @collection.fetch success: @initialFetch
    @collection.on "sync", @render, @

    @current_user = new User sd.CURRENT_USER

  initialFetch: =>
    @setSharedBlocks()
    # @startPolling()

    mediator.trigger 'load:stop'

    _.defer => @count = mediator.shared.blocks.length

    if sd.FEED_TYPE is 'primary'
      # notifications api updates to be paginated :/
      @infinite_view = new InfiniteView
        context: @$el
        collection: @collection
        itemSelector: @$el

  startPolling: ->
    # poller = Poller.get(@collection,
    #   delay: [3000]
    #   delayed: 10000
    # ).start()

  render: ->
    @$el.html feedTemplate(feed: @collection.models, user: @current_user)

    @setSharedBlocks()

    @$('.grid__block').each @initBlockView

    _.defer -> 
      IconicJS().inject 'img.iconic'

  updateTitle: (diff) =>
{'fraction_non_alphanumeric': 0.15926493108728942, 'fraction_numerical': 0.006125574272588055, 'mean_word_length': 3.1552162849872776, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '105882', 'n_tokens_mistral': 1033, 'n_tokens_neox': 977, 'n_words': 206}