Skip to content

Commit

Permalink
a little more RESTful
Browse files Browse the repository at this point in the history
  • Loading branch information
jzw committed Jul 19, 2011
1 parent 53c7ba9 commit c876032
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
@@ -1,18 +1,18 @@
class Admin::ProductImportController < Admin::BaseController
class Admin::ProductImportsController < Admin::BaseController

#Sorry for not using resource_controller railsdog - I wanted to, but then... I did it this way.
#Verbosity is nice?
#Feel free to refactor and submit a pull request.

def index
redirect_to :action => :new
end

def new
@product_import = ProductImport.new
end


def create
@product_import = ProductImport.create(params[:product_import])
Delayed::Job.enqueue ImportProducts::ImportJob.new(@product_import, @current_user)
Expand Down
@@ -1,8 +1,7 @@
<h2><%= t('form.product_import.heading') %></h2>


<%= render "shared/error_messages", :target => @product_import %>
<%= form_for(:product_import, :url => admin_product_import_index_path, :method => :post, :html => { :multipart => true }) do |f| %>
<%= form_for([:admin, @product_import], :method => :post, :html => { :multipart => true }) do |f| %>
<fieldset>
<%= f.field_container :data_file do %>
<%= f.label :data_file, t('form.product_import.new.data_file') %>
Expand Down
1 change: 1 addition & 0 deletions config/initializers/delayed_job.rb
@@ -0,0 +1 @@
Delayed::Worker.backend = :active_record
2 changes: 1 addition & 1 deletion config/locales/en.yml
@@ -1,6 +1,6 @@
en:
product_import_processing: 'Thanks, your import has been added to the queue for processing. You will receive an email confirming the import once it has completed.'
product_import_index: 'Import Products'
product_imports: 'Import Products'
form:
product_import:
heading: 'Import Products from CSV'
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
@@ -1,5 +1,5 @@
Rails.application.routes.draw do
namespace :admin do
resources :product_import, :only => [:index, :new, :create]
resources :product_imports, :only => [:index, :new, :create]
end
end
2 changes: 1 addition & 1 deletion lib/import_products_hooks.rb
@@ -1,6 +1,6 @@
class ImportProductsHooks < Spree::ThemeSupport::HookListener
# custom hooks go here
insert_after :admin_tabs do
%(<%= tab(:product_import_index) %>)
%(<%= tab(:product_imports) %>)
end
end

0 comments on commit c876032

Please sign in to comment.