Skip to content

Commit

Permalink
Added public files and commented site_configuration so you can now in…
Browse files Browse the repository at this point in the history
…stall clean
  • Loading branch information
Valentino authored and Valentino committed Mar 24, 2011
1 parent 6ac8f96 commit e616df5
Show file tree
Hide file tree
Showing 16 changed files with 1,017 additions and 398 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions 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")
2 changes: 1 addition & 1 deletion 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

Expand Down
38 changes: 0 additions & 38 deletions db/migrate/20101101185116_rename_columns_for_devise.rb

This file was deleted.

@@ -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
53 changes: 53 additions & 0 deletions 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?
23 changes: 7 additions & 16 deletions db/schema.rb
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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

Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions 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
Binary file added public/images/reorder.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions public/javascripts/admin/unobtrusive_handlers.js
Expand Up @@ -12,4 +12,32 @@ $(document).ready(function(){
return false;
});


jQuery('table.sortable').ready(function(){
jQuery('table.sortable tbody').sortable(
{
handle: '.handle',
update: function(event, ui) {
$("#progress").show();
positions = {};
type = '';
jQuery.each(jQuery('table.sortable tbody tr'), function(position, obj){
reg = /(\w+_?)+_(\d+)/;
parts = reg.exec(jQuery(obj).attr('id'));
if (parts) {
positions['positions['+parts[2]+']'] = position;
type = parts[1];
}
});
jQuery.ajax({
type: 'POST',
dataType: 'script',
url: type+'s/update_positions',
data: positions,
success: function(data){ $("#progress").hide(); }
});
}
});
});

});
97 changes: 0 additions & 97 deletions public/javascripts/application.js
@@ -1,28 +1,5 @@
(function($){
$(document).ready(function(){
//homepabe banner carousel
$('div#banner section div').jCarouselLite({
btnNext: "#banner-nav .last",
btnPrev: "#banner-nav .first",
visible: 1,
auto: 3000,
speed: 1000,
btnGo:
["#b1_handle", "#b2_handle",
"#b3_handle", "#b4_handle"],
afterEnd: function(a) {
$('#banner-nav li.current').removeClass('current');

var handle = $('#' + a.attr('id') + '_handle');
handle.addClass('current');
}

});

//pause scrolling after click of controls
$('nav#banner-nav a').click(function(){
$('div#banner section div').trigger('pauseCarousel');
});

// Remove an item from the cart by setting its quantity to zero and posting the update form
$('form#updatecart a.delete').show().click(function(){
Expand All @@ -31,79 +8,5 @@
return false;
});


// add handler for mousing over thumbnails
$("#main-image").data('selectedThumb', $('#main-image img').attr('src'));
$('ul.thumbnails li').eq(0).addClass('selected');
$('ul.thumbnails li a').click(function() {
$("#main-image").data('selectedThumb', $(this).attr('data-product-image'));
$('ul.thumbnails li').removeClass('selected');
$(this).parent('li').addClass('selected');
}).hover(
function() {
$("a[rel='facebox']").attr('href', $(this).attr('href'));
$("a[rel='facebox']").fancybox();

$('#main-image img').attr('src', $(this).attr('data-product-image'));
},
function() {
$('#main-image img').attr('src', $("#main-image").data('selectedThumb'));
}
);

// add light box
$("a[rel='product_images']").fancybox({
'transitionIn' : 'elastic',
'transitionOut' : 'elastic'
});



$("a[rel='facebox']").fancybox();


//wishlist


//handle wishlist edit link (show / hide form)
$('a#edit_wishlist_link').click(function(){
if($('#edit_wishlist').is(':visible')){
$('#edit_wishlist').slideUp();
}else{
$('#edit_wishlist').slideDown();
}

return false;
});

//handle move item link
$('.move_item a.button').click(function(){
var move_button = $(this);
move_button.hide();
move_button.parent().find('form').fadeIn();
return false;
});



//search box
if(!$.browser.webkit){
var $input = $('#s1');
var placeholder = $input.attr('placeholder');
$input.focus(function(){
if($input.val() == placeholder){
$input.val('');
$input.removeClass('empty');
}
});
$input.blur(function(){
if($.trim($input.val()) == ""){
$input.val(placeholder);
$input.addClass('empty');
}
});
$input.triggerHandler('blur');
}

});
})(jQuery);

0 comments on commit e616df5

Please sign in to comment.