class LandingsController < ApplicationController

  respond_to :html

  def watch_bands
    @promo_buzz = PromoBuzz.active

    if Rails.application.config.use_promos_on_homepage
      @promo_latest = PromoLatest.active
    else
      @promo_latest, start = Feed.index(nil, limit: 10)
    end

    page = params['p'].to_i

    if page == 2
      render 'watch_bands_2', layout: 'web'
    elsif page == 3
      render 'watch_bands_3', layout: 'web'
    else
      render 'watch_bands_1', layout: 'web'
    end
  end

  def watch_overview_kick
    render 'watch_kick', layout: 'web'
  end

  def watch_overview_kick2
    render 'watch_kick_2', layout: 'web'
  end

  def watch_overview_kick3
    render 'watch_kick_3', layout: 'web'
  end

  def watch_overview_kick4
    render 'watch_kick_4', layout: 'web'
  end

  def watch_overview
    @promo_buzz = PromoBuzz.active

    if Rails.application.config.use_promos_on_homepage
      @promo_latest = PromoLatest.active
    else
      @promo_latest, start = Feed.index(nil, limit: 10)
    end

    page = params['p'].to_i

    if page == 2
      render 'watch_overview_2', layout: 'web'
    elsif page == 3
      render 'watch_overview_3', layout: 'web'
    else
      render 'watch_overview_1', layout: 'web'
    end
  end

  def watch_bands_tight
    render 'watch_bands_tight', layout: 'web'
  end

  def watch_overview_tight
    render 'watch_overview_tight', layout: 'web'
  end

  def individual_jamtrack
    @no_landing_tag = true
    @show_cta_free_jamtrack = true
    @jam_track = JamTrack.find_by_plan_code("jamtrack-" + params[:plan_code])
    gon.jam_track_plan_code = params[:plan_code] ? "jamtrack-" + params[:plan_code] : nil
    gon.generic = params[:generic]
    render 'individual_jamtrack', layout: 'web'
  end

  def individual_jamtrack_band
    @no_landing_tag = true
    @show_cta_free_jamtrack = true
    @jam_track = JamTrack.find_by_plan_code("jamtrack-" + params[:plan_code])
    gon.jam_track_plan_code = params[:plan_code] ? "jamtrack-" + params[:plan_code] : nil

    render 'individual_jamtrack_band', layout: 'web'
  end

  def product_jamblaster
    render 'product_jamblaster', layout: 'web'
  end

  def product_platform
    render 'product_platform', layout: 'web'
  end

  def product_jamtracks
    gon.generic = true
    gon.just_previews = true
    jam_track = JamTrack.select('plan_code').where(plan_code: Rails.application.config.nominated_jam_track).first
    unless jam_track
      jam_track = JamTrack.first
    end

    gon.jam_track_plan_code = jam_track.plan_code if jam_track
    render 'product_jamtracks', layout: 'web'
  end

  def affiliate_program
    render 'affiliate_program', layout: 'web'
  end

end

