c80_contest 0.1.1
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 +17 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/MIT-LICENSE +20 -0
- data/README.md +32 -0
- data/README.rdoc +3 -0
- data/Rakefile +23 -0
- data/app/admin/c80_contest/bids.rb +28 -0
- data/app/assets/images/c80_contest/.keep +0 -0
- data/app/assets/images/loading-sm.gif +0 -0
- data/app/assets/images/loading.gif +0 -0
- data/app/assets/javascripts/c80_contest/frontend/ajax_bid_form.js +157 -0
- data/app/assets/javascripts/c80_contest.js.coffee +2 -0
- data/app/assets/javascripts/lib/fileinput/fileinput.js +3833 -0
- data/app/assets/javascripts/lib/fileinput/themes/explorer/theme.js +58 -0
- data/app/assets/javascripts/lib/fileinput/themes/fa/theme.js +45 -0
- data/app/assets/javascripts/lib/fileinput/themes/gly/theme.js +45 -0
- data/app/assets/stylesheets/c80_contest/backend/bid_page.scss +22 -0
- data/app/assets/stylesheets/c80_contest/frontend/foo.scss +0 -0
- data/app/assets/stylesheets/c80_contest.scss +3 -0
- data/app/assets/stylesheets/c80_contest_active_admin.scss +2 -0
- data/app/assets/stylesheets/lib/fileinput/fileinput.scss +481 -0
- data/app/assets/stylesheets/lib/fileinput/themes/explorer/theme.scss +211 -0
- data/app/controllers/c80_contest/application_controller.rb +5 -0
- data/app/controllers/c80_contest/bid_controller.rb +26 -0
- data/app/controllers/c80_contest/site_controller.rb +13 -0
- data/app/helpers/c80_contest/application_helper.rb +26 -0
- data/app/models/c80_contest/bid.rb +17 -0
- data/app/models/c80_contest/setting.rb +53 -0
- data/app/uploaders/c80_contest/bid_photo_uploader.rb +32 -0
- data/app/views/c80_contest/bid/make_bid.js.erb +4 -0
- data/app/views/c80_contest/shared/_bid_form.html.erb +65 -0
- data/app/views/c80_contest/shared/_ok_message.html.erb +16 -0
- data/app/views/c80_contest/site/give_me_form.js.erb +4 -0
- data/app/views/layouts/c80_contest/application.html.erb +14 -0
- data/bin/console +14 -0
- data/bin/rails +12 -0
- data/bin/setup +8 -0
- data/c80_contest.gemspec +46 -0
- data/config/routes.rb +4 -0
- data/create_base.rb +25 -0
- data/db/migrate/20170510124400_create_c80_contest_bids.rb +12 -0
- data/db/migrate/20170511145501_create_c80_contest_settings.rb +19 -0
- data/db/seeds/c80_contest_fill_settings.rb +22 -0
- data/lib/c80_contest/engine.rb +20 -0
- data/lib/c80_contest/version.rb +3 -0
- data/lib/c80_contest.rb +8 -0
- data/lib/tasks/c80_contest_tasks.rake +4 -0
- metadata +335 -0
@@ -0,0 +1,211 @@
|
|
1
|
+
/*!
|
2
|
+
* bootstrap-fileinput v4.4.0
|
3
|
+
* http://plugins.krajee.com/file-input
|
4
|
+
*
|
5
|
+
* Krajee Explorer theme style for bootstrap-fileinput. Load this theme file after loading `fileinput.css`.
|
6
|
+
*
|
7
|
+
* Author: Kartik Visweswaran
|
8
|
+
* Copyright: 2014 - 2017, Kartik Visweswaran, Krajee.com
|
9
|
+
*
|
10
|
+
* Licensed under the BSD 3-Clause
|
11
|
+
* https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md
|
12
|
+
*/
|
13
|
+
.theme-explorer .file-preview .table {
|
14
|
+
margin: 0;
|
15
|
+
}
|
16
|
+
|
17
|
+
.theme-explorer .explorer-frame td {
|
18
|
+
vertical-align: middle;
|
19
|
+
text-align: left;
|
20
|
+
}
|
21
|
+
|
22
|
+
.explorer-frame .file-preview-text {
|
23
|
+
display: inline-block;
|
24
|
+
color: #428bca;
|
25
|
+
border: 1px solid #ddd;
|
26
|
+
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
|
27
|
+
outline: none;
|
28
|
+
padding: 8px;
|
29
|
+
resize: none;
|
30
|
+
}
|
31
|
+
|
32
|
+
.explorer-frame .file-preview-html {
|
33
|
+
display: inline-block;
|
34
|
+
border: 1px solid #ddd;
|
35
|
+
padding: 8px;
|
36
|
+
overflow: auto;
|
37
|
+
}
|
38
|
+
|
39
|
+
.explorer-frame .file-preview-other {
|
40
|
+
text-align: center;
|
41
|
+
}
|
42
|
+
|
43
|
+
.explorer-frame .file-other-icon {
|
44
|
+
font-size: 4.2em;
|
45
|
+
}
|
46
|
+
|
47
|
+
.theme-explorer .explorer-frame .kv-file-content {
|
48
|
+
width: 80px;
|
49
|
+
height: 80px;
|
50
|
+
padding: 5px;
|
51
|
+
text-align: center;
|
52
|
+
}
|
53
|
+
|
54
|
+
.theme-explorer .file-actions-cell {
|
55
|
+
width: 100px;
|
56
|
+
padding: 0;
|
57
|
+
}
|
58
|
+
|
59
|
+
.theme-explorer .file-thumb-progress .progress {
|
60
|
+
display: block;
|
61
|
+
margin-top: 5px;
|
62
|
+
}
|
63
|
+
|
64
|
+
.theme-explorer .file-thumb-progress .progress, .theme-explorer .file-thumb-progress .progress-bar {
|
65
|
+
height: 13px;
|
66
|
+
font-size: 11px;
|
67
|
+
line-height: 13px;
|
68
|
+
}
|
69
|
+
|
70
|
+
.theme-explorer .file-actions-cell {
|
71
|
+
position: relative;
|
72
|
+
}
|
73
|
+
|
74
|
+
.theme-explorer .file-upload-indicator, .theme-explorer .file-drag-handle {
|
75
|
+
position: absolute;
|
76
|
+
text-align: center;
|
77
|
+
top: 0;
|
78
|
+
right: 0;
|
79
|
+
padding-left: 5px;
|
80
|
+
padding-right: 2px;
|
81
|
+
border-right: none;
|
82
|
+
border-top: none;
|
83
|
+
border-left: 1px solid #8a6d3b;
|
84
|
+
border-bottom: 1px solid #8a6d3b;
|
85
|
+
border-bottom-left-radius: 11px;
|
86
|
+
font-size: 12px;
|
87
|
+
}
|
88
|
+
|
89
|
+
.theme-explorer .explorer-caption {
|
90
|
+
display: block;
|
91
|
+
color: #777;
|
92
|
+
}
|
93
|
+
|
94
|
+
.theme-explorer .file-actions {
|
95
|
+
text-align: center;
|
96
|
+
}
|
97
|
+
|
98
|
+
.theme-explorer .kvsortable-ghost {
|
99
|
+
opacity: 0.6;
|
100
|
+
background: #e1edf7;
|
101
|
+
border: 2px solid #a1abff;
|
102
|
+
}
|
103
|
+
|
104
|
+
.theme-explorer .file-upload-indicator {
|
105
|
+
font-size: 13px;
|
106
|
+
padding-left: 6px;
|
107
|
+
background-color: #fcf8e3;
|
108
|
+
border-color: #faebcc;
|
109
|
+
}
|
110
|
+
|
111
|
+
.theme-explorer .file-drag-handle {
|
112
|
+
right: -2px;
|
113
|
+
background-color: #d9edf7;
|
114
|
+
border-color: #bce8f1;
|
115
|
+
}
|
116
|
+
|
117
|
+
.theme-explorer .file-preview-error .file-upload-indicator {
|
118
|
+
background-color: #f2dede;
|
119
|
+
border-color: #ebccd1;
|
120
|
+
}
|
121
|
+
|
122
|
+
.theme-explorer .file-preview-success .file-upload-indicator {
|
123
|
+
background-color: #dff0d8;
|
124
|
+
border-color: #d6e9c6;
|
125
|
+
}
|
126
|
+
|
127
|
+
.theme-explorer .file-preview-loading .file-upload-indicator {
|
128
|
+
background-color: #e5e5e5;
|
129
|
+
border-color: #777;
|
130
|
+
}
|
131
|
+
|
132
|
+
.theme-explorer .file-error-message ul {
|
133
|
+
padding-left: 15px;
|
134
|
+
}
|
135
|
+
|
136
|
+
.theme-explorer .file-error-message .close {
|
137
|
+
margin-top: -5px;
|
138
|
+
margin-right: -5px;
|
139
|
+
}
|
140
|
+
|
141
|
+
/*
|
142
|
+
* mobile responsive styling
|
143
|
+
*/
|
144
|
+
@media only screen and (max-width: 500px) {
|
145
|
+
.theme-explorer .table, .theme-explorer .table tbody, .theme-explorer .table tr, .theme-explorer .table td {
|
146
|
+
display: block;
|
147
|
+
width: 100% !important;
|
148
|
+
}
|
149
|
+
|
150
|
+
.theme-explorer .table {
|
151
|
+
border: none;
|
152
|
+
}
|
153
|
+
|
154
|
+
.theme-explorer .table tr {
|
155
|
+
margin-top: 5px;
|
156
|
+
}
|
157
|
+
|
158
|
+
.theme-explorer .table tr:first-child {
|
159
|
+
margin-top: 0;
|
160
|
+
}
|
161
|
+
|
162
|
+
.theme-explorer .table td {
|
163
|
+
text-align: center;
|
164
|
+
}
|
165
|
+
|
166
|
+
.theme-explorer .table .kv-file-content {
|
167
|
+
border-bottom: none;
|
168
|
+
padding: 4px;
|
169
|
+
margin: 0;
|
170
|
+
}
|
171
|
+
|
172
|
+
.theme-explorer .table .kv-file-content .file-preview-image {
|
173
|
+
max-width: 100%;
|
174
|
+
}
|
175
|
+
|
176
|
+
.theme-explorer .file-details-cell {
|
177
|
+
border-top: none;
|
178
|
+
border-bottom: none;
|
179
|
+
padding-top: 0;
|
180
|
+
margin: 0;
|
181
|
+
}
|
182
|
+
|
183
|
+
.theme-explorer .file-actions-cell {
|
184
|
+
border-top: none;
|
185
|
+
padding-bottom: 4px;
|
186
|
+
}
|
187
|
+
|
188
|
+
.theme-explorer .explorer-frame .explorer-caption {
|
189
|
+
white-space: nowrap;
|
190
|
+
text-overflow: ellipsis;
|
191
|
+
overflow: hidden;
|
192
|
+
left: 0;
|
193
|
+
right: 0;
|
194
|
+
margin: auto;
|
195
|
+
}
|
196
|
+
|
197
|
+
.theme-explorer .file-upload-indicator, .theme-explorer .file-drag-handle {
|
198
|
+
right: 0;
|
199
|
+
bottom: 0;
|
200
|
+
border-top-left-radius: 40px;
|
201
|
+
border-bottom-left-radius: 0;
|
202
|
+
padding: 12px 3px 0 6px;
|
203
|
+
}
|
204
|
+
|
205
|
+
.theme-explorer .file-actions-cell .btn-xs {
|
206
|
+
font-size: 0.9em;
|
207
|
+
padding: 2px 7px;
|
208
|
+
margin-right: 3px;
|
209
|
+
cursor: pointer;
|
210
|
+
}
|
211
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module C80Contest
|
2
|
+
class BidController < ApplicationController
|
3
|
+
|
4
|
+
def make_bid
|
5
|
+
m = Bid.new(mess_params)
|
6
|
+
respond_to do |format|
|
7
|
+
if m.save
|
8
|
+
|
9
|
+
# noinspection RubyResolve
|
10
|
+
format.js
|
11
|
+
settings = Setting.first
|
12
|
+
# MessageOrderMailer.send_mess(m, settings.message_letter_subj).deliver
|
13
|
+
else
|
14
|
+
# noinspection RubyResolve
|
15
|
+
format.js { render json: m.errors, status: :unprocessable_entity }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def mess_params
|
21
|
+
# noinspection RubyResolve
|
22
|
+
params.require(:bid).permit(:title, :phone, :photo)
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module C80Contest
|
2
|
+
module ApplicationHelper
|
3
|
+
|
4
|
+
def render_bid_form(bid)
|
5
|
+
|
6
|
+
settings = Setting.first
|
7
|
+
|
8
|
+
render :partial => 'c80_contest/shared/bid_form',
|
9
|
+
:locals => {
|
10
|
+
bid: bid,
|
11
|
+
settings: settings
|
12
|
+
}
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
def render_ok_message
|
17
|
+
settings = Setting.first
|
18
|
+
render :partial => 'c80_contest/shared/ok_message',
|
19
|
+
:locals => {
|
20
|
+
ok_text: settings.ok_text,
|
21
|
+
ok_text_title: settings.ok_text_title
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module C80Contest
|
2
|
+
# noinspection RailsParamDefResolve
|
3
|
+
class Bid < ActiveRecord::Base
|
4
|
+
|
5
|
+
validates :title,
|
6
|
+
:presence => true,
|
7
|
+
:length => { in: 5..100 }
|
8
|
+
|
9
|
+
validates :phone,
|
10
|
+
:presence => true,
|
11
|
+
:format => { with: /\A((8|\+?7)[\- ]?)?(\(?\d{3,5}\)?[\- ]?)?[\d\- ]{5,10}\z/}
|
12
|
+
|
13
|
+
validates_presence_of :photo
|
14
|
+
|
15
|
+
mount_uploader :photo, C80Contest::BidPhotoUploader
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module C80Contest
|
2
|
+
class Setting < ActiveRecord::Base
|
3
|
+
|
4
|
+
validates :form_title,
|
5
|
+
:presence => true,
|
6
|
+
:length => { :in => 5..125 }
|
7
|
+
|
8
|
+
validates :form_label_name,
|
9
|
+
:presence => true,
|
10
|
+
:length => { :in => 3..49 }
|
11
|
+
|
12
|
+
validates :form_label_phone,
|
13
|
+
:presence => true,
|
14
|
+
:length => { :in => 3..80 }
|
15
|
+
|
16
|
+
validates :form_label_photo,
|
17
|
+
:presence => true,
|
18
|
+
:length => { :in => 3..80 }
|
19
|
+
|
20
|
+
validates :form_label_button_send,
|
21
|
+
:presence => true,
|
22
|
+
:length => { :in => 3..15 }
|
23
|
+
|
24
|
+
validates :form_label_button_sending,
|
25
|
+
:presence => true,
|
26
|
+
:length => { :in => 3..20 }
|
27
|
+
|
28
|
+
validates :ok_text,
|
29
|
+
:presence => true,
|
30
|
+
:length => { :in => 2..125 }
|
31
|
+
|
32
|
+
validates :ok_text_title,
|
33
|
+
:presence => true,
|
34
|
+
:length => { :in => 2..125 }
|
35
|
+
|
36
|
+
validates :admin_label_menu,
|
37
|
+
:presence => true,
|
38
|
+
:length => { :in => 2..20 }
|
39
|
+
|
40
|
+
validates :rules,
|
41
|
+
# :presence => true,
|
42
|
+
:length => { :in => 0..1000 }
|
43
|
+
|
44
|
+
validates :message_letter_subj,
|
45
|
+
:presence => true,
|
46
|
+
:length => { :in => 10..125 }
|
47
|
+
|
48
|
+
validates :message_text,
|
49
|
+
:presence => true,
|
50
|
+
:length => { :in => 20..499 }
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module C80Contest
|
2
|
+
|
3
|
+
class BidPhotoUploader < ::CarrierWave::Uploader::Base
|
4
|
+
|
5
|
+
include ::CarrierWave::MiniMagick
|
6
|
+
|
7
|
+
storage :file
|
8
|
+
process :resize_to_limit => [1024,1024]
|
9
|
+
|
10
|
+
version :thumb do
|
11
|
+
process :resize_to_fit => [500,500]
|
12
|
+
end
|
13
|
+
|
14
|
+
def store_dir
|
15
|
+
'uploads/bids/'
|
16
|
+
end
|
17
|
+
|
18
|
+
def filename
|
19
|
+
if original_filename
|
20
|
+
"photo_#{secure_token(4)}.#{file.extension}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
protected
|
25
|
+
def secure_token(length=16)
|
26
|
+
var = :"@#{mounted_as}_secure_token"
|
27
|
+
model.instance_variable_get(var) or model.instance_variable_set(var, SecureRandom.hex(length/2))
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
<%# application_helper.rb: render_bid_form %>
|
2
|
+
|
3
|
+
<%= render_ok_message %>
|
4
|
+
|
5
|
+
<div id="bid_form" class="modal fade">
|
6
|
+
<div class="modal-dialog">
|
7
|
+
<div class="modal-content">
|
8
|
+
<div class="modal-header">
|
9
|
+
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
10
|
+
<h4 class="modal-title medium" id="myModalLabel"><%= settings.form_title %></h4>
|
11
|
+
</div>
|
12
|
+
<div class="modal-body regular">
|
13
|
+
|
14
|
+
<%= # noinspection RailsParamDefResolve
|
15
|
+
form_for :bid,
|
16
|
+
:url => '/make_bid',
|
17
|
+
:remote => true,
|
18
|
+
html: {
|
19
|
+
multipart: true,
|
20
|
+
:role => :form,
|
21
|
+
:id => 'form_bid',
|
22
|
+
:data => {
|
23
|
+
:model => 'bid'
|
24
|
+
}
|
25
|
+
} do |f| %>
|
26
|
+
<%= hidden_field_tag :authenticity_token, '', :value => form_authenticity_token %>
|
27
|
+
<div class="form-group clearfix">
|
28
|
+
<%= f.label :title, settings.form_label_name, class: 'control-label must' %>
|
29
|
+
<%= f.text_field :title, class: 'form-control' %>
|
30
|
+
<span class="help-block col-md-12"></span>
|
31
|
+
</div>
|
32
|
+
|
33
|
+
<div class="form-group clearfix">
|
34
|
+
<%= f.label :phone, settings.form_label_phone, class: 'control-label must' %>
|
35
|
+
<%= f.text_field :phone, class: 'form-control' %>
|
36
|
+
<span class="help-block col-md-12"></span>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div class="form-group clearfix">
|
40
|
+
<%= f.label :photo, settings.form_label_photo, class: 'control-label must' %>
|
41
|
+
<%= f.text_field :photo, :type => 'file', data: { preview_Type_File: 'text' }, class: 'form-control' %>
|
42
|
+
<span class="help-block col-md-12"></span>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<div class="actions clearfix">
|
46
|
+
<%= f.label ' ', class: 'control-label' %>
|
47
|
+
<%= f.submit settings.form_label_button_send,
|
48
|
+
class: 'btn btn-success',
|
49
|
+
data: {
|
50
|
+
disable_with: settings.form_label_button_sending
|
51
|
+
}
|
52
|
+
%>
|
53
|
+
</div>
|
54
|
+
|
55
|
+
<% end %>
|
56
|
+
|
57
|
+
</div>
|
58
|
+
|
59
|
+
<div class="modal-footer">
|
60
|
+
<button type="button" class="btn btn_close btn-default" data-dismiss="modal">Закрыть</button>
|
61
|
+
</div>
|
62
|
+
|
63
|
+
</div>
|
64
|
+
</div>
|
65
|
+
</div>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<div class="modal fade" id="bid_ok">
|
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">×</button>
|
6
|
+
<h4 class="modal-title" id="myModalLabel"><%= ok_text_title %></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-default" data-dismiss="modal">Закрыть</button>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
</div>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>C80Contest</title>
|
5
|
+
<%= stylesheet_link_tag "c80_contest/application", media: "all" %>
|
6
|
+
<%= javascript_include_tag "c80_contest/application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "c80_contest"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/rails
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
|
3
|
+
|
4
|
+
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
5
|
+
ENGINE_PATH = File.expand_path('../../lib/c80_contest/engine', __FILE__)
|
6
|
+
|
7
|
+
# Set up gems listed in the Gemfile.
|
8
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
9
|
+
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
10
|
+
|
11
|
+
require 'rails/all'
|
12
|
+
require 'rails/engine/commands'
|
data/bin/setup
ADDED
data/c80_contest.gemspec
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'c80_contest/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'c80_contest'
|
9
|
+
spec.version = C80Contest::VERSION
|
10
|
+
spec.authors = ['C80609A']
|
11
|
+
spec.email = ['c080609a@gmail.com']
|
12
|
+
|
13
|
+
spec.summary = 'Конкурс'
|
14
|
+
spec.description = 'Пришли чек и участвуй в розыгрыше 500 литров бензина'
|
15
|
+
spec.homepage = 'https://github.com/c80609a/c80_contest'
|
16
|
+
spec.license = 'MIT'
|
17
|
+
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
19
|
+
f.match(%r{^(test|spec|features)/})
|
20
|
+
end
|
21
|
+
spec.bindir = 'exe'
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
+
spec.require_paths = ['lib']
|
24
|
+
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.14.6'
|
26
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
27
|
+
spec.add_development_dependency 'rspec-rails', '~> 3.0'
|
28
|
+
spec.add_development_dependency 'rails', '~> 4.0'
|
29
|
+
spec.add_development_dependency 'activeadmin', '~> 1.0'
|
30
|
+
spec.add_development_dependency 'mysql2', '~> 0.3.18'
|
31
|
+
spec.add_development_dependency 'dotenv-rails', '~> 2.2.1'
|
32
|
+
spec.add_development_dependency 'shoulda-matchers', '~> 3.1'
|
33
|
+
spec.add_development_dependency 'execjs', '~> 2.7.0'
|
34
|
+
spec.add_development_dependency 'therubyracer', '~> 0.12.3'
|
35
|
+
spec.add_development_dependency 'mini_magick', '~> 4.3.3'
|
36
|
+
spec.add_development_dependency 'carrierwave', '~> 0.10.0'
|
37
|
+
|
38
|
+
spec.add_development_dependency 'jquery-rails', '~> 4.3.1'
|
39
|
+
spec.add_development_dependency 'bootstrap-sass', '>= 3.3.5.1'
|
40
|
+
spec.add_development_dependency 'sass-rails', '>= 5.0.4'
|
41
|
+
spec.add_development_dependency 'c80_modal_forms', '~> 0.1.0.1'
|
42
|
+
spec.add_development_dependency 'byebug', '~> 9.0.6'
|
43
|
+
|
44
|
+
# spec.add_development_dependency 'combustion', '~> 0.6.0'
|
45
|
+
|
46
|
+
end
|
data/config/routes.rb
ADDED
data/create_base.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
require 'mysql2'
|
3
|
+
require 'dotenv/load'
|
4
|
+
|
5
|
+
user_name = 'dummy'
|
6
|
+
env = 'test'
|
7
|
+
db_name = "#{user_name}_#{env}_db"
|
8
|
+
pass = ENV['DB_PASS']
|
9
|
+
|
10
|
+
puts '---[ CREATE DATABASE ]------------------ '
|
11
|
+
puts "\t\t user_name = #{user_name}"
|
12
|
+
puts "\t\t env = #{env}"
|
13
|
+
puts "\t\t db_name = #{db_name}"
|
14
|
+
|
15
|
+
begin
|
16
|
+
client = Mysql2::Client.new(:host => "localhost", :username => "root", :password => pass)
|
17
|
+
client.query("CREATE DATABASE #{db_name};")
|
18
|
+
client.query("GRANT ALL PRIVILEGES ON #{db_name}.* TO #{user_name}@localhost IDENTIFIED by '#{pass}';")
|
19
|
+
client.query("FLUSH PRIVILEGES;")
|
20
|
+
rescue => e
|
21
|
+
puts "\t\t #{e}"
|
22
|
+
end
|
23
|
+
|
24
|
+
# puts '---[ FILL DATABASE ]-------------------- '
|
25
|
+
# %x`mysql -uroot -p #{db_name} < db.sql`
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateC80ContestBids < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :c80_contest_bids, :options => 'COLLATE=utf8_unicode_ci' do |t|
|
4
|
+
t.string :title
|
5
|
+
t.string :photo
|
6
|
+
t.string :phone
|
7
|
+
t.string :comment
|
8
|
+
t.boolean :marked
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class CreateC80ContestSettings < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :c80_contest_settings, :options => 'COLLATE=utf8_unicode_ci' do |t|
|
4
|
+
t.string :form_title
|
5
|
+
t.string :form_label_name
|
6
|
+
t.string :form_label_phone
|
7
|
+
t.string :form_label_photo
|
8
|
+
t.string :form_label_button_send
|
9
|
+
t.string :form_label_button_sending
|
10
|
+
t.string :ok_text
|
11
|
+
t.string :ok_text_title
|
12
|
+
t.string :admin_label_menu
|
13
|
+
t.text :rules
|
14
|
+
t.string :message_letter_subj
|
15
|
+
t.text :message_text
|
16
|
+
t.timestamps
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# rake db:seed:c80_contest_fill_settings
|
2
|
+
|
3
|
+
C80Contest::Setting.delete_all
|
4
|
+
C80Contest::Setting.create!({
|
5
|
+
:form_title => 'Участвуй в конкурсе: пришли чек и выиграй 500 литров бензина!',
|
6
|
+
:form_label_name => 'Ваше имя',
|
7
|
+
:form_label_phone => 'Номер телефона',
|
8
|
+
:form_label_photo => 'Фото чека',
|
9
|
+
:form_label_button_send => 'Отправить',
|
10
|
+
:form_label_button_sending => 'Отправляется...',
|
11
|
+
:ok_text => 'Ваша заявка принята',
|
12
|
+
:ok_text_title => 'Ваша заявка отправлена',
|
13
|
+
:admin_label_menu => 'Розыгрыш',
|
14
|
+
:rules => 'Акция проводится с 18 мая по 18 июня. В розыгрыше участвуют чеки на покупки, совершённые в цетре "7авто".',
|
15
|
+
:message_letter_subj => 'Заявка на участие',
|
16
|
+
:message_text => ' • Имя: {name}<br>' +
|
17
|
+
' • Номер телефона: {phone}<br>' +
|
18
|
+
' • Фото чека: <br>' +
|
19
|
+
' <img src="http://google.com/uploads/bids/{photo_url}" />' +
|
20
|
+
' --------------------------------------<br>' +
|
21
|
+
" Просмотреть заявку: <a href='http://google.com/admin/bids/{subj_id}'>http://google.com/admin/bids/{subj_id}</a><br>"
|
22
|
+
})
|