enjoy_cms_faq 0.3.5 → 0.4.0.beta3

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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-gemset +1 -0
  3. data/.ruby-version +1 -0
  4. data/app/assets/javascripts/enjoy/faq.coffee +6 -0
  5. data/app/assets/javascripts/enjoy/faq/form.coffee +9 -0
  6. data/app/assets/javascripts/enjoy/faq/init.coffee +2 -0
  7. data/app/assets/stylesheets/enjoy/faq.sass +0 -0
  8. data/app/{models/concerns/enjoy/faq/decorators/question_category.rb → controllers/concerns/enjoy/faq/decorators/categories.rb} +1 -1
  9. data/app/controllers/enjoy/faq/categories_controller.rb +7 -0
  10. data/app/{controllers/concerns/enjoy/catalog/decorators/questions.rb → models/concerns/enjoy/faq/decorators/category.rb} +1 -1
  11. data/app/models/enjoy/faq/category.rb +11 -0
  12. data/app/views/enjoy/faq/categories/index.html.slim +6 -0
  13. data/app/views/enjoy/faq/{question_categories → categories}/show.html.slim +1 -1
  14. data/app/views/enjoy/faq/questions/{_new_question_form.html.slim → _form.html.slim} +1 -1
  15. data/app/views/enjoy/faq/questions/_form_with_wrapper.html.slim +2 -0
  16. data/app/views/enjoy/faq/questions/_question_block.html.slim +3 -3
  17. data/app/views/enjoy/faq/questions/create.html.slim +1 -1
  18. data/app/views/enjoy/faq/questions/index.html.slim +1 -1
  19. data/app/views/enjoy/faq/questions/new.html.slim +1 -1
  20. data/config/locales/enjoy.faq.ru.yml +39 -0
  21. data/enjoy_cms_faq.gemspec +1 -1
  22. data/lib/enjoy/faq/admin/{question_category.rb → category.rb} +1 -1
  23. data/lib/enjoy/faq/admin/question.rb +2 -2
  24. data/lib/enjoy/faq/configuration.rb +16 -0
  25. data/lib/enjoy/faq/controllers/{question_categories.rb → categories.rb} +12 -12
  26. data/lib/enjoy/faq/controllers/questions.rb +22 -4
  27. data/lib/enjoy/faq/models/{question_category.rb → category.rb} +7 -5
  28. data/lib/enjoy/faq/models/mongoid/{question_category.rb → category.rb} +5 -8
  29. data/lib/enjoy/faq/models/mongoid/question.rb +6 -10
  30. data/lib/enjoy/faq/models/question.rb +10 -5
  31. data/lib/enjoy/faq/routes.rb +57 -13
  32. data/lib/enjoy/faq/version.rb +1 -1
  33. data/lib/enjoy_cms_faq.rb +5 -10
  34. metadata +26 -20
  35. data/app/controllers/concerns/enjoy/catalog/decorators/question_categories.rb +0 -5
  36. data/app/controllers/concerns/enjoy/faq/decorators/question_categories.rb +0 -5
  37. data/app/controllers/enjoy/faq/question_categories_controller.rb +0 -7
  38. data/app/models/enjoy/faq/question_category.rb +0 -11
  39. data/app/views/enjoy/faq/question_categories/index.html.slim +0 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c5c4f104fce776355a25b9073e42aa96a4643d8d
4
- data.tar.gz: 2e4422d8ec654c5b0c9e6f41dbc9b8b70db52b9d
3
+ metadata.gz: 61d83964ea24eb0baa90091655042615b1a4cc2c
4
+ data.tar.gz: 3a84569c09aa468a409248f4dc78b1a844e1cfa1
5
5
  SHA512:
