spree_faq 3.0.3 → 3.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,13 +1,47 @@
1
- Faq
2
- ===
1
+ Spree Frequently Asked Question Extension
2
+ =========
3
3
 
4
- Introduction goes here.
4
+ An spree extension for managing FAQs
5
5
 
6
+ Supported versions of Spree
7
+ =========
6
8
 
7
- Example
8
- =======
9
+ any version of Spree higher than 0.10.x
9
10
 
10
- Example goes here.
11
+ Installation
12
+ ============
11
13
 
14
+ 1) add the gem to your `Gemfile`:
12
15
 
13
- Copyright (c) 2010 [name of extension creator], released under the New BSD License
16
+ `gem 'spree_faq'`
17
+
18
+ 2) run bundler:
19
+
20
+ `bundle install`
21
+
22
+ 3) migrate your database:
23
+
24
+ `rake railties:install:migrations db:migrate`
25
+
26
+ Viewing FAQs
27
+ ============
28
+
29
+ `http://yourdomain.tld/faq`
30
+
31
+ Editing FAQs
32
+ ===========
33
+
34
+ 1. Login to Administraton Console
35
+ 2. Click on FAQ
36
+
37
+ Running Specs
38
+ ===========
39
+ `git clone git://github.com/joshnuss/spree-faq.git`
40
+
41
+ `gem install bundler`
42
+
43
+ `bundle`
44
+
45
+ `rake test_app`
46
+
47
+ `rake spec`
@@ -0,0 +1 @@
1
+ //= require spree_faq
@@ -0,0 +1,5 @@
1
+ $ ->
2
+ $('.answer').hide()
3
+ $('.question').click ->
4
+ id = $(this).attr('id').split('_')[1]
5
+ $('#answer_' + id).slideToggle()
@@ -4,7 +4,8 @@ class Admin::QuestionCategoriesController < Admin::BaseController
4
4
  helper 'spree/base'
5
5
 
6
6
  new_action.response do |format|
7
- format.html {render :action => :new, :layout => false}
7
+ format.html
8
+ format.js
8
9
  end
9
10
  update.response do |format|
10
11
  format.html { redirect_to admin_question_categories_path }
@@ -2,5 +2,5 @@ class Question < ActiveRecord::Base
2
2
  belongs_to :question_category
3
3
  acts_as_list
4
4
 
5
- validates_presence_of :question_category_id, :question, :answer
5
+ validates :question_category_id, :question, :answer, :presence => true
6
6
  end
@@ -1,9 +1,8 @@
1
1
  class QuestionCategory < ActiveRecord::Base
2
2
  acts_as_list
3
-
4
3
  has_many :questions
5
- validates_uniqueness_of :name
6
- validates_presence_of :name
4
+
5
+ validates :name, :presence => true, :uniqueness => true
7
6
 
8
7
  accepts_nested_attributes_for :questions, :allow_destroy => true
9
8
  end
@@ -0,0 +1,4 @@
1
+ Deface::Override.new(:virtual_path => "layouts/admin",
2
+ :name => "faq_admin_tab",
3
+ :insert_bottom => "[data-hook='admin_tabs']",
4
+ :text => "<%= tab(:question_categories, :label => :question_categories_admin) %>")
@@ -33,7 +33,8 @@
33
33
 
34
34
  <div id="questions">
35
35
  <h2>Questions</h2>
36
- <%= link_to_with_icon 'add', t('add_question'), '#', :id => 'new_question_link' %>
36
+ <%= button_link_to t('add_question'), '#', {:icon => 'add', :id => 'new_question_link' } %>
37
+ <div class="clear"></div>
37
38
 
38
39
  <%= f.fields_for :questions do |question_form| %>
39
40
  <%= render :partial => 'question', :locals => {:f => question_form } %>
@@ -3,12 +3,12 @@
3
3
  <li id="new_question_category_link">
4
4
  <%= button_link_to t("new_question_category"),
5
5
  new_object_url,
6
- {:remote => :true, :icon => 'add' } %>
6
+ {:remote => :true, :icon => 'add', :id => 'admin_new_question_category' } %>
7
7
  </li>
8
8
  </ul>
