spree_retailers 0.40.0.2 → 0.40.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -4,6 +4,18 @@ Spree Retailers
4
4
  Spree Retailers is a simple Spree Extension that adds a retailers page as well as a retailers admin.
5
5
 
6
6
 
7
+ Installation
8
+ ------------
9
+
10
+ As usual, add 'spree_retalers' to your Gemfile or install directly.
11
+
12
+ gem 'spree_retailers', '0.40.0.4'
13
+
14
+ # or
15
+
16
+ (sudo) gem install spree_retailers
17
+
18
+
7
19
  Demo
8
20
  ----
9
21
 
@@ -11,7 +23,7 @@ To create a spree retailers demo app, run the following:
11
23
 
12
24
  rails new spree_retailers_example
13
25
  cd spree_retailers_example
14
- echo "gem 'spree', '0.40.2'" >> Gemfile
26
+ echo "gem 'spree', '0.40.3'" >> Gemfile
15
27
  echo "gem 'spree_retailers'" >> Gemfile
16
28
  rm public/index.html
17
29
  bundle install
@@ -19,7 +31,7 @@ To create a spree retailers demo app, run the following:
19
31
 
20
32
  Or all at once:
21
33
 
22
- rails new spree_retailers_example; cd spree_retailers_example; echo "gem 'spree', '0.40.2'" >> Gemfile; echo "gem 'spree_retailers'" >> Gemfile; rm public/index.html; bundle install; rake spree:install spree_retailers:install db:migrate db:seed db:admin:create
34
+ rails new spree_retailers_example; cd spree_retailers_example; echo "gem 'spree', '0.40.3'" >> Gemfile; echo "gem 'spree_retailers'" >> Gemfile; rm public/index.html; bundle install; rake spree:install spree_retailers:install db:migrate db:seed db:admin:create
23
35
 
24
36
  `rake spree_sample:install db:sample` if you want to...
25
37
 
@@ -30,6 +42,10 @@ To Do
30
42
  -----
31
43
 
32
44
  * Write controller tests
