hancock_cms_faq 1.0.2
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.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +55 -0
- data/Rakefile +1 -0
- data/app/assets/javascripts/hancock/faq.coffee +6 -0
- data/app/assets/javascripts/hancock/faq/form.coffee +9 -0
- data/app/assets/javascripts/hancock/faq/init.coffee +2 -0
- data/app/assets/stylesheets/hancock/faq.sass +0 -0
- data/app/controllers/concerns/hancock/faq/decorators/categories.rb +17 -0
- data/app/controllers/concerns/hancock/faq/decorators/questions.rb +71 -0
- data/app/controllers/hancock/faq/categories_controller.rb +7 -0
- data/app/controllers/hancock/faq/questions_controller.rb +7 -0
- data/app/models/concerns/hancock/faq/decorators/category.rb +36 -0
- data/app/models/concerns/hancock/faq/decorators/question.rb +48 -0
- data/app/models/hancock/faq/category.rb +11 -0
- data/app/models/hancock/faq/question.rb +11 -0
- data/app/views/hancock/faq/categories/index.html.slim +10 -0
- data/app/views/hancock/faq/categories/show.html.slim +8 -0
- data/app/views/hancock/faq/questions/_fields.html.slim +11 -0
- data/app/views/hancock/faq/questions/_fields_with_settings.html.slim +20 -0
- data/app/views/hancock/faq/questions/_form.html.slim +66 -0
- data/app/views/hancock/faq/questions/_form_with_wrapper.html.slim +2 -0
- data/app/views/hancock/faq/questions/_question_block.html.slim +33 -0
- data/app/views/hancock/faq/questions/_simple_captcha.html.slim +16 -0
- data/app/views/hancock/faq/questions/_success.html.slim +3 -0
- data/app/views/hancock/faq/questions/create.html.slim +1 -0
- data/app/views/hancock/faq/questions/index.html.slim +11 -0
- data/app/views/hancock/faq/questions/new.html.slim +6 -0
- data/app/views/hancock/faq/questions/show.html.slim +8 -0
- data/app/views/hancock/faq/questions/update_captcha.html.slim +16 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/config/locales/hancock.faq.ru.yml +64 -0
- data/hancock_cms_faq.gemspec +36 -0
- data/lib/generators/hancock/faq/config/config_generator.rb +13 -0
- data/lib/generators/hancock/faq/config/templates/hancock_faq.erb +23 -0
- data/lib/generators/hancock/faq/controllers/all_generator.rb +28 -0
- data/lib/generators/hancock/faq/controllers/category_generator.rb +43 -0
- data/lib/generators/hancock/faq/controllers/decorators_generator.rb +24 -0
- data/lib/generators/hancock/faq/controllers/question_generator.rb +43 -0
- data/lib/generators/hancock/faq/controllers/templates/categories_controller.erb +10 -0
- data/lib/generators/hancock/faq/controllers/templates/questions_controller.erb +10 -0
- data/lib/generators/hancock/faq/models/all_generator.rb +28 -0
- data/lib/generators/hancock/faq/models/category_generator.rb +43 -0
- data/lib/generators/hancock/faq/models/decorators_generator.rb +24 -0
- data/lib/generators/hancock/faq/models/question_generator.rb +34 -0
- data/lib/generators/hancock/faq/models/templates/category.erb +36 -0
- data/lib/generators/hancock/faq/models/templates/question.erb +37 -0
- data/lib/hancock/faq/admin.rb +6 -0
- data/lib/hancock/faq/admin/category.rb +128 -0
- data/lib/hancock/faq/admin/question.rb +104 -0
- data/lib/hancock/faq/configuration.rb +53 -0
- data/lib/hancock/faq/controllers/categories.rb +88 -0
- data/lib/hancock/faq/controllers/questions.rb +174 -0
- data/lib/hancock/faq/engine.rb +7 -0
- data/lib/hancock/faq/models/category.rb +50 -0
- data/lib/hancock/faq/models/mongoid/category.rb +33 -0
- data/lib/hancock/faq/models/mongoid/question.rb +72 -0
- data/lib/hancock/faq/models/question.rb +85 -0
- data/lib/hancock/faq/routes.rb +83 -0
- data/lib/hancock/faq/version.rb +5 -0
- data/lib/hancock_cms_faq.rb +31 -0
- data/release.sh +6 -0
- metadata +159 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b805ff6820575b001725be796416aa508ad6c7f9
|
4
|
+
data.tar.gz: 87add6a36016ec18182aaf15cb415d6a539149fd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 34a23e6577df41b03b5af99565649eae6f344cbf8f17737b316f6795b7e147d363537f63b3bf69e768e4b8959092801e3b440307f0f16787addb74daae002272
|
7
|
+
data.tar.gz: f57864e1be1a6fe8a19ef665ec457de39bb856d5c818ca7300cd565c28f0e0b75d3f9b951def2278df51e4ae3166537294496848328c772e87541d3230d1cde6
|
data/.gitignore
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
hancock_cms_faq
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.3.1
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Alexander Kiseliev
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# HancockCmsFaq
|
2
|
+
|
3
|
+
### Remaded from [EnjoyCMSFaq](https://github.com/enjoycreative/enjoy_cms_faq)
|
4
|
+
|
5
|
+
FAQ system for [HancockCMS](https://github.com/red-rocks/hancock_cms).
|
6
|
+
Question send form, question categories, captcha support
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'hancock_cms_faq'
|
14
|
+
```
|
15
|
+
|
16
|
+
Then add this
|
17
|
+
```ruby
|
18
|
+
gem "recaptcha", require: "recaptcha/rails" # Recaptcha
|
19
|
+
```
|
20
|
+
or this
|
21
|
+
```ruby
|
22
|
+
gem "glebtv-simple_captcha" # simple_captcha
|
23
|
+
```
|
24
|
+
before it for captcha you need. And configure it. If you need
|
25
|
+
|
26
|
+
And then execute:
|
27
|
+
|
28
|
+
$ bundle
|
29
|
+
|
30
|
+
Or install it yourself as:
|
31
|
+
|
32
|
+
$ gem install hancock_cms_faq
|
33
|
+
|
34
|
+
## Usage
|
35
|
+
|
36
|
+
Add in config/routes.rb
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
hancock_cms_faq_routes
|
40
|
+
```
|
41
|
+
|
42
|
+
## Development
|
43
|
+
|
44
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake false` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
45
|
+
|
46
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
47
|
+
|
48
|
+
## Contributing
|
49
|
+
|
50
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/red-rocks/hancock_cms_faq.
|
51
|
+
|
52
|
+
|
53
|
+
## License
|
54
|
+
|
55
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,9 @@
|
|
1
|
+
window.hancock_cms.faq.create_ajax_form = (form_selector = "#new_hancock_faq_question", wrapper_selector = "#hancock_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
|
File without changes
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Hancock::Faq::Decorators
|
2
|
+
module Categories
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
# included do
|
6
|
+
#
|
7
|
+
# def category_class
|
8
|
+
# Hancock::Faq::Category
|
9
|
+
# end
|
10
|
+
# def question_class
|
11
|
+
# Hancock::Faq::Question
|
12
|
+
# end
|
13
|
+
#
|
14
|
+
# end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module Hancock::Faq::Decorators
|
2
|
+
module Questions
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
# included do
|
6
|
+
#
|
7
|
+
# def hancock_faq_update_captcha_path
|
8
|
+
# url_for(action: :update_captcha, time: Time.new.to_i, only_path: true)
|
9
|
+
# end
|
10
|
+
# def cache_fields?
|
11
|
+
# ['new', 'index'].include? action_name
|
12
|
+
# end
|
13
|
+
# def cache_key
|
14
|
+
# 'hancock_faq_question_fields'.freeze
|
15
|
+
# end
|
16
|
+
# def fields_partial
|
17
|
+
# "hancock/faq/questions/#{(Hancock::Faq.config.model_settings_support ? 'fields' : 'fields_with_settings')}".freeze
|
18
|
+
# end
|
19
|
+
# def settings_scope
|
20
|
+
# if Hancock::Faq.config.model_settings_support
|
21
|
+
# question_class.settings
|
22
|
+
# elsif defined?(Settings)
|
23
|
+
# Settings.ns('FAQ')
|
24
|
+
# else
|
25
|
+
# nil
|
26
|
+
# end
|
27
|
+
# end
|
28
|
+
#
|
29
|
+
# def render_faq_error
|
30
|
+
# if request.xhr? && process_ajax
|
31
|
+
# render partial: form_partial, status: 422
|
32
|
+
# # render json: {errors: @contact_message.errors}, status: 422
|
33
|
+
# else
|
34
|
+
# flash.now[:alert] = @question.errors.full_messages.join("\n")
|
35
|
+
# render action: Hancock::Faq.configuration.recreate_contact_message_action, status: 422
|
36
|
+
# end
|
37
|
+
# end
|
38
|
+
# def process_ajax
|
39
|
+
# true
|
40
|
+
# end
|
41
|
+
# def ajax_success
|
42
|
+
# render partial: success_partial
|
43
|
+
# # render json: {ok: true}
|
44
|
+
# end
|
45
|
+
# def redirect_after_done
|
46
|
+
# redirect_to action: :sent
|
47
|
+
# end
|
48
|
+
# def xhr_checker
|
49
|
+
# if request.xhr?
|
50
|
+
# render layout: false
|
51
|
+
# end
|
52
|
+
# end
|
53
|
+
# def after_initialize
|
54
|
+
# end
|
55
|
+
# def after_create
|
56
|
+
# # overrideable hook for updating message
|
57
|
+
# end
|
58
|
+
# def form_partial
|
59
|
+
# "hancock/faq/questions/form"
|
60
|
+
# end
|
61
|
+
# def success_partial
|
62
|
+
# "hancock/faq/questions/success"
|
63
|
+
# end
|
64
|
+
# def question_params
|
65
|
+
# params[:hancock_faq_question].permit(:question_text, :author_name, :author_email, :captcha, :captcha_key)
|
66
|
+
# end
|
67
|
+
#
|
68
|
+
# end
|
69
|
+
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Hancock::Faq::Decorators
|
2
|
+
module Category
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
# def self.default_cache_keys
|
7
|
+
# []
|
8
|
+
# end
|
9
|
+
#
|
10
|
+
# ############# rails_admin ##############
|
11
|
+
# def self.rails_admin_add_fields
|
12
|
+
# {}
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
# def self.rails_admin_add_config(config)
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# def self.admin_can_user_defined_actions
|
19
|
+
# [].freeze
|
20
|
+
# end
|
21
|
+
# def self.admin_cannot_user_defined_actions
|
22
|
+
# [].freeze
|
23
|
+
# end
|
24
|
+
# def self.manager_can_user_defined_actions
|
25
|
+
# [].freeze
|
26
|
+
# end
|
27
|
+
# def self.manager_cannot_user_defined_actions
|
28
|
+
# [].freeze
|
29
|
+
# end
|
30
|
+
# def self.rails_admin_user_defined_visible_actions
|
31
|
+
# [].freeze
|
32
|
+
# end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Hancock::Faq::Decorators
|
2
|
+
module Question
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
# def self.default_cache_keys
|
7
|
+
# []
|
8
|
+
# end
|
9
|
+
#
|
10
|
+
# def send_emails?
|
11
|
+
# true
|
12
|
+
# end
|
13
|
+
#
|
14
|
+
# def mailer_class
|
15
|
+
# Hancock::Feedback::ContactMailer
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# def mailer_method
|
19
|
+
# :new_message_email
|
20
|
+
# end
|
21
|
+
#
|
22
|
+
# ############# rails_admin ##############
|
23
|
+
# def self.rails_admin_add_fields
|
24
|
+
# {}
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
# def self.rails_admin_add_config(config)
|
28
|
+
# end
|
29
|
+
#
|
30
|
+
# def self.admin_can_user_defined_actions
|
31
|
+
# [].freeze
|
32
|
+
# end
|
33
|
+
# def self.admin_cannot_user_defined_actions
|
34
|
+
# [].freeze
|
35
|
+
# end
|
36
|
+
# def self.manager_can_user_defined_actions
|
37
|
+
# [].freeze
|
38
|
+
# end
|
39
|
+
# def self.manager_cannot_user_defined_actions
|
40
|
+
# [].freeze
|
41
|
+
# end
|
42
|
+
# def self.rails_admin_user_defined_visible_actions
|
43
|
+
# [].freeze
|
44
|
+
# end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Hancock::Faq
|
2
|
+
class Category
|
3
|
+
include Hancock::Faq::Models::Category
|
4
|
+
|
5
|
+
include Hancock::Faq::Decorators::Category
|
6
|
+
|
7
|
+
rails_admin(&Hancock::Faq::Admin::Category.config(rails_admin_add_fields) { |config|
|
8
|
+
rails_admin_add_config(config)
|
9
|
+
})
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Hancock::Faq
|
2
|
+
class Question
|
3
|
+
include Hancock::Faq::Models::Question
|
4
|
+
|
5
|
+
include Hancock::Faq::Decorators::Question
|
6
|
+
|
7
|
+
rails_admin(&Hancock::Faq::Admin::Question.config(rails_admin_add_fields) { |config|
|
8
|
+
rails_admin_add_config(config)
|
9
|
+
})
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
- _partial_path = (Hancock::Faq.config.seo_support ? 'shared/obj_with_seo' : 'shared/obj')
|
2
|
+
= render _partial_path, obj: (@seo_page || @seo_parent_page)
|
3
|
+
|
4
|
+
|
5
|
+
- @categories.each do |c|
|
6
|
+
p= link_to c.name, hancock_faq_category_path(c), title: c.name
|
7
|
+
|
8
|
+
.newquestionform
|
9
|
+
p.newquestiontitle Задать свой вопрос:
|
10
|
+
= render partial: "hancock/faq/questions/form_with_wrapper"
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/ - _cache_helper = (Hancock::Faq.config.cache_support ? :hancock_cache : :cache)
|
2
|
+
|
3
|
+
- _partial_path = (Hancock::Faq.config.seo_support ? 'shared/obj_with_seo' : 'shared/obj')
|
4
|
+
= render _partial_path, obj: @category
|
5
|
+
|
6
|
+
h1= @category.name
|
7
|
+
- @questions.each do |q|
|
8
|
+
= link_to q.name.html_safe, hancock_faq_question_path(q), title: q.name
|
@@ -0,0 +1,11 @@
|
|
1
|
+
- label = t('hancock.faq_plugin.fields.author_name.label')
|
2
|
+
- placeholder = t('hancock.faq_plugin.fields.author_name.placeholder')
|
3
|
+
= f.input :author_name, label: label, input_html: {placeholder: placeholder, autofocus: true}
|
4
|
+
|
5
|
+
- label = t('hancock.faq_plugin.fields.author_email.label')
|
6
|
+
- placeholder = t('hancock.faq_plugin.fields.author_email.placeholder')
|
7
|
+
= f.input :author_email, label: label, input_html: {placeholder: placeholder}
|
8
|
+
|
9
|
+
- label = t('hancock.faq_plugin.fields.question_text.label')
|
10
|
+
- placeholder = t('hancock.faq_plugin.fields.question_text.placeholder')
|
11
|
+
= f.input :question_text, as: :text, label: label, input_html: {placeholder: placeholder}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
ruby:
|
2
|
+
cache_key ||= 'views/hancock_faq_question_fields'.freeze
|
3
|
+
if Hancock::Faq.config.model_settings_support
|
4
|
+
settings_scope ||= Hancock::Faq::Question.settings
|
5
|
+
elsif defined?(Settings)
|
6
|
+
settings_scope ||= Settings.ns('FAQ')
|
7
|
+
end
|
8
|
+
|
9
|
+
|
10
|
+
- label = settings_scope.author_name_label(default: t('hancock.faq_plugin.fields.author_name.label'), label: "Заголовок поля ФИО", cache_keys: cache_key)
|
11
|
+
- placeholder = settings_scope.author_name_placeholder(default: t('hancock.faq_plugin.fields.author_name.placeholder'), label: "Placeholder поля ФИО", cache_keys: cache_key)
|
12
|
+
= f.input :author_name, label: label, input_html: {placeholder: placeholder, autofocus: true}
|
13
|
+
|
14
|
+
- label = settings_scope.author_email_label(default: t('hancock.faq_plugin.fields.author_email.label'), label: "Заголовок поля e-mail", cache_keys: cache_key)
|
15
|
+
- placeholder = settings_scope.author_email_placeholder(default: t('hancock.faq_plugin.fields.author_email.placeholder'), label: "Placeholder поля e-mail", cache_keys: cache_key)
|
16
|
+
= f.input :author_email, label: label, input_html: {placeholder: placeholder}
|
17
|
+
|
18
|
+
- label = settings_scope.question_text_label(default: t('hancock.faq_plugin.fields.question_text.label'), label: "Заголовок поля текст вопроса", cache_keys: cache_key)
|
19
|
+
- placeholder = settings_scope.question_text_placeholder(default: t('hancock.faq_plugin.fields.question_text.placeholder'), label: "Placeholder поля текст вопроса", cache_keys: cache_key)
|
20
|
+
= f.input :question_text, as: :text, label: label, input_html: {placeholder: placeholder}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
ruby:
|
2
|
+
is_cache_fields ||= ['new', 'index'].include? action_name
|
3
|
+
cache_key ||= 'hancock_faq_question_fields'.freeze
|
4
|
+
if Hancock::Faq.config.model_settings_support
|
5
|
+
settings_scope ||= Hancock::Faq::Question.settings
|
6
|
+
elsif defined?(Settings)
|
7
|
+
settings_scope ||= Settings.ns('FAQ')
|
8
|
+
end
|
9
|
+
fields_partial ||= "hancock/faq/questions/#{(Hancock::Faq.config.model_settings_support ? 'fields_with_settings' : 'fields')}".freeze
|
10
|
+
recaptcha_options ||= {}
|
11
|
+
@question ||= Hancock::Faq::Question.new
|
12
|
+
_cache_helper ||= (Hancock::Catalog.config.cache_support ? :hancock_cache : :cache)
|
13
|
+
|
14
|
+
= simple_form_for @question, url: hancock_faq_questions_path, html: {data: {remote: true }} do |f|
|
15
|
+
- if is_cache_fields
|
16
|
+
- send _cache_helper, cache_key, skip_digest: true do
|
17
|
+
= render partial: fields_partial, locals: {f: f, cache_key: "views/#{cache_key}", settings_scope: settings_scope}
|
18
|
+
- else
|
19
|
+
= render partial: fields_partial, locals: {f: f, settings_scope: settings_scope}
|
20
|
+
|
21
|
+
- if Hancock::Faq.config.captcha
|
22
|
+
- if Hancock::Faq.config.recaptcha_support
|
23
|
+
.input
|
24
|
+
- if @recaptcha_error
|
25
|
+
span.error.recaptcha_error= @recaptcha_error
|
26
|
+
= recaptcha_tags
|
27
|
+
- elsif Hancock::Faq.config.simple_captcha_support
|
28
|
+
= render partial: "hancock/faq/questions/simple_captcha", locals: {f: f, settings_scope: settings_scope}
|
29
|
+
|
30
|
+
- if Hancock::Faq.config.model_settings_support
|
31
|
+
- label = settings_scope.submit_label(default: t('hancock.send'), label: "Текст на кнопке отправки")
|
32
|
+
- else
|
33
|
+
- label = t('hancock.send')
|
34
|
+
= f.submit label
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
/ - @question ||= Hancock::Faq::Question.new
|
39
|
+
/ - if @question.new_record?
|
40
|
+
/ = simple_form_for @question, url: hancock_faq_questions_path do |f|
|
41
|
+
/ - unless @message.blank?
|
42
|
+
/ h3= @message
|
43
|
+
/ .inputtextblock_q
|
44
|
+
/
|
45
|
+
/ - label = Settings.ns('faq_form').author_name_label( default: "ФИО", label: "Заголовок поля ФИО")
|
46
|
+
/ = f.input :author_name, label: label
|
47
|
+
/
|
48
|
+
/ - label = Settings.ns('faq_form').author_email_label( default: "E-mail", label: "Заголовок поля E-mail")
|
49
|
+
/ = f.input :author_email, as: :email, label: label
|
50
|
+
/
|
51
|
+
/ - label = Settings.ns('faq_form').question_text_label( default: "Текст вопроса", label: "Заголовок поля Текст вопроса")
|
52
|
+
/ = f.input :question_text, as: :text, label: label
|
53
|
+
/
|
54
|
+
/
|
55
|
+
/ - if Hancock::Faq.configuration.save_with_captcha
|
56
|
+
/ .question_captcha
|
57
|
+
/ - label = Settings.ns('faq_form').captcha_label( default: "Код проверки", label: "Заголовок поля Код проверки")
|
58
|
+
/ = f.simple_captcha label: label, required: true
|
59
|
+
/ - unless @question.errors[:captcha].blank?
|
60
|
+
/ span.error= @question.errors[:captcha].join("<br />").html_safe
|
61
|
+
/
|
62
|
+
/ - label = Settings.ns('faq_form').submit_label( default: "Отправить", label: "Заголовок кнопки Отправить")
|
63
|
+
/ = f.button :submit, label
|
64
|
+
/ - else
|
65
|
+
/ - unless @message.blank?
|
66
|
+
/ h3= @message
|