c80_push 0.1.0.8 → 0.1.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +6 -0
  3. data/Gemfile +15 -0
  4. data/Gemfile.lock +192 -0
  5. data/app/assets/images/c80_push/.keep +0 -0
  6. data/bin/rails +14 -0
  7. data/c80_push.gemspec +23 -0
  8. data/engines/be/README.md +12 -0
  9. data/engines/be/app/admin/be/message_dealers.rb +24 -0
  10. data/engines/be/app/assets/javascripts/be.js.coffee +1 -0
  11. data/engines/be/app/assets/javascripts/frontend/dealer-form-ajax.js +54 -0
  12. data/engines/be/app/assets/stylesheets/backend/_active_admin_custom.scss +1 -0
  13. data/engines/be/app/assets/stylesheets/backend/active_admin_custom/_message_dealers.scss +8 -0
  14. data/engines/be/app/assets/stylesheets/be.scss +2 -0
  15. data/engines/be/app/assets/stylesheets/be_admin.scss +1 -0
  16. data/engines/be/app/assets/stylesheets/frontend/form.scss +130 -0
  17. data/engines/be/app/controllers/be/be_controller.rb +27 -0
  18. data/engines/be/app/helpers/be/be_helper.rb +22 -0
  19. data/engines/be/app/mailer/be/message_dealer_mailer.rb +29 -0
  20. data/engines/be/app/models/be/message_dealer.rb +5 -0
  21. data/engines/be/app/models/be/message_dealer_validator.rb +52 -0
  22. data/engines/be/app/views/be/be/give_me_dealer_form.js.erb +10 -0
  23. data/engines/be/app/views/be/be/message_dealer.js.erb +4 -0
  24. data/engines/be/app/views/be/message_dealer_mailer/mail_mess.html.erb +1 -0
  25. data/engines/be/app/views/be/shared/_dealer_form.html.erb +77 -0
  26. data/engines/be/app/views/be/shared/_ok_message.html.erb +16 -0
  27. data/engines/be/config/routes.rb +4 -0
  28. data/engines/be/db/migrate/20170725011920_create_be_message_dealers.rb +12 -0
  29. data/engines/be/lib/be/engine.rb +21 -0
  30. data/engines/be/lib/be/version.rb +3 -0
  31. data/engines/be/lib/be.rb +5 -0
  32. data/lib/c80_push/version.rb +1 -1
  33. data/lib/c80_push.rb +1 -1
  34. metadata +31 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3671964c3a44f48a8cd23558663d45da911b68a4
4
- data.tar.gz: b01b6e7d0b03fd6d266e064eaf6423b0cf7461c5
3
+ metadata.gz: 963dfdf5b64914f82d1034ef4223a621ceb7892b
4
+ data.tar.gz: 43acc93010c73f1e2059ac9a7ba6e52ba4bf4465
5
5
  SHA512:
