forked from jsqu99/spree_wholesale
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reworked wholesaler_controller, added some tests, locales and a bunch…
… of other stuff
- Loading branch information
Showing
41 changed files
with
983 additions
and
364 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
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,13 @@ | ||
class Admin::WholesalerStatesController < Admin::BaseController | ||
|
||
def index | ||
#params[:prefix] = params[:prefix].to_s.downcase | ||
#prefix = %w(bill ship).include?(params[:prefix]) ? params[:prefix] : "bill" | ||
if params[:country_id] | ||
@country = Country.includes(:states).find(params[:country_id]) rescue nil | ||
@states = @country.states.order(:name).all if @country | ||
end | ||
render :partial => "admin/wholesalers/state_field", :locals => { :states => @states } | ||
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 |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
User.class_eval do | ||
|
||
def wholesaler? | ||
has_role?("wholesaler") | ||
has_role?("wholesaler") && !wholesaler.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
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<% states ||= [] %> | ||
<% prefix ||= '' %> | ||
<% value ||= '' %> | ||
<% unless states.empty? %> | ||
<%= select_tag "#{prefix}_address[state_id]", options_for_select(states.map{|s| [s.name, s.id]}, value.is_a?(Address) ? value.state.id : value), :class => 'required' %> | ||
<% else %> | ||
<%= text_field_tag "#{prefix}_address[state_name]", value.is_a?(Address) ? value.state_name : value, :class => 'text required' %> | ||
<% 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<% if @user.wholesaler? %> | ||
<h1>Wholesaler</h1> | ||
<h4 class="wholesale-customer-id"><%= t('wholesale_customer', { :id => @user.id }) %></h4> | ||
<h4 class="wholesale-customer-id"><%= t('wholesale_customer_since', { :time => @user.wholesaler.created_at }) %></h4> | ||
<% end %> |
Oops, something went wrong.