spree_product_testimonials 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/README.md +13 -0
- data/app/controllers/admin/testimonials_controller.rb +12 -0
- data/app/models/testimonial.rb +6 -0
- data/app/views/admin/testimonials/_form.html.erb +30 -0
- data/app/views/admin/testimonials/edit.html.erb +4 -0
- data/app/views/admin/testimonials/index.html.erb +52 -0
- data/app/views/admin/testimonials/new.html.erb +4 -0
- data/config/routes.rb +7 -0
- data/lib/generators/spree_product_testimonials/install_generator.rb +13 -0
- data/lib/generators/templates/db/migrate/20101122222055_create_testimonials.rb +17 -0
- data/lib/spree_product_testimonials.rb +3 -0
- data/lib/spree_product_testimonials/engine.rb +15 -0
- data/lib/spree_product_testimonials_hooks.rb +8 -0
- metadata +72 -0
data/README.md
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
class Admin::TestimonialsController < Admin::BaseController
|
2
|
+
resource_controller
|
3
|
+
belongs_to :product
|
4
|
+
|
5
|
+
create.wants.html { redirect_to collection_path }
|
6
|
+
update.wants.html { redirect_to collection_path }
|
7
|
+
|
8
|
+
new_action.response do |wants|
|
9
|
+
wants.html {render :action => :new, :layout => !request.xhr?}
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<%- locals = {:f => f} %>
|
2
|
+
|
3
|
+
<%= render "shared/error_messages", :target => f.object %>
|
4
|
+
|
5
|
+
<%= hook :admin_testimonial_form, locals do %>
|
6
|
+
|
7
|
+
<%= f.field_container :name do %>
|
8
|
+
<%= f.label :name, t("name") %> <span class="required">*</span><br />
|
9
|
+
<%= f.text_field :name, :class => 'fullwidth title' %>
|
10
|
+
<%= f.error_message_on :name %>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<%= f.field_container :location do %>
|
14
|
+
<%= f.label :location, t("location") %> <span class="required">*</span><br />
|
15
|
+
<%= f.text_field :location, :class => 'fullwidth title' %>
|
16
|
+
<%= f.error_message_on :location %>
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<%= f.field_container :description do %>
|
20
|
+
<%= f.label :description, t("description") %> <span class="required">*</span><br />
|
21
|
+
<%= f.text_area :description, :class => 'fullwidth title' %>
|
22
|
+
<%= f.error_message_on :description %>
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
<%= f.field_container :featured do %>
|
26
|
+
<%= f.check_box :featured %>
|
27
|
+
<%= f.label :featured, t("featured") %>
|
28
|
+
<%= f.error_message_on :featured %>
|
29
|
+
<% end %>
|
30
|
+
<% end %>
|
@@ -0,0 +1,52 @@
|
|
1
|
+
<%= render :partial => 'admin/shared/product_sub_menu' %>
|
2
|
+
|
3
|
+
<%= render :partial => 'admin/shared/product_tabs', :locals => {:current => "Testimonials"} %>
|
4
|
+
|
5
|
+
|
6
|
+
<%= csrf_meta_tag %>
|
7
|
+
|
8
|
+
<div class='toolbar'>
|
9
|
+
<ul class='actions'>
|
10
|
+
<li id="new_testimonial_link">
|
11
|
+
<%= button_link_to t("new_testimonial"),
|
12
|
+
new_object_url,
|
13
|
+
{:remote => :true, :icon => 'add' } %>
|
14
|
+
</li>
|
15
|
+
</ul>
|
16
|
+
<br class='clear' />
|
17
|
+
</div>
|
18
|
+
<div id="new_testimonial"></div>
|
19
|
+
|
20
|
+
<h1><%= t("testimonials") %></h1>
|
21
|
+
<table class="index">
|
22
|
+
<thead>
|
23
|
+
<%= hook :admin_testimonials_index_headers do %>
|
24
|
+
<th><%= t("name") %></td>
|
25
|
+
<th><%= t("description") %></td>
|
26
|
+
<th><%= t("location") %></td>
|
27
|
+
<th><%= t("featured") %></td>
|
28
|
+
<% end %>
|
29
|
+
<th>
|
30
|
+
<%= hook :admin_testimonials_header_actions %>
|
31
|
+
</th>
|
32
|
+
</tr>
|
33
|
+
<thead>
|
34
|
+
<% @testimonials.each do |testimonial| %>
|
35
|
+
<tr id="<%= dom_id testimonial %>">
|
36
|
+
<%- locals = {:testimonial => testimonial} %>
|
37
|
+
<%= hook :admin_testimonials_index_rows, locals do %>
|
38
|
+
<td><%= testimonial.name %></td>
|
39
|
+
<td><%= simple_format testimonial.description %></td>
|
40
|
+
<td><%= testimonial.location %></td>
|
41
|
+
<td><%= "featured" if testimonial.featured %></td>
|
42
|
+
<% end %>
|
43
|
+
<td class="actions">
|
44
|
+
<%= hook :admin_testimonials_index_row_actions, locals do %>
|
45
|
+
<%= link_to_edit testimonial %>
|
46
|
+
<%= link_to_delete testimonial %>
|
47
|
+
<% end %>
|
48
|
+
</td>
|
49
|
+
</tr>
|
50
|
+
<% end %>
|
51
|
+
</tbody>
|
52
|
+
</table>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
module SpreeProductTestimonials
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path("../../templates", __FILE__)
|
5
|
+
|
6
|
+
desc "Configures your Rails application for use with spree_testimonials"
|
7
|
+
def copy_migrations
|
8
|
+
directory "db"
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateTestimonials < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :testimonials do |t|
|
4
|
+
t.string :name
|
5
|
+
t.string :location
|
6
|
+
t.text :description
|
7
|
+
t.boolean :featured
|
8
|
+
t.integer :product_id
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.down
|
15
|
+
drop_table :testimonials
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require "spree_product_testimonials"
|
2
|
+
|
3
|
+
module SpreeProductTestimonials
|
4
|
+
|
5
|
+
class Engine < Rails::Engine
|
6
|
+
|
7
|
+
def self.activate
|
8
|
+
Product.class_eval do
|
9
|
+
has_many :testimonials
|
10
|
+
end
|
11
|
+
end
|
12
|
+
config.to_prepare &method(:activate).to_proc
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class SpreeProductTestimonialsHooks < Spree::ThemeSupport::HookListener
|
2
|
+
insert_after :admin_product_tabs do
|
3
|
+
%{<li<%== ' class="active"' if current == "Testimonials" %>>
|
4
|
+
<%= link_to t("testimonials"), admin_product_testimonials_url(@product) %>
|
5
|
+
</li>}
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: spree_product_testimonials
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Ben Hutton
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-03-16 00:00:00.000000000 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: spree_core
|
17
|
+
requirement: &15390960 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.30.1
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *15390960
|
26
|
+
description: With this gem you get management tools to make it very easy to update
|
27
|
+
your product testimonials thru the admin section
|
28
|
+
email: benhutton@gmail.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- README.md
|
34
|
+
- lib/spree_product_testimonials_hooks.rb
|
35
|
+
- lib/spree_product_testimonials.rb
|
36
|
+
- lib/generators/spree_product_testimonials/install_generator.rb
|
37
|
+
- lib/generators/templates/db/migrate/20101122222055_create_testimonials.rb
|
38
|
+
- lib/spree_product_testimonials/engine.rb
|
39
|
+
- app/views/admin/testimonials/new.html.erb
|
40
|
+
- app/views/admin/testimonials/edit.html.erb
|
41
|
+
- app/views/admin/testimonials/index.html.erb
|
42
|
+
- app/views/admin/testimonials/_form.html.erb
|
43
|
+
- app/models/testimonial.rb
|
44
|
+
- app/controllers/admin/testimonials_controller.rb
|
45
|
+
- config/routes.rb
|
46
|
+
has_rdoc: false
|
47
|
+
homepage:
|
48
|
+
licenses: []
|
49
|
+
post_install_message:
|
50
|
+
rdoc_options: []
|
51
|
+
require_paths:
|
52
|
+
- lib
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ! '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: 1.8.7
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ! '>='
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
requirements:
|
66
|
+
- none
|
67
|
+
rubyforge_project:
|
68
|
+
rubygems_version: 1.5.2
|
69
|
+
signing_key:
|
70
|
+
specification_version: 3
|
71
|
+
summary: Adds the ability to manage product testimonials to a spree site
|
72
|
+
test_files: []
|