Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pull request #1

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ Recently Viewed

### Installation

script/extension install git://github.com/romul/spree-recently-viewed.git
in the Gemfile add:

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

for i18n add a file named {language}_spree_recently_viewed.yml in your /config/locales/ directory.

### Usage

<%= stylesheet_link_tag "/recently/viewed/products.css?product_id=#{@product.id}" %>
in the view file you prefer add the following line:

<%= render 'shared/recently_viewed_products' %>
6 changes: 3 additions & 3 deletions app/views/shared/_recently_viewed_products.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<% if get_recently_viewed_products.any? %>
<h3>Recently viewed products</h3>
<h3><%= t :recently_viewed_products %></h3>
<ul>
<% get_recently_viewed_products.each do |p| %>
<li><%= link_to p.name, p %></li>
<li><%= link_to p.name, p %></li>
<% end -%>
</ul>
<% end %>
<% end %>
3 changes: 3 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
en:
recently_viewed_products: "Recently viewed products"

9 changes: 0 additions & 9 deletions lib/spree_recently_viewed_hooks.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,2 @@
class RecentlyViewedHooks < Spree::ThemeSupport::HookListener

insert_after :inside_head do
'
<% if @product %>
<%= stylesheet_link_tag("/recently/viewed/products.css?product_id=#{@product.id}") %>
<% end %>
'
end

end
5 changes: 3 additions & 2 deletions spree_recently_viewed.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ Gem::Specification.new do |s|
s.summary = 'Adds recently viewed products to Spree'
#s.description = 'Add (optional) gem description here'
s.required_ruby_version = '>= 1.8.7'
s.author = 'Nebulab'

s.files = Dir['CHANGELOG', 'README.md', 'LICENSE', 'lib/**/*', 'app/**/*']
s.require_path = 'lib'
s.requirements << 'none'

s.has_rdoc = true

s.add_dependency('spree_core', '>= 0.40.0')
end
s.add_dependency('spree_core', '>= 0.30.1')
end