From e616df5f74835cb280836e430411c4e29ae1f518 Mon Sep 17 00:00:00 2001 From: Valentino Date: Thu, 24 Mar 2011 11:03:14 -0400 Subject: [PATCH] Added public files and commented site_configuration so you can now install clean --- Gemfile.lock | 2 +- config/initializers/site_preferences.rb | 12 +- ...0100506185838_add_description_to_taxons.rb | 2 +- ...0101101185116_rename_columns_for_devise.rb | 38 - ...ve_trailing_slashes_in_taxon_permalinks.rb | 17 + db/sample/users.rb | 53 + db/schema.rb | 23 +- lib/spree_site.rb | 12 +- public/images/reorder.jpg | Bin 0 -> 9268 bytes .../javascripts/admin/unobtrusive_handlers.js | 28 + public/javascripts/application.js | 97 -- public/javascripts/checkout.js | 30 +- public/robots.txt | 9 + public/stylesheets/admin/admin-forms.css | 7 +- public/stylesheets/admin/admin.css | 6 + public/stylesheets/screen.css | 1079 +++++++++++++---- 16 files changed, 1017 insertions(+), 398 deletions(-) delete mode 100644 db/migrate/20101101185116_rename_columns_for_devise.rb create mode 100644 db/migrate/20110314192118_remove_trailing_slashes_in_taxon_permalinks.rb create mode 100644 db/sample/users.rb create mode 100644 public/images/reorder.jpg diff --git a/Gemfile.lock b/Gemfile.lock index 8320edc6..636506b1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -190,7 +190,7 @@ GEM faraday (0.5.7) addressable (~> 2.2.4) multipart-post (~> 1.1.0) - rack (>= 1.1.0, < 2) + rack (< 2, >= 1.1.0) ffi (1.0.7) rake (>= 0.8.7) gherkin (2.3.5) diff --git a/config/initializers/site_preferences.rb b/config/initializers/site_preferences.rb index 6752ef90..4de79252 100644 --- a/config/initializers/site_preferences.rb +++ b/config/initializers/site_preferences.rb @@ -1,7 +1,7 @@ -Spree::Config.set(:homepage_groups => 'Slingbox,Satellite Radios,Boomboxes,Accessories,Internet Radios,Vehicle Installation') -Spree::Config.set(:site_name => 'Rails Dog Radio') +#Spree::Config.set(:homepage_groups => 'Slingbox,Satellite Radios,Boomboxes,Accessories,Internet Radios,Vehicle Installation') +#Spree::Config.set(:site_name => 'Rails Dog Radio') -Spree::ActiveShipping::Config.set(:origin_country => "US") -Spree::ActiveShipping::Config.set(:origin_state => "MD") -Spree::ActiveShipping::Config.set(:origin_city => "Chevy Chase") -Spree::ActiveShipping::Config.set(:origin_zip => "20815") +#Spree::ActiveShipping::Config.set(:origin_country => "US") +#Spree::ActiveShipping::Config.set(:origin_state => "MD") +#Spree::ActiveShipping::Config.set(:origin_city => "Chevy Chase") +#Spree::ActiveShipping::Config.set(:origin_zip => "20815") diff --git a/db/migrate/20100506185838_add_description_to_taxons.rb b/db/migrate/20100506185838_add_description_to_taxons.rb index 9a047bd7..9bb85fbf 100644 --- a/db/migrate/20100506185838_add_description_to_taxons.rb +++ b/db/migrate/20100506185838_add_description_to_taxons.rb @@ -1,7 +1,7 @@ class AddDescriptionToTaxons < ActiveRecord::Migration def self.up # skip this migration if the attribute already exists because of advanced taxon extension - return if Taxon.new.respond_to? :description + return if column_exists?(:taxons, :description) add_column :taxons, :description, :text end diff --git a/db/migrate/20101101185116_rename_columns_for_devise.rb b/db/migrate/20101101185116_rename_columns_for_devise.rb deleted file mode 100644 index 231b94f1..00000000 --- a/db/migrate/20101101185116_rename_columns_for_devise.rb +++ /dev/null @@ -1,38 +0,0 @@ -class RenameColumnsForDevise < ActiveRecord::Migration - def self.up - rename_column :users, :crypted_password, :encrypted_password - rename_column :users, :salt, :password_salt - rename_column :users, :remember_token_expires_at, :remember_created_at - rename_column :users, :login_count, :sign_in_count - rename_column :users, :failed_login_count, :failed_attempts - rename_column :users, :single_access_token, :reset_password_token - rename_column :users, :current_login_at, :current_sign_in_at - rename_column :users, :last_login_at, :last_sign_in_at - rename_column :users, :current_login_ip, :current_sign_in_ip - rename_column :users, :last_login_ip, :last_sign_in_ip - add_column :users, :authentication_token, :string - add_column :users, :unlock_token, :string - add_column :users, :locked_at, :datetime - remove_column :users, :api_key - remove_column :users, :openid_identifier - end - - def self.down - remove_column :users, :authentication_token - remove_column :users, :locked_at - remove_column :users, :unlock_token - rename_column :table_name, :new_column_name, :column_name - rename_column :users, :last_sign_in_ip, :last_login_ip - rename_column :users, :current_sign_in_ip, :current_login_ip - rename_column :users, :last_sign_in_at, :last_login_at - rename_column :users, :current_sign_in_at, :current_login_at - rename_column :users, :reset_password_token, :single_access_token - rename_column :users, :failed_attempts, :failed_login_count - rename_column :users, :sign_in_count, :login_count - rename_column :users, :remember_created_at, :remember_token_expires_at - rename_column :users, :password_salt, :salt - rename_column :users, :encrypted_password, :crypted_password - add_column :users, :unlock_token, :string - add_column :users, :openid_identifier, :string - end -end diff --git a/db/migrate/20110314192118_remove_trailing_slashes_in_taxon_permalinks.rb b/db/migrate/20110314192118_remove_trailing_slashes_in_taxon_permalinks.rb new file mode 100644 index 00000000..286fa747 --- /dev/null +++ b/db/migrate/20110314192118_remove_trailing_slashes_in_taxon_permalinks.rb @@ -0,0 +1,17 @@ +class RemoveTrailingSlashesInTaxonPermalinks < ActiveRecord::Migration + def self.up + Taxon.find_each(:conditions => {}) do |t| + if t.permalink && t.permalink[-1..-1] == '/' + t.update_attribute(:permalink, t.permalink[0...-1]) + end + end + end + + def self.down + Taxon.find_each(:conditions => {}) do |t| + if t.permalink && t.permalink[-1..-1] != '/' + t.update_attribute(:permalink, t.permalink + '/') + end + end + end +end diff --git a/db/sample/users.rb b/db/sample/users.rb new file mode 100644 index 00000000..e3da03e4 --- /dev/null +++ b/db/sample/users.rb @@ -0,0 +1,53 @@ +# see last line where we create an admin if there is none, asking for email and password +def prompt_for_admin_password + password = ask('Password [spree123]: ', String) do |q| + q.echo = false + q.validate = /^(|.{5,40})$/ + q.responses[:not_valid] = "Invalid password. Must be at least 5 characters long." + q.whitespace = :strip + end + password = "spree123" if password.blank? + password +end + +def prompt_for_admin_email + email = ask('Email [spree@example.com]: ', String) do |q| + q.echo = true + q.whitespace = :strip + end + email = "spree@example.com" if email.blank? + email +end + +def create_admin_user + if ENV['AUTO_ACCEPT'] + password = "spree123" + email = "spree@example.com" + else + require 'highline/import' + puts "Create the admin user (press enter for defaults)." + #name = prompt_for_admin_name unless name + email = prompt_for_admin_email + password = prompt_for_admin_password + end + attributes = { + :password => password, + :password_confirmation => password, + :email => email, + :login => email + } + + load 'user.rb' + + if User.find_by_email(email) + say "\nWARNING: There is already a user with the email: #{email}, so no account changes were made. If you wish to create an additional admin user, please run rake db:admin:create again with a different email.\n\n" + else + admin = User.create(attributes) + # create an admin role and and assign the admin user to that role + role = Role.find_or_create_by_name "admin" + admin.roles << role + admin.save + end +end + +create_admin_user if User.where("roles.name" => 'admin').includes(:roles).empty? \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index 71053e00..f5837ee5 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20110125135821) do +ActiveRecord::Schema.define(:version => 20110314192118) do create_table "addresses", :force => true do |t| t.string "firstname" @@ -326,7 +326,7 @@ add_index "product_scopes", ["product_group_id"], :name => "index_product_scopes_on_product_group_id" create_table "products", :force => true do |t| - t.string "name", :null => false + t.string "name", :default => "", :null => false t.text "description" t.datetime "created_at" t.datetime "updated_at" @@ -337,7 +337,7 @@ t.datetime "deleted_at" t.string "meta_description" t.string "meta_keywords" - t.integer "count_on_hand", :default => 0, :null => false + t.integer "count_on_hand", :default => 0, :null => false t.decimal "rrp", :precision => 8, :scale => 2 end @@ -523,10 +523,10 @@ end create_table "taxons", :force => true do |t| - t.integer "taxonomy_id", :null => false + t.integer "taxonomy_id", :null => false t.integer "parent_id" - t.integer "position", :default => 0 - t.string "name", :null => false + t.integer "position", :default => 0 + t.string "name", :null => false t.datetime "created_at" t.datetime "updated_at" t.string "permalink" @@ -537,15 +537,6 @@ t.integer "icon_file_size" t.datetime "icon_updated_at" t.text "description" - t.boolean "hidden", :default => false - t.boolean "disabled", :default => false - t.string "short_name" - t.boolean "homepage", :default => false - t.string "display_style" - t.string "banner_file_name" - t.string "banner_content_type" - t.integer "banner_file_size" - t.datetime "banner_updated_at" end add_index "taxons", ["parent_id"], :name => "index_taxons_on_parent_id" @@ -609,7 +600,7 @@ create_table "variants", :force => true do |t| t.integer "product_id" - t.string "sku", :null => false + t.string "sku", :default => "", :null => false t.decimal "price", :precision => 8, :scale => 2, :null => false t.decimal "weight", :precision => 8, :scale => 2 t.decimal "height", :precision => 8, :scale => 2 diff --git a/lib/spree_site.rb b/lib/spree_site.rb index fcbe9b86..03e83a39 100644 --- a/lib/spree_site.rb +++ b/lib/spree_site.rb @@ -1,12 +1,12 @@ module SpreeSite class Engine < Rails::Engine def self.activate - - Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c| - Rails.configuration.cache_classes ? require(c) : load(c) - end - + # Add your custom site logic here end + + def load_tasks + end + config.to_prepare &method(:activate).to_proc end -end +end \ No newline at end of file diff --git a/public/images/reorder.jpg b/public/images/reorder.jpg new file mode 100644 index 0000000000000000000000000000000000000000..dd3653460293504820e7fea53979d3908452f058 GIT binary patch literal 9268 zcmeGiYj9Il`rN$JmbU4Gr|Vu)UOKjUHEol%lqM~0kwEE#m%}(WH@9gZ$qo13v?)8N zJQQ_iXBI(Je(VUMAmgk9;(JF#LB$=%1yKQ)S@12pD2VuA#q4)Za&MASg~4@nc6&1S z-0ytfcfRv|-}%mW&dt5a!^sosz0HYG4?;d4x)vd1Km`;+YJe#8Td1fsd=j|t;@EJie_x1`m$|PQL+r` zW|bmaH8mv;wZa`dmbxboCr_aQV$V%pA5tYhLxrS;0=HtmSDSa0m&DT z$$*Mbp_(!ym5EZDsN^v)l1lES8bC`eMG7d4iy9(Eqt)pR#=LxLFp)wkwM;BVl!j8P zG%BrLXV9t(96&UwHRDTc+QvCdsd?!NyRK~QrX8M&3FRGo{Elj2qBynf4VyYAV0=z}jGdSc&OAD)}r z(|7xZho5};?T@~yZJ8JBUvux)r(SvIm(|Sx0Pr>gQezDt$oGX zGOWR#jsvG16Z|KHm3MnP%UQAd%tRelKtIX(;z3a2!BK(c?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