6
- metadata.gz: 3ee95207fb2d6a8f3b174214b4920976d0ae31df2034bfb123c302caa64f40e2cfccedd758a586cdbf68ed15f5ca0126badfad7001971be9433a78af1fe7abd7
7
- data.tar.gz: 4c97c0f2c58c34e8fffc037809b476114478e51a696b70c3ac5fe5a87c1422e4db84c99a2a32f63bd92ebbf14c35f02fd54f11a10c1ebe484987bd81d080a9f2
6
+ metadata.gz: 2cab60407097ea2c3e5c6ba12a2ff4d9633da8c0b3152ff89707ad5bf117d2520e1185052465edd526c1d292850819f5d0774139a4b365b874421456a01ff907
7
+ data.tar.gz: 35553b82ee52b5f334f9de00b271fd32677830da380da9867422e0b0f59af85e2db08520da6adae2bf6af3e993b96403ab65115f3e46de3d563e87e766523652
@@ -0,0 +1 @@
1
+ enjoy_cms_faq
@@ -0,0 +1 @@
1
+ 2.3.1
@@ -0,0 +1,6 @@
1
+ #= require ./faq/init
2
+ #= require ./faq/form
3
+
4
+ #= require_self
5
+
6
+ window.enjoy_cms.faq.create_ajax_form()
@@ -0,0 +1,9 @@
1
+ window.enjoy_cms.faq.create_ajax_form = (form_selector = "#new_enjoy_faq_question", wrapper_selector = "#enjoy_faq_form" )->
2
+
3
+ $(document).delegate form_selector, "ajax:complete", (event, xhr, status)->
4
+ $(event.currentTarget).closest(wrapper_selector).html(xhr.responseText)
5
+
6
+ $(document).delegate form_selector + " .input", 'click', (e) ->
7
+ e.preventDefault()
8
+ $(e.currentTarget).removeClass("field_with_errors").find('span.error').hide()
9
+ return false
@@ -0,0 +1,2 @@
1
+ window.enjoy_cms ||= {}
2
+ window.enjoy_cms.faq ||= {}
File without changes
@@ -1,5 +1,5 @@
1
1
  module Enjoy::Faq::Decorators
2
- module QuestionCategory
2
+ module Categories
3
3
  extend ActiveSupport::Concern
4
4
  end
5
5
  end
@@ -0,0 +1,7 @@
1
+ module Enjoy::Faq
2
+ class CategoriesController < ApplicationController
3
+ include Enjoy::Faq::Controllers::Categories
4
+
5
+ include Enjoy::Faq::Decorators::Categories
6
+ end
7
+ end
@@ -1,5 +1,5 @@
1
1
  module Enjoy::Faq::Decorators
2
- module Questions
2
+ module Category
3
3
  extend ActiveSupport::Concern
4
4
  end
5
5
  end
@@ -0,0 +1,11 @@
1
+ module Enjoy::Faq
2
+ class Category
3
+ include Enjoy::Faq::Models::Category
4
+
5
+ include Enjoy::Faq::Decorators::Category
6
+
7
+ rails_admin(&Enjoy::Faq::Admin::Category.config(rails_admin_add_fields) { |config|
8
+ rails_admin_add_config(config)
9
+ })
10
+ end
11
+ end
@@ -0,0 +1,6 @@
1
+ - @categories.each do |c|
2
+ p= link_to c.name, c, title: c.name
3
+
4
+ .newquestionform
5
+ p.newquestiontitle Задать свой вопрос:
6
+ = render partial: "enjoy/faq/questions/form_with_wrapper"
@@ -1,3 +1,3 @@
1
- h1= @question_category.name
1
+ h1= @category.name
2
2
  - @questions.each do |q|
3
3
  = link_to q.name, q, title: q.name
@@ -1,6 +1,6 @@
1
1
  - @question ||= Enjoy::Faq::Question.new
2
2
  - if @question.new_record?
3
- = simple_form_for @question, url: enjoy_questions_path do |f|
3
+ = simple_form_for @question, url: enjoy_faq_questions_path do |f|
4
4
  - unless @message.blank?
5
5
  h3= @message
6
6
  .inputtextblock_q
@@ -0,0 +1,2 @@
1
+ #enjoy_faq_form
2
+ = render partial: "enjoy/faq/questions/form"
@@ -1,7 +1,7 @@
1
1
  .qtable
2
- - _question_category = q.question_category
3
- - if _question_category
4
- = link_to _question_category.name, _question_category, title: _question_category.name
2
+ - _category = q.category
3
+ - if _category
4
+ = link_to _category.name, _category, title: _category.name
5
5
 
6
6
  .qtext_block
7
7
  .questionblock
@@ -1 +1 @@
1
- = render partial: "enjoy/faq/questions/new_question_form"
1
+ = render partial: "enjoy/faq/questions/form_with_wrapper"
@@ -4,4 +4,4 @@
4
4
 
