Skip to content
This repository has been archived by the owner on Jun 29, 2023. It is now read-only.

Commit

Permalink
Upgraded to use 0-70-x asset pipeline, Deface, and engine activation
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickmcelwee committed Mar 26, 2012
1 parent d1c2418 commit cd2b158
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 29 deletions.
12 changes: 1 addition & 11 deletions lib/shipping_csv_hooks.rb → app/assets/javascripts/admin/shipping_csv.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
class ShippingCsvHooks < Spree::ThemeSupport::HookListener

insert_after :admin_orders_index_search_buttons do
%( <script>
function submitCSV()
function submitCSV()
{
confirm("This function returns only complete orders within the selected date range.");
var startDate = $('#search_created_at_greater_than').val();
Expand All @@ -13,9 +9,3 @@ class ShippingCsvHooks < Spree::ThemeSupport::HookListener
}
window.location = "/admin/shippingdocs" + "?start=" + startDate + "&end=" + endDate
}
</script>
<p><button type="button" onclick="javascript:submitCSV()"><span>CSV</span></button>
)
end

end
5 changes: 5 additions & 0 deletions app/overrides/add_shipping_csv_button.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Deface::Override.new(:virtual_path => 'admin/orders/index',
:name => "add_shipping_csv_button",
:insert_bottom => "div.box, [data-hook='admin_orders_index_search']",
:text => %q{<p><button type="button" onclick="javascript:submitCSV()"><span>CSV</span></button>}
)
18 changes: 0 additions & 18 deletions lib/shipping_csv.rb

This file was deleted.

21 changes: 21 additions & 0 deletions lib/spree_shipping_csv.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
require 'spree_core'

module SpreeShippingCsv
class Engine < Rails::Engine
engine_name 'spree_shipping_csv'

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

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
config.autoload_paths += %W(#{config.root}/lib)
end
end

0 comments on commit cd2b158

Please sign in to comment.