hancock_cms_feedback 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.ruby-gemset +1 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +4 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +60 -0
  9. data/Rakefile +1 -0
  10. data/app/assets/javascripts/hancock/feedback.coffee +8 -0
  11. data/app/assets/javascripts/hancock/feedback/form.coffee +77 -0
  12. data/app/assets/javascripts/hancock/feedback/init.coffee +2 -0
  13. data/app/assets/stylesheets/hancock/feedback.sass +0 -0
  14. data/app/controllers/concerns/hancock/feedback/decorators/contacts.rb +84 -0
  15. data/app/controllers/hancock/feedback/contacts_controller.rb +7 -0
  16. data/app/mailers/hancock/feedback/contact_mailer.rb +17 -0
  17. data/app/models/concerns/hancock/feedback/decorators/contact_message.rb +44 -0
  18. data/app/models/hancock/feedback/contact_message.rb +17 -0
  19. data/app/views/hancock/feedback/contact_mailer/new_message_email.html.slim +15 -0
  20. data/app/views/hancock/feedback/contacts/_fields.html.slim +18 -0
  21. data/app/views/hancock/feedback/contacts/_fields_with_settings.html.slim +24 -0
  22. data/app/views/hancock/feedback/contacts/_form.html.slim +37 -0
  23. data/app/views/hancock/feedback/contacts/_form_with_wrapper.html.slim +2 -0
  24. data/app/views/hancock/feedback/contacts/_simple_captcha.html.slim +17 -0
  25. data/app/views/hancock/feedback/contacts/_success.html.slim +4 -0
  26. data/app/views/hancock/feedback/contacts/index.html.slim +8 -0
  27. data/app/views/hancock/feedback/contacts/new.html.slim +8 -0
  28. data/app/views/hancock/feedback/contacts/sent.html.slim +3 -0
  29. data/app/views/hancock/feedback/contacts/update_captcha.html.slim +21 -0
  30. data/bin/console +15 -0
  31. data/bin/setup +7 -0
  32. data/config/locales/hancock.feedback.ru.yml +56 -0
  33. data/config/locales/ru.simple_captcha.yml +3 -0
  34. data/config/locales/ru.simple_form.yml +9 -0
  35. data/hancock_cms_feedback.gemspec +39 -0
  36. data/lib/generators/hancock/feedback/config/config_generator.rb +13 -0
  37. data/lib/generators/hancock/feedback/config/templates/hancock_feedback.erb +19 -0
  38. data/lib/generators/hancock/feedback/controllers/decorators_generator.rb +24 -0
  39. data/lib/generators/hancock/feedback/controllers/templates/contacts.erb +145 -0
  40. data/lib/generators/hancock/feedback/controllers/transfers_generator.rb +39 -0
  41. data/lib/generators/hancock/feedback/migrations/migrations_generator.rb +18 -0
  42. data/lib/generators/hancock/feedback/migrations/templates/migration_contact_messages.erb +17 -0
  43. data/lib/hancock/feedback/admin.rb +6 -0
  44. data/lib/hancock/feedback/admin/contact_message.rb +40 -0
  45. data/lib/hancock/feedback/configuration.rb +51 -0
  46. data/lib/hancock/feedback/controllers/contacts.rb +154 -0
  47. data/lib/hancock/feedback/engine.rb +36 -0
  48. data/lib/hancock/feedback/models/active_record/contact_message.rb +13 -0
  49. data/lib/hancock/feedback/models/contact_message.rb +92 -0
  50. data/lib/hancock/feedback/models/mongoid/contact_message.rb +35 -0
  51. data/lib/hancock/feedback/routes.rb +42 -0
  52. data/lib/hancock/feedback/version.rb +5 -0
  53. data/lib/hancock_cms_feedback.rb +34 -0
  54. data/release.sh +6 -0
  55. metadata +187 -0
