<commit_before>_ = require 'underscore'
sd = require('sharify').data
Backbone = require 'backbone'
Fairs = require '../../../collections/fairs.coffee'
CurrentUser = require '../../../models/current_user.coffee'
initCarousel = require '../../../components/merry_go_round/index.coffee'

{ Following, FollowButton } = require '../../../components/follow_button/index.coffee'

module.exports.init = ->
  fairs = new Fairs sd.FAIRS

  user = CurrentUser.orNull()
  following = new Following [], kind: 'profile' if user

  ids = fairs.map (fair) ->
    $el = $(".profile-follow[data-id='#{fair.related().profile.id}']")

    new FollowButton
      el: $el
      following: following
      modelName: 'profile'
      model: fair.related().profile
      analyticsFollowMessage: 'Followed fair, via fairs page'
      analyticsUnfollowMessage: 'Unfollowed fair, via fairs page'

    fair.related().profile.id

  following.syncFollows ids if user

  initCarousel $('.fairs__promo__slideshow'),
    $navigation: $('.mgr-navigation')
    autoPlay: 5000<commit_msg>handles sign up button<commit_after>_ = require 'underscore'
sd = require('sharify').data
Backbone = require 'backbone'
Fairs = require '../../../collections/fairs.coffee'
mediator = require '../../../lib/mediator.coffee'
CurrentUser = require '../../../models/current_user.coffee'
initCarousel = require '../../../components/merry_go_round/index.coffee'

{ Following, FollowButton } = require '../../../components/follow_button/index.coffee'

module.exports.init = ->
  fairs = new Fairs sd.FAIRS

  user = CurrentUser.orNull()
  following = new Following [], kind: 'profile' if user

  ids = fairs.map (fair) ->
    $el = $(".profile-follow[data-id='#{fair.related().profile.id}']")

    new FollowButton
      el: $el
      following: following
      modelName: 'profile'
      model: fair.related().profile
      analyticsFollowMessage: 'Followed fair, via fairs page'
      analyticsUnfollowMessage: 'Unfollowed fair, via fairs page'

    fair.related().profile.id

  following.syncFollows ids if user

  initCarousel $('.fairs__promo__slideshow'),
    $navigation: $('.mgr-navigation')
    autoPlay: 5000
    imagesLoaded: true

  $('.fairs__promo__sign-up').click (e)->
    e.preventDefault()
    mediator.trigger 'open:auth',
      mode: 'register'
      copy: "Sign up to follow fairs"
    return false
{'fraction_non_alphanumeric': 0.15707027942421675, 'fraction_numerical': 0.003386960203217612, 'mean_word_length': 3.3517495395948433, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '3203313', 'n_tokens_mistral': 750, 'n_tokens_neox': 725, 'n_words': 168}