5
5
  .newquestionform
6
6
  p.newquestiontitle Задать свой вопрос:
7
- = render partial: "enjoy/faq/questions/new_question_form"
7
+ = render partial: "enjoy/faq/questions/form_with_wrapper"
@@ -1,3 +1,3 @@
1
1
  .newquestionform
2
2
  p.newquestiontitle Задать свой вопрос:
3
- = render partial: "enjoy/faq/questions/new_question_form"
3
+ = render partial: "enjoy/faq/questions/form_with_wrapper"
@@ -0,0 +1,39 @@
1
+ ru:
2
+ enjoy:
3
+ faq: FAQ
4
+ breadcrumbs:
5
+ faq: FAQ
6
+ errors:
7
+ faq:
8
+ recaptcha: Вы робот?
9
+
10
+ mongoid:
11
+ models:
12
+ enjoy/faq/question: Вопросы
13
+ enjoy/faq/category: Категории
14
+ attributes:
15
+ enjoy/faq/question:
16
+ question_text: Текст вопроса
17
+ question_text_after_editing: Текст вопроса (редактированный)
18
+ author_name: Имя автора
19
+ author_name_after_editing: Имя автора (редактированное)
20
+ author_email: E-mail автора
21
+
22
+ answered: Есть ответ
23
+ answer_text: Текст ответа
24
+ answered_time: Время ответа
25
+ answer_author_name: Имя автора ответа
26
+
27
+ categories: Категории
28
+ category_ids: Категории
29
+
30
+ enjoy/faq/category:
31
+ questions: Вопросы
32
+
33
+
34
+ errors:
35
+ models:
36
+ enjoy/faq/question:
37
+ attributes:
38
+ author_email:
39
+ invalid_email_address: "Некорректный e-mail"
@@ -30,5 +30,5 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency "bundler", "~> 1.10"
31
31
  spec.add_development_dependency "rake", "~> 10.0"
32
32
 
33
- spec.add_dependency 'enjoy_cms', "~> 0.3.5"
33
+ spec.add_dependency 'enjoy_cms', "~> 0.4.0.beta3"
34
34
  end
@@ -1,6 +1,6 @@
1
1
  module Enjoy::Faq
2
2
  module Admin
3
- module QuestionCategory
3
+ module Category
4
4
  def self.config(fields = {})
