forked from HeroInt/spree_reviews
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
145 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module SpreeReviews | ||
module Generators | ||
class InstallGenerator < Rails::Generators::Base | ||
# source_root File.expand_path("../../../../", __FILE__) | ||
def copy_locale | ||
Dir.glob(File.join(ReviewsExtension.root, "db", 'sample', '*.{yml,csv}')).each do |resource_file| | ||
say_status("copying", "#{resource_file} --->> db/sample/#{File.basename(resource_file)}", :green) | ||
copy_file resource_file, "db/sample/#{File.basename(resource_file)}" | ||
end | ||
end | ||
|
||
def add_migrations | ||
run 'rake railties:install:migrations FROM=<%= file_name %>' | ||
end | ||
|
||
def run_migrations | ||
res = ask "Would you like to run the migrations now? [Y/n]" | ||
if res == "" || res.downcase == "y" | ||
run 'rake db:migrate' | ||
else | ||
puts "Skiping rake db:migrate, don't forget to run it!" | ||
end | ||
end | ||
|
||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Uncomment this if you reference any of your controllers in activate | ||
# require_dependency 'application' | ||
|
||
|
||
module SpreeReviews | ||
|
||
class Engine < Rails::Engine | ||
engine_name 'spree-reviews' | ||
|
||
config.autoload_paths += %W(#{config.root}/lib) | ||
|
||
def self.activate | ||
Dir.glob(File.join(File.dirname(__FILE__), "../app/overrides/**/*.rb")) do |c| | ||
Rails.application.config.cache_classes ? require(c) : load(c) | ||
end | ||
end | ||
|
||
config.to_prepare &method(:activate).to_proc | ||
end | ||
end | ||
|
||
|
||
#class ReviewsExtension < Spree::Extension | ||
# version "1.0" | ||
# description "Support for reviews and ratings within Spree" | ||
# url "git://github.com/paulcc/spree-reviews.git" | ||
# | ||
# def activate | ||
# # admin.tabs.add "Reviews", "/admin/reviews", :after => "Layouts", :visibility => [:all] | ||
# | ||
# Admin::ConfigurationsController.class_eval do | ||
# before_filter :add_review_links, :only => :index | ||
# | ||
# def add_review_links | ||
# @extension_links << {:link => admin_reviews_path, :link_text => t('review_management'), :description => t('review_management_description')} | ||
# @extension_links << {:link => admin_review_settings_path, :link_text => t('reviews.review_settings'), :description => t('reviews.manage_review_settings') } | ||
# end | ||
# end | ||
# | ||
# # Add access to reviews/ratings to the product model | ||
# Product.class_eval do | ||
# has_one :rating | ||
# has_many :reviews | ||
# | ||
# def get_stars | ||
# if rating.nil? | ||
# [0,0] | ||
# else | ||
# [rating.get_stars, rating.count] | ||
# end | ||
# end | ||
# end | ||
# end | ||
# | ||
# def deactivate | ||
# # admin.tabs.remove "Reviews" | ||
# end | ||
# | ||
#end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Uncomment this if you reference any of your controllers in activate | ||
# require_dependency 'application' | ||
|
||
|
||
module SpreeReviews | ||
|
||
class Engine < Rails::Engine | ||
engine_name 'spree_reviews' | ||
|
||
config.autoload_paths += %W(#{config.root}/lib) | ||
|
||
def self.activate | ||
Dir.glob(File.join(File.dirname(__FILE__), "../app/overrides/**/*.rb")) do |c| | ||
Rails.application.config.cache_classes ? require(c) : load(c) | ||
end | ||
end | ||
|
||
config.to_prepare &method(:activate).to_proc | ||
end | ||
end | ||
|
||
|
||
#class ReviewsExtension < Spree::Extension | ||
# version "1.0" | ||
# description "Support for reviews and ratings within Spree" | ||
# url "git://github.com/paulcc/spree-reviews.git" | ||
# | ||
# def activate | ||
# # admin.tabs.add "Reviews", "/admin/reviews", :after => "Layouts", :visibility => [:all] | ||
# | ||
# Admin::ConfigurationsController.class_eval do | ||
# before_filter :add_review_links, :only => :index | ||
# | ||
# def add_review_links | ||
# @extension_links << {:link => admin_reviews_path, :link_text => t('review_management'), :description => t('review_management_description')} | ||
# @extension_links << {:link => admin_review_settings_path, :link_text => t('reviews.review_settings'), :description => t('reviews.manage_review_settings') } | ||
# end | ||
# end | ||
# | ||
# # Add access to reviews/ratings to the product model | ||
# Product.class_eval do | ||
# has_one :rating | ||
# has_many :reviews | ||
# | ||
# def get_stars | ||
# if rating.nil? | ||
# [0,0] | ||
# else | ||
# [rating.get_stars, rating.count] | ||
# end | ||
# end | ||
# end | ||
# end | ||
# | ||
# def deactivate | ||
# # admin.tabs.remove "Reviews" | ||
# end | ||
# | ||
#end |