cafepress_wrapper 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/Gemfile +33 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +33 -0
  5. data/app/controllers/content_controller.rb +26 -0
  6. data/app/controllers/products_controller.rb +30 -0
  7. data/app/controllers/sitemap_controller.rb +26 -0
  8. data/app/controllers/stores_controller.rb +37 -0
  9. data/app/models/image_url.rb +3 -0
  10. data/app/models/product.rb +89 -0
  11. data/app/models/size.rb +3 -0
  12. data/app/models/store.rb +91 -0
  13. data/app/models/user_token.rb +36 -0
  14. data/app/views/content/about.html.erb +71 -0
  15. data/app/views/content/contact.html.erb +30 -0
  16. data/app/views/layouts/cafepress_wrapper.html.erb +75 -0
  17. data/app/views/products/show.rjs +14 -0
  18. data/app/views/sitemap/index.xml.erb +39 -0
  19. data/app/views/stores/_front_back_image.html.erb +15 -0
  20. data/app/views/stores/_product_details.html.erb +71 -0
  21. data/app/views/stores/feed.rss.builder +43 -0
  22. data/app/views/stores/index.html.erb +45 -0
  23. data/app/views/stores/show.html.erb +83 -0
  24. data/config/initializers/cafepress.rb +23 -0
  25. data/config/routes.rb +13 -0
  26. data/lib/cafepress_wrapper.rb +21 -0
  27. data/lib/db/migrate/20101103152700_create_user_tokens.rb +13 -0
  28. data/lib/db/migrate/20101104032051_create_stores.rb +13 -0
  29. data/lib/db/migrate/20101104032412_create_products.rb +16 -0
  30. data/lib/db/migrate/20101111004355_add_description_to_store.rb +9 -0
  31. data/lib/db/migrate/20101111025931_add_cafepress_design_id_to_products.rb +9 -0
  32. data/lib/db/migrate/20101119163852_add_cafepress_design_url_to_stores.rb +9 -0
  33. data/lib/db/migrate/20101119171328_add_design_background_color_to_stores.rb +9 -0
  34. data/lib/db/migrate/20101120003908_add_cafepress_back_design_id_to_products.rb +9 -0
  35. data/lib/db/migrate/20101123021036_add_cafepress_back_design_url_to_stores.rb +9 -0
  36. data/lib/db/migrate/20110301072358_add_gender_to_products.rb +9 -0
  37. data/lib/db/migrate/20110302191748_create_thumbnail_urls.rb +14 -0
  38. data/lib/db/migrate/20110302195801_add_view_to_thumbnail_urls.rb +9 -0
  39. data/lib/db/migrate/20110305004142_rename_thumbnail_urls_to_image_urls.rb +9 -0
  40. data/lib/db/migrate/20110305004402_add_image_size_to_image_urls.rb +9 -0
  41. data/lib/db/migrate/20110307005237_add_cafepress_merchandise_id_to_products.rb +9 -0
  42. data/lib/db/migrate/20110307014703_add_default_color_id_to_products.rb +9 -0
  43. data/lib/db/migrate/20110307063709_create_sizes.rb +16 -0
  44. data/lib/db/migrate/20110307064131_add_default_cafepress_size_id_to_products.rb +9 -0
  45. data/lib/db/migrate/20110308010304_add_title_to_stores.rb +9 -0
  46. data/lib/db/migrate/20110308050955_add_price_to_products.rb +9 -0
  47. data/lib/tasks/cafepress_wrapper.rake +48 -0
  48. data/public/images/ajax-loader.gif +0 -0
  49. data/public/images/back_bg.png +0 -0
  50. data/public/images/cart.png +0 -0
  51. data/public/images/fabric_bg.png +0 -0
  52. data/public/images/footer_bg.png +0 -0
  53. data/public/images/front_bg.png +0 -0
  54. data/public/images/header_bg.png +0 -0
  55. data/public/javascripts/cafepress_wrapper.js +118 -0
  56. data/public/stylesheets/cafepress_wrapper.css +473 -0
  57. metadata +137 -0
