Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 9 additions & 9 deletions app/controllers/admin/accessories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,49 @@ def edit
@product_accessories = @product.product_accessories
@categories = Category.root.all_children
end

def show
@product = Product.find(params[:product_id])
@category = Category.find(params[:category_id])
@products = @category.products
end

def create
@product = Product.find(params[:product_id])
accessory = Product.find(params[:accessory_id])
@product.accessories << accessory
@product_accessories = @product.product_accessories
respond_to do |format|
format.js {
format.js {
render :partial => 'accessories'
}
end

end

def update
@product = Product.find(params[:product_id])
@product_accessory = ProductAccessory.find(params[:id])
@product_accessory.update_attributes(params[:product_accessory])
@product_accessories = @product.product_accessories
respond_to do |format|
format.js {
format.js {
render :partial => 'accessories'
}
end
end

def destroy
@product = Product.find(params[:product_id])
@product_accessory = ProductAccessory.find(params[:id])
@product_accessory.destroy
@product_accessories = @product.product_accessories
respond_to do |format|
format.js {
format.js {
render :partial => 'accessories'
}
end
end

end
end
10 changes: 5 additions & 5 deletions app/controllers/admin/authorizations_controller.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module Admin

class AuthorizationsController < ApplicationController

def update
@order = Order.find(params[:id])
# set amount if exists, else use order total
# set amount if exists, else use order total
amount = params[:post_authorize_amount].to_d unless params[:post_authorize_amount].blank?
amount ||= @order.total_in_cents

if @order.authorized?
@order.capture_payment({:amount => amount})
else
Expand All @@ -17,8 +17,8 @@ def update

render :partial => 'admin/orders/order_transactions'
end


end


Expand Down
14 changes: 7 additions & 7 deletions app/controllers/admin/categories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def index
def new
@category = Category.new
end

def create
@category = Category.new(params[:category])
respond_to do |format|
Expand All @@ -27,11 +27,11 @@ def create
end
end
end

def edit
@category = Category.find(params[:id])
end

def update
@category = Category.find(params[:id])

Expand All @@ -42,10 +42,10 @@ def update
flash[:notice] = 'Category was successfully updated.'
end
format.html { render :action => "edit" }

end
end

def show
@category = Category.find(params[:id])

Expand All @@ -58,12 +58,12 @@ def show
def destroy
category = Category.find(params[:id])
category.destroy

respond_to do |format|
format.html { redirect_to(admin_categories_url) }
end
end

def reorder
category = Category.find(params[:id])
category.reorder(params)
Expand Down
12 changes: 6 additions & 6 deletions app/controllers/admin/category_icon_hovers_controller.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
class Admin::CategoryIconHoversController < ApplicationController
layout "admin"
require_role "admin"
def create

def create
category_icon = CategoryIcon.find(params[:category_icon_id])
category_icon.create_category_icon_hover(params[:category_icon_hover])
render :partial => '/admin/categories/icon_hover',
render :partial => '/admin/categories/icon_hover',
:locals => { :icon => category_icon }
end

def destroy
category_icon = CategoryIcon.find(params[:category_icon_id])
category_icon_hover = CategoryIconHover.find(params[:id])
category_icon_hover.destroy
render :partial => '/admin/categories/icon_hover',
render :partial => '/admin/categories/icon_hover',
:locals => { :icon => category_icon }
end
end

end
14 changes: 7 additions & 7 deletions app/controllers/admin/category_icons_controller.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
class Admin::CategoryIconsController < ApplicationController
layout "admin"
require_role "admin"
def create

def create
category = Category.find(params[:category_id])
category.create_category_icon(params[:category_icon])
render :partial => '/admin/categories/icon',

render :partial => '/admin/categories/icon',
:locals => { :category => category }
end

def destroy
category = Category.find(params[:category_id])
category_icon = CategoryIcon.find(params[:id])
category_icon.destroy
render :partial => '/admin/categories/icon',
render :partial => '/admin/categories/icon',
:locals => { :category => category }
end
end

end
12 changes: 6 additions & 6 deletions app/controllers/admin/category_images_controller.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
class Admin::CategoryImagesController < ApplicationController
layout "admin"
require_role "admin"
def create

def create
category = Category.find(params[:category_id])
category.category_images.create(params[:category_image])
category = Category.find(params[:category_id])
render :partial => '/admin/categories/image_list',
render :partial => '/admin/categories/image_list',
:locals => { :category => category }
end

def destroy
category = Category.find(params[:category_id])
category_image = CategoryImage.find(params[:id])
category_image.destroy
render :partial => '/admin/categories/image_list',
render :partial => '/admin/categories/image_list',
:locals => { :category => category }
end
end

end
12 changes: 6 additions & 6 deletions app/controllers/admin/configurations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ module Admin
class ConfigurationsController < ApplicationController
layout "admin"
require_role "admin"

def index
@configuration = Configuration.first || Configuration.create

respond_to do |format|
format.html # index.rhtml
format.xml { render :xml => @optimization.to_xml }
end
end

def edit
@configuration = Configuration.first || Configuration.create
end

def update
@configuration = Configuration.first
@configuration = Configuration.first
respond_to do |format|
if @configuration.update_attributes(params[:configuration])
flash[:notice] = 'configuration was successfully updated.'
Expand All @@ -31,6 +31,6 @@ def update
end
end
end

end
end
8 changes: 4 additions & 4 deletions app/controllers/admin/flat_rate_shipping_controller.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module Admin


class FlatRateShippingController < ApplicationController
layout 'admin'
require_role "admin"

def index

end


Expand Down
12 changes: 6 additions & 6 deletions app/controllers/admin/optimizations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ module Admin
class OptimizationsController < ApplicationController
layout "admin"
require_role "admin"

def index
@optimization = Optimization.first || Optimization.create

respond_to do |format|
format.html # index.rhtml
format.xml { render :xml => @optimization.to_xml }
end
end

def edit
@optimization = Optimization.first
@optimization = Optimization.first
end

def update
@optimization = Optimization.first
respond_to do |format|
Expand All @@ -31,6 +31,6 @@ def update
end
end
end

end
end
16 changes: 8 additions & 8 deletions app/controllers/admin/out_of_stock_options_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ module Admin

class OutOfStockOptionsController < ApplicationController
require_role "admin"

# add a new out of stock option
def create
puts params.to_yaml
product = Product.find(params[:product_id])
out_of_stock_option = OutOfStockOption.new

# adds out of stock selections
selections = params[:selections]
unless product.out_of_stock?(selections)
Expand All @@ -22,21 +22,21 @@ def create
out_of_stock_option.out_of_stock_option_selections << out_of_stock_selection
end
end

product.out_of_stock_options << out_of_stock_option
end

render :partial => 'admin/products/out_of_stock_options/out_of_stock_options',
:locals => { :out_of_stock_options => product.out_of_stock_options }
end


# delete a out of stock option
def destroy
product = Product.find(params[:product_id])
product = Product.find(params[:product_id])
out_of_stock_option = OutOfStockOption.find(params[:id])
product.out_of_stock_options.delete(out_of_stock_option)

render :partial => 'admin/products/out_of_stock_options/out_of_stock_options',
:locals => { :out_of_stock_options => product.out_of_stock_options }
end
Expand Down
Loading