6
- metadata.gz: ee2cf7f535c76144959aede98d47a65fc1a569741cc0991536e162a35d9e01d38caa5f5561d21fa8983abf69391bd09e2b8609481fcfc4027a0ce744dac94a66
7
- data.tar.gz: 1d4112088638f557e5f4dfc286c3d75e2abbc84209ead9a8893dbd13fee7c755ec4895db45a3e01201dc55ef11984538bd1a592a0e3b978bfc1e90b73f83156e
6
+ metadata.gz: 31341528da55ae261ab8acf2bbe58a83ded4738ee3d7a394281b7dbae72b5a2c4183939b5991a4657f82efca4228e44f48245f46bd5ac6e65e72bc8f368f50c0
7
+ data.tar.gz: 3a0fcb83724e2dd0fa6ec5ae9fd92ef09b16a2efde3d96bbe2ca0f48c5fd152c585708a22e9a208ccb9cfd5bc81ef2694bf79f54ce4c20197c3ad8a8bab9df8c
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ .idea/
2
+ .bundle/
3
+ log/*.log
4
+ pkg/
5
+ *.swp
6
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Declare your gem's dependencies in c80_push.gemspec.
4
+ # Bundler will treat runtime dependencies like base dependencies, and
5
+ # development dependencies will be added by default to the :development group.
6
+ gemspec
7
+
8
+ # Declare any dependencies that are still in development here instead of in
9
+ # your gemspec. These might include edge Rails or gems from your path or
10
+ # Git. Remember to move these dependencies to your gemspec before releasing
11
+ # your gem to rubygems.org.
12
+
13
+ # To use a debugger
14
+ # gem 'byebug', group: [:development, :test]
15
+ gem 'be', path: 'engines/be'
data/Gemfile.lock ADDED
@@ -0,0 +1,192 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ c80_push (0.1.0.2)
5
+ activeadmin
6
+ rails
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actioncable (5.1.2)
12
+ actionpack (= 5.1.2)
13
+ nio4r (~> 2.0)
14
+ websocket-driver (~> 0.6.1)
15
+ actionmailer (5.1.2)
16
+ actionpack (= 5.1.2)
17
+ actionview (= 5.1.2)
18
+ activejob (= 5.1.2)
19
+ mail (~> 2.5, >= 2.5.4)
20
+ rails-dom-testing (~> 2.0)
21
+ actionpack (5.1.2)
22
+ actionview (= 5.1.2)
23
+ activesupport (= 5.1.2)
24
+ rack (~> 2.0)
25
+ rack-test (~> 0.6.3)
26
+ rails-dom-testing (~> 2.0)
27
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
28
+ actionview (5.1.2)
29
+ activesupport (= 5.1.2)
30
+ builder (~> 3.1)
31
+ erubi (~> 1.4)
32
+ rails-dom-testing (~> 2.0)
33
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
34
+ activeadmin (1.0.0)
35
+ arbre (>= 1.1.1)
36
+ bourbon
37
+ coffee-rails
38
+ formtastic (~> 3.1)
39
+ formtastic_i18n
40
+ inherited_resources (~> 1.7)
41
+ jquery-rails
42
+ jquery-ui-rails
43
+ kaminari (>= 0.15, < 2.0)
44
+ railties (>= 4.2, < 5.2)
45
+ ransack (~> 1.3)
46
+ sass-rails
47
+ sprockets (< 4.1)
48
+ activejob (5.1.2)
49
+ activesupport (= 5.1.2)
50
+ globalid (>= 0.3.6)
51
+ activemodel (5.1.2)
52
+ activesupport (= 5.1.2)
53
+ activerecord (5.1.2)
54
+ activemodel (= 5.1.2)
55
+ activesupport (= 5.1.2)
56
+ arel (~> 8.0)
57
+ activesupport (5.1.2)
58
+ concurrent-ruby (~> 1.0, >= 1.0.2)
59
+ i18n (~> 0.7)
60
+ minitest (~> 5.1)
61
+ tzinfo (~> 1.1)
62
+ arbre (1.1.1)
63
+ activesupport (>= 3.0.0)
64
+ arel (8.0.0)
65
+ bourbon (4.3.4)
66
+ sass (~> 3.4)
67
+ thor (~> 0.19)
68
+ builder (3.2.3)
69
+ coffee-rails (4.2.2)
70
+ coffee-script (>= 2.2.0)
71
+ railties (>= 4.0.0)
72
+ coffee-script (2.4.1)
73
+ coffee-script-source
74
+ execjs
75
+ coffee-script-source (1.12.2)
76
+ concurrent-ruby (1.0.5)
77
+ erubi (1.6.1)
78
+ execjs (2.7.0)
79
+ formtastic (3.1.5)
80
+ actionpack (>= 3.2.13)
81
+ formtastic_i18n (0.6.0)
82
+ globalid (0.4.0)
83
+ activesupport (>= 4.2.0)
84
+ has_scope (0.7.1)
85
+ actionpack (>= 4.1, < 5.2)
86
+ activesupport (>= 4.1, < 5.2)
87
+ i18n (0.8.4)
88
+ inherited_resources (1.7.2)
89
+ actionpack (>= 3.2, < 5.2.x)
90
+ has_scope (~> 0.6)
91
+ railties (>= 3.2, < 5.2.x)
92
+ responders
93
+ jquery-rails (4.3.1)
94
+ rails-dom-testing (>= 1, < 3)
95
+ railties (>= 4.2.0)
96
+ thor (>= 0.14, < 2.0)
97
+ jquery-ui-rails (6.0.1)
98
+ railties (>= 3.2.16)
99
+ kaminari (1.0.1)
100
+ activesupport (>= 4.1.0)
101
+ kaminari-actionview (= 1.0.1)
102
+ kaminari-activerecord (= 1.0.1)
103
+ kaminari-core (= 1.0.1)
104
+ kaminari-actionview (1.0.1)
105
+ actionview
106
+ kaminari-core (= 1.0.1)
107
+ kaminari-activerecord (1.0.1)
108
+ activerecord
109
+ kaminari-core (= 1.0.1)
110
+ kaminari-core (1.0.1)
111
+ loofah (2.0.3)
112
+ nokogiri (>= 1.5.9)
113
+ mail (2.6.6)
114
+ mime-types (>= 1.16, < 4)
115
+ method_source (0.8.2)
116
+ mime-types (3.1)
117
+ mime-types-data (~> 3.2015)
118
+ mime-types-data (3.2016.0521)
119
+ mini_portile2 (2.2.0)
120
+ minitest (5.10.2)
121
+ nio4r (2.1.0)
122
+ nokogiri (1.8.0)
123
+ mini_portile2 (~> 2.2.0)
124
+ polyamorous (1.3.1)
125
+ activerecord (>= 3.0)
126
+ rack (2.0.3)
127
+ rack-test (0.6.3)
128
+ rack (>= 1.0)
129
+ rails (5.1.2)
130
+ actioncable (= 5.1.2)
131
+ actionmailer (= 5.1.2)
132
+ actionpack (= 5.1.2)
133
+ actionview (= 5.1.2)
134
+ activejob (= 5.1.2)
135
+ activemodel (= 5.1.2)
136
+ activerecord (= 5.1.2)
137
+ activesupport (= 5.1.2)
138
+ bundler (>= 1.3.0, < 2.0)
139
+ railties (= 5.1.2)
140
+ sprockets-rails (>= 2.0.0)
141
+ rails-dom-testing (2.0.3)
142
+ activesupport (>= 4.2.0)
143
+ nokogiri (>= 1.6)
144
+ rails-html-sanitizer (1.0.3)
145
+ loofah (~> 2.0)
146
+ railties (5.1.2)
147
+ actionpack (= 5.1.2)
148
+ activesupport (= 5.1.2)
149
+ method_source
150
+ rake (>= 0.8.7)
151
+ thor (>= 0.18.1, < 2.0)
152
+ rake (12.0.0)
153
+ ransack (1.8.2)
154
+ actionpack (>= 3.0)
155
+ activerecord (>= 3.0)
156
+ activesupport (>= 3.0)
157
+ i18n
158
+ polyamorous (~> 1.3)
159
+ responders (2.4.0)
160
+ actionpack (>= 4.2.0, < 5.3)
161
+ railties (>= 4.2.0, < 5.3)
162
+ sass (3.4.24)
163
+ sass-rails (5.0.6)
164
+ railties (>= 4.0.0, < 6)
165
+ sass (~> 3.1)
166
+ sprockets (>= 2.8, < 4.0)
167
+ sprockets-rails (>= 2.0, < 4.0)
168
+ tilt (>= 1.1, < 3)
169
+ sprockets (3.7.1)
170
+ concurrent-ruby (~> 1.0)
171
+ rack (> 1, < 3)
172
+ sprockets-rails (3.2.0)
173
+ actionpack (>= 4.0)
174
+ activesupport (>= 4.0)
175
+ sprockets (>= 3.0.0)
176
+ thor (0.19.4)
177
+ thread_safe (0.3.6)
178
+ tilt (2.0.7)
179
+ tzinfo (1.2.3)
180
+ thread_safe (~> 0.1)
181
+ websocket-driver (0.6.5)
182
+ websocket-extensions (>= 0.1.0)
183
+ websocket-extensions (0.1.2)
184
+
185
+ PLATFORMS
186
+ ruby
187
+
188
+ DEPENDENCIES
189
+ c80_push!
190
+
191
+ BUNDLED WITH
192
+ 1.14.6
File without changes
data/bin/rails ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails gems
3
+ # installed from the root of your application.
4
+
5
+ ENGINE_ROOT = File.expand_path('../..', __FILE__)
6
+ ENGINE_PATH = File.expand_path('../../lib/c80_push/engine', __FILE__)
7
+ APP_PATH = File.expand_path('../../test/dummy/config/application', __FILE__)
8
+
9
+ # Set up gems listed in the Gemfile.
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
11
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
12
+
13
+ require 'rails/all'
14
+ require 'rails/engine/commands'
data/c80_push.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ $:.push File.expand_path('../lib', __FILE__)
2
+
3
+ # Maintain your gem's version:
4
+ require 'c80_push/version'
5
+
6
+ # Describe your gem and declare its dependencies:
7
+ Gem::Specification.new do |s|
8
+ s.name = 'c80_push'
9
+ s.version = C80Push::VERSION
10
+ s.authors = ['C80609A']
11
+ s.email = ['c080609a@gmail.com']
12
+ s.homepage = 'https://github.com/c80609a/c80_push'
13
+ s.summary = 'Пушеры'
14
+ s.description = 'Добавляет функционал дилеров и офисов продаж'
15
+ s.license = 'MIT'
16
+
17
+ # s.files = Dir['{app,config,db,lib,engines}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.md']
18
+ s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+
20
+ s.add_dependency 'rails'#, '~> 5.1.1'
21
+ s.add_dependency 'activeadmin'
22
+
23
+ end
@@ -0,0 +1,12 @@
1
+ # Функционал обратной связи для дилеров (на странице «Стать дилером»)
2
+
3
+ Данный функционал предполагает возможность пользователю подать
4
+ заявку для того, чтобы стать дилером. Пользователю необходимо
5
+ заполнить следующие поля:
6
+
7
+ - название организации (обязательно для заполнения),
8
+ - имя контактного лица (обязательно для заполнения),
9
+ - телефонный номер (условно обязательно для заполнения – необходимо заполнить
10
+ минимум одно из двух полей «телефонные номер» или e-mail),
11
+ - e-mail (условно обязательно для заполнения – необходимо заполнить минимум
12
+ одно из двух полей «телефонные номер» или e-mail).
@@ -0,0 +1,24 @@
1
+ ActiveAdmin.register Be::MessageDealer, :as => 'MessageDealer' do
2
+
3
+ before_filter :skip_sidebar!, :only => :index
4
+
5
+ menu :label => 'Заявки',
6
+ :parent => 'x_c80_push',
7
+ :priority => 3
8
+
9
+ index do
10
+ selectable_column
11
+ id_column
12
+ column :created_at
13
+ column :name
14
+ column :name_org
15
+ column :email_or_phone
16
+ column :comment do |msg|
17
+ msg.comment.html_safe if msg.comment.present?
18
+ end
19
+
20
+ actions
21
+ end
22
+
23
+
24
+ end
@@ -0,0 +1 @@
1
+ #= require_directory ./frontend
@@ -0,0 +1,54 @@
1
+
2
+ // =[ interface ]=====================================================================================================================
3
+
4
+ var $dd;
5
+ var markInvalidateInProgress = false;
6
+ var markWasPasted = false;
7
+ var fDealerFormInvalidate;
8
+ var fDealerFormOnScroll;
9
+
10
+ // =[ implementation ]=====================================================================================================================
11
+
12
+ $(function () {
13
+
14
+ $dd = $("div#dd");
15
+
16
+ if ($dd.length === 1) {
17
+
18
+ fDealerFormInvalidate = function () {
19
+ if (!markInvalidateInProgress) {
20
+ markInvalidateInProgress = true;
21
+
22
+ if (!markWasPasted) {
23
+
24
+ $('<div id="loading"></div>').appendTo($dd);
25
+
26
+ $.ajax({
27
+ url: '/give_me_dealer_form',
28
+ type: 'GET',
29
+ dataType: 'script'
30
+ }).done(function (data, result) {
31
+ if (result === "success") {
32
+ markWasPasted = true;
33
+ }
34
+ });
35
+ }
36
+ }
37
+ };
38
+
39
+ //noinspection JSUnusedLocalSymbols
40
+ fDealerFormOnScroll = function(event) {
41
+ var closeToBottom = jQuery(window).scrollTop() >= 0;
42
+ if (closeToBottom) {
43
+ fDealerFormInvalidate();
44
+ }
45
+ };
46
+
47
+ // start
48
+ $(document).bind('scroll', fDealerFormOnScroll);
49
+ setTimeout(function () {
50
+ fDealerFormOnScroll();
51
+ },300);
52
+
53
+ }
54
+ });
@@ -0,0 +1 @@
1
+ @import "active_admin_custom/message_dealers";
@@ -0,0 +1,8 @@
1
+ body.admin_message_dealers {
2
+ // прячем кнопку batch actions
3
+ .table_tools { display: none; }
4
+ // прячем кнопку "создать новую запись"
5
+ div.action_items { display: none; }
6
+ //прячем ссылку "редактировать"
7
+ a.edit_link { display: none; }
8
+ }
@@ -0,0 +1,2 @@
1
+ @import "frontend/contacts";
2
+
@@ -0,0 +1 @@
1
+ @import "backend/active_admin_custom";
@@ -0,0 +1,130 @@
1
+ #dd {
2
+ margin: 0;
3
+ background-color: transparent;
4
+ min-height: 300px;
5
+ position: relative;
6
+ * { &:focus { outline: none !important; } }
7
+
8
+ #loading {
9
+ position: absolute;
10
+ top: 0;
11
+ left: 0;
12
+ bottom: 0;
13
+ right: 0;
14
+ text-align: center;
15
+ font-size: 20px;
16
+ background: rgba(255, 255, 255, 1) url(data:image/gif;base64,R0lGODlhIwAjAPUAAP///zLIMuL24tn02fH68czwzPL78vr9+tLy0tz13Of458/xz/f899fz1+z57N/138Xvxer46pfil7LqsjvKO33bfZ3knZPhk4rfijLIMoDcgGPVY7jruKrnqm3XbVXRVbzsvL3svaXmpXDYcHfad6jnqEjNSAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAIwA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IDANST5ZFDIopBDizb9UihYk6GekwwaFGDNmwCBkAERkEKwUOXBRo0YPuj4uaPBA2ZEDBSSU1GgCxBADAxCsfOBgWsGXVULwdajwgcKHCqagOGhwKWgeoOEOFEzCwGPIZQjUPMCTAN4XBuMiioJAB+aib18cpOo3AAJaBXgiQlXiIK6iXMsUIRhibdHUkRAPqVUk2O41JQ8VuYWziCKCVHONJC6A19eieWYXRR75uMCDLJr2xjtWAK2Sdl4BENDU9ObmL3YWiQb3xNpi2k9W5/mLu4iCAS57C0cSBAA7AAAAAAAAAAAA) 50% 50% no-repeat;
17
+ z-index: 9999;
18
+ line-height: 3;
19
+ transition: visibility 1s, opacity 0.5s linear;
20
+
21
+ &.invis {
22
+ visibility: hidden;
23
+ opacity: 0;
24
+ }
25
+
26
+ }
27
+
28
+ div#dealer_form { /* NOTE:: получается, на странице может быть только одна такая форма */
29
+
30
+ .modal-dialog {
31
+ width: auto;
32
+ margin: 0;
33
+
34
+ .modal-content {
35
+ box-shadow: none;
36
+ border: none;
37
+ /*background-color: transparent;*/
38
+
39
+ div.modal-header {
40
+ border-bottom: none !important;
41
+ }
42
+
43
+ div.modal-body {
44
+ padding: 0;
45
+
46
+ div.form-group {
47
+ margin-bottom: 25px;
48
+
49
+ &.hiddn {
50
+ width: 0;
51
+ height: 0;
52
+ position: absolute;
53
+ overflow: hidden;
54
+ }
55
+
56
+ label {
57
+
58
+ }
59
+
60
+ .input_wrapper {
61
+
62
+ position: relative;
63
+
64
+ &:after {
65
+ content: "";
66
+ background: transparent url(image_path('stripe.png')) repeat 0 0; /*NOTE:: можно переопределить в custom классах */
67
+ opacity: 0.1;
68
+ top: 0;
69
+ left: 0;
70
+ bottom: 0;
71
+ right: 0;
72
+ position: absolute;
73
+ z-index: 0;
74
+ }
75
+
76
+ .form-control {
77
+ position: relative;
78
+ z-index: 1;
79
+
80
+ &:focus {
81
+ text-shadow: none !important;
82
+ border: #2d2d2d 1px solid;
83
+ box-shadow: none !important;
84
+ -webkit-box-shadow: none !important;
85
+ }
86
+
87
+ }
88
+
89
+ }
90
+
91
+ textarea {
92
+
93
+ }
94
+
95
+ .help-block {
96
+ padding-left: 0 !important;
97
+ position: absolute;
98
+ text-align: right;
99
+ padding-right: 0;
100
+ color: #ff0000;
101
+ }
102
+
103
+ &.has-error {
104
+
105
+ .help-block {
106
+ /*color: #ff7f7c;*/
107
+ }
108
+
109
+ }
110
+
111
+ }
112
+
113
+ div.actions {
114
+ margin-top: 15px;
115
+
116
+ input.btn {
117
+
118
+ }
119
+
120
+ }
121
+
122
+ }
123
+
124
+ }
125
+
126
+ }
127
+ }
128
+
129
+ }
130
+
@@ -0,0 +1,27 @@
1
+ module Be
2
+ class BeController < ::ApplicationController
3
+
4
+ def give_me_dealer_form
5
+ end
6
+
7
+ def message_dealer
8
+ puts '<BeController.message_dealer>'
9
+ m = MessageDealer.new(mess_params)
10
+ respond_to do |format|
11
+ if m.save
12
+
13
+ format.js
14
+ MessageDealerMailer.send_mess(m, 'Заявка "Стать дилером"').deliver
15
+ else
16
+ puts "<BeController.message_dealer> errors: #{m.errors}"
17
+ format.js { render json: m.errors, status: :unprocessable_entity }
18
+ end
19
+ end
20
+ end
21
+
22
+ def mess_params
23
+ params.require(:mess).permit(:name, :name_org, :email_or_phone, :comment)
24
+ end
25
+
26
+ end
27
+ end
@@ -0,0 +1,22 @@
1
+ module Be
2
+ module BeHelper
3
+
4
+ def render_dealer_form
5
+
6
+ render :partial => 'be/shared/dealer_form',
7
+ :locals => {
8
+ :mess => MessageDealer.new
9
+ }
10
+
11
+ end
12
+
13
+ def render_ok_message
14
+ render :partial => 'be/shared/ok_message',
15
+ :locals => {
16
+ ok_text: 'Мы свяжемся с Вами в ближайшее время.',
17
+ wtitle: 'Ваше сообщение отправлено'
18
+ }
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,29 @@
1
+ module Be
2
+ class MessageDealerMailer < ActionMailer::Base
3
+
4
+ default from: Proc.new { SiteProp.first.mail_from },
5
+ to: Proc.new { SiteProp.first.mail_to }
6
+
7
+ def send_mess(message, subject)
8
+ @message = format_message(message)
9
+
10
+ puts '<MessageDealerMailer.send_mess> Отправляем сообщение.'
11
+ mail(subject: subject) do |format|
12
+ format.html { render 'mail_mess'}
13
+ end
14
+
15
+ #puts "#{SiteProps.first.mail_to}"
16
+ end
17
+
18
+ private
19
+
20
+ def format_message(message)
21
+ result = "<br> • Имя: #{message.name}"
22
+ result = "<br> • Название организации: #{message.name_org}"
23
+ result += "<br> • Телефон или Email: #{message.email_or_phone}"
24
+ result += "<br> • Комментарий:<br><br> #{message.comment}"
25
+ result
26
+ end
27
+
28
+ end
29
+ end
@@ -0,0 +1,5 @@
1
+ module Be
2
+ class MessageDealer < ActiveRecord::Base
3
+ validates_with MessageDealerValidator
4
+ end
5
+ end
@@ -0,0 +1,52 @@
1
+ module Be
2
+ class MessageDealerValidator < ActiveModel::Validator
3
+ def validate(record)
4
+ unless record.errors.present?
5
+ puts "<MessageDealerValidator.validate> record = #{record}"
6
+ mark_please_used = false
7
+
8
+ unless record.name.present?
9
+ record.errors[:name] = 'Укажите, пожалуйста, Ваше имя'
10
+ mark_please_used = true
11
+ end
12
+
13
+ unless record.name_org.present?
14
+ if mark_please_used
15
+ record.errors[:name_org] = 'Укажите название организации'
16
+ else
17
+ record.errors[:name_org] = 'Укажите, пожалуйста, название организации'
18
+ mark_please_used = true
19
+ end
20
+ end
21
+
22
+ if record.email_or_phone.present?
23
+ # указан email
24
+ if record.email_or_phone[/([a-z0-9_.-]+)@([a-z0-9-]+)\.[a-z.]+/].present?
25
+ else
26
+ # указан мобильный
27
+ if record.email_or_phone[/^((8|\+7)[\- ]?)?(\(?\d{3}\)?[\- ]?)?[\d\- ]{7,10}$/].present?
28
+ else
29
+ if mark_please_used
30
+ t2 = 'Номер телефона или email введены неверно'
31
+ else
32
+ t2 = 'Пожалуйста, укажите корректный номер телефона или email'
33
+ mark_please_used = true
34
+ end
35
+ record.errors[:email_or_phone] = t2
36
+ end
37
+ end
38
+ else
39
+ if mark_please_used
40
+ t1 = 'Укажите или номер телефона или email'
41
+ else
42
+ t1 = 'Укажите, пожалуйста, или номер телефона или email'
43
+ mark_please_used = true
44
+ end
45
+ record.errors[:email_or_phone] = t1
46
+ end
47
+
48
+ end
49
+
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,10 @@
1
+ var $cc = $("#dd");
2
+ var html_str = "<%= j render_dealer_form %>";
3
+
4
+ setTimeout(function () {
5
+ $('#loading').addClass('invis');
6
+ setTimeout(function () {
7
+ $cc.html(html_str);
8
+ },500);
9
+ },1000);
10
+
@@ -0,0 +1,4 @@
1
+ $('#dealer_form').modal_success();
2
+ setTimeout(function(){
3
+ $('#modal_ok').modal("show");
4
+ },400);
@@ -0,0 +1 @@
1
+ <%= @message.html_safe %>
@@ -0,0 +1,77 @@
1
+ <%= render_ok_message %>
2
+ <div id="dealer_form" tabindex="-1" role="dialog" aria-labelledby="dealerForm" aria-hidden="true">
3
+ <div class="modal-dialog">
4
+ <div class="modal-content">
5
+ <div class="modal-header">
6
+ <h4 class="modal-title medium" id="myModalLabel">Обратная связь</h4>
7
+ </div>
8
+ <div class="modal-body regular">
9
+
10
+ <%= form_for :mess,
11
+ :url => '/message_dealer',
12
+ :remote => true,
13
+ html: {
14
+ multipart: true,
15
+ :role => :form,
16
+ :id => 'form_dealer',
17
+ :data => {
18
+ :model => 'mess'
19
+ }
20
+ } do |f| %>
21
+
22
+ <div class="form-group clearfix">
23
+ <%= f.label :name_org, 'Название организации', class: 'control-label must' %>
24
+ <div class="input_wrapper"><%= f.text_field :name_org, class: 'form-control' %></div>
25
+ <span class="help-block col-md-12"></span>
26
+ </div>
27
+
28
+ <div class="form-group clearfix">
29
+ <%= f.label :name, 'Имя контактного лица', class: 'control-label must' %>
30
+ <div class="input_wrapper"><%= f.text_field :name, class: 'form-control' %></div>
31
+ <span class="help-block col-md-12"></span>
32
+ </div>
33
+
34
+ <div class="form-group clearfix">
35
+ <%= f.label :email_or_phone, 'Email или телефон', class: 'control-label must' %>
36
+ <div class="input_wrapper"><%= f.text_field :email_or_phone, class: 'form-control' %></div>
37
+ <span class="help-block col-md-12"></span>
38
+ </div>
39
+
40
+ <div class="form-group clearfix" style="margin-bottom: 0;">
41
+ <%= f.label :comment, 'Сообщение', class: 'control-label' %>
42
+ <div class="input_wrapper"><%= f.text_area :comment, class: 'form-control', :rows => "4" %></div>
43
+ <span class="help-block col-md-12"></span>
44
+ </div>
45
+
46
+ <div class="actions clearfix">
47
+ <%= f.label ' ', class: 'control-label' %>
48
+ <%= f.submit 'Отправить',
49
+ class: 'btn btn-primary',
50
+ data: {
51
+ disable_with: 'Отправляется...'
52
+ }
53
+ %>
54
+ </div>
55
+
56
+ <% end %>
57
+
58
+ </div>
59
+
60
+ </div>
61
+ </div>
62
+ </div>
63
+
64
+ <%# настраиваем форму %>
65
+ <script>
66
+ $(document).ready(function () {
67
+
68
+ var $form = $("form#form_dealer");
69
+
70
+ $form.bind("ajax:error", function (event, data, status, xhr) {
71
+ $form.render_form_errors($.parseJSON(data.responseText));
72
+ });
73
+
74
+ $form.modal_success();
75
+
76
+ });
77
+ </script>
@@ -0,0 +1,16 @@
1
+ <div class="modal fade" id="modal_ok" tabindex="1" role="dialog" aria-labelledby="modalOk" aria-hidden="true">
2
+ <div class="modal-dialog">
3
+ <div class="modal-content">
4
+ <div class="modal-header">
5
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
6
+ <h4 class="modal-title" id="myModalLabel"><%= wtitle %></h4>
7
+ </div>
8
+ <div class="modal-body">
9
+ <p><%= ok_text %></p>
10
+ </div>
11
+ <div class="modal-footer">
12
+ <button type="button" class="btn btn-primary" data-dismiss="modal">Закрыть</button>
13
+ </div>
14
+ </div>
15
+ </div>
16
+ </div>
@@ -0,0 +1,4 @@
1
+ Be::Engine.routes.draw do
2
+ match '/message_dealer', :to => 'be#message_dealer', :via => :post
3
+ match '/give_me_dealer_form', :to => 'be#give_me_dealer_form', :via => :get
4
+ end
@@ -0,0 +1,12 @@
1
+ class CreateBeMessageDealers < ActiveRecord::Migration
2
+ def change
3
+ create_table :be_message_dealers do |t|
4
+ t.string :name, null: false
5
+ t.string :name_org, null: false
6
+ t.string :email_or_phone, null: false
7
+ t.string :comment
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,21 @@
1
+ module Be
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Be
4
+
5
+ initializer :be_engine do
6
+ if defined?(ActiveAdmin)
7
+ ActiveAdmin.application.load_paths += Dir["#{config.root}/app/models/**/"]
8
+ ActiveAdmin.application.load_paths += Dir["#{config.root}/app/admin/**/"]
9
+ end
10
+ end
11
+
12
+ initializer :append_migrations do |app|
13
+ unless app.root.to_s.match root.to_s
14
+ config.paths['db/migrate'].expanded.each do |expanded_path|
15
+ app.config.paths['db/migrate'] << expanded_path
16
+ end
17
+ end
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,3 @@
1
+ module Be
2
+ VERSION = '0.1.0'
3
+ end
@@ -0,0 +1,5 @@
1
+ require_relative './be/version'
2
+ require_relative './be/engine'
3
+
4
+ module Be
5
+ end
@@ -1,3 +1,3 @@
1
1
  module C80Push
