spree_active_sale 1.0.6 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +198 -56
- data/app/controllers/spree/admin/active_sale_events_controller.rb +52 -0
- data/app/controllers/spree/admin/active_sales_controller.rb +25 -0
- data/app/controllers/spree/admin/sale_images_controller.rb +33 -0
- data/app/controllers/spree/checkout_controller_decorator.rb +6 -0
- data/app/controllers/spree/home_controller_decorator.rb +10 -0
- data/app/controllers/spree/orders_controller_decorator.rb +6 -0
- data/app/controllers/{products_controller_decorator.rb → spree/products_controller_decorator.rb} +5 -1
- data/app/controllers/spree/store_controller_decorator.rb +11 -0
- data/app/controllers/{taxons_controller_decorator.rb → spree/taxons_controller_decorator.rb} +1 -1
- data/app/helpers/spree/active_sale_events_helper.rb +46 -0
- data/app/helpers/spree/active_sales_helper.rb +4 -0
- data/app/models/spree/active_sale.rb +12 -6
- data/app/models/spree/active_sale_configuration.rb +13 -0
- data/app/models/spree/active_sale_event.rb +58 -0
- data/app/models/spree/line_item_decorator.rb +6 -0
- data/app/models/spree/order_decorator.rb +6 -0
- data/app/models/spree/product_decorator.rb +14 -3
- data/app/models/spree/sale_event.rb +86 -0
- data/app/models/spree/sale_image.rb +51 -0
- data/app/models/spree/taxon_decorator.rb +11 -2
- data/app/models/spree/variant_decorator.rb +2 -2
- data/app/overrides/admin_active_sales_tab.rb +6 -0
- data/app/views/spree/admin/active_sale_events/_form.html.erb +136 -0
- data/app/views/spree/admin/active_sale_events/edit.html.erb +17 -0
- data/app/views/spree/admin/active_sale_events/index.html.erb +12 -0
- data/app/views/spree/admin/active_sale_events/new.html.erb +15 -0
- data/app/views/spree/admin/active_sales/_form.html.erb +35 -0
- data/app/views/spree/admin/active_sales/edit.html.erb +17 -0
- data/app/views/spree/admin/active_sales/index.html.erb +57 -0
- data/app/views/spree/admin/active_sales/new.html.erb +15 -0
- data/app/views/spree/admin/sale_images/_form.html.erb +18 -0
- data/app/views/spree/admin/sale_images/edit.html.erb +24 -0
- data/app/views/spree/admin/sale_images/new.html.erb +19 -0
- data/app/views/spree/admin/shared/_list_events.html.erb +32 -0
- data/app/views/spree/admin/shared/_sale_images.html.erb +41 -0
- data/app/views/spree/admin/shared/_translations.html.erb +57 -0
- data/app/views/spree/home/index.html.erb +4 -0
- data/app/views/spree/shared/_sale_events.html.erb +28 -0
- data/config/locales/active_sales_en.yml +74 -0
- data/config/locales/active_sales_es.yml +74 -0
- data/config/routes.rb +12 -0
- data/db/migrate/20130404062459_create_sale_events.rb +70 -0
- data/db/migrate/20130411091742_add_discount_to_sale_events.rb +5 -0
- data/lib/generators/spree_active_sale/assets/assets_generator.rb +37 -0
- data/lib/generators/spree_active_sale/templates/README.md +3 -0
- data/lib/spree_active_sale/engine.rb +7 -0
- data/lib/tasks/spree_active_sale.rake +14 -6
- metadata +46 -11
- data/app/assets/javascripts/admin/spree_active_sale.js +0 -1
- data/app/assets/javascripts/store/spree_active_sale.js +0 -1
- data/app/assets/stylesheets/admin/spree_active_sale.css +0 -3
- data/app/assets/stylesheets/store/spree_active_sale.css +0 -3
- data/app/models/spree/active_sale/event.rb +0 -57
- data/config/locales/en.yml +0 -12
@@ -0,0 +1,74 @@
|
|
1
|
+
# Active Sale localization file for English. Add more files in this directory for other locales.
|
2
|
+
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
3
|
+
|
4
|
+
es:
|
5
|
+
spree:
|
6
|
+
active_sale:
|
7
|
+
active_record:
|
8
|
+
name: "Nombre de la campaña"
|
9
|
+
event:
|
10
|
+
active_record:
|
11
|
+
description: "Descripción del evento"
|
12
|
+
is_active: "Activo"
|
13
|
+
is_hidden: "Oculto"
|
14
|
+
is_permanent: "Permanente"
|
15
|
+
is_live: "Vigente"
|
16
|
+
discount: "Porcentaje de descuento"
|
17
|
+
name: "Nombre del evento"
|
18
|
+
start_date: "Fecha de comienzo"
|
19
|
+
end_date: "Fecha de finalización"
|
20
|
+
eventable_name: "Nombre de elemento asociado"
|
21
|
+
eventable_type: "Tipo de evento"
|
22
|
+
permalink: "Nombre o permalink"
|
23
|
+
boolean:
|
24
|
+
yes: "Sí"
|
25
|
+
no: "No"
|
26
|
+
can_not_be_nil: "Argument can not be nil or instance of any other class than Spree::ActiveSaleEvent"
|
27
|
+
create_if_no_record: "You don't have any event in this active sale, let's create an event?"
|
28
|
+
datetimepicker:
|
29
|
+
format: ! '%d/%m/%Y %H:%M:%S %z'
|
30
|
+
js_format: 'HH:mm:ss z'
|
31
|
+
js_date_format: 'dd/mm/yy'
|
32
|
+
time_only_title: 'Sólo hora'
|
33
|
+
time_text: 'Hora'
|
34
|
+
hour_text: 'Hora'
|
35
|
+
minute_text: 'Minuto'
|
36
|
+
second_text: 'Segundo'
|
37
|
+
current_text: 'Actual'
|
38
|
+
close_text: 'Cerrar'
|
39
|
+
ending_message: "EL EVENTO TERMINA EN"
|
40
|
+
eventable_hint: "¿Esta campaña estará asociada a un producto concreto o a un taxón?"
|
41
|
+
eventable_name_hint: "Teclea el nombre del producto o del taxón que estará asociado a esta campaña."
|
42
|
+
discount_hint: "Número que indique el porcentaje medio aplicado (p.e. '30' para expresar un 30%)."
|
43
|
+
flash:
|
44
|
+
error: "La página que buscas ya no está disponible."
|
45
|
+
link:
|
46
|
+
new: "Nuevo evento"
|
47
|
+
edit: "Editar evento"
|
48
|
+
back: "Volver a eventos"
|
49
|
+
no_image: "Imagen no encontrada. Si la campaña no tiene asociada una imagen entonces la imagen del producto/taxón asociado será utilizado para mostarla en la tienda."
|
50
|
+
notice_messages:
|
51
|
+
created: "El evento ha sido creado con éxito."
|
52
|
+
updated: "El evento ha sido actualizado con éxito."
|
53
|
+
deleted: "El evento ha sido eliminado."
|
54
|
+
title:
|
55
|
+
new: "Nuevo evento"
|
56
|
+
edit: "Editar evento"
|
57
|
+
list: "Listar eventos"
|
58
|
+
validation:
|
59
|
+
errors:
|
60
|
+
invalid_dates: "no puede ser superior o igual a la fecha de finalización."
|
61
|
+
live_event: "ya está creada y vigente."
|
62
|
+
events_not_found: "No hay eventos disponibles en este momento."
|
63
|
+
link:
|
64
|
+
new: "Nueva campaña"
|
65
|
+
edit: "Editar campaña"
|
66
|
+
back: "Volver a listado de campañas"
|
67
|
+
notice_messages:
|
68
|
+
created: "La campaña ha sido creada con éxito."
|
69
|
+
updated: "La campaña ha sido actualizada con éxito."
|
70
|
+
deleted: "La campaña ha sido borrada."
|
71
|
+
title:
|
72
|
+
new: "Nueva campaña"
|
73
|
+
edit: "Editar campaña"
|
74
|
+
list: "Listar campañas"
|
data/config/routes.rb
CHANGED
@@ -1,3 +1,15 @@
|
|
1
1
|
Spree::Core::Engine.routes.draw do
|
2
2
|
# Add this extension's routes here
|
3
|
+
namespace :admin do
|
4
|
+
resources :active_sales do
|
5
|
+
resources :active_sale_events do
|
6
|
+
get 'eventables', :on => :collection
|
7
|
+
resources :sale_images do
|
8
|
+
collection do
|
9
|
+
post :update_positions
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
3
15
|
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
class OldActiveSale < ActiveRecord::Base
|
2
|
+
self.table_name = "spree_active_sales"
|
3
|
+
end
|
4
|
+
|
5
|
+
class CreateSaleEvents < ActiveRecord::Migration
|
6
|
+
def up
|
7
|
+
# New migration starts here:
|
8
|
+
rename_table :spree_active_sale_events, :spree_sale_events
|
9
|
+
add_column :spree_sale_events, :type, :string
|
10
|
+
add_column :spree_sale_events, :parent_id, :integer
|
11
|
+
add_column :spree_sale_events, :lft, :integer
|
12
|
+
add_column :spree_sale_events, :rgt, :integer
|
13
|
+
add_column :spree_sale_events, :position, :integer, :default => 0
|
14
|
+
|
15
|
+
# Required to have old data backed up!
|
16
|
+
# Saving data to new structure by running steps below:
|
17
|
+
if table_exists?(:spree_active_sales)
|
18
|
+
add_column :spree_active_sales, :type, :string, :default => "Spree::ActiveSale"
|
19
|
+
update_changes
|
20
|
+
drop_table :spree_active_sales
|
21
|
+
end
|
22
|
+
|
23
|
+
# Index for search
|
24
|
+
add_index :spree_sale_events, [:parent_id], :name => 'index_active_sale_on_parent_id'
|
25
|
+
add_index :spree_sale_events, [:active_sale_id], :name => 'index_active_sale_on_active_sale_id'
|
26
|
+
add_index :spree_sale_events, [:permalink], :name => 'index_active_sale_on_permalink'
|
27
|
+
end
|
28
|
+
|
29
|
+
def down
|
30
|
+
# Required to get new data saved in old format!
|
31
|
+
# Saving data to old structure by running steps below:
|
32
|
+
unless table_exists?(:spree_active_sales)
|
33
|
+
create_table :spree_active_sales do |t|
|
34
|
+
t.string :name
|
35
|
+
|
36
|
+
t.timestamps
|
37
|
+
end
|
38
|
+
add_column :spree_active_sales, :type, :string, :default => "Spree::ActiveSale"
|
39
|
+
revert_changes
|
40
|
+
remove_column :spree_active_sales, :type
|
41
|
+
end
|
42
|
+
|
43
|
+
remove_column :spree_sale_events, :position
|
44
|
+
remove_column :spree_sale_events, :rgt
|
45
|
+
remove_column :spree_sale_events, :lft
|
46
|
+
remove_column :spree_sale_events, :parent_id
|
47
|
+
remove_column :spree_sale_events, :type
|
48
|
+
rename_table :spree_sale_events, :spree_active_sale_events
|
49
|
+
end
|
50
|
+
|
51
|
+
def update_changes
|
52
|
+
OldActiveSale.where(:type => nil).each{ |a| a.update_attributes(:type => "Spree::ActiveSale") }
|
53
|
+
Spree::SaleEvent.where(:type => nil).each{ |sale| sale.update_attributes(:type => "Spree::ActiveSaleEvent") }
|
54
|
+
OldActiveSale.all.each{ |as|
|
55
|
+
sale = Spree::SaleEvent.find_or_create_by_name_and_active_sale_id_and_type(as.name, nil, "Spree::ActiveSale")
|
56
|
+
as.active_sale_events.each{ |event|
|
57
|
+
event.update_attributes(:active_sale_id => sale.id)
|
58
|
+
}
|
59
|
+
}
|
60
|
+
end
|
61
|
+
|
62
|
+
def revert_changes
|
63
|
+
Spree::SaleEvent.where(:type => "Spree::ActiveSale").update_all(:type => nil)
|
64
|
+
Spree::SaleEvent.where(:active_sale_id => nil).each{ |as|
|
65
|
+
sale = OldActiveSale.find_or_create_by_name(as.name)
|
66
|
+
Spree::ActiveSaleEvent.where(:active_sale_id => as.id).update_all(:active_sale_id => sale.id)
|
67
|
+
}
|
68
|
+
Spree::SaleEvent.where(:active_sale_id => nil).destroy_all
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module SpreeActiveSale
|
2
|
+
module Generators
|
3
|
+
class AssetsGenerator < Rails::Generators::Base
|
4
|
+
|
5
|
+
source_root File.expand_path('../../templates', __FILE__)
|
6
|
+
|
7
|
+
desc 'Copies the assets from spree_active_sale plugin to the applciation\'s assets folder.'
|
8
|
+
|
9
|
+
def copy_locale
|
10
|
+
directory assets_source_path, assets_destination_path
|
11
|
+
directory js_source_path, js_destination_path
|
12
|
+
end
|
13
|
+
|
14
|
+
def show_readme
|
15
|
+
readme 'README.md' if behavior == :invoke
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def assets_source_path
|
21
|
+
'../../../../vendor/assets/stylesheets/'
|
22
|
+
end
|
23
|
+
|
24
|
+
def assets_destination_path
|
25
|
+
'app/assets/stylesheets/'
|
26
|
+
end
|
27
|
+
|
28
|
+
def js_source_path
|
29
|
+
'../../../../vendor/assets/javascripts/'
|
30
|
+
end
|
31
|
+
|
32
|
+
def js_destination_path
|
33
|
+
'app/assets/javascripts/'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -6,6 +6,11 @@ module SpreeActiveSale
|
|
6
6
|
|
7
7
|
config.autoload_paths += %W(#{config.root}/lib)
|
8
8
|
|
9
|
+
initializer "spree_active_sale.environment", :after => "spree.environment" do |app|
|
10
|
+
Spree::ActiveSaleConfig = Spree::ActiveSaleConfiguration.new
|
11
|
+
%w(ActionController::Base Spree::BaseController).each { |controller| controller.constantize.send(:helper, Spree::ActiveSaleEventsHelper) }
|
12
|
+
end
|
13
|
+
|
9
14
|
# use rspec for tests
|
10
15
|
config.generators do |g|
|
11
16
|
g.test_framework :rspec
|
@@ -20,3 +25,5 @@ module SpreeActiveSale
|
|
20
25
|
config.to_prepare &method(:activate).to_proc
|
21
26
|
end
|
22
27
|
end
|
28
|
+
|
29
|
+
|
@@ -1,9 +1,17 @@
|
|
1
|
-
namespace :
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
namespace :spree_active_sale do
|
2
|
+
desc "Copies all migrations and assets"
|
3
|
+
task :install do
|
4
|
+
Rake::Task['spree_active_sale:install:migrations'].invoke
|
5
|
+
Rake::Task['spree_active_sale:install:assets'].invoke
|
6
|
+
end
|
7
|
+
|
8
|
+
namespace :install do
|
9
|
+
desc "Copies all assets to the application"
|
10
|
+
task :assets do
|
11
|
+
source = File.join(File.dirname(__FILE__), '..', '..', 'app', 'assets')
|
12
|
+
destination = File.join(Rails.root, 'app', 'assets')
|
13
|
+
puts "INFO: Mirroring assets from #{source} to #{destination}"
|
14
|
+
`rails generate spree_active_sale:assets`
|
7
15
|
end
|
8
16
|
end
|
9
17
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_active_sale
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-04-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: spree_core
|
@@ -60,7 +60,7 @@ dependencies:
|
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
63
|
+
name: factory_girl_rails
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
@@ -170,25 +170,57 @@ files:
|
|
170
170
|
- LICENSE
|
171
171
|
- README.md
|
172
172
|
- app/models/spree.rb
|
173
|
+
- app/models/spree/active_sale_configuration.rb
|
173
174
|
- app/models/spree/product_decorator.rb
|
174
|
-
- app/models/spree/
|
175
|
+
- app/models/spree/line_item_decorator.rb
|
176
|
+
- app/models/spree/order_decorator.rb
|
177
|
+
- app/models/spree/sale_image.rb
|
175
178
|
- app/models/spree/taxon_decorator.rb
|
176
179
|
- app/models/spree/variant_decorator.rb
|
177
180
|
- app/models/spree/active_sale.rb
|
178
|
-
- app/
|
179
|
-
- app/
|
180
|
-
- app/
|
181
|
-
- app/
|
182
|
-
- app/
|
183
|
-
- app/
|
181
|
+
- app/models/spree/active_sale_event.rb
|
182
|
+
- app/models/spree/sale_event.rb
|
183
|
+
- app/views/spree/home/index.html.erb
|
184
|
+
- app/views/spree/admin/active_sales/_form.html.erb
|
185
|
+
- app/views/spree/admin/active_sales/new.html.erb
|
186
|
+
- app/views/spree/admin/active_sales/index.html.erb
|
187
|
+
- app/views/spree/admin/active_sales/edit.html.erb
|
188
|
+
- app/views/spree/admin/active_sale_events/_form.html.erb
|
189
|
+
- app/views/spree/admin/active_sale_events/new.html.erb
|
190
|
+
- app/views/spree/admin/active_sale_events/index.html.erb
|
191
|
+
- app/views/spree/admin/active_sale_events/edit.html.erb
|
192
|
+
- app/views/spree/admin/shared/_translations.html.erb
|
193
|
+
- app/views/spree/admin/shared/_list_events.html.erb
|
194
|
+
- app/views/spree/admin/shared/_sale_images.html.erb
|
195
|
+
- app/views/spree/admin/sale_images/_form.html.erb
|
196
|
+
- app/views/spree/admin/sale_images/new.html.erb
|
197
|
+
- app/views/spree/admin/sale_images/edit.html.erb
|
198
|
+
- app/views/spree/shared/_sale_events.html.erb
|
199
|
+
- app/controllers/spree/admin/sale_images_controller.rb
|
200
|
+
- app/controllers/spree/admin/active_sales_controller.rb
|
201
|
+
- app/controllers/spree/admin/active_sale_events_controller.rb
|
202
|
+
- app/controllers/spree/home_controller_decorator.rb
|
203
|
+
- app/controllers/spree/orders_controller_decorator.rb
|
204
|
+
- app/controllers/spree/checkout_controller_decorator.rb
|
205
|
+
- app/controllers/spree/products_controller_decorator.rb
|
206
|
+
- app/controllers/spree/store_controller_decorator.rb
|
207
|
+
- app/controllers/spree/taxons_controller_decorator.rb
|
208
|
+
- app/helpers/spree/active_sale_events_helper.rb
|
209
|
+
- app/helpers/spree/active_sales_helper.rb
|
210
|
+
- app/overrides/admin_active_sales_tab.rb
|
184
211
|
- config/routes.rb
|
185
|
-
- config/locales/
|
212
|
+
- config/locales/active_sales_en.yml
|
213
|
+
- config/locales/active_sales_es.yml
|
186
214
|
- lib/tasks/spree_active_sale.rake
|
215
|
+
- lib/generators/spree_active_sale/assets/assets_generator.rb
|
187
216
|
- lib/generators/spree_active_sale/install/install_generator.rb
|
217
|
+
- lib/generators/spree_active_sale/templates/README.md
|
188
218
|
- lib/spree_active_sale/engine.rb
|
189
219
|
- lib/spree_active_sale.rb
|
190
220
|
- db/migrate/20130119154826_create_active_sales.rb
|
191
221
|
- db/migrate/20130119182020_create_events.rb
|
222
|
+
- db/migrate/20130404062459_create_sale_events.rb
|
223
|
+
- db/migrate/20130411091742_add_discount_to_sale_events.rb
|
192
224
|
homepage: https://github.com/suryart/spree_active_sale
|
193
225
|
licenses: []
|
194
226
|
post_install_message:
|
@@ -207,6 +239,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
239
|
- - ! '>='
|
208
240
|
- !ruby/object:Gem::Version
|
209
241
|
version: '0'
|
242
|
+
segments:
|
243
|
+
- 0
|
244
|
+
hash: -3636572579804555877
|
210
245
|
requirements:
|
211
246
|
- none
|
212
247
|
rubyforge_project:
|
@@ -1 +0,0 @@
|
|
1
|
-
//= require admin/spree_core
|
@@ -1 +0,0 @@
|
|
1
|
-
//= require store/spree_core
|
@@ -1,57 +0,0 @@
|
|
1
|
-
# EVENTS
|
2
|
-
# Events represent an entity for active sale in a flash sale/ daily deal.
|
3
|
-
# There can be many events for one sale.
|
4
|
-
#
|
5
|
-
module Spree
|
6
|
-
class ActiveSale::Event < ActiveRecord::Base
|
7
|
-
belongs_to :eventable, :polymorphic => true
|
8
|
-
belongs_to :active_sale
|
9
|
-
|
10
|
-
attr_accessible :description, :end_date, :eventable_id, :eventable_type, :is_active, :is_hidden, :name, :permalink, :active_sale_id, :start_date
|
11
|
-
|
12
|
-
validates :name, :presence => true
|
13
|
-
validates :permalink, :presence => true
|
14
|
-
validates :start_date, :presence => true
|
15
|
-
validates :end_date, :presence => true
|
16
|
-
validates :active_sale_id, :presence => true
|
17
|
-
validate :validate_start_and_end_date
|
18
|
-
|
19
|
-
scope :live, lambda { where("(start_date <= :start_date AND end_date >= :end_date) OR is_permanent = :is_permanent", { :start_date => Time.now, :end_date => Time.now, :is_permanent => true }) }
|
20
|
-
scope :active, lambda { |*args| where(:is_active => valid_argument(args)) }
|
21
|
-
scope :hidden, lambda { |*args| where(:is_hidden => valid_argument(args)) }
|
22
|
-
scope :live_active, lambda { |*args| self.live.active(valid_argument(args)) }
|
23
|
-
scope :live_active_and_hidden, lambda { |*args|
|
24
|
-
args = [{}] if [nil, true, false].include? args.first
|
25
|
-
self.live.active(valid_argument([args.first[:active]])).hidden(valid_argument([args.first[:hidden]]))
|
26
|
-
}
|
27
|
-
scope :upcoming_events, lambda { where("start_date > :start_date", { :start_date => Time.now }) }
|
28
|
-
scope :starting_today, lambda { where(:start_date => Time.now.at_beginning_of_day..Time.now.end_of_day) }
|
29
|
-
scope :ending_today, lambda { where(:end_date => Time.now.at_beginning_of_day..Time.now.end_of_day) }
|
30
|
-
|
31
|
-
def validate_start_and_end_date
|
32
|
-
errors.add(:start_date, I18n.t('spree.active_sale.event.validation.errors.invalid_dates')) if (self.start_date and self.end_date) and (self.start_date > self.end_date)
|
33
|
-
end
|
34
|
-
|
35
|
-
def live?
|
36
|
-
current_time = Time.now
|
37
|
-
(self.start_date <= current_time and self.end_date >= current_time) or self.is_permanent?
|
38
|
-
end
|
39
|
-
|
40
|
-
def live_and_active?
|
41
|
-
self.live? and self.is_active?
|
42
|
-
end
|
43
|
-
|
44
|
-
# Spree::ActiveSale::Event.is_live? method
|
45
|
-
# should only/ always represents live and active events and not just live events.
|
46
|
-
def self.is_live? object
|
47
|
-
object_class_name = object.class.name
|
48
|
-
return (object.live_and_active?) if object_class_name == self.name
|
49
|
-
%w(Spree::Product Spree::Variant Spree::Taxon).include?(object_class_name) ? object.live? : false
|
50
|
-
end
|
51
|
-
|
52
|
-
private
|
53
|
-
def self.valid_argument args
|
54
|
-
(args.first == nil || args.first == true)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
data/config/locales/en.yml
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
# Sample localization file for English. Add more files in this directory for other locales.
|
2
|
-
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
3
|
-
|
4
|
-
en:
|
5
|
-
spree:
|
6
|
-
active_sale:
|
7
|
-
event:
|
8
|
-
validation:
|
9
|
-
errors:
|
10
|
-
invalid_dates: "Event's start date can not be greater than end date."
|
11
|
-
flash:
|
12
|
-
error: "The page you are looking for is no longer available."
|