c80_catoffers 0.1.0.3 → 0.1.0.4
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 +4 -4
- data/app/admin/c80_catoffers/csamples.rb +69 -0
- data/app/admin/c80_catoffers/csprops.rb +41 -0
- data/app/assets/javascripts/c80_catoffers/offer_full_desc.js +52 -47
- data/app/assets/javascripts/c80_catoffers/offers_ajax.js +89 -0
- data/app/assets/stylesheets/c80_catoffers/offer_full_desc.scss +3 -2
- data/app/assets/stylesheets/c80_catoffers/offer_list_grouped.scss +23 -0
- data/app/assets/stylesheets/c80_catoffers/offer_list_widget.scss +19 -15
- data/app/assets/stylesheets/c80_catoffers/will_paginate.scss +65 -0
- data/app/controllers/c80_catoffers/application_controller.rb +25 -0
- data/app/helpers/c80_catoffers/app_helper.rb +47 -4
- data/app/helpers/c80_catoffers/csamples_helper.rb +52 -0
- data/app/helpers/c80_catoffers/inner/modal_helper.rb +16 -0
- data/app/helpers/c80_catoffers/price_helper.rb +17 -0
- data/app/helpers/c80_catoffers/urls_helper.rb +7 -3
- data/app/models/c80_catoffers/crow.rb +22 -0
- data/app/models/c80_catoffers/csample.rb +40 -0
- data/app/models/c80_catoffers/csprop.rb +5 -0
- data/app/models/c80_catoffers/offer.rb +7 -0
- data/app/uploaders/c80_catoffers/csphoto_uploader.rb +49 -0
- data/app/views/c80_catoffers/_bs_modal.html.erb +18 -0
- data/app/views/c80_catoffers/_csamples_widget.html.erb +43 -0
- data/app/views/c80_catoffers/_offers_list_grouped.html.erb +5 -2
- data/app/views/c80_catoffers/_offers_list_widget.html.erb +54 -48
- data/app/views/c80_catoffers/_offers_page.html.erb +23 -0
- data/app/views/c80_catoffers/_popup_price.html.erb +2 -0
- data/app/views/c80_catoffers/application/fake_main.html.erb +0 -0
- data/app/views/c80_catoffers/application/offers_guru.js.erb +10 -0
- data/app/views/c80_catoffers/application/price_me.js.erb +19 -0
- data/config/locales/ru.yml +6 -0
- data/config/routes.rb +3 -9
- data/db/migrate/20161105123939_c80_catoffers_add_per_page_to_props.rb +5 -0
- data/db/migrate/20161106154221_create_c80_catoffers_csamples.rb +13 -0
- data/db/migrate/20161106191544_create_c80_catoffers_crows.rb +13 -0
- data/db/migrate/20161107115555_c80_catoffers_create_csprops.rb +7 -0
- data/db/migrate/20161107123333_c80_catoffers_create_join_table_csprops_csamples.rb +11 -0
- data/db/seeds/c80_catoffers_01_fill_props.rb +2 -1
- data/lib/c80_catoffers/version.rb +1 -1
- metadata +27 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48db66d169bf13945de278b3a3dea333caad80ea
|
4
|
+
data.tar.gz: cf5e62ca220ed3f47c35a37589cd52c4e6df861c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9b13025570c9eab19e345d387668364430e3385b24fec4fd7394e8579940c3bd4ca2fc858447ed68a11924c9c2c654befd4448a9c3becf348d8d60647cc1099
|
7
|
+
data.tar.gz: 51e597afa2bb90da566cbb06a27d6c937c16e4e557d44c4e529be99a3c4f13961c15b9c0641eff06d2c8602d479b61cd738e4dff0733a37761b54f4d2a3436eb
|
@@ -0,0 +1,69 @@
|
|
1
|
+
ActiveAdmin.register C80Catoffers::Csample, as: 'Csample' do
|
2
|
+
|
3
|
+
config.per_page = 100
|
4
|
+
|
5
|
+
menu :label => 'Рассчёт стоимости', # TODO_MY:: название пункта меню перенесести в параметры в базу
|
6
|
+
priority: 4,
|
7
|
+
parent: 'Услуги' # TODO_MY:: название пункта меню перенесести в параметры в базу
|
8
|
+
|
9
|
+
permit_params :title,
|
10
|
+
:sub_title,
|
11
|
+
:csphoto,
|
12
|
+
:ord,
|
13
|
+
:crows_attributes => [:id, :_destroy, :offer_id, :ord]
|
14
|
+
|
15
|
+
batch_action :destroy, false
|
16
|
+
|
17
|
+
config.sort_order = 'ord_asc'
|
18
|
+
|
19
|
+
# before_filter :skip_sidebar!, :only => :index
|
20
|
+
|
21
|
+
index do
|
22
|
+
selectable_column
|
23
|
+
column :ord
|
24
|
+
column :title
|
25
|
+
column :sub_title
|
26
|
+
column :csphoto do |csample|
|
27
|
+
if csample.csphoto.present?
|
28
|
+
link_to image_tag(csample.csphoto.thumb_md, style: 'width:150px;'), csample.csphoto.url, target: '_blank'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
column :crows do |csample|
|
32
|
+
s = csample.crows.def_order
|
33
|
+
.map{ |crow| "<li>#{crow.offer.title} (#{crow.offer.price})</li>"}
|
34
|
+
.join('')
|
35
|
+
s += "<li>Итого: #{ csample.summ_price }</li>"
|
36
|
+
"<ul>#{s}</ul>".html_safe
|
37
|
+
end
|
38
|
+
actions
|
39
|
+
end
|
40
|
+
|
41
|
+
form(:html => {:multipart => true}) do |f|
|
42
|
+
|
43
|
+
f.inputs 'Свойства' do
|
44
|
+
|
45
|
+
f.input :title
|
46
|
+
f.input :sub_title
|
47
|
+
f.input :ord
|
48
|
+
|
49
|
+
f.input :csphoto,
|
50
|
+
:as => :file,
|
51
|
+
:hint => image_tag(f.object.csphoto.thumb_md)
|
52
|
+
|
53
|
+
f.inputs 'Услуги' do
|
54
|
+
f.has_many :crows, allow_destroy: true do |crow|
|
55
|
+
crow.input :ord
|
56
|
+
crow.input :offer,
|
57
|
+
:as => :select,
|
58
|
+
:input_html => {:multiple => false},
|
59
|
+
:collection => C80Catoffers::Offer.all.map { |o| ["#{o.title} (#{o.price})", o.id]}
|
60
|
+
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
f.actions
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
ActiveAdmin.register C80Catoffers::Csprop, as: 'Csprop' do
|
2
|
+
|
3
|
+
config.per_page = 100
|
4
|
+
|
5
|
+
menu :label => 'Настройки рассчёта стоимости', # TODO_MY:: название пункта меню перенесести в параметры в базу
|
6
|
+
priority: 5,
|
7
|
+
parent: 'Услуги' # TODO_MY:: название пункта меню перенесести в параметры в базу
|
8
|
+
|
9
|
+
permit_params :csample_ids => []
|
10
|
+
|
11
|
+
batch_action :destroy, false
|
12
|
+
|
13
|
+
config.sort_order = 'id_asc'
|
14
|
+
|
15
|
+
before_filter :skip_sidebar!, :only => :index
|
16
|
+
|
17
|
+
index do
|
18
|
+
# selectable_column
|
19
|
+
column 'Список который выводится в виджете' do |csprop|
|
20
|
+
res = ''
|
21
|
+
csprop.csamples.map do |csample|
|
22
|
+
res += "<li>#{csample.title}</li>"
|
23
|
+
end
|
24
|
+
"<ul>#{res}</ul>".html_safe
|
25
|
+
end
|
26
|
+
actions
|
27
|
+
end
|
28
|
+
|
29
|
+
form(:html => {:multipart => true}) do |f|
|
30
|
+
|
31
|
+
f.inputs 'Список который выводится в виджете' do
|
32
|
+
|
33
|
+
f.input :csamples,
|
34
|
+
:as => :check_boxes
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
f.actions
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -1,53 +1,58 @@
|
|
1
1
|
$(document).ready(function() {
|
2
2
|
|
3
3
|
var $c = $('.offer_full_desc');
|
4
|
-
var $w = $c.find("div.big_gallery_wrapper");
|
5
|
-
var $nav = $c.find('div.nav_gallery_wrapper');
|
6
|
-
|
7
|
-
$w.magnificPopup({
|
8
|
-
delegate: 'a',
|
9
|
-
fixedContentPos: false,
|
10
|
-
removalDelay: 300,
|
11
|
-
mainClass: 'mfp-fade',
|
12
|
-
type: 'image',
|
13
|
-
gallery: {enabled:true}
|
14
|
-
});
|
15
|
-
|
16
|
-
$w.slick({
|
17
|
-
slidesToShow: 1,
|
18
|
-
slidesToScroll: 1,
|
19
|
-
autoplay: false,
|
20
|
-
fade:true,
|
21
|
-
arrows:true,
|
22
|
-
speed: 200,
|
23
|
-
dots:false,
|
24
|
-
infinite: true,
|
25
|
-
asNavFor: '#offer_gallery'// TODO:: это негибкий хардкод, а что если на странице будет несколько галерей такого типа?
|
26
|
-
});
|
27
|
-
|
28
|
-
$nav.slick({
|
29
|
-
slidesToShow: 3,
|
30
|
-
slidesToScroll: 1,
|
31
|
-
asNavFor: '#offer_gallery', // TODO:: это негибкий хардкод, а что если на странице будет несколько галерей такого типа?
|
32
|
-
dots: false,
|
33
|
-
speed: 200,
|
34
|
-
//centerMode: true,
|
35
|
-
arrows:false,
|
36
|
-
focusOnSelect: true
|
37
|
-
});
|
38
|
-
|
39
|
-
/*setTimeout(function() {
|
40
|
-
var $b = $("#gallery3_nav").find(".img-holder");
|
41
|
-
//console.log($b);
|
42
|
-
$b.bind({
|
43
|
-
mouseenter: function() {
|
44
|
-
$(this).addClass("plusOpacity");
|
45
|
-
},
|
46
|
-
mouseleave: function() {
|
47
|
-
$(this).removeClass("plusOpacity");
|
48
|
-
}
|
49
|
-
})
|
50
|
-
},100);*/
|
51
4
|
|
5
|
+
if ($c.length) {
|
6
|
+
var $w = $c.find("div.big_gallery_wrapper");
|
7
|
+
var $nav = $c.find('div.nav_gallery_wrapper');
|
8
|
+
|
9
|
+
//noinspection JSUnresolvedFunction
|
10
|
+
$w.magnificPopup({
|
11
|
+
delegate: 'a',
|
12
|
+
fixedContentPos: false,
|
13
|
+
removalDelay: 300,
|
14
|
+
mainClass: 'mfp-fade',
|
15
|
+
type: 'image',
|
16
|
+
gallery: {enabled:true}
|
17
|
+
});
|
18
|
+
|
19
|
+
$w.slick({
|
20
|
+
slidesToShow: 1,
|
21
|
+
slidesToScroll: 1,
|
22
|
+
autoplay: false,
|
23
|
+
fade:true,
|
24
|
+
arrows:true,
|
25
|
+
speed: 200,
|
26
|
+
dots:false,
|
27
|
+
infinite: true,
|
28
|
+
asNavFor: '#offer_gallery'// TODO:: это негибкий хардкод, а что если на странице будет несколько галерей такого типа?
|
29
|
+
});
|
30
|
+
|
31
|
+
$nav.slick({
|
32
|
+
slidesToShow: 3,
|
33
|
+
slidesToScroll: 1,
|
34
|
+
asNavFor: '#offer_gallery', // TODO:: это негибкий хардкод, а что если на странице будет несколько галерей такого типа?
|
35
|
+
dots: false,
|
36
|
+
speed: 200,
|
37
|
+
//centerMode: true,
|
38
|
+
arrows:false,
|
39
|
+
focusOnSelect: true
|
40
|
+
});
|
41
|
+
|
42
|
+
/*setTimeout(function() {
|
43
|
+
var $b = $("#gallery3_nav").find(".img-holder");
|
44
|
+
//console.log($b);
|
45
|
+
$b.bind({
|
46
|
+
mouseenter: function() {
|
47
|
+
$(this).addClass("plusOpacity");
|
48
|
+
},
|
49
|
+
mouseleave: function() {
|
50
|
+
$(this).removeClass("plusOpacity");
|
51
|
+
}
|
52
|
+
})
|
53
|
+
},100);*/
|
54
|
+
|
55
|
+
|
56
|
+
}
|
52
57
|
|
53
58
|
});
|
@@ -0,0 +1,89 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
// Код, реализующий ajax функционал на странице "Наши Услуги"
|
4
|
+
|
5
|
+
var fOffersBindHistoryAdapter;
|
6
|
+
var fOffersdoAjaxRequest;
|
7
|
+
var fOffersProccessPaginateLinks;
|
8
|
+
var fOffersStartWillPaginateAjax;
|
9
|
+
|
10
|
+
var fOffersGetBlock;
|
11
|
+
var fOffersGetWillPaginateLinks;
|
12
|
+
|
13
|
+
$(function () {
|
14
|
+
|
15
|
+
//console.log('<offers_ajax>');
|
16
|
+
|
17
|
+
// соберём в одном месте обращения к узлам DOM, с которыми будем работать
|
18
|
+
fOffersGetBlock = function () {
|
19
|
+
return $('.ajax_div_offers');
|
20
|
+
};
|
21
|
+
|
22
|
+
fOffersGetWillPaginateLinks = function () {
|
23
|
+
return fOffersGetBlock().find(".div_will_paginate a");
|
24
|
+
};
|
25
|
+
|
26
|
+
// надо ли вообще что либо делать?
|
27
|
+
if (fOffersGetBlock().length) {
|
28
|
+
|
29
|
+
fOffersBindHistoryAdapter = function () {
|
30
|
+
//noinspection JSUnresolvedVariable
|
31
|
+
History.Adapter.bind(window,'statechange',function(){ // Note: We are using statechange instead of popstate
|
32
|
+
|
33
|
+
// Log the State
|
34
|
+
//noinspection JSUnresolvedFunction
|
35
|
+
var State = History.getState(); // Note: We are using History.getState() instead of event.state
|
36
|
+
var p;
|
37
|
+
|
38
|
+
//History.log('statechange:', State.data, State.title, State.url);
|
39
|
+
if (State.title == "") {
|
40
|
+
p = 1;
|
41
|
+
} else {
|
42
|
+
p = State.data.page;
|
43
|
+
}
|
44
|
+
|
45
|
+
fOffersdoAjaxRequest(p);
|
46
|
+
});
|
47
|
+
};
|
48
|
+
|
49
|
+
fOffersdoAjaxRequest = function (page/*integer*/,callback/*function*/) {
|
50
|
+
|
51
|
+
var $ajax_div = fOffersGetBlock(); // к этому контейнеру изначально прикреплены кое-какие данные
|
52
|
+
|
53
|
+
$.ajax({
|
54
|
+
url: "/offers_guru",
|
55
|
+
type: "POST",
|
56
|
+
data: {
|
57
|
+
page: page,
|
58
|
+
css_class_offers_block: $ajax_div.data('css_class_offers_block') // уйдёт на render_offers_page
|
59
|
+
},
|
60
|
+
dataType: "script"
|
61
|
+
}).done(callback);
|
62
|
+
};
|
63
|
+
|
64
|
+
fOffersProccessPaginateLinks = function () {
|
65
|
+
//console.log("fOffersProccessPaginateLinks");
|
66
|
+
fOffersGetWillPaginateLinks().click(function (e) {
|
67
|
+
e.preventDefault();
|
68
|
+
var page = $(this).attr('href').split("?page=")[1];
|
69
|
+
//noinspection JSUnresolvedFunction
|
70
|
+
History.pushState({page:page},window.document.title,"?page="+page);
|
71
|
+
});
|
72
|
+
};
|
73
|
+
|
74
|
+
fOffersStartWillPaginateAjax = function () {
|
75
|
+
if (fOffersGetWillPaginateLinks().length > 0) {
|
76
|
+
fOffersProccessPaginateLinks();
|
77
|
+
fOffersBindHistoryAdapter();
|
78
|
+
}
|
79
|
+
};
|
80
|
+
|
81
|
+
var _fInit = function () {
|
82
|
+
fOffersStartWillPaginateAjax();
|
83
|
+
};
|
84
|
+
|
85
|
+
_fInit();
|
86
|
+
|
87
|
+
}
|
88
|
+
|
89
|
+
});
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
div.left {
|
6
6
|
float: left;
|
7
|
-
|
7
|
+
width: 621px;
|
8
8
|
|
9
9
|
/* скроем навигационную галерею, если в ней один элемент */
|
10
10
|
div.bottom {
|
@@ -18,7 +18,8 @@
|
|
18
18
|
|
19
19
|
div.right {
|
20
20
|
float: left;
|
21
|
-
|
21
|
+
width: calc(100% - 621px);
|
22
|
+
padding-left: 40px;
|
22
23
|
}
|
23
24
|
|
24
25
|
}
|
@@ -1,3 +1,26 @@
|
|
1
1
|
div.offer_list_grouped {
|
2
2
|
|
3
|
+
ul {
|
4
|
+
padding: 0;
|
5
|
+
margin: 0;
|
6
|
+
list-style: none;
|
7
|
+
|
8
|
+
li {
|
9
|
+
padding-right: 20px;
|
10
|
+
padding-top: 3px;
|
11
|
+
padding-bottom: 3px;
|
12
|
+
|
13
|
+
&.odd {}
|
14
|
+
&.even { background-color: rgba(0,0,0,0.03); }
|
15
|
+
|
16
|
+
&:hover { background-color: rgba(0,0,0,0.08); }
|
17
|
+
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
div.offer_price {
|
22
|
+
float: right;
|
23
|
+
display: inline-block;
|
24
|
+
}
|
25
|
+
|
3
26
|
}
|
@@ -1,28 +1,32 @@
|
|
1
|
-
|
1
|
+
.offer_list_widget_wrapper {
|
2
|
+
clear: both;
|
2
3
|
|
3
|
-
|
4
|
+
div.offer_list_widget {
|
4
5
|
|
5
|
-
|
6
|
-
padding:0;
|
7
|
-
list-style: none;
|
6
|
+
ul {
|
8
7
|
|
9
|
-
|
8
|
+
margin: 0;
|
9
|
+
padding: 0;
|
10
|
+
list-style: none;
|
10
11
|
|
11
|
-
|
12
|
-
display: inline-block;
|
13
|
-
margin-right: 15px;
|
12
|
+
> li {
|
14
13
|
|
15
|
-
> * {
|
16
14
|
float: left;
|
17
|
-
|
18
|
-
|
15
|
+
display: inline-block;
|
16
|
+
margin-right: 15px;
|
17
|
+
|
18
|
+
> * {
|
19
|
+
float: left;
|
20
|
+
clear: both;
|
21
|
+
}
|
22
|
+
|
23
|
+
a.lazy-image-wrapper {
|
24
|
+
background-color: #F8F8F8 !important;
|
25
|
+
}
|
19
26
|
|
20
|
-
a.lazy-image-wrapper {
|
21
|
-
background-color: #F8F8F8 !important;
|
22
27
|
}
|
23
28
|
|
24
29
|
}
|
25
30
|
|
26
31
|
}
|
27
|
-
|
28
32
|
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
div.ajax_div_offers {
|
2
|
+
|
3
|
+
div.div_will_paginate {
|
4
|
+
width: 100%;
|
5
|
+
clear: both;
|
6
|
+
float: left;
|
7
|
+
padding: 0 46px;
|
8
|
+
|
9
|
+
.pagination {
|
10
|
+
margin: 0;
|
11
|
+
|
12
|
+
span {
|
13
|
+
&.previous_page {
|
14
|
+
display: none;
|
15
|
+
}
|
16
|
+
&.next_page {
|
17
|
+
display: none;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
em {
|
22
|
+
|
23
|
+
display: inline-block;
|
24
|
+
line-height: 29px;
|
25
|
+
width: 30px;
|
26
|
+
height: 30px;
|
27
|
+
|
28
|
+
text-align: center;
|
29
|
+
font-weight: bold !important;
|
30
|
+
font-style: normal !important;
|
31
|
+
|
32
|
+
border: 1px solid #B6B6B6;
|
33
|
+
background-color: #E9353B;
|
34
|
+
color:#ffffff;
|
35
|
+
|
36
|
+
}
|
37
|
+
|
38
|
+
a {
|
39
|
+
display: inline-block;
|
40
|
+
line-height: 29px;
|
41
|
+
width: 30px;
|
42
|
+
height: 30px;
|
43
|
+
|
44
|
+
border: 1px solid #B6B6B6;
|
45
|
+
background-color: #ffffff;
|
46
|
+
color:#777777;
|
47
|
+
text-align: center;
|
48
|
+
font-weight: bold !important;
|
49
|
+
|
50
|
+
text-decoration: none;
|
51
|
+
&:hover, &:active, &:focus { text-decoration: none !important; color: black; }
|
52
|
+
|
53
|
+
&.previous_page {
|
54
|
+
display: none;
|
55
|
+
}
|
56
|
+
&.next_page {
|
57
|
+
display: none;
|
58
|
+
}
|
59
|
+
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
}
|
64
|
+
|
65
|
+
}
|