forked from spree/spree
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
29 changed files
with
255 additions
and
128 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,9 +1,49 @@ | ||
class Admin::AdjustmentsController < Admin::BaseController | ||
|
||
before_filter :load_order, :only => [:index, :new, :create, :edit, :update] | ||
before_filter :load_adjustment, :only => [:edit, :update] | ||
|
||
resource_controller | ||
belongs_to :order | ||
|
||
update.wants.html { redirect_to collection_url } | ||
create.wants.html { redirect_to collection_url } | ||
destroy.success.wants.js { @order.reload && render_js_for_destroy } | ||
|
||
def index | ||
render | ||
end | ||
|
||
def new | ||
@adjustment = @order.adjustments.build | ||
end | ||
|
||
def edit | ||
render | ||
end | ||
|
||
def update | ||
if @adjustment.update_attributes(params[:adjustment]) | ||
redirect_to admin_order_adjustments_path(@order), :notice => "Successfully updated!" | ||
else | ||
render :action => :edit | ||
end | ||
end | ||
|
||
def create | ||
@adjustment = @order.adjustments.create(params[:adjustment]) | ||
if @adjustment.errors.any? | ||
render :action => :new | ||
else | ||
redirect_to admin_order_adjustments_path(@order), :notice => "Successfully created!" | ||
end | ||
end | ||
|
||
private | ||
|
||
def load_order | ||
@order = Order.find_by_number(params[:order_id]) | ||
end | ||
|
||
def load_adjustment | ||
@adjustment = @order.adjustments.find(params[:id]) | ||
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
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
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 |
---|---|---|
@@ -1,14 +1,18 @@ | ||
class LocaleController < Spree::BaseController | ||
|
||
def set | ||
if request.referer && request.referer.starts_with?("http://" + request.host) | ||
session["user_return_to"] = request.referer | ||
end | ||
|
||
if params[:locale] && I18n.available_locales.include?(params[:locale].to_sym) | ||
session[:locale] = I18n.locale = params[:locale].to_sym | ||
flash.notice = t(:locale_changed) | ||
else | ||
flash[:error] = t(:locale_not_changed) | ||
end | ||
|
||
redirect_back_or_default(root_path) | ||
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
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 |
---|---|---|
@@ -1,37 +1,27 @@ | ||
class ProductsController < Spree::BaseController | ||
HTTP_REFERER_REGEXP = /^https?:\/\/[^\/]+\/t\/([a-z0-9\-\/]+)$/ | ||
|
||
#prepend_before_filter :reject_unknown_object, :only => [:show] | ||
before_filter :load_data, :only => :show | ||
HTTP_REFERER_REGEXP = /^https?:\/\/[^\/]+\/t\/([a-z0-9\-\/]+)$/ | ||
|
||
resource_controller | ||
helper :taxons | ||
actions :show, :index | ||
|
||
private | ||
|
||
def load_data | ||
load_object | ||
|
||
@variants = Variant.active.find_all_by_product_id(@product.id, | ||
:include => [:option_values, :images]) | ||
@product_properties = ProductProperty.find_all_by_product_id(@product.id, | ||
:include => [:property]) | ||
def show | ||
@product = Product.where(:permalink => params[:id]).limit(1).first | ||
@variants = Variant.active.find_all_by_product_id(@product.id, :include => [:option_values, :images]) | ||
@product_properties = ProductProperty.find_all_by_product_id(@product.id, :include => [:property]) | ||
@selected_variant = @variants.detect { |v| v.available? } | ||
|
||
referer = request.env['HTTP_REFERER'] | ||
|
||
if referer && referer.match(HTTP_REFERER_REGEXP) | ||
@taxon = Taxon.find_by_permalink($1) | ||
end | ||
@taxon = Taxon.find_by_permalink($1) if referer && referer.match(HTTP_REFERER_REGEXP) | ||
end | ||
|
||
def collection | ||
def index | ||
@searcher = Spree::Config.searcher_class.new(params) | ||
@products = @searcher.retrieve_products | ||
end | ||
|
||
private | ||
|
||
def accurate_title | ||
@product ? @product.name : nil | ||
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 |
---|---|---|
@@ -1,23 +1,18 @@ | ||
class TaxonsController < Spree::BaseController | ||
#prepend_before_filter :reject_unknown_object, :only => [:show] | ||
before_filter :load_data, :only => :show | ||
resource_controller | ||
actions :show | ||
|
||
helper :products | ||
|
||
private | ||
def load_data | ||
@taxon ||= object | ||
def show | ||
@taxon = Taxon.find_by_permalink(params[:id]) | ||
params[:taxon] = @taxon.id | ||
@searcher = Spree::Config.searcher_class.new(params) | ||
@products = @searcher.retrieve_products | ||
end | ||
|
||
def object | ||
@object ||= end_of_association_chain.find_by_permalink(params[:id]) | ||
end | ||
private | ||
|
||
def accurate_title | ||
@taxon ? @taxon.name : nil | ||
end | ||
|
||
end |
File renamed without changes.
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<%= render 'admin/shared/new_adjustment_button' %> | ||
<%= render :partial => 'admin/shared/order_tabs', :locals => {:current => "Adjustments"} %> | ||
<%= render 'admin/shared/adjustments_table' %> | ||
<%= button_link_to t('continue'), @order.cart? ? new_admin_order_payment_url(@order) : admin_orders_url %> | ||
<%= render 'adjustments_table' %> | ||
<%= button_link_to t('continue'), @order.cart? ? new_admin_order_payment_url(@order) : admin_orders_url %> |
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
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
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
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
Feature: Admin > configurations > tax_categories | ||
|
||
Scenario: Visiting admin configurations states | ||
Given I go to the admin home page | ||
When I follow "Configuration" | ||
When I follow "States" | ||
Then I should see listing states tabular attributes |
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
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
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
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
Oops, something went wrong.