9
9
  <br class='clear' />
10
10
  </div>
11
- <div id="new_question_category"></div>
11
+ <div id="new_question_category" data-hook></div>
12
12
 
13
13
  <h1><%= t("question_categories") %></h1>
14
14
  <table class="index">
@@ -0,0 +1,3 @@
1
+ $("#new_question_category").html('<%= escape_javascript(render :template => "admin/question_categories/new.html.erb") %>');
2
+ handle_date_picker_fields();
3
+ $("#admin_new_question_category").parent().hide();
@@ -19,15 +19,3 @@
19
19
  </div>
20
20
  <% end %>
21
21
  </div>
22
-
23
- <%= content_for :head do %>
24
- <%= javascript_tag do %>
25
- $(function() {
26
- $('.answer').hide();
27
- $('.question').click(function() {
28
- var id = $(this).attr('id').split('_')[1];
29
- $('#answer_' + id).slideToggle();
30
- });
31
- });
32
- <% end %>
33
- <% end %>
@@ -1,12 +1,19 @@
1
- require "spree_faq"
2
-
3
1
  module SpreeFaq
4
-
5
2
  class Engine < Rails::Engine
3
+ engine_name 'spree_faq'
4
+
5
+ config.autoload_paths += %W(#{config.root}/lib)
6
6
 
7
7
  def self.activate
8
+ Dir.glob(File.join(File.dirname(__FILE__), "../../app/**/*_decorator*.rb")) do |c|
9
+ Rails.application.config.cache_classes ? require(c) : load(c)
10
+ end
11
+
12
+ Dir.glob(File.join(File.dirname(__FILE__), "../../app/overrides/*.rb")) do |c|
13
+ Rails.application.config.cache_classes ? require(c) : load(c)
14
+ end
8
15
  end
9
16
 
17
+ config.to_prepare &method(:activate).to_proc
10
18
  end
11
-
12
19
  end
data/lib/spree_faq.rb CHANGED
@@ -1,3 +1,2 @@
1
1
  require 'spree_core'
2
- require 'spree_faq_hooks'
3
2
  require 'spree_faq/engine'
metadata CHANGED
@@ -1,104 +1,76 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: spree_faq
3
- version: !ruby/object:Gem::Version
4
- hash: 1
5
- prerelease: false
6
- segments:
7
- - 3
8
- - 0
9
- - 3
10
- version: 3.0.3
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.0.4
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Josh Nussbaum
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-01-06 00:00:00 -05:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2011-11-03 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: spree_core
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &82239700 !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 101
30
- segments:
31
- - 0
32
- - 30
33
- - 1
34
- version: 0.30.1
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.70.0
35
22
  type: :runtime
36
- version_requirements: *id001
37
- description: With this gem you get an faq page and the management tools to make it very easy to update your faq and reduce the demand on your sites customer service
23
+ prerelease: false
24
+ version_requirements: *82239700
25
+ description: With this gem you get an faq page and the management tools to make it
26
+ very easy to update your faq and reduce the demand on your sites customer service
38
27
  email: joshnuss@gmail.com
39
28
  executables: []
40
-
41
29
  extensions: []
42
-
43
30
  extra_rdoc_files: []
44
-
45
- files:
31
+ files:
46
32
  - README.md
47
33
  - lib/spree_faq/engine.rb
48
34
  - lib/spree_faq.rb
49
- - lib/spree_faq_hooks.rb
50
- - lib/generators/spree_faq/install_generator.rb
51
- - lib/generators/templates/public/javascripts/jquery.scrollTo-min.js
52
- - lib/generators/templates/public/stylesheets/spree_faq.css
53
- - lib/generators/templates/db/migrate/20090526213535_create_questions.rb
54
- - lib/generators/templates/db/migrate/20090526213550_create_question_categories.rb
35
+ - app/assets/stylesheets/admin/spree_faq.css
36
+ - app/assets/javascripts/store/spree_faq.js.coffee
37
+ - app/assets/javascripts/store/all.js
38
+ - app/assets/javascripts/admin/jquery.scrollTo-min.js
55
39
  - app/views/faqs/index.html.erb
56
40
  - app/views/admin/question_categories/edit.html.erb
41
+ - app/views/admin/question_categories/new.js.erb
42
+ - app/views/admin/question_categories/index.html.erb
57
43
  - app/views/admin/question_categories/_question.html.erb
58
44
  - app/views/admin/question_categories/new.html.erb
59
- - app/views/admin/question_categories/index.html.erb
45
+ - app/overrides/faq_admin_tab.rb
46
+ - app/models/question_category.rb
47
+ - app/models/question.rb
60
48
  - app/controllers/faqs_controller.rb
61
49
  - app/controllers/admin/question_categories_controller.rb
62
- - app/models/question.rb
63
- - app/models/question_category.rb
64
50
  - config/routes.rb
65
- - config/locales/en-US.yml
66
- - config/locales/en-GB.yml
67
- has_rdoc: true
68
51
  homepage: http://spreecommerce.com
69
52
  licenses: []
70
-
71
53
  post_install_message:
72
54
  rdoc_options: []
73
-
74
- require_paths:
55
+ require_paths:
75
56
  - lib
76
- required_ruby_version: !ruby/object:Gem::Requirement
57
+ required_ruby_version: !ruby/object:Gem::Requirement
77
58
  none: false
78
- requirements:
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- hash: 57
82
- segments:
83
- - 1
84
- - 8
85
- - 7
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
86
62
  version: 1.8.7
87
- required_rubygems_version: !ruby/object:Gem::Requirement
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
64
  none: false
89
- requirements:
90
- - - ">="
91
- - !ruby/object:Gem::Version
92
- hash: 3
93
- segments:
94
- - 0
95
- version: "0"
96
- requirements:
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ requirements:
97
70
  - none
98
71
  rubyforge_project: spree_faq
99
- rubygems_version: 1.3.7
72
+ rubygems_version: 1.8.6
100
73
  signing_key:
101
74
  specification_version: 3
102
75
  summary: Adds an easy faq page to your spree site
103
76
  test_files: []
104
-
@@ -1,13 +0,0 @@
1
- ---
2
- en:
3
- frequently_asked_questions: Frequently Asked Questions
4
- question_categories_admin: FAQ
5
- question_categories: Frequently Asked Questions
6
- new_question_category: New Category
7
- questions: Questions
8
- create_category: Create Category
9
- category_name: Category Name
10
- add_question: Add Question
11
- question: Question
12
- answer: Answer
13
-
@@ -1,13 +0,0 @@
1
- ---
2
- en:
3
- frequently_asked_questions: Frequently Asked Questions
4
- question_categories_admin: FAQ
5
- question_categories: Frequently Asked Questions
6
- new_question_category: New Category
7
- questions: Questions
8
- create_category: Create Category
9
- category_name: Category Name
10
- add_question: Add Question
11
- question: Question
12
- answer: Answer
13
-
@@ -1,17 +0,0 @@
1
- module SpreeFaq
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_faq"
7
- def copy_migrations
8
- directory "db"
9
- end
10
-
11
- def copy_public
12
- directory "public"
13
- end
14
-
15
- end
16
- end
17
- end
@@ -1,17 +0,0 @@
1
- class CreateQuestions < ActiveRecord::Migration
2
- def self.up
3
- create_table :questions do |t|
4
- t.integer :question_category_id
5
- t.text :question
6
- t.text :answer
7
- t.integer :position
8
-
9
-
10
- t.timestamps
11
- end
12
- end
13
-
14
- def self.down
15
- drop_table :questions
16
- end
17
- end
@@ -1,14 +0,0 @@
1
- class CreateQuestionCategories < ActiveRecord::Migration
2
- def self.up
3
- create_table :question_categories do |t|
4
- t.string :name
5
- t.integer :position
6
-
7
- t.timestamps
8
- end
9
- end
10
-
11
- def self.down
12
- drop_table :question_categories
13
- end
14
- end
@@ -1,6 +0,0 @@
1
- class SpreeFaqHooks < Spree::ThemeSupport::HookListener
2
- insert_after :admin_tabs do
3
- %(<%= tab(:question_categories, :label => :question_categories_admin) %>)
4
- end
5
- end
6
-