2
- VERSION = '0.1.0.8'
2
+ VERSION = '0.1.0.10'
3
3
  end
data/lib/c80_push.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'c80_push/engine'
2
- require_relative './engines/be/lib/be'
2
+ require_relative '../engines/be/lib/be'
3
3
 
4
4
  module C80Push
5
5
  def self.table_name_prefix
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: c80_push
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.8
4
+ version: 0.1.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - C80609A
@@ -45,6 +45,9 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - Gemfile.lock
48
51
  - MIT-LICENSE
49
52
  - README.md
50
53
  - Rakefile
@@ -52,6 +55,7 @@ files:
52
55
  - app/admin/c80_push/regions.rb
53
56
  - app/admin/c80_push/x_c80_push.rb
54
57
  - app/assets/config/c80_push_manifest.js
58
+ - app/assets/images/c80_push/.keep
55
59
  - app/assets/javascripts/c80_push.js.coffee
56
60
  - app/assets/javascripts/c80_push/backend/dealers.js
57
61
  - app/assets/javascripts/c80_push/frontend/c80_push_page_dealers/_dealers_left_list_clicks.js
@@ -79,6 +83,8 @@ files:
79
83
  - app/models/c80_push/region.rb
80
84
  - app/views/c80_push/shared/_page_dealers.html.erb