45
+ * Write admin tests
46
+ * Google map integration (we're already geocoding, so why not?)
47
+ * Add International Support
48
+
33
49
 
34
50
  License
35
51
  -------
data/Rakefile CHANGED
@@ -26,26 +26,4 @@ desc "Builds dummy app for testing"
26
26
  task :test_app do
27
27
  require 'spree_retailers/generators/test_app_generator'
28
28
  SpreeRetailers::Generators::TestAppGenerator.start
29
- end
30
-
31
-
32
-
33
- #require 'bundler'
34
- #require 'rake/testtask'
35
- #Bundler::GemHelper.install_tasks
36
- #
37
- #Rake::TestTask.new do |t|
38
- # t.libs << "lib"
39
- # t.pattern = 'test/**/*_test.rb'
40
- # t.verbose = true
41
- #end
42
- #
43
- #desc "Default Task"
44
- #task :default => [ :test ]
45
- #
46
- #
47
- #desc "Builds dummy app for testing"
48
- #task :test_app do
49
- # require 'spree_retailers/generators/test_app_generator'
50
- # SpreeRetailers::Generators::TestAppGenerator.start
51
- #end
29
+ end
@@ -46,7 +46,7 @@ class Admin::RetailersController < Admin::BaseController
46
46
  end
47
47
 
48
48
  def get_states
49
- @states = State.where(:country_id => 214).collect{|state| state.name }.sort
49
+ @states = State.where(:country_id => 214).collect{|state| [state.name, state.abbr] }.sort
50
50
  end
51
51
 
52
52
  end
@@ -2,6 +2,10 @@ class RetailersController < Spree::BaseController
2
2
 
3
3
  def index
4
4
  @retailers = Retailer.order(:state, :name)
5
+ @states = {}
6
+ State.where(:abbr => @retailers.collect(&:state).uniq).all.each do |state|
7
+ @states[state.abbr] = state.name
8
+ end
5
9
  end
6
10
 
7
11
  end
@@ -1,9 +1,9 @@
1
1
  module RetailersHelper
2
2
 
3
3
  def state_nav_helper
4
- retailers = Retailer.select(:state).group(:state).order(:state).all
5
- return "" unless 1 < retailers.length
6
- retailers.collect{|retailer| link_to(retailer.state, "##{retailer.state.downcase}") }.join(" | ").html_safe
4
+ states = (@retailers || Retailer.select(:state).group(:state).all).collect(&:state).uniq
5
+ return "" unless 1 < states.length
6
+ states.collect{|state| link_to(state, "##{state.downcase}") }.join(" | ").html_safe
7
7
  end
8
8
 
9
9
  end
@@ -55,11 +55,7 @@ class Retailer < ActiveRecord::Base
55
55
  def geocode
56
56
  geo = Geokit::Geocoders::MultiGeocoder.geocode(full_address)
57
57
  if geo.success
58
- self.attributes = {
59
- :address => geo.street_address,
60
- :city => geo.city,
61
- :state => geo.state,
62
- :zipcode => geo.zip,
58
+ self.attributes = {
63
59
  :latitude => geo.lat,
64
60
  :longitude => geo.lng,
65
61
  :geokit_provider => geo.provider,
@@ -69,8 +65,8 @@ class Retailer < ActiveRecord::Base
69
65
  }
70
66
  else
71
67
  self.attributes = {
72
- :latitude => nil,
73
- :longitude => nil,
68
+ :latitude => nil,
69
+ :longitude => nil,
74
70
  :geokit_provider => nil,
75
71
  :geokit_precision => nil,
76
72
  :geokit_accuracy => nil,
@@ -15,6 +15,7 @@
15
15
  <tr>
16
16
  <th><%= order @search, :by => :name %></th>
17
17
  <th><%= order @search, :by => :address %></th>
18
+ <th><%= order @search, :by => :state %></th>
18
19
  <th><%= order @search, :by => :email %></th>
19
20
  <th><%= order @search, :by => :phone %></th>
20
21
  <th><%= t("action") %></th>
@@ -25,6 +26,7 @@
25
26
  <tr id="<%= dom_id retailer %>">
26
27
  <td width="200px"><%= link_to retailer.name, object_url(retailer) %></td>
27
28
  <td><%= retailer.address %></td>
29
+ <td><%= retailer.state %></td>
28
30
  <td><%= retailer.email %></td>
29
31
  <td><%= retailer.phone %></td>
30
32
  <td>
@@ -8,7 +8,7 @@
8
8
 
9
9
  <% retailers.group_by(&:state).each do |state, state_retailers| %>
10
10
  <hr/>
11
- <h4 id="<%= state.downcase %>"><%= state %></h4>
11
+ <h4 id="<%= state.downcase %>"><%= @states[state] %></h4>
12
12
  <%= render :partial => 'retailer', :collection => state_retailers %>
13
13
  <% end %>
14
14
 
@@ -1,35 +1,39 @@
1
1
  <% if defined? retailer %>
2
2
  <div class="retailer">
3
- <%= image_tag retailer.logo.url, :alt => retailer.name, :class => 'thumb' if retailer.has_logo? %>
4
- <p>
5
- <b><%= retailer.has_url? ? link_to(retailer.name, retailer.url, :class => 'popup') : retailer.name %></b><br/>
6
- <%= retailer.address %>
7
-
8
- <% if retailer.has_address2? %>
9
- <br/>
10
- <%= retailer.address2 %>
11
- <% end %>
12
-
13
- <br/>
14
-
15
- <%= retailer.city %>,
16
- <%= retailer.state %>
17
- <%= retailer.zipcode %>
18
-
19
- <% if retailer.has_phone? %>
3
+ <div class="retailer-logo">
4
+ <%= image_tag retailer.logo.url, :alt => retailer.name, :class => 'thumb' if retailer.has_logo? %>
5
+ </div>
6
+ <div class="retailer-info">
7
+ <p>
8
+ <b><%= retailer.has_url? ? link_to(retailer.name, retailer.url, :class => 'popup') : retailer.name %></b><br/>
9
+ <%= retailer.address %>
10
+
11
+ <% if retailer.has_address2? %>
12
+ <br/>
13
+ <%= retailer.address2 %>
14
+ <% end %>
15
+
20
16
  <br/>
21
- <%= retailer.phone %>
22
- <% end %>
17
+
18
+ <%= retailer.city %>,
19
+ <%= retailer.state %>
20
+ <%= retailer.zipcode %>
23
21
 
24
- <% if retailer.has_email? %>
25
- <br/>
26
- <%= mail_to retailer.email %>
27
- <% end %>
28
-
29
- <% if retailer.has_url? %>
30
- <br/>
31
- <%= link_to retailer.url, retailer.url, :class => 'popup' %>
32
- <% end %>
33
- </p>
22
+ <% if retailer.has_phone? %>
23
+ <br/>
24
+ <%= retailer.phone %>
25
+ <% end %>
26
+
27
+ <% if retailer.has_email? %>
28
+ <br/>
29
+ <%= mail_to retailer.email %>
30
+ <% end %>
31
+
32
+ <% if retailer.has_url? %>
33
+ <br/>
34
+ <%= link_to retailer.url, retailer.url, :class => 'popup' %>
35
+ <% end %>
36
+ </p>
37
+ </div>
34
38
  </div>
35
39
  <% end %>
@@ -1,3 +1,3 @@
1
1
  module SpreeRetailers
2
- VERSION = "0.40.0.2"
2
+ VERSION = "0.40.0.4"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: spree_retailers
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.40.0.2
5
+ version: 0.40.0.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Spencer Steffen
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-02-08 00:00:00 -08:00
13
+ date: 2011-03-10 00:00:00 -08:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -90,7 +90,7 @@ dependencies:
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: *id007
93
- description: Spree Retailers adds a retailer page and admin to Spree.
93
+ description: Spree Retailers adds a retailer page and admin to Spree Commerce.
94
94
  email:
95
95
  - spencer@citrusme.com
96
96
  executables: []
@@ -139,7 +139,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
139
139
  requirements:
140
140
  - - ">="
141
141
  - !ruby/object:Gem::Version
142
- hash: 1791211122067461475
142
+ hash: -1846554186713783098
143
143
  segments:
144
144
  - 0
145
145
  version: "0"
@@ -148,14 +148,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  requirements:
149
149
  - - ">="
150
150
  - !ruby/object:Gem::Version
151
- hash: 1791211122067461475
151
+ hash: -1846554186713783098
152
152
  segments:
153
153
  - 0
154
154
  version: "0"
155
155
  requirements: []
156
156
 
157
157
  rubyforge_project:
158
- rubygems_version: 1.5.0
158
+ rubygems_version: 1.6.1
159
159
  signing_key:
160
160
  specification_version: 3
161
161
  summary: Spree Retailers adds a retailer admin to Spree.