Sha256: bca79874c8a8859d242d0a1c188f75da923827b3b9cae84a0d60d6023d32766f

Contents?: true

Size: 565 Bytes

Versions: 9

Compression:

Stored size: 565 Bytes

Contents

class Plugins::Sidebars::AmazonController < Sidebars::ComponentPlugin
  description "Adds sidebar links to any amazon books linked in the body of the page"

  setting :title,        'Cited books'
  setting :associate_id, 'justasummary-20'
  setting :maxlinks,      4

  def content
    asin_list = params[:contents].to_a.inject([]) { |acc, item| acc | item.whiteboard[:asins].to_a }
    @asins = asin_list.compact[0,@sb_config['maxlinks'].to_i]
    @assoc_id = @sb_config['associate_id']
    if @asins.empty?
      render :text => ""
      return
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
typo-3.99.0 components/plugins/sidebars/amazon_controller.rb
typo-3.99.2 components/plugins/sidebars/amazon_controller.rb
typo-3.99.3 components/plugins/sidebars/amazon_controller.rb
typo-3.99.1 components/plugins/sidebars/amazon_controller.rb
typo-4.0.1 components/plugins/sidebars/amazon_controller.rb
typo-3.99.4 components/plugins/sidebars/amazon_controller.rb
typo-4.0.0 components/plugins/sidebars/amazon_controller.rb
typo-4.0.2 components/plugins/sidebars/amazon_controller.rb
typo-4.0.3 components/plugins/sidebars/amazon_controller.rb