@@ -0,0 +1,35 @@
1
+ module Hancock::Feedback
2
+ module Models
3
+ module Mongoid
4
+ module ContactMessage
5
+ extend ActiveSupport::Concern
6
+ included do
7
+ field :name, type: String
8
+ field :email, type: String
9
+ field :phone, type: String
10
+ field :content, type: String
11
+
12
+ if Hancock.rails5?
13
+ if relations.has_key?("updater") and defined?(::Mongoid::History)
14
+ belongs_to :updater, class_name: ::Mongoid::History.modifier_class_name, optional: true, validate: false
15
+ _validators.delete(:updater)
16
+ _validate_callbacks.each do |callback|
17
+ if callback.raw_filter.respond_to?(:attributes) and callback.raw_filter.attributes.include?(:updater)
18
+ _validate_callbacks.delete(callback)
19
+ end
20
+ end
21
+ end
22
+ end
23
+
24
+ end
25
+
26
+ class_methods do
27
+ def track_history?
28
+ false
29
+ end
30
+ end
31
+
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,42 @@
1
+ module ActionDispatch::Routing
2
+ class Mapper
3
+
4
+ def hancock_cms_feedback_routes(config = {})
5
+ routes_config = {
6
+ use_contacts_path: true,
7
+ contacts_path: 'contacts',
8
+ classes: {
9
+ contacts: :contacts
10
+ }
11
+ }
12
+ routes_config.deep_merge!(config)
13
+
14
+ generate_hancock_feedback_user_routes(routes_config)
15
+ generate_hancock_feedback_cms_routes(routes_config)
16
+ end
17
+
18
+
19
+ private
20
+ def generate_hancock_feedback_user_routes(routes_config)
21
+ if !routes_config[:use_contacts_path] and !routes_config[:classes][:contacts].nil?
22
+ get "#{routes_config[:contacts_path]}" => "#{routes_config[:classes][:contacts]}#new"
23
+ post "#{routes_config[:contacts_path]}" => "#{routes_config[:classes][:contacts]}#create"
24
+ get "#{routes_config[:contacts_path]}/sent" => "#{routes_config[:classes][:contacts]}#sent"
25
+ get "#{routes_config[:contacts_path]}/update_captcha" => "#{routes_config[:classes][:contacts]}#update_captcha"
26
+ end
27
+ end
28
+ def generate_hancock_feedback_cms_routes(routes_config)
29
+ scope module: 'hancock' do
30
+ scope module: 'feedback' do
31
+ if routes_config[:use_contacts_path]
32
+ get "#{routes_config[:contacts_path]}" => "#{routes_config[:classes][:contacts]}#new", as: :hancock_feedback_contacts
33
+ post "#{routes_config[:contacts_path]}" => "#{routes_config[:classes][:contacts]}#create", as: :create_hancock_feedback_contacts
34
+ get "#{routes_config[:contacts_path]}/sent" => "#{routes_config[:classes][:contacts]}#sent", as: :hancock_feedback_contacts_sent
35
+ get "#{routes_config[:contacts_path]}/update_captcha" => "#{routes_config[:classes][:contacts]}#update_captcha", as: :hancock_feedback_update_captcha
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+ end
42
+ end
@@ -0,0 +1,5 @@
1
+ module Hancock
2
+ module Feedback
3
+ VERSION = "1.0.2".freeze
4
+ end
5
+ end
@@ -0,0 +1,34 @@
1
+ require "hancock/feedback/version"
2
+
3
+ require 'hancock/feedback/configuration'
4
+ require 'hancock/feedback/engine'
5
+ require 'hancock/feedback/routes'
6
+
7
+ require 'addressable/uri'
8
+ require 'validates_email_format_of'
9
+ require 'x-real-ip'
10
+
11
+ module Hancock::Feedback
12
+ include Hancock::Plugin
13
+
14
+ autoload :Admin, 'hancock/feedback/admin'
15
+ module Admin
16
+ autoload :ContactMessage, 'hancock/feedback/admin/contact_message'
17
+ end
18
+
19
+ module Models
20
+ autoload :ContactMessage, 'hancock/feedback/models/contact_message'
21
+
22
+ module Mongoid
23
+ autoload :ContactMessage, 'hancock/feedback/models/mongoid/contact_message'
24
+ end
25
+ module ActiveRecord
26
+ autoload :ContactMessage, 'hancock/feedback/models/active_record/contact_message'
27
+ end
28
+ end
29
+
30
+ module Controllers
31
+ autoload :Contacts, 'hancock/feedback/controllers/contacts'
32
+ end
33
+
34
+ end
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/bash
2
+ bundle update
3
+ git add --all .
4
+ git commit -am "${*:1}"
5
+ git push -u origin master
6
+ rake release
metadata ADDED
@@ -0,0 +1,187 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hancock_cms_feedback
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Alexander Kiseliev
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-04-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: hancock_cms
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 1.0.2
48
+ - - "<"
49
+ - !ruby/object:Gem::Version
50
+ version: 2.1.x
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: 1.0.2
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: 2.1.x
61
+ - !ruby/object:Gem::Dependency
62
+ name: addressable
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: x-real-ip
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :runtime
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: validates_email_format_of
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ type: :runtime
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ description: 'hancock_cms_feedback '
104
+ email:
105
+ - dev@redrocks.pro
106
+ executables: []
107
+ extensions: []
108
+ extra_rdoc_files: []
109
+ files:
110
+ - ".gitignore"
111
+ - ".ruby-gemset"
112
+ - ".ruby-version"
113
+ - ".travis.yml"
114
+ - Gemfile
115
+ - LICENSE.txt
116
+ - README.md
117
+ - Rakefile
118
+ - app/assets/javascripts/hancock/feedback.coffee
119
+ - app/assets/javascripts/hancock/feedback/form.coffee
120
+ - app/assets/javascripts/hancock/feedback/init.coffee
121
+ - app/assets/stylesheets/hancock/feedback.sass
122
+ - app/controllers/concerns/hancock/feedback/decorators/contacts.rb
123
+ - app/controllers/hancock/feedback/contacts_controller.rb
124
+ - app/mailers/hancock/feedback/contact_mailer.rb
125
+ - app/models/concerns/hancock/feedback/decorators/contact_message.rb
126
+ - app/models/hancock/feedback/contact_message.rb
127
+ - app/views/hancock/feedback/contact_mailer/new_message_email.html.slim
128
+ - app/views/hancock/feedback/contacts/_fields.html.slim
129
+ - app/views/hancock/feedback/contacts/_fields_with_settings.html.slim
130
+ - app/views/hancock/feedback/contacts/_form.html.slim
131
+ - app/views/hancock/feedback/contacts/_form_with_wrapper.html.slim
132
+ - app/views/hancock/feedback/contacts/_simple_captcha.html.slim
133
+ - app/views/hancock/feedback/contacts/_success.html.slim
134
+ - app/views/hancock/feedback/contacts/index.html.slim
135
+ - app/views/hancock/feedback/contacts/new.html.slim
136
+ - app/views/hancock/feedback/contacts/sent.html.slim
137
+ - app/views/hancock/feedback/contacts/update_captcha.html.slim
138
+ - bin/console
139
+ - bin/setup
140
+ - config/locales/hancock.feedback.ru.yml
141
+ - config/locales/ru.simple_captcha.yml
142
+ - config/locales/ru.simple_form.yml
143
+ - hancock_cms_feedback.gemspec
144
+ - lib/generators/hancock/feedback/config/config_generator.rb
145
+ - lib/generators/hancock/feedback/config/templates/hancock_feedback.erb
146
+ - lib/generators/hancock/feedback/controllers/decorators_generator.rb
147
+ - lib/generators/hancock/feedback/controllers/templates/contacts.erb
148
+ - lib/generators/hancock/feedback/controllers/transfers_generator.rb
149
+ - lib/generators/hancock/feedback/migrations/migrations_generator.rb
150
+ - lib/generators/hancock/feedback/migrations/templates/migration_contact_messages.erb
151
+ - lib/hancock/feedback/admin.rb
152
+ - lib/hancock/feedback/admin/contact_message.rb
153
+ - lib/hancock/feedback/configuration.rb
154
+ - lib/hancock/feedback/controllers/contacts.rb
155
+ - lib/hancock/feedback/engine.rb
156
+ - lib/hancock/feedback/models/active_record/contact_message.rb
157
+ - lib/hancock/feedback/models/contact_message.rb
158
+ - lib/hancock/feedback/models/mongoid/contact_message.rb
159
+ - lib/hancock/feedback/routes.rb
160
+ - lib/hancock/feedback/version.rb
161
+ - lib/hancock_cms_feedback.rb
162
+ - release.sh
163
+ homepage: https://github.com/red-rocks/hancock_cms_feedback
164
+ licenses:
165
+ - MIT
166
+ metadata: {}
167
+ post_install_message:
168
+ rdoc_options: []
169
+ require_paths:
170
+ - lib
171
+ required_ruby_version: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - ">="
174
+ - !ruby/object:Gem::Version
175
+ version: '0'
176
+ required_rubygems_version: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ requirements: []
182
+ rubyforge_project:
183
+ rubygems_version: 2.5.1
184
+ signing_key:
185
+ specification_version: 4
186
+ summary: hancock_cms_feedback
187
+ test_files: []