5
5
  Proc.new {
6
6
  navigation_label "FAQ"
@@ -9,12 +9,12 @@ module Enjoy::Faq
9
9
  scopes [:by_date, :by_answered_date, :answered, :not_answered, :enabled, nil]
10
10
 
11
11
  field :enabled, :toggle
12
- field :question_categories
12
+ field :categories
13
13
  field :full_name
14
14
  end
15
15
 
16
16
  edit do
17
- field :question_categories
17
+ field :categories
18
18
  field :enabled, :toggle
19
19
 
20
20
  group :URL do
@@ -19,6 +19,13 @@ module Enjoy
19
19
  attr_accessor :save_with_captcha
20
20
  attr_accessor :captcha_error_message
21
21
 
22
+ attr_accessor :recaptcha_support
23
+ attr_accessor :simple_captcha_support
24
+
25
+ attr_accessor :seo_support
26
+
27
+ attr_accessor :localize
28
+
22
29
  def initialize
23
30
  @author_name_required = true
24
31
 
@@ -26,6 +33,15 @@ module Enjoy
26
33
 
27
34
  @save_with_captcha = true
28
35
  @captcha_error_message = "Код с картинки введен неверно"
36
+
37
+ @recaptcha_support = defined?(Recaptcha)
38
+ @simple_captcha_support = defined?(SimpleCaptcha)
39
+
40
+ @seo_support = defined?(Enjoy::Seo)
41
+
42
+ @breadcrumbs_on_rails_support = defined?(BreadcrumbsOnRails)
43
+
44
+ @localize = Enjoy.config.localize
29
45
  end
30
46
  end
31
47
  end
@@ -1,40 +1,40 @@
1
1
  module Enjoy::Faq
2
2
  module Controllers
3
- module QuestionCategories
3
+ module Categories
4
4
  extend ActiveSupport::Concern
5
5
 
6
6
  def index
7
- @question_categories = question_category_class.enabled.sorted.to_a
8
- @root_categories = question_category_class.enabled.roots.sorted.all.to_a
7
+ @categories = category_class.enabled.sorted.to_a
8
+ @root_categories = category_class.enabled.roots.sorted.all.to_a
9
9
  # index_crumbs
10
10
  end
11
11
 
12
12
  def show
13
- @question_category = question_category_class.enabled.find(params[:id])
14
- if !@question_category.text_slug.blank? and @question_category.text_slug != params[:id]
15
- redirect_to @question_category, status_code: 301
13
+ @category = category_class.enabled.find(params[:id])
14
+ if !@category.text_slug.blank? and @category.text_slug != params[:id]
15
+ redirect_to @category, status_code: 301
16
16
  return
17
17
  end
18
18
  @seo_parent_page = find_seo_page(question_categories_path)
19
19
 
20
- @children = @question_category.children.enabled.sorted.all.to_a
21
- @questions = @question_category.questions.enabled.sorted.all.to_a
20
+ @children = @category.children.enabled.sorted.all.to_a
21
+ @questions = @category.questions.enabled.sorted.all.to_a
22
22
 
23
23
  # index_crumbs
24
24
  # category_crumbs
25
25
  end
26
26
 
27
27
  def page_title
28
- if @question_category
29
- @question_category.page_title
28
+ if @category
29
+ @category.page_title
30
30
  else
31
31
  super
32
32
  end
33
33
  end
34
34
 
35
35
  private
36
- def question_category_class
37
- Enjoy::Faq::QuestionCategory
36
+ def category_class
37
+ Enjoy::Faq::Category
38
38
  end
39
39
  def question_class
40
40
  Enjoy::Faq::Question
@@ -29,7 +29,25 @@ module Enjoy::Faq
29
29
  def create
30
30
  @question = question_class.new(question_params)
31
31
 
32
- _method = Enjoy::Faq.configuration.save_with_captcha ? :save_with_captcha : :save
32
+ if Enjoy::Faq.config.captcha
33
+ if Enjoy::Faq.config.recaptcha_support
34
+ if verify_recaptcha
35
+ meth = :save
36
+ else
37
+ meth = :valid?
38
+ @recaptcha_error = I18n.t('enjoy.errors.faq.recaptcha')
39
+ end
40
+
41
+ elsif Enjoy::Faq.config.simple_captcha_support
42
+ meth = :save_with_captcha
43
+
44
+ else
45
+ meth = :save
46
+ end
47
+ else
48
+ meth = :save
49
+ end
50
+
33
51
  if @question.send(_method)
34
52
  @message = "Успешно создано все"
35
53
  else
@@ -43,11 +61,11 @@ module Enjoy::Faq
43
61
 
44
62
  private
45
63
  def question_params
46
- params[:question].permit(:question_text, :author_name, :author_email, :captcha, :captcha_key)
64
+ params[:enjoy_faq_question].permit(:question_text, :author_name, :author_email, :captcha, :captcha_key)
47
65
  end
48
66
 
49
- def question_category_class
50
- Enjoy::Faq::QuestionCategory
67
+ def category_class
68
+ Enjoy::Faq::Category
51
69
  end
52
70
  def question_class
53
71
  Enjoy::Faq::Question
@@ -1,15 +1,17 @@
1
1
  module Enjoy::Faq
2
2
  module Models
3
- module QuestionCategory
3
+ module Category
4
4
  extend ActiveSupport::Concern
5
5
  include Enjoy::Model
6
-
7
6
  include Enjoy::Enableable
8
- include Enjoy::Seoable
9
- include Enjoy::SitemapDataField
7
+
8
+ if Enjoy::Faq.config.seo_support
9
+ include Enjoy::Seo::Seoable
10
+ include Enjoy::Seo::SitemapDataField
11
+ end
10
12
  include ManualSlug
11
13
 
12
- include Enjoy::Faq.orm_specific('QuestionCategory')
14
+ include Enjoy::Faq.orm_specific('Category')
13
15
 
14
16
  included do
15
17
  manual_slug :name
@@ -1,23 +1,20 @@
1
1
  module Enjoy::Faq
2
2
  module Models
3
3
  module Mongoid
4
- module QuestionCategory
4
+ module Category
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  include Enjoy::HtmlField
8
8
 
9
9
  included do
10
- if defined?(RailsAdminComments)
11
- include RailsAdminComments::Commentable
12
- end
13
-
14
- field :name, type: String, localize: Enjoy.configuration.localize
10
+
11
+ field :name, type: String, localize: Enjoy::Faq.configuration.localize
15
12
 
16
13
  acts_as_nested_set
17
14
  scope :sorted, -> { order_by([:lft, :asc]) }
18
15
 
19
- enjoy_cms_html_field :excerpt, type: String, localize: Enjoy.configuration.localize, default: ""
20
- enjoy_cms_html_field :content, type: String, localize: Enjoy.configuration.localize, default: ""
16
+ enjoy_cms_html_field :excerpt, type: String, localize: Enjoy::Faq.configuration.localize, default: ""
17
+ enjoy_cms_html_field :content, type: String, localize: Enjoy::Faq.configuration.localize, default: ""
21
18
  end
22
19
 
23
20
  def questions
@@ -7,23 +7,19 @@ module Enjoy::Faq
7
7
  include Enjoy::HtmlField
8
8
 
9
9
  included do
10
- if defined?(RailsAdminComments)
11
- include RailsAdminComments::Commentable
12
- end
13
10
 
14
11
  field :question_text
15
- enjoy_cms_html_field :question_text_after_editing, localize: Enjoy.configuration.localize
12
+ enjoy_cms_html_field :question_text_after_editing, localize: Enjoy::Faq.configuration.localize
16
13
  field :author_name
17
- field :author_name_text_after_editing, localize: Enjoy.configuration.localize
14
+ field :author_name_text_after_editing, localize: Enjoy::Faq.configuration.localize
18
15
  field :author_email
19
16
 
20
17
  field :answered, type: Boolean, default: false
21
- enjoy_cms_html_field :answer_text, localize: Enjoy.configuration.localize
18
+ enjoy_cms_html_field :answer_text, localize: Enjoy::Faq.configuration.localize
22
19
  field :answered_time, type: Time
23
20
  field :answer_author_name, default: Enjoy::Faq.configuration.default_answer_author_name
24
21
 
25
- has_and_belongs_to_many :question_categories, class_name: "Enjoy::Faq::QuestionCategory", inverse_of: nil
26
- alias :categories :question_categories
22
+ has_and_belongs_to_many :categories, class_name: "Enjoy::Faq::Category", inverse_of: nil
27
23
 
28
24
  acts_as_nested_set
29
25
  scope :sorted, -> { order_by([:lft, :asc]) }
@@ -37,8 +33,8 @@ module Enjoy::Faq
37
33
  scope :recent, ->(count = 5) { enabled.after_now.by_date.limit(count) }
38
34
  end
39
35
 
40
- def question_category
41
- self.question_categories.enabled.sorted.first
36
+ def category
37
+ self.categories.enabled.sorted.first
42
38
  end
43
39
 
44
40
  def question_text_output
@@ -5,8 +5,10 @@ module Enjoy::Faq
5
5
  include Enjoy::Model
6
6
  include Enjoy::Enableable
7
7
 
8
- include Enjoy::Seoable
9
- include Enjoy::SitemapDataField
8
+ if Enjoy::Faq.config.seo_support
9
+ include Enjoy::Seo::Seoable
10
+ include Enjoy::Seo::SitemapDataField
11
+ end
10
12
  include ManualSlug
11
13
 
12
14
  include Enjoy::Faq.orm_specific('Question')
@@ -14,7 +16,10 @@ module Enjoy::Faq
14
16
  included do
15
17
  manual_slug :full_name
16
18
 
17
- apply_simple_captcha message: Enjoy::Faq.configuration.captcha_error_message
19
+ if Enjoy::Faq.config.simple_captcha_support
20
+ include SimpleCaptcha::ModelHelpers
21
+ apply_simple_captcha message: Enjoy::Faq.configuration.captcha_error_message
22
+ end
18
23
 
19
24
  validates_email_format_of :author_email
20
25
  if Enjoy::Faq.config.author_name_required
@@ -31,8 +36,8 @@ module Enjoy::Faq
31
36
  "#{self.author_name_output}: \"#{self.question_text_output}\""
32
37
  end
33
38
 
34
- def question_category_class
35
- Enjoy::Faq::QuestionCategory
39
+ def category_class
40
+ Enjoy::Faq::Category
36
41
  end
37
42
 
38
43
  end
@@ -1,33 +1,77 @@
1
1
  module ActionDispatch::Routing
2
2
  class Mapper
3
-
4
3
  def enjoy_cms_faq_routes(config = {})
5
4
  routes_config = {
6
5
  use_questions_path: true,
7
- use_question_categories_path: true,
8
- use_faq_path: true
6
+ use_categories_path: true,
7
+ use_faq_path: true,
8
+ faq_path: 'faq',
9
+ classes: {
10
+ questions: :questions,
11
+ categories: :categories,
12
+ faq_controller: :categories
13
+ },
14
+ paths: {
15
+ questions: :questions,
16
+ categories: :categories
17
+ },
18
+ pagination: {
19
+ questions: true,
20
+ categories: true,
21
+ category_questions: true
22
+ },
23
+ actions: {
24
+ questions: [:show, :create],
25
+ categories: [:show],
26
+ }
9
27
  }
10
- routes_config.merge!(config)
28
+ routes_config.deep_merge!(config)
29
+
30
+ generate_enjoy_faq_user_routes(routes_config)
31
+ generate_enjoy_faq_cms_routes(routes_config)
32
+ end
33
+
34
+
35
+ private
36
+ def generate_enjoy_faq_user_routes(routes_config)
37
+ if !routes_config[:use_questions_path] and !routes_config[:classes][:questions].nil?
38
+ resources routes_config[:classes][:questions].to_sym, only: routes_config[:actions][:questions], path: routes_config[:paths][:questions] do
39
+ get '(/page/:page)', action: :index, on: :collection, as: "" if routes_config[:pagination][:questions]
40
+ end
41
+ end
11
42
 
43
+ if !routes_config[:use_categories_path] and !routes_config[:classes][:categories].nil?
44
+ resources routes_config[:classes][:categories].to_sym, only: routes_config[:actions][:categories], path: routes_config[:paths][:categories] do
45
+ get '(/page/:page)', action: :index, on: :collection, as: "" if routes_config[:pagination][:categories]
46
+ get 'questions(/page/:page)', action: :questions, on: :member, as: :questions if routes_config[:pagination][:category_questions]
47
+ end
48
+ end
49
+
50
+ if !routes_config[:use_faq_path] and !routes_config[:classes][:faq_controller].nil?
51
+ get "#{routes_config[:faq_path]}" => "#{routes_config[:classes][:faq_controller]}#index"
52
+ end
53
+ end
54
+
55
+ def generate_enjoy_faq_cms_routes(routes_config)
12
56
  scope module: 'enjoy' do
13
57
  scope module: 'faq' do
14
- if routes_config[:use_questions_path]
15
- resources :questions, only: [:show, :new, :create], as: :enjoy_faq_questions do
16
- get '(/page/:page)', action: :index, on: :collection, as: ""
58
+ if routes_config[:use_questions_path] and !routes_config[:classes][:questions].nil?
59
+ resources routes_config[:classes][:questions].to_sym, only: routes_config[:actions][:questions], path: routes_config[:paths][:questions], as: :enjoy_faq_questions do
60
+ get '(/page/:page)', action: :index, on: :collection, as: "" if routes_config[:pagination][:questions]
17
61
  end
18
62
  end
19
63
 
20
- if routes_config[:use_question_categories_path]
21
- resources :question_categories, only: [:index, :show], as: :enjoy_faq_question_categories do
22
- get 'questions(/page/:page)', action: :questions, on: :member, as: :questions
64
+ if routes_config[:use_categories_path] and !routes_config[:classes][:categories].nil?
65
+ resources routes_config[:classes][:categories].to_sym, only: routes_config[:actions][:categories], path: routes_config[:paths][:categories], as: :enjoy_catalog_categories do
66
+ get '(/page/:page)', action: :index, on: :collection, as: "" if routes_config[:pagination][:categories]
67
+ get 'questions(/page/:page)', action: :items, on: :member, as: :questions if routes_config[:pagination][:category_questions]
23
68
  end
24
69
  end
25
- if routes_config[:use_faq_path]
26
- get 'faq' => 'question_categories#index', as: :enjoy_faq
70
+ if routes_config[:use_faq_path] and !routes_config[:classes][:faq_controller].nil?
71
+ get "#{routes_config[:faq_path]}" => "#{routes_config[:classes][:faq_controller]}#index", as: :enjoy_faq
27
72
  end
28
73
  end
29
74
  end
30
-
31
75
  end
32
76
 
33
77
  end
@@ -1,5 +1,5 @@
1
1
  module Enjoy
2
2
  module Faq
3
- VERSION = "0.3.5"
3
+ VERSION = "0.4.0.beta3"
4
4
  end
5
5
  end
@@ -2,11 +2,6 @@ require "enjoy/faq/version"
2
2
 
3
3
  require 'enjoy/faq/routes'
4
4
 
5
- require 'enjoy_cms'
6
-
7
- require 'rails_admin_sort_embedded'
8
- require 'rails_admin_jcrop'
9
-
10
5
  require 'enjoy/faq/configuration'
11
6
  require 'enjoy/faq/engine'
12
7
 
@@ -23,7 +18,7 @@ module Enjoy
23
18
  Enjoy::Faq.orm == :active_record
24
19
  end
25
20
  def model_namespace
26
- "Enjoy::Faq::Models::#{Enjoy::Catalog.orm.to_s.camelize}"
21
+ "Enjoy::Faq::Models::#{Enjoy::Faq.orm.to_s.camelize}"
27
22
  end
28
23
  def orm_specific(name)
29
24
  "#{model_namespace}::#{name}".constantize
@@ -33,22 +28,22 @@ module Enjoy
33
28
  autoload :Admin, 'enjoy/faq/admin'
34
29
  module Admin
35
30
  autoload :Question, 'enjoy/faq/admin/question'
36
- autoload :QuestionCategory, 'enjoy/faq/admin/question_category'
31
+ autoload :Category, 'enjoy/faq/admin/category'
37
32
  end
38
33
 
39
34
  module Models
40
35
  autoload :Question, 'enjoy/faq/models/question'
41
- autoload :QuestionCategory, 'enjoy/faq/models/question_category'
36
+ autoload :Category, 'enjoy/faq/models/category'
42
37
 
43
38
  module Mongoid
44
39
  autoload :Question, 'enjoy/faq/models/mongoid/question'
45
- autoload :QuestionCategory, 'enjoy/faq/models/mongoid/question_category'
40
+ autoload :Category, 'enjoy/faq/models/mongoid/category'
46
41
  end
47
42
  end
48
43
 
49
44
  module Controllers
50
45
  autoload :Questions, 'enjoy/faq/controllers/questions'
51
- autoload :QuestionCategories, 'enjoy/faq/controllers/question_categories'
46
+ autoload :Categories, 'enjoy/faq/controllers/categories'
52
47
  end
53
48
  end
54
49
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enjoy_cms_faq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.4.0.beta3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Kiseliev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-07 00:00:00.000000000 Z
11
+ date: 2016-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.3.5
47
+ version: 0.4.0.beta3
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.3.5
54
+ version: 0.4.0.beta3
55
55
  description: FAQ system with EnjoyCMS support.
56
56
  email:
57
57
  - dev@enjoycreate.ru
@@ -60,24 +60,29 @@ extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
62
  - ".gitignore"
63
+ - ".ruby-gemset"
64
+ - ".ruby-version"
63
65
  - ".travis.yml"
64
66
  - Gemfile
65
67
  - LICENSE.txt
66
68
  - README.md
67
69
  - Rakefile
68
- - app/controllers/concerns/enjoy/catalog/decorators/question_categories.rb
69
- - app/controllers/concerns/enjoy/catalog/decorators/questions.rb
70
- - app/controllers/concerns/enjoy/faq/decorators/question_categories.rb
70
+ - app/assets/javascripts/enjoy/faq.coffee
71
+ - app/assets/javascripts/enjoy/faq/form.coffee
72
+ - app/assets/javascripts/enjoy/faq/init.coffee
73
+ - app/assets/stylesheets/enjoy/faq.sass
74
+ - app/controllers/concerns/enjoy/faq/decorators/categories.rb
71
75
  - app/controllers/concerns/enjoy/faq/decorators/questions.rb
72
- - app/controllers/enjoy/faq/question_categories_controller.rb
76
+ - app/controllers/enjoy/faq/categories_controller.rb
73
77
  - app/controllers/enjoy/faq/questions_controller.rb
78
+ - app/models/concerns/enjoy/faq/decorators/category.rb
74
79
  - app/models/concerns/enjoy/faq/decorators/question.rb
75
- - app/models/concerns/enjoy/faq/decorators/question_category.rb
80
+ - app/models/enjoy/faq/category.rb
76
81
  - app/models/enjoy/faq/question.rb
77
- - app/models/enjoy/faq/question_category.rb
78
- - app/views/enjoy/faq/question_categories/index.html.slim
79
- - app/views/enjoy/faq/question_categories/show.html.slim
80
- - app/views/enjoy/faq/questions/_new_question_form.html.slim
82
+ - app/views/enjoy/faq/categories/index.html.slim
83
+ - app/views/enjoy/faq/categories/show.html.slim
84
+ - app/views/enjoy/faq/questions/_form.html.slim
85
+ - app/views/enjoy/faq/questions/_form_with_wrapper.html.slim
81
86
  - app/views/enjoy/faq/questions/_question_block.html.slim
82
87
  - app/views/enjoy/faq/questions/create.html.slim
83
88
  - app/views/enjoy/faq/questions/index.html.slim
@@ -86,18 +91,19 @@ files:
86
91
  - bin/console
87
92
  - bin/setup
88
93
  - config/initializers/rails_admin.rb
94
+ - config/locales/enjoy.faq.ru.yml
89
95
  - enjoy_cms_faq.gemspec
90
96
  - lib/enjoy/faq/admin.rb
97
+ - lib/enjoy/faq/admin/category.rb
91
98
  - lib/enjoy/faq/admin/question.rb
92
- - lib/enjoy/faq/admin/question_category.rb
93
99
  - lib/enjoy/faq/configuration.rb
94
- - lib/enjoy/faq/controllers/question_categories.rb
100
+ - lib/enjoy/faq/controllers/categories.rb
95
101
  - lib/enjoy/faq/controllers/questions.rb
96
102
  - lib/enjoy/faq/engine.rb
103
+ - lib/enjoy/faq/models/category.rb
104
+ - lib/enjoy/faq/models/mongoid/category.rb
97
105
  - lib/enjoy/faq/models/mongoid/question.rb
98
- - lib/enjoy/faq/models/mongoid/question_category.rb
99
106
  - lib/enjoy/faq/models/question.rb
100
- - lib/enjoy/faq/models/question_category.rb
101
107
  - lib/enjoy/faq/routes.rb
102
108
  - lib/enjoy/faq/version.rb
103
109
  - lib/enjoy_cms_faq.rb
@@ -117,12 +123,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
117
123
  version: '0'
118
124
  required_rubygems_version: !ruby/object:Gem::Requirement
119
125
  requirements:
120
- - - ">="
126
+ - - ">"
121
127
  - !ruby/object:Gem::Version
122
- version: '0'
128
+ version: 1.3.1
123
129
  requirements: []
124
130
  rubyforge_project:
125
- rubygems_version: 2.4.8
131
+ rubygems_version: 2.5.1
126
132
  signing_key:
127
133
  specification_version: 4
128
134
  summary: FAQ system with EnjoyCMS support.
@@ -1,5 +0,0 @@
1
- module Enjoy::Faq::Decorators
2
- module QuestionCategories
3
- extend ActiveSupport::Concern
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- module Enjoy::Faq::Decorators
2
- module QuestionCategories
3
- extend ActiveSupport::Concern
4
- end
5
- end
@@ -1,7 +0,0 @@
1
- module Enjoy::Faq
2
- class QuestionCategoriesController < ApplicationController
3
- include Enjoy::Faq::Controllers::QuestionCategories
4
-
5
- include Enjoy::Faq::Decorators::QuestionCategories
6
- end
7
- end
@@ -1,11 +0,0 @@
1
- module Enjoy::Faq
2
- class QuestionCategory
3
- include Enjoy::Faq::Models::QuestionCategory
4
-
5
- include Enjoy::Faq::Decorators::QuestionCategory
6
-
7
- rails_admin(&Enjoy::Faq::Admin::QuestionCategory.config(rails_admin_add_fields) { |config|
8
- rails_admin_add_config(config)
9
- })
10
- end
11
- end
@@ -1,2 +0,0 @@
1
- - @question_categories.each do |qc|
2
- p= link_to qc.name, qc, title: qc.name