data/Gemfile ADDED
@@ -0,0 +1,33 @@
1
+ source 'http://rubygems.org'
2
+ gemspec
3
+ # gem 'rails', '3.0.1'
4
+ #
5
+ # # Bundle edge Rails instead:
6
+ # # gem 'rails', :git => 'git://github.com/rails/rails.git'
7
+ #
8
+ # #gem 'sqlite3-ruby', :require => 'sqlite3'
9
+ # gem 'pg'
10
+ #
11
+ # # Use unicorn as the web server
12
+ # # gem 'unicorn'
13
+ #
14
+ # # Deploy with Capistrano
15
+ # # gem 'capistrano'
16
+ #
17
+ # # To use debugger
18
+ # gem 'ruby-debug'
19
+ #
20
+ # # Bundle the extra gems:
21
+ # # gem 'bj'
22
+ # # gem 'nokogiri'
23
+ # # gem 'sqlite3-ruby', :require => 'sqlite3'
24
+ # # gem 'aws-s3', :require => 'aws/s3'
25
+ #
26
+ # # Bundle gems for the local environment. Make sure to
27
+ # # put test-only gems in this group so their generators
28
+ # # and rake tasks are available in development mode:
29
+ # # group :development, :test do
30
+ # # gem 'webrat'
31
+ # # end
32
+ #
33
+ # gem 'cafepress_api'
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2011 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = CafepressWrapper
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,33 @@
1
+ # encoding: UTF-8
2
+ require 'rubygems'
3
+
4
+ require 'rake'
5
+ require 'rake/rdoctask'
6
+
7
+ require 'rake/testtask'
8
+
9
+ begin
10
+ require 'bundler/setup'
11
+ rescue LoadError
12
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
13
+ end
14
+
15
+ Rake::TestTask.new(:test) do |t|
16
+ t.libs << 'lib'
17
+ t.libs << 'test'
18
+ t.pattern = 'test/**/*_test.rb'
19
+ t.verbose = false
20
+ end
21
+
22
+ task :default => :test
23
+
24
+ Rake::RDocTask.new(:rdoc) do |rdoc|
25
+ rdoc.rdoc_dir = 'rdoc'
26
+ rdoc.title = 'CafepressWrapper'
27
+ rdoc.options << '--line-numbers' << '--inline-source'
28
+ rdoc.rdoc_files.include('README.rdoc')
29
+ rdoc.rdoc_files.include('lib/**/*.rb')
30
+ end
31
+
32
+ require 'bundler'
33
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,26 @@
1
+ # Copyright 2010 Benjamin Lee Smith <benjamin.lee.smith@gmail.com>
2
+ #
3
+ # This file is part of CafePress Wrapper.
4
+ # CafePress Wrapper is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # CafePress Wrapper is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with CafePress Wrapper. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ class ContentController < ApplicationController
18
+ layout 'cafepress_wrapper'
19
+
20
+ def about
21
+ end
22
+
23
+ def contact
24
+ end
25
+
26
+ end
@@ -0,0 +1,30 @@
1
+ # Copyright 2010 Benjamin Lee Smith <benjamin.lee.smith@gmail.com>
2
+ #
3
+ # This file is part of CafePress Wrapper.
4
+ # CafePress Wrapper is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # CafePress Wrapper is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with CafePress Wrapper. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ class ProductsController < ApplicationController
18
+ layout 'cafepress_wrapper'
19
+
20
+ respond_to :js
21
+ def show
22
+ respond_to do |format|
23
+ format.js {@product = Product.find(params[:id])}
24
+ format.html {
25
+ product = Product.find(params[:id])
26
+ redirect_to store_url(product.store, :product_id => product.id)
27
+ }
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,26 @@
1
+ # Copyright 2010 Benjamin Lee Smith <benjamin.lee.smith@gmail.com>
2
+ #
3
+ # This file is part of CafePress Wrapper.
4
+ # CafePress Wrapper is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # CafePress Wrapper is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with CafePress Wrapper. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ class SitemapController < ApplicationController
18
+ layout nil
19
+
20
+ def index
21
+ headers['Content-Type'] = 'application/xml'
22
+ respond_to do |format|
23
+ format.xml { @stores = Store.all }
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,37 @@
1
+ # Copyright 2010 Benjamin Lee Smith <benjamin.lee.smith@gmail.com>
2
+ #
3
+ # This file is part of CafePress Wrapper.
4
+ # CafePress Wrapper is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # CafePress Wrapper is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with CafePress Wrapper. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ class StoresController < ApplicationController
18
+ layout 'cafepress_wrapper'
19
+
20
+ def show
21
+ @store = Store.find(params[:id])
22
+ if params[:product_id]
23
+ @product = Product.find(params[:product_id])
24
+ else
25
+ @product = @store.mens_products.first || @store.womens_products.first || @store.unisex_products.first
26
+ end
27
+
28
+ end
29
+
30
+ def index
31
+ @stores = Store.all(:order => 'updated_at DESC')
32
+ end
33
+
34
+ def feed
35
+ @stores = Store.all(:order => 'created_at DESC')
36
+ end
37
+ end
@@ -0,0 +1,3 @@
1
+ class ImageUrl < ActiveRecord::Base
2
+ belongs_to :product
3
+ end
@@ -0,0 +1,89 @@
1
+ # Copyright 2010 Benjamin Lee Smith <benjamin.lee.smith@gmail.com>
2
+ #
3
+ # This file is part of CafePress Wrapper.
4
+ # CafePress Wrapper is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # CafePress Wrapper is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with CafePress Wrapper. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ class Product < ActiveRecord::Base
18
+ belongs_to :store
19
+ has_many :image_urls, :dependent => :destroy
20
+ has_many :sizes, :dependent => :destroy
21
+
22
+ THUMBNAIL_IMAGE_SIZE = '100'
23
+ LARGE_IMAGE_SIZE = '350'
24
+
25
+ def front_thumbnail_urls
26
+ image_urls.find_all_by_view_and_size(CafePressAPI::FRONT_PRODUCT_VIEW, THUMBNAIL_IMAGE_SIZE)
27
+ end
28
+
29
+ def default_front_image
30
+ if default_color_id
31
+ image_urls.find_by_view_and_size_and_color_id(CafePressAPI::FRONT_PRODUCT_VIEW, LARGE_IMAGE_SIZE, default_color_id)
32
+ else
33
+ # Sometimes there is no default color returned from the API, so just pick one
34
+ image_urls.find_by_view_and_size(CafePressAPI::FRONT_PRODUCT_VIEW, LARGE_IMAGE_SIZE)
35
+ end
36
+ end
37
+
38
+ def default_back_image
39
+ if default_color_id
40
+ image_urls.find_by_view_and_size_and_color_id(CafePressAPI::BACK_PRODUCT_VIEW, LARGE_IMAGE_SIZE, default_color_id)
41
+ else
42
+ # Sometimes there is no default color returned from the API, so just pick one
43
+ image_urls.find_by_view_and_size(CafePressAPI::BACK_PRODUCT_VIEW, LARGE_IMAGE_SIZE)
44
+ end
45
+ end
46
+
47
+
48
+ def front_image_url_for_color(color_id)
49
+ image_urls.find_by_view_and_size_and_color_id(CafePressAPI::FRONT_PRODUCT_VIEW, LARGE_IMAGE_SIZE, color_id).url
50
+ end
51
+
52
+ def back_image_url_for_color(color_id)
53
+ image_urls.find_by_view_and_size_and_color_id(CafePressAPI::BACK_PRODUCT_VIEW, LARGE_IMAGE_SIZE, color_id).url
54
+ end
55
+
56
+
57
+ def color_ids
58
+ front_thumbnail_urls.map(&:color_id)
59
+ end
60
+
61
+ def default_front_thumbnail_url
62
+ if default_color_id
63
+ image_urls.find_by_view_and_size_and_color_id(CafePressAPI::FRONT_PRODUCT_VIEW, THUMBNAIL_IMAGE_SIZE, default_color_id).url
64
+ else
65
+ # Sometimes there is no default color returned from the API, so just pick one
66
+ image_urls.find_by_view_and_size(CafePressAPI::FRONT_PRODUCT_VIEW, THUMBNAIL_IMAGE_SIZE).url
67
+ end
68
+ end
69
+
70
+ def sizes_array
71
+ sizes.collect{|s| [s.full_name, s.cafepress_size_id]}
72
+ end
73
+
74
+ def available_in_multiple_colors?
75
+ color_ids.length > 1
76
+ end
77
+
78
+ def has_sizes?
79
+ sizes.length > 0
80
+ end
81
+
82
+ def better_default_caption
83
+ default_caption.gsub('(dark)','').strip
84
+ end
85
+
86
+ def has_back_design?
87
+ store.cafepress_back_design_url
88
+ end
89
+ end
@@ -0,0 +1,3 @@
1
+ class Size < ActiveRecord::Base
2
+ belongs_to :product
3
+ end
@@ -0,0 +1,91 @@
1
+ # Copyright 2010 Benjamin Lee Smith <benjamin.lee.smith@gmail.com>
2
+ #
3
+ # This file is part of CafePress Wrapper.
4
+ # CafePress Wrapper is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # CafePress Wrapper is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with CafePress Wrapper. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ class Store < ActiveRecord::Base
18
+ validates_uniqueness_of :cafepress_store_id
19
+ has_many :products
20
+
21
+ def self.load_cafepress_store(cafepress_store_id)
22
+ store = Store.find_or_create_by_cafepress_store_id(cafepress_store_id)
23
+ cafepress_store_attributes = CafePressAPI.get_store(cafepress_store_id)
24
+ store.description = cafepress_store_attributes[:description]
25
+ store.title = cafepress_store_attributes[:title]
26
+ store.save!
27
+ store
28
+ end
29
+
30
+ def self.load_cafepress_store_and_products(cafepress_store_id)
31
+ store = Store.load_cafepress_store(cafepress_store_id)
32
+
33
+ store.products.destroy_all
34
+
35
+ cafepress_store_products = CafePressAPI.get_store_products(cafepress_store_id)
36
+
37
+ cafepress_store_products.each do |cp_product_attributes|
38
+ # pull thumbnails out of hash
39
+ image_urls = cp_product_attributes.delete(:image_urls)
40
+
41
+ # pull sizes out of hash
42
+ sizes = cp_product_attributes.delete(:sizes)
43
+
44
+ # create product
45
+ product = store.products.build(cp_product_attributes)
46
+
47
+ # add thumbnails to product
48
+ image_urls.each do |image_url_attributes|
49
+ product.image_urls.build(image_url_attributes)
50
+ end
51
+
52
+ # add sizes to product
53
+ sizes.each do |size_attributes|
54
+ product.sizes.build(size_attributes)
55
+ end
56
+ end
57
+
58
+ store.save!
59
+ store
60
+
61
+ design_url = CafePressAPI.get_design_url(store.products.first.cafepress_design_id)
62
+ store.update_attributes(:cafepress_design_url => design_url)
63
+
64
+ if store.products.first.cafepress_back_design_id
65
+ design_url = CafePressAPI.get_design_url(store.products.first.cafepress_back_design_id)
66
+ store.update_attributes(:cafepress_back_design_url => design_url)
67
+ end
68
+ end
69
+
70
+ def mens_products
71
+ products.find_all_by_gender(CafePressAPI::MALE)
72
+ end
73
+
74
+ def womens_products
75
+ products.find_all_by_gender(CafePressAPI::FEMALE)
76
+ end
77
+
78
+ def unisex_products
79
+ products.find_all_by_gender(CafePressAPI::UNISEX)
80
+ end
81
+
82
+ def load_cafepress_data
83
+ Store.load_cafepress_store_and_products(self.cafepress_store_id)
84
+ end
85
+
86
+ def self.load_all_stores_cafepress_data
87
+ Store.all.each do |store|
88
+ store.load_cafepress_data
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,36 @@
1
+ # Copyright 2010 Benjamin Lee Smith <benjamin.lee.smith@gmail.com>
2
+ #
3
+ # This file is part of CafePress Wrapper.
4
+ # CafePress Wrapper is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # CafePress Wrapper is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with CafePress Wrapper. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ class UserToken < ActiveRecord::Base
18
+ def self.set_token(user_token)
19
+ if (ut = UserToken.first)
20
+ ut.update_attributes(:token => user_token)
21
+ else
22
+ ut = UserToken.create(:token => user_token)
23
+ end
24
+ ut
25
+ end
26
+
27
+ def self.get_user_token
28
+ ut = UserToken.first
29
+ if ut && 30.minutes.ago < ut.updated_at
30
+ user_token = ut.token
31
+ else
32
+ user_token = UserToken.set_token(CafePress.user_token).token
33
+ end
34
+ user_token
35
+ end
36
+ end
@@ -0,0 +1,71 @@
1
+ <%
2
+ # Copyright 2010 Benjamin Lee Smith <benjamin.lee.smith@gmail.com>
3
+ #
4
+ # This file is part of CafePress Wrapper.
5
+ # CafePress Wrapper is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # CafePress Wrapper is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with CafePress Wrapper. If not, see <http://www.gnu.org/licenses/>.
17
+ %>
18
+
19
+ <% content_for :title, 'About the shirts, the creator, and the site.' %>
20
+
21
+ <div id="about">
22
+ <h1>About the Shirts</h1>
23
+ <p>
24
+ All designs are available in a variety of sizes and colors for both men and
25
+ women via <%= link_to 'CafePress', 'http://www.cafepress.com/', :target => '_new' %>.
26
+ CafePress does an excellent job of printing shirts. The designs are very durable,
27
+ and will often out last the shirt fabric they are printed on.
28
+ </p>
29
+ <p>
30
+ The prices range from $10 for a basic Jersey Ringer style shirt, to $38 for a
31
+ Hoodie. Sadly, the prices are on the expensive side. Even more sad is the fact
32
+ that I only make 10% of each sale while the rest goes to CafePress.
33
+ </p>
34
+ <p>
35
+ One day, I would love to print these shirts myself. Or maybe a company like
36
+ Black Diamond or Metolius will pay me to design shirts for them! Until then,
37
+ CafePress will have to do.
38
+ </p>
39
+
40
+ <h1>About Me</h1>
41
+ <p>
42
+ My name is Benjamin Smith. I am, of course, an avid climber. Ever since June
43
+ 6th of 2010, my girlfriend Erin and I have been on a road trip around the US
44
+ and Canada, climbing, surfing, and searching for a new place to live. You can
45
+ read about our travels on our blog: <%= link_to 'benanderininabus.com', 'http://benanderininabus.com/', :target => '_blog' %>
46
+ </p>
47
+
48
+ <p>
49
+ When I'm not traveling, I work as a web developer usually doing Ruby on Rails
50
+ work. You can check me out on <%= link_to 'LinkedIn', 'http://www.linkedin.com/in/benjaminleesmith', :target => '_linkedin' %>,
51
+ or check out my open source projects on <%= link_to 'GitHub', 'https://github.com/benjaminleesmith', :target => '_github' %>.
52
+ I also dabble in a bit of photography. Mostly as a hobby which doesn't make me
53
+ much money, but I do enjoy it. Especially when I combine it with climbing:
54
+ <%= link_to 'benjaminsmithphotography.com', 'http://benjaminsmithphotography.com/', :target => '_portfolio' %>
55
+ </p>
56
+
57
+ <h1>About the Site</h1>
58
+ <p>
59
+ The site was built using <%= link_to('Rails 3', 'http://www.rubyonrails.org/', :target => '_rails') %>,
60
+ is deployed on <%= link_to('Heroku', 'http://heroku.com/', :target => '_heroku') %>,
61
+ and is a work in progress. It uses the <%= link_to('CafePress API', 'http://developer.cafepress.com/docs', :target => '_cafepress') %>
62
+ to pull resources for the shirt design. The source code for the site can be found
63
+ on GitHub: <%= link_to('https://github.com/benjaminleesmith/cafepress_wrapper', 'https://github.com/benjaminleesmith/cafepress_wrapper', :target => '_github') %>
64
+ </p>
65
+
66
+ <p>
67
+ The picture at the top of the site is The Elephant Perch in the Sawtooth Mountains
68
+ in Idaho. The silhouette at the bottom of the site is Castleton Tower, The Priest
69
+ and The Rectory in Moab, Utah.
70
+ </p>
71
+ </div>
@@ -0,0 +1,30 @@
1
+ <%
2
+ # Copyright 2010 Benjamin Lee Smith <benjamin.lee.smith@gmail.com>
3
+ #
4
+ # This file is part of CafePress Wrapper.
5
+ # CafePress Wrapper is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # CafePress Wrapper is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with CafePress Wrapper. If not, see <http://www.gnu.org/licenses/>.
17
+ %>
18
+
19
+ <% content_for :title, 'Contact' %>
20
+
21
+ <div id="contact">
22
+ <h1>Contact</h1>
23
+ <p>
24
+ You can email me at <%= link_to('benjamin.lee.smith@gmail.com', 'mailto:benjamin.lee.smith@gmail.com') %>
25
+ or just look for my ugly mug at the crag...
26
+ </p>
27
+ <p>
28
+ <a href="http://www.flickr.com/photos/benjaminsmith/4839622122/" title="Lover's Leap by benjamin.smith, on Flickr"><img src="http://farm5.static.flickr.com/4091/4839622122_a2b5cc5a97.jpg" width="375" height="500" alt="Lover's Leap" /></a>
29
+ </p>
30
+ </div>
@@ -0,0 +1,75 @@
1
+ <!DOCTYPE html>
2
+ <%
3
+ # Copyright 2010 Benjamin Lee Smith <benjamin.lee.smith@gmail.com>
4
+ #
5
+ # This file is part of CafePress Wrapper.
6
+ # CafePress Wrapper is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # CafePress Wrapper is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with CafePress Wrapper. If not, see <http://www.gnu.org/licenses/>.
18
+ %>
19
+ <html>
20
+ <head>
21
+ <title>Rock Climbing Shirts - <%= yield :title %></title>
22
+ <%= stylesheet_link_tag :all %>
23
+ <%= javascript_include_tag :defaults %>
24
+ <%= javascript_include_tag 'cafepress_wrapper' %>
25
+ <%= csrf_meta_tag %>
26
+ <meta name="description" content="Hilarious, sweet, and all around kickass shirts for every type of rock climber." />
27
+ <link rel="alternate" type="application/rss+xml" title="Rock Climbing Shirts - <%= yield :title %>" href="/feed.rss" />
28
+ <script type="text/javascript">
29
+
30
+ var _gaq = _gaq || [];
31
+ _gaq.push(['_setAccount', '<%= ::CAFEPRESS_CONFIG['google_analytics'] %>']);
32
+ _gaq.push(['_trackPageview']);
33
+
34
+ (function() {
35
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
36
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
37
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
38
+ })();
39
+
40
+ </script>
41
+ </head>
42
+ <body>
43
+ <div id="header">
44
+ <div class="menu">
45
+ <ul>
46
+ <li class="first"><%= link_to 'Home', root_url %></li>
47
+ <li><%= link_to 'Photos', 'http://www.flickr.com/photos/benjaminsmith/tags/tshirt/show/', :target => '_flickr' %></li>
48
+ <li><%= link_to 'About', content_about_path %></li>
49
+ <li><%= link_to 'Contact', content_contact_path %></li>
50
+ <li><%= link_to 'RSS', '/feed.rss' %></li>
51
+ </ul>
52
+ </div>
53
+ </div>
54
+ <div id="content">
55
+ <div id="cart">
56
+ <%= link_to("#{CafePressAPI::VIEW_CART_BASE_URL}?s=search&keepshopping=#{u(request.url)}") do%>
57
+ <div class="text">Checkout/View Cart</div>
58
+ <div class="image"><%= image_tag('cart.png', :width => '32px', :height => '32px') %></div>
59
+ <% end %>
60
+ </div>
61
+ <%= yield %>
62
+ </div>
63
+ <div id="footer">
64
+ <div class="menu">
65
+ <ul>
66
+ <li><%= link_to 'Home', root_url %></li>
67
+ <li><%= link_to 'Photos', 'http://www.flickr.com/photos/benjaminsmith/tags/tshirt/show/', :target => '_flickr' %></li>
68
+ <li><%= link_to 'About', content_about_path %></li>
69
+ <li><%= link_to 'Contact', content_contact_path %></li>
70
+ <li><%= link_to 'RSS', '/feed.rss' %></li>
71
+ </ul>
72
+ </div>
73
+ </div>
74
+ </body>
75
+ </html>
@@ -0,0 +1,14 @@
1
+ # this should be refactored.
2
+ # if a color id was passed in, just replace the image
3
+ # else replace the whole product
4
+ if params[:color_id]
5
+ if @product.has_back_design?
6
+ page.replace_html 'image', render(:partial => '/stores/front_back_image', :locals => {:product => @product, :color_id => params[:color_id]})
7
+ else
8
+ page.replace_html 'image', image_tag(@product.front_image_url_for_color(params[:color_id]), :alt => '')
9
+ end
10
+ page.call 'CPW.update_selected_color', params[:color_id]
11
+ else
12
+ page.replace_html 'moving_div', render(:partial => '/stores/product_details', :locals => {:product => @product})
13
+ page.call 'CPW.bind_color_name_events'
14
+ end