c80_order_form 0.1.0.1 → 0.1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +1 -3
- data/app/admin/c80_order_form/message_orders.rb +1 -1
- data/app/assets/javascripts/frontend/ajax_form.js +9 -1
- data/app/assets/stylesheets/backend/active_admin_custom.scss +1 -1
- data/app/controllers/c80_order_form/mess_controller.rb +4 -3
- data/app/controllers/c80_order_form/site_controller.rb +1 -0
- data/app/helpers/c80_order_form/site_helper.rb +8 -4
- data/app/mailers/c80_order_form/message_order_mailer.rb +9 -5
- data/app/models/c80_order_form/settings.rb +4 -0
- data/app/views/c80_order_form/site/give_me_form.js.erb +1 -1
- data/app/views/c80_order_form/site/shared/_order_form.html.erb +12 -6
- data/c80_order_form.gemspec +2 -0
- data/db/migrate/20151229144545_add_subj_id_to_c80_order_form_message_orders.rb +5 -0
- data/db/migrate/20151229234343_create_c80_order_form_settings.rb +18 -0
- data/lib/c80_order_form/version.rb +1 -1
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69d9b2b451b40fb1bc3071bb174b7f466fd546aa
|
4
|
+
data.tar.gz: da2134f1e0b56829a3e002777498e08532dfb894
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33d93f4b41fba194797118995d3c7df68c07f78e804a9c3366b69389dbd07ae8883a2acab1efcc581fba2efadaef6176004ed9ed36bebaa1bb026b1cb10f72c7
|
7
|
+
data.tar.gz: 1dc7d34ad612d875f7aae1fcf7308a235e859b835b59c6eabd1dc2c5c10a8852e05b24b617893e1cf495ba1eeb04c4bd0013dc3af81c6b9296a4ea4bc6b13fd9
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -59,8 +59,6 @@ Add this line into `routes.rb`:
|
|
59
59
|
|
60
60
|
mount C80OrderForm::Engine => '/'
|
61
61
|
|
62
|
-
Form invoked by link with class `c80_order_invoking_btn`.
|
63
|
-
|
64
62
|
## Development
|
65
63
|
|
66
64
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -69,7 +67,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
69
67
|
|
70
68
|
## Contributing
|
71
69
|
|
72
|
-
1. Fork it ( https://github.com/
|
70
|
+
1. Fork it ( https://github.com/[my-github-username]/c80_order_form/fork )
|
73
71
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
74
72
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
75
73
|
4. Push to the branch (`git push origin my-new-feature`)
|
@@ -2,7 +2,7 @@ ActiveAdmin.register C80OrderForm::MessageOrder, :as => 'MessageOrder' do
|
|
2
2
|
|
3
3
|
before_filter :skip_sidebar!, :only => :index
|
4
4
|
|
5
|
-
menu :parent => 'Сообщения', :label =>
|
5
|
+
menu :parent => 'Сообщения', :label => C80OrderForm::Settings.first.admin_label_menu
|
6
6
|
|
7
7
|
index do
|
8
8
|
selectable_column
|
@@ -80,9 +80,17 @@ $(function () {
|
|
80
80
|
predefined_comment = $clickedButton.data('comment-text');
|
81
81
|
}
|
82
82
|
|
83
|
+
var subj_id = -1;
|
84
|
+
if ($clickedButton.data('subj-id') != undefined) {
|
85
|
+
subj_id = $clickedButton.data('subj-id');
|
86
|
+
}
|
87
|
+
|
83
88
|
$.ajax({
|
84
89
|
url: '/give_me_order_form',
|
85
|
-
data:{
|
90
|
+
data:{
|
91
|
+
predefined_comment:predefined_comment,
|
92
|
+
subj_id:subj_id
|
93
|
+
},
|
86
94
|
type: 'POST',
|
87
95
|
dataType: 'script'
|
88
96
|
}).done(function (data, result) {
|
@@ -2,13 +2,14 @@ module C80OrderForm
|
|
2
2
|
class MessController < ApplicationController
|
3
3
|
|
4
4
|
def handle_message_order
|
5
|
-
puts "<MessController.handle_message_order>"
|
5
|
+
# puts "<MessController.handle_message_order>"
|
6
6
|
m = MessageOrder.new(mess_params)
|
7
7
|
respond_to do |format|
|
8
8
|
if m.save
|
9
9
|
|
10
10
|
format.js
|
11
|
-
|
11
|
+
settings = Settings.first
|
12
|
+
MessageOrderMailer.send_mess(m, settings.message_letter_subj).deliver
|
12
13
|
else
|
13
14
|
puts "<MessController.handle_message_order> errors: #{m.errors}"
|
14
15
|
format.js { render json: m.errors, status: :unprocessable_entity }
|
@@ -17,7 +18,7 @@ module C80OrderForm
|
|
17
18
|
end
|
18
19
|
|
19
20
|
def mess_params
|
20
|
-
params.require(:mess).permit(:name, :email_or_phone, :comment, :kapcha)
|
21
|
+
params.require(:mess).permit(:name, :email_or_phone, :comment, :kapcha, :subj_id)
|
21
22
|
end
|
22
23
|
|
23
24
|
end
|
@@ -1,21 +1,25 @@
|
|
1
1
|
module C80OrderForm
|
2
2
|
module SiteHelper
|
3
3
|
|
4
|
-
def render_order_form(predefined_comment="")
|
4
|
+
def render_order_form(predefined_comment="",subj_id=-1)
|
5
|
+
|
6
|
+
@settings = Settings.first
|
5
7
|
|
6
8
|
render :partial => "c80_order_form/site/shared/order_form",
|
7
9
|
:locals => {
|
8
10
|
:mess => "MessageOrder.new",
|
9
|
-
:predefined_comment => predefined_comment
|
11
|
+
:predefined_comment => predefined_comment,
|
12
|
+
:subj_id => subj_id
|
10
13
|
}
|
11
14
|
|
12
15
|
end
|
13
16
|
|
14
17
|
def render_ok_message
|
18
|
+
settings = Settings.first
|
15
19
|
render :partial => "c80_order_form/site/shared/ok_message",
|
16
20
|
:locals => {
|
17
|
-
ok_text:
|
18
|
-
wtitle:
|
21
|
+
ok_text: settings.ok_text,
|
22
|
+
wtitle: settings.ok_text_title
|
19
23
|
}
|
20
24
|
end
|
21
25
|
|
@@ -15,13 +15,17 @@ module C80OrderForm
|
|
15
15
|
#puts "#{SiteProps.first.mail_to}"
|
16
16
|
end
|
17
17
|
|
18
|
-
private
|
18
|
+
# private
|
19
19
|
|
20
20
|
def format_message(message)
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
m = Settings.first.message_text
|
22
|
+
m = m.gsub!('{name}',message.name)
|
23
|
+
m = m.gsub!('{email_or_phone}',message.email_or_phone)
|
24
|
+
m = m.gsub!('{comment}',message.comment)
|
25
|
+
m = m.gsub!('{subj_id}',message.subj_id)
|
26
|
+
# puts "<format_message> m: #{m}"
|
27
|
+
message.update(:comment => m)
|
28
|
+
m
|
25
29
|
end
|
26
30
|
|
27
31
|
end
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<div class="modal-content">
|
5
5
|
<div class="modal-header">
|
6
6
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
7
|
-
<h4 class="modal-title medium" id="myModalLabel"
|
7
|
+
<h4 class="modal-title medium" id="myModalLabel"><%= @settings.order_form_title %></h4>
|
8
8
|
</div>
|
9
9
|
<div class="modal-body regular">
|
10
10
|
|
@@ -21,13 +21,13 @@
|
|
21
21
|
} do |f| %>
|
22
22
|
|
23
23
|
<div class="form-group clearfix">
|
24
|
-
<%= f.label :name,
|
24
|
+
<%= f.label :name, @settings.order_form_label_name, class: 'control-label must' %>
|
25
25
|
<%= f.text_field :name, class: 'form-control' %>
|
26
26
|
<span class="help-block col-md-12"></span>
|
27
27
|
</div>
|
28
28
|
|
29
29
|
<div class="form-group clearfix">
|
30
|
-
<%= f.label :email_or_phone,
|
30
|
+
<%= f.label :email_or_phone, @settings.order_form_label_email_or_phone, class: 'control-label must' %>
|
31
31
|
<%= f.text_field :email_or_phone, class: 'form-control' %>
|
32
32
|
<span class="help-block col-md-12"></span>
|
33
33
|
</div>
|
@@ -38,18 +38,24 @@
|
|
38
38
|
<span class="help-block col-md-12"></span>
|
39
39
|
</div>
|
40
40
|
|
41
|
+
<div class="form-group kapcha clearfix">
|
42
|
+
<%= f.label :subj_id, "subj_id", class: 'control-label' %>
|
43
|
+
<%= f.text_field :subj_id, class: 'form-control', :value => subj_id %>
|
44
|
+
<span class="help-block col-md-12"></span>
|
45
|
+
</div>
|
46
|
+
|
41
47
|
<div class="form-group clearfix" style="margin-bottom: 0;">
|
42
|
-
<%= f.label :comment,
|
48
|
+
<%= f.label :comment, @settings.order_form_label_comment, class: 'control-label' %>
|
43
49
|
<%= f.text_area :comment, class: 'form-control', :rows => "4", :value => predefined_comment %>
|
44
50
|
<span class="help-block col-md-12"></span>
|
45
51
|
</div>
|
46
52
|
|
47
53
|
<div class="actions clearfix">
|
48
54
|
<%= f.label " ", class: 'control-label' %>
|
49
|
-
<%= f.submit
|
55
|
+
<%= f.submit @settings.order_form_label_button_send,
|
50
56
|
class: 'btn btn-primary',
|
51
57
|
data: {
|
52
|
-
disable_with:
|
58
|
+
disable_with: @settings.order_form_label_button_sending
|
53
59
|
}
|
54
60
|
%>
|
55
61
|
</div>
|
data/c80_order_form.gemspec
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateC80OrderFormSettings < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :c80_order_form_settings, :options => 'COLLATE=utf8_unicode_ci' do |t|
|
4
|
+
t.string :order_form_title
|
5
|
+
t.string :order_form_label_name
|
6
|
+
t.string :order_form_label_email_or_phone
|
7
|
+
t.string :order_form_label_comment
|
8
|
+
t.string :order_form_label_button_send
|
9
|
+
t.string :order_form_label_button_sending
|
10
|
+
t.string :ok_text
|
11
|
+
t.string :ok_text_title
|
12
|
+
t.string :admin_label_menu
|
13
|
+
t.text :message_text
|
14
|
+
t.string :message_letter_subj
|
15
|
+
t.timestamps
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: c80_order_form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- C80609A
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: activesupport
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.0.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.0.0
|
41
55
|
description: Order form
|
42
56
|
email:
|
43
57
|
- c080609a@gmail.com
|
@@ -68,6 +82,7 @@ files:
|
|
68
82
|
- app/mailers/c80_order_form/message_order_mailer.rb
|
69
83
|
- app/models/c80_order_form/message_order.rb
|
70
84
|
- app/models/c80_order_form/message_order_validator.rb
|
85
|
+
- app/models/c80_order_form/settings.rb
|
71
86
|
- app/views/c80_order_form/mess/handle_message_order.js.erb
|
72
87
|
- app/views/c80_order_form/message_order_mailer/mail_mess.html.erb
|
73
88
|
- app/views/c80_order_form/site/give_me_form.js.erb
|
@@ -78,6 +93,8 @@ files:
|
|
78
93
|
- c80_order_form.gemspec
|
79
94
|
- config/routes.rb
|
80
95
|
- db/migrate/20151221164444_create_c80_order_form_message_orders.rb
|
96
|
+
- db/migrate/20151229144545_add_subj_id_to_c80_order_form_message_orders.rb
|
97
|
+
- db/migrate/20151229234343_create_c80_order_form_settings.rb
|
81
98
|
- lib/c80_order_form.rb
|
82
99
|
- lib/c80_order_form/engine.rb
|
83
100
|
- lib/c80_order_form/version.rb
|