Skip to content

Commit

Permalink
Updated to work with 0.70.0 edge
Browse files Browse the repository at this point in the history
  • Loading branch information
BDQ committed Aug 29, 2011
1 parent 8e466bc commit bb76683
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 74 deletions.
19 changes: 13 additions & 6 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
Recently Viewed
===============
Spree Recently Viewed
=====================

This extension maintains and displays a list of the products a user has recently viewed.

### Installation

script/extension install git://github.com/romul/spree-recently-viewed.git

### Usage
Add the following to you Gemfile:

gem 'spree_recently_viewed', :git => 'git://github.com/spree/spree_recently_viewed.git'

And run bundler:

bundle install

<%= stylesheet_link_tag "/recently/viewed/products.css?product_id=#{@product.id}" %>

NOTE: There's no migrations required for this extension. You're done,
move along now.
1 change: 1 addition & 0 deletions Versionfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
"0.70.x" => { :branch => "master" }
"0.60.x" => { :branch => "0-60-stable" }
"0.50.x" => { :branch => "0-50-stable" }
5 changes: 3 additions & 2 deletions app/helpers/spree/base_helper_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
Spree::BaseHelper.class_eval do
Spree::BaseHelper.module_eval do
def get_recently_viewed_products_ids
if session['recently_viewed_products'].nil?
[]
else
session['recently_viewed_products'].split(', ')
end
end

def get_recently_viewed_products
Product.find_by_array_of_ids(get_recently_viewed_products_ids)
end
end
end
9 changes: 9 additions & 0 deletions app/overrides/add_recently_viewed_products.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Deface::Override.new(:virtual_path => 'shared/_products',
:name => 'add_recently_viewed_products_to_products_index',
:insert_after => "#products[data-hook], [data-hook='products']",
:partial => 'shared/recently_viewed_products')

Deface::Override.new(:virtual_path => 'products/show',
:name => 'add_recently_viewed_products_to_products_show',
:insert_after => "#product_description[data-hook], [data-hook='product_description']",
:partial => 'shared/recently_viewed_products')
5 changes: 0 additions & 5 deletions config/routes.rb

This file was deleted.

2 changes: 0 additions & 2 deletions db/seeds.rb

This file was deleted.

8 changes: 4 additions & 4 deletions lib/spree_recently_viewed.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
require 'spree_core'
require 'spree_recently_viewed_hooks'

module SpreeRecentlyViewed
class Engine < Rails::Engine
railtie_name "spree_recently_viewed"

config.autoload_paths += %W(#{config.root}/lib)

def self.activate
Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
Rails.env.production? ? require(c) : load(c)
Rails.application.config.cache_classes ? require(c) : load(c)
end

Dir.glob(File.join(File.dirname(__FILE__), "../lib/**/*_decorator*.rb")) do |c|
Rails.env.production? ? require(c) : load(c)
Dir.glob(File.join(File.dirname(__FILE__), "../app/overrides/*.rb")) do |c|
Rails.application.config.cache_classes ? require(c) : load(c)
end

end
Expand Down
12 changes: 0 additions & 12 deletions lib/spree_recently_viewed_hooks.rb

This file was deleted.

6 changes: 0 additions & 6 deletions spec/spec.opts

This file was deleted.

37 changes: 0 additions & 37 deletions spec/spec_helper.rb

This file was deleted.

0 comments on commit bb76683

Please sign in to comment.