10 Commits

Author SHA1 Message Date
Michael Bianco
8a12e1c25e Running tests, and fixing breaking changes, for 1.2.3 2013-03-10 09:47:35 -04:00
Michael Bianco
f6d5812379 Merge pull request #32 from jdutil/patch-1
Fix README link.
2013-02-12 13:06:25 -08:00
Jeff Dutil
e2f33cd006 Fix README link.
Also add shell syntax highlighting.
2013-02-09 14:01:39 -05:00
Michael Bianco
9360c63503 Fixing deface name typo 2013-01-28 10:01:39 -05:00
Dave Mitchell
b381ede8e1 Convert 1.9 to 1.8 syntax. Fixes #23 2013-01-08 13:41:07 -05:00
Michael Bianco
37fe465dd9 Updating documentation. Adding nginx send_file info 2012-11-06 11:34:28 -05:00
Michael Bianco
23317eb0fb Adding button to order admin to reset digital downloads
* Resets expire time
* Resets download count
2012-11-01 17:36:47 -04:00
Michael Bianco
4dc2d9d54f Minor improvement to digital factory 2012-10-29 13:05:35 -04:00
Michael Bianco
446a23ce3a Adding Spree::Order#reset_digital_links! to ease in handling customer support
Hope to add this as a button to the admin soon.
2012-10-29 13:04:39 -04:00
Michael Bianco
fdd8536b5b Tests passing on 1.2 2012-10-29 12:55:37 -04:00
11 changed files with 46 additions and 19 deletions

View File

@@ -9,4 +9,4 @@ group :test do
end
end
gem 'spree', '~> 1.1.3'
gem 'spree', '~> 1.2.3'

View File

@@ -1,6 +1,6 @@
module Spree
class Admin::DigitalsController < Spree::Admin::ResourceController
belongs_to "spree/product", find_by: :permalink
belongs_to "spree/product", :find_by => :permalink
protected
def location_after_save

View File

@@ -0,0 +1,7 @@
Spree::Admin::OrdersController.class_eval do
def reset_digitals
@order.reset_digital_links!
flash[:notice] = t(:downloads_reset)
redirect_to admin_order_url(@order)
end
end

View File

@@ -10,8 +10,14 @@ Spree::Order.class_eval do
false
end
# UPGRADE_CHECK this works as of spree 1.1.1; make sure to check the original function on upgrade
def reset_digital_links!
line_items.select(&:digital?).map(&:digital_links).flatten.each do |digital_link|
digital_link.update_column :access_counter, 0
digital_link.update_column :created_at, Time.now
end
end
# UPGRADE_CHECK this works as of spree 1.2.0. check function for changes on upgrade
def available_shipping_methods(display_on = nil)
return [] unless ship_address
all_methods = Spree::ShippingMethod.all_available(self, display_on)

View File

@@ -0,0 +1,7 @@
Deface::Override.new(:virtual_path => "spree/admin/shared/_order_tabs",
:name => "add_reset_digitals_to_admin_orders",
:insert_after => ".sidebar",
:text => %q{
<%= content_tag(:p, button_link_to(t(:reset_downloads), reset_digitals_admin_order_url(@order)), class: 'clear') if @order.digital? or true %>
},
:disabled => false)

View File

@@ -1,5 +1,7 @@
en:
digital_versions: Digital Versions
reset_downloads: Reset Digital Downloads
downloads_reset: Digital Downloads Reset
current_file: Current File
new_file: New File
delete_file: Delete this file

View File

@@ -3,8 +3,13 @@ Spree::Core::Engine.routes.draw do
resources :products do
resources :digitals
end
resources :orders do
member do
get :reset_digitals
end
end
end
get '/digital/:secret', :to => 'digitals#show', :via => :get, :as => 'digital', :constraints => { :secret => /[a-zA-Z0-9]{30}/ }
end
end

View File

@@ -24,13 +24,13 @@ The idea is simple. You attach a file to a Product (or a Variant of this Product
Add this line to your gemfile:
```
```shell
gem 'spree_digital', :git => 'git://github.com/halo/spree_digital.git', :branch => 'master'
```
The following terminal commands will copy the migration files to the corresponding directory in your Rails application and apply the migrations to your database.
```
```shell
bundle exec rails g spree_digital:install
bundle exec rake db:migrate
```
@@ -104,14 +104,14 @@ References:
Get the spree framework and spree_digital extension for it:
```
```shell
git clone git://github.com/spree/spree.git
git clone git://github.com/halo/spree_digital.git
```
Go into the spree directory and run the bundle command:
```
```shell
cd spree
bundle install
```
@@ -120,19 +120,19 @@ Go into the spree_digital directory and do the same:
NOTE: At this point you may need to uncomment the stuff in the `Gemfile` before you can start developing and testing!
```
```shell
cd spree_digital
bundle install
```
Bring up the test application (you only need to do this whenever you fiddle around with the migrations) and then you can run the tests as you please.
```
```shell
rake test_app
rake spec
```
This link may be very helpful to you: "http://github.com/spree/spree":http://github.com/spree/spree
This link may be very helpful to you: [http://github.com/spree/spree](http://github.com/spree/spree)
### Authors
@@ -143,4 +143,4 @@ This link may be very helpful to you: "http://github.com/spree/spree":http://git
Copyright (c) 2011 funkensturm.
Released under the MIT License
See [LICENSE](http://github.com/funkensturm/spree_digital/blob/master/LICENSE)
See [LICENSE](http://github.com/funkensturm/spree_digital/blob/master/LICENSE)

View File

@@ -2,5 +2,8 @@ FactoryGirl.define do
factory :digital, :class => Spree::Digital do |f|
# TODO good to assign variant association if no association is manually defined
# f.variant { |p| p.association(:variant) }
attachment_content_type 'application/octet-stream'
attachment_file_name 'a_great_book.epub'
end
end

View File

@@ -1,16 +1,14 @@
ENV["RAILS_ENV"] = "test"
require File.expand_path("../dummy/config/environment.rb", __FILE__)
require 'rspec/rails'
require 'database_cleaner'
require 'ffaker'
require 'shoulda-matchers'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each {|f| require f }
require 'spree/core/testing_support/factories'
require 'spree/core/testing_support/env'
require 'spree/core/testing_support/controller_requests'
require 'spree/core/url_helpers'
@@ -21,7 +19,6 @@ RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods
config.include Spree::Core::UrlHelpers
config.include Spree::Core::TestingSupport::ControllerRequests
config.include Devise::TestHelpers, :type => :controller
config.use_transactional_fixtures = false
config.before(:each) do

View File

@@ -3,7 +3,7 @@ Gem::Specification.new do |s|
s.name = 'spree_digital'
s.version = '1.1.1'
s.summary = ''
s.description = 'Add digital download functionality to spree'
s.description = 'Digital download functionality for spree'
s.authors = ['funkensturm', 'Michael Bianco']
s.email = ['info@cliffsidedev.com']
s.homepage = 'http://www.funkensturm.com'
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
s.require_path = 'lib'
s.requirements << 'none'
s.required_ruby_version = '>= 1.8.7'
s.add_dependency 'spree_core', '>= 1.1.0'
s.add_dependency 'spree_core', '~> 1.1'
# test suite
s.add_development_dependency 'shoulda-matchers'