81
85
  - app/views/c80_push/shared/_select_region.html.erb
86
+ - bin/rails
87
+ - c80_push.gemspec
82
88
  - config/locales/dealer/ru.yml
83
89
  - config/locales/office/ru.yml
84
90
  - config/locales/region/ru.yml
@@ -91,6 +97,30 @@ files:
91
97
  - db/migrate/20170626130303_create_c80_push_join_table_offices_regions.rb
92
98
  - db/migrate/20170630061313_create_c80_push_presets.rb
93
99
  - db/migrate/20170630061515_create_c80_push_join_table_dealers_presets.rb
100
+ - engines/be/README.md
101
+ - engines/be/app/admin/be/message_dealers.rb
102
+ - engines/be/app/assets/javascripts/be.js.coffee
103
+ - engines/be/app/assets/javascripts/frontend/dealer-form-ajax.js
104
+ - engines/be/app/assets/stylesheets/backend/_active_admin_custom.scss
105
+ - engines/be/app/assets/stylesheets/backend/active_admin_custom/_message_dealers.scss
106
+ - engines/be/app/assets/stylesheets/be.scss
107
+ - engines/be/app/assets/stylesheets/be_admin.scss
108
+ - engines/be/app/assets/stylesheets/frontend/form.scss
109
+ - engines/be/app/controllers/be/be_controller.rb
110
+ - engines/be/app/helpers/be/be_helper.rb
111
+ - engines/be/app/mailer/be/message_dealer_mailer.rb
112
+ - engines/be/app/models/be/message_dealer.rb
113
+ - engines/be/app/models/be/message_dealer_validator.rb
114
+ - engines/be/app/views/be/be/give_me_dealer_form.js.erb
115
+ - engines/be/app/views/be/be/message_dealer.js.erb
116
+ - engines/be/app/views/be/message_dealer_mailer/mail_mess.html.erb
117
+ - engines/be/app/views/be/shared/_dealer_form.html.erb
118
+ - engines/be/app/views/be/shared/_ok_message.html.erb
119
+ - engines/be/config/routes.rb
120
+ - engines/be/db/migrate/20170725011920_create_be_message_dealers.rb
121
+ - engines/be/lib/be.rb
122
+ - engines/be/lib/be/engine.rb
123
+ - engines/be/lib/be/version.rb
94
124
  - lib/c80_push.rb
95
125
  - lib/c80_push/engine.rb
96
126
  - lib/c80_push/version.rb