spree_inactive_taxons 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ Redistribution and use in source and binary forms, with or without modification,
2
+ are permitted provided that the following conditions are met:
3
+
4
+ * Redistributions of source code must retain the above copyright notice,
5
+ this list of conditions and the following disclaimer.
6
+ * Redistributions in binary form must reproduce the above copyright notice,
7
+ this list of conditions and the following disclaimer in the documentation
8
+ and/or other materials provided with the distribution.
9
+ * Neither the name of the Rails Dog LLC nor the names of its
10
+ contributors may be used to endorse or promote products derived from this
11
+ software without specific prior written permission.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,13 @@
1
+ SpreeInactiveTaxons
2
+ =======================
3
+
4
+ Introduction goes here.
5
+
6
+
7
+ Example
8
+ =======
9
+
10
+ Example goes here.
11
+
12
+
13
+ Copyright (c) 2011 [name of extension creator], released under the New BSD License
@@ -0,0 +1,5 @@
1
+ <%= f.field_container :inactive do %>
2
+ <%= f.label :inactive, t("inactive") %><br />
3
+ <%= error_message_on :taxon, :inactive, :class => 'fullwidth title' %>
4
+ <%= text_field :taxon, :inactive %>
5
+ <% end %>
@@ -0,0 +1,25 @@
1
+ <%= f.field_container :inactive do %>
2
+ <%= error_message_on :taxon, :inactive, :class => 'fullwidth title' %>
3
+ <%= check_box :taxon, :inactive %>
4
+ <%= f.label :inactive, t("inactive") %>
5
+ <% end %>
6
+ <%= f.field_container :name do %>
7
+ <%= f.label :name, t("name") %> <span class="required">*</span><br />
8
+ <%= error_message_on :taxon, :name, :class => 'fullwidth title' %>
9
+ <%= text_field :taxon, :name %>
10
+ <% end %>
11
+
12
+ <%= f.field_container :permalink_part do %>
13
+ <%= f.label :permalink_part, t("permalink") %><span class="required">*</span><br />
14
+ <%= @taxon.permalink.split("/")[0...-1].join("/") + "/" %><%= text_field_tag :permalink_part, @permalink_part %>
15
+ <% end %>
16
+
17
+ <%= f.field_container :icon do %>
18
+ <%= f.label :icon, t('icon') %><br />
19
+ <%= f.file_field :icon %>
20
+ <% end %>
21
+
22
+ <%= f.field_container :description do %>
23
+ <%= f.label :description, t(:description) %><br />
24
+ <%= f.text_area :description %>
25
+ <% end %>
@@ -0,0 +1,13 @@
1
+ <%= # From 0.40.2, unless taxon.inactive? %>
2
+ <div id="taxonomies" class="sidebar-item">
3
+ <% get_taxonomies.each do |taxonomy| %>
4
+ <ul class="navigation-list">
5
+ <li<%= ' class="current"' if @taxon && @taxon == taxonomy.root %>><%= link_to t("shop_by_taxonomy", :taxonomy => taxonomy.name.singularize), seo_url(taxonomy.root), :class => 'root' %></li>
6
+ <% taxonomy.root.children.each do |taxon| %>
7
+ <% unless taxon.inactive? %>
8
+ <li<%= ' class="current"' if @taxon and ([@taxon] + @taxon.ancestors).include?(taxon) %>><%= link_to taxon.name, seo_url(taxon) %></li>
9
+ <% end %>
10
+ <% end %>
11
+ </ul>
12
+ <% end %>
13
+ </div>
@@ -0,0 +1,17 @@
1
+ require 'spree_core'
2
+ require 'spree_inactive_taxons_hooks'
3
+
4
+ module SpreeInactiveTaxons
5
+ class Engine < Rails::Engine
6
+
7
+ config.autoload_paths += %W(#{config.root}/lib)
8
+
9
+ def self.activate
10
+ Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
11
+ Rails.env.production? ? require(c) : load(c)
12
+ end
13
+ end
14
+
15
+ config.to_prepare &method(:activate).to_proc
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ class SpreeInactiveTaxonsHooks < Spree::ThemeSupport::HookListener
2
+ # waiting for 0.40.3
3
+ #insert_before :admin_inside_taxon_form, 'admin/taxons/before_admin_inside_taxon_form'
4
+ # replace :admin_inside_taxon_form, 'admin/taxons/admin_inside_taxon_form'
5
+ end
@@ -0,0 +1,25 @@
1
+ namespace :spree_inactive_taxons do
2
+ desc "Copies all migrations and assets (NOTE: This will be obsolete with Rails 3.1)"
3
+ task :install do
4
+ Rake::Task['spree_inactive_taxons:install:migrations'].invoke
5
+ Rake::Task['spree_inactive_taxons:install:assets'].invoke
6
+ end
7
+
8
+ namespace :install do
9
+ desc "Copies all migrations (NOTE: This will be obsolete with Rails 3.1)"
10
+ task :migrations do
11
+ source = File.join(File.dirname(__FILE__), '..', '..', 'db')
12
+ destination = File.join(Rails.root, 'db')
13
+ Spree::FileUtilz.mirror_files(source, destination)
14
+ end
15
+
16
+ desc "Copies all assets (NOTE: This will be obsolete with Rails 3.1)"
17
+ task :assets do
18
+ source = File.join(File.dirname(__FILE__), '..', '..', 'public')
19
+ destination = File.join(Rails.root, 'public')
20
+ puts "INFO: Mirroring assets from #{source} to #{destination}"
21
+ Spree::FileUtilz.mirror_files(source, destination)
22
+ end
23
+ end
24
+
25
+ end
@@ -0,0 +1 @@
1
+ # add custom rake tasks here
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spree_inactive_taxons
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 0
10
+ version: 1.0.0
11
+ platform: ruby
12
+ authors: []
13
+
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-01-24 00:00:00 +01:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: spree_core
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 187
30
+ segments:
31
+ - 0
32
+ - 40
33
+ - 2
34
+ version: 0.40.2
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description:
38
+ email:
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files: []
44
+
45
+ files:
46
+ - README.md
47
+ - LICENSE
48
+ - lib/spree_inactive_taxons.rb
49
+ - lib/spree_inactive_taxons_hooks.rb
50
+ - lib/tasks/install.rake
51
+ - lib/tasks/spree_inactive_taxons.rake
52
+ - app/views/admin/taxons/_before_admin_inside_taxon_form.html.erb
53
+ - app/views/admin/taxons/_form.html.erb
54
+ - app/views/shared/_taxonomies.html.erb
55
+ has_rdoc: true
56
+ homepage:
57
+ licenses: []
58
+
59
+ post_install_message:
60
+ rdoc_options: []
61
+
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ hash: 57
70
+ segments:
71
+ - 1
72
+ - 8
73
+ - 7
74
+ version: 1.8.7
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ hash: 3
81
+ segments:
82
+ - 0
83
+ version: "0"
84
+ requirements:
85
+ - none
86
+ rubyforge_project:
87
+ rubygems_version: 1.4.2
88
+ signing_key:
89
+ specification_version: 3
90
+ summary: Add gem summary here
91
+ test_files: []
92
+