c80_yax 0.1.0.11 → 0.1.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/app/assets/stylesheets/c80_yax.scss +2 -1
- data/app/models/c80_yax/item.rb +6 -0
- data/engines/of/README.md +27 -0
- data/engines/of/app/admin/ti/offers.rb +67 -0
- data/engines/of/app/assets/javascripts/ti/facts_ajax.js +76 -0
- data/engines/of/app/assets/javascripts/ti.coffee +1 -0
- data/engines/of/app/assets/stylesheets/of/offer_show.scss +20 -0
- data/engines/of/app/assets/stylesheets/of/offers_list.scss +27 -0
- data/engines/of/app/assets/stylesheets/of.scss +5 -0
- data/engines/of/app/controllers/ti/application_controller.rb +14 -0
- data/engines/of/app/decorators/of/offer_decorator.rb +24 -0
- data/engines/of/app/helpers/of/offer_show_helper.rb +14 -0
- data/engines/of/app/helpers/of/offers_list_helper.rb +33 -0
- data/engines/of/app/models/of/offer.rb +27 -0
- data/engines/of/app/models/of/offer_validator.rb +11 -0
- data/engines/of/app/models/of/ophoto.rb +6 -0
- data/engines/of/app/uploaders/of/ophoto_uploader.rb +76 -0
- data/engines/of/app/views/of/_offer.html.erb +16 -0
- data/engines/of/app/views/of/_offers_list.html.erb +13 -0
- data/engines/of/app/views/of/_offers_list_flat.html.erb +7 -0
- data/engines/of/bin/console +14 -0
- data/engines/of/bin/setup +7 -0
- data/engines/of/config/locales/ru.yml +3 -0
- data/engines/of/config/routes.rb +2 -0
- data/engines/of/db/migrate/20170716095757_create_of_offers.rb +10 -0
- data/engines/of/db/migrate/20170716095858_create_of_ophotos.rb +11 -0
- data/engines/of/db/migrate/20170716100707_create_of_join_table_items_offers.rb +12 -0
- data/engines/of/db/seeds/ti_02_fill_test_data.rb +23 -0
- data/engines/of/lib/of/engine.rb +23 -0
- data/engines/of/lib/of/version.rb +3 -0
- data/engines/of/lib/of.rb +5 -0
- data/engines/ti/app/helpers/ti/tech_info_list_helper.rb +77 -0
- data/engines/ti/app/uploaders/ti/dphoto_uploader.rb +1 -1
- data/lib/c80_yax/version.rb +1 -1
- data/lib/c80_yax.rb +1 -0
- metadata +32 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67543c9ac41ce9a2907541c4162f79cccb324ad1
|
4
|
+
data.tar.gz: 28131f3a14f46add35bb7e09329f34ad6d21148c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 129853498c49498cb181a8a75f4aa6905107f97f198fe08614298dc3b07eaee3412f53f41829dd91b6913609ca1c863ff0dc6d2e39dbaa630df8260ca2e8db51
|
7
|
+
data.tar.gz: 01d8142872d507ed3cd25c3dd4e589ff75d0e7e8ac8f0f9408effe74b30eb7d3ef48b687968a9d883bbb5d3842e2dfce3992289c2f2de375305ae78350cbc080
|
data/Gemfile
CHANGED
data/app/models/c80_yax/item.rb
CHANGED
@@ -43,6 +43,12 @@ class C80Yax::Item < ActiveRecord::Base
|
|
43
43
|
foreign_key: 'item_id',
|
44
44
|
association_foreign_key: 'similar_item_id'
|
45
45
|
|
46
|
+
has_and_belongs_to_many :offers,
|
47
|
+
class_name: 'Of::Offer',
|
48
|
+
foreign_key: 'offer_id',
|
49
|
+
join_table: 'of_items_offers',
|
50
|
+
association_foreign_key: 'item_id'
|
51
|
+
|
46
52
|
extend FriendlyId
|
47
53
|
friendly_id :slug_candidates, :use => :slugged
|
48
54
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Функционал раздела «Акции»
|
2
|
+
|
3
|
+
> Функционал раздела «Акции» базируется на системе каталога продукции.
|
4
|
+
> Каждый товар, находящийся в каталоге сайта, может стать «акционным товаром», для этого необходимо из панели управления сайтом задать характеристику «старая цена». После чего товар автоматически становится акционным, а в интерфейсе сайта он помечается специальным элементом «%».
|
5
|
+
> Если товар с проставленной старой ценой не принадлежит никакой из акций, то он отображается в разделе «Акции» в блоке «Все товары со скидкой»
|
6
|
+
>
|
7
|
+
> В разделе акции из панели управления сайтом можно создавать/редактировать/удалять акции. У каждой акции есть следующие характеристики:
|
8
|
+
> - название (обязательно для заполнения)
|
9
|
+
> - изображение (обязательно для заполнения)
|
10
|
+
> - описание (необязательно)
|
11
|
+
> - набор акционных товаров (обязательно для заполнения. У акции должно быть не менее одного товара)
|
12
|
+
>
|
13
|
+
> На странице «Акции» все акции отображаются списком, каждая из них сопровождается баннером на всю ширину рабочего поля сайта. Кликнув на баннер, пользователь попадает на страницу акции, на которой отображается выдача из соответствующих данной акции акционных товаров
|
14
|
+
> Каждая акция имеет заранее предопределенное свойство "id".
|
15
|
+
|
16
|
+
|
17
|
+
# TODO
|
18
|
+
|
19
|
+
* [ ] Добавляем новую модель "Акции" - Offers.
|
20
|
+
* [X] Снабжаем загрузчиком баннера акции
|
21
|
+
* [X] Лабаем метод рисующий список акции {кликабельный баннер, название}
|
22
|
+
* [X] Лабаем метод, рисующий страницу просмотра акции
|
23
|
+
* [ ] Лабаем метод, который достраивает выпадающее меню
|
24
|
+
пункта "акции" (как "каталог")
|
25
|
+
|
26
|
+
* [ ] Лабаем метод, выдающий список акционных товаров:
|
27
|
+
т.е. тех товаров, у которых имеется старая цена, больше 0.
|
@@ -0,0 +1,67 @@
|
|
1
|
+
ActiveAdmin.register Of::Offer, :as => 'Offer' do
|
2
|
+
|
3
|
+
before_filter :skip_sidebar!, :only => :index
|
4
|
+
|
5
|
+
menu :label => 'Акции',
|
6
|
+
:parent => 'x_c80_yax',
|
7
|
+
:priority => 10
|
8
|
+
|
9
|
+
permit_params :title,
|
10
|
+
:desc,
|
11
|
+
:item_ids => [],
|
12
|
+
:ophotos_attributes => [:id,:image,:_destroy]
|
13
|
+
|
14
|
+
index do
|
15
|
+
selectable_column
|
16
|
+
id_column
|
17
|
+
column :title
|
18
|
+
column '' do |offer|
|
19
|
+
if offer.ophotos.count > 0
|
20
|
+
image_tag(offer.ophotos.first.image.thumb_sm)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
column :desc do |offer|
|
25
|
+
res = '-'
|
26
|
+
if offer.desc.present?
|
27
|
+
res = "#{offer.desc[0..30]}..."
|
28
|
+
end
|
29
|
+
res
|
30
|
+
end
|
31
|
+
|
32
|
+
actions
|
33
|
+
end
|
34
|
+
|
35
|
+
form(:html => {:multipart => true}) do |f|
|
36
|
+
f.inputs 'Свойства' do
|
37
|
+
f.input :title
|
38
|
+
|
39
|
+
f.input :items,
|
40
|
+
:as => :select,
|
41
|
+
:input_html => {
|
42
|
+
:title => '',
|
43
|
+
:class => 'selectpicker',
|
44
|
+
:data => {
|
45
|
+
:size => 10,
|
46
|
+
:width => '700px'
|
47
|
+
},
|
48
|
+
:multiple => true
|
49
|
+
},
|
50
|
+
:include_blank => true
|
51
|
+
|
52
|
+
f.inputs 'Фото' do
|
53
|
+
f.has_many :ophotos, :allow_destroy => true do |ophoto|
|
54
|
+
ophoto.input :image,
|
55
|
+
:as => :file,
|
56
|
+
:hint => image_tag(ophoto.object.image.thumb_sm)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
f.input :desc, :as => :ckeditor,
|
61
|
+
:input_html => {:style => 'height:500px', rows: 20}
|
62
|
+
|
63
|
+
end
|
64
|
+
f.actions
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
// Код, реализующий ajax функционал на странице "новости"
|
4
|
+
|
5
|
+
var fNewsBindHistoryAdapter;
|
6
|
+
var fNewsdoAjaxRequest;
|
7
|
+
var fNewsProccessPaginateLinks;
|
8
|
+
var fNewsStartWillPaginateAjax;
|
9
|
+
var fNewsProcessBlocks; // при клике по preview-картинке новости будет происходить переход на просмотр новости
|
10
|
+
|
11
|
+
$(function () {
|
12
|
+
if ($('.news_block[data-is_render_paginator="true"]').length) {
|
13
|
+
|
14
|
+
fNewsBindHistoryAdapter = function () {
|
15
|
+
History.Adapter.bind(window,'statechange',function(){ // Note: We are using statechange instead of popstate
|
16
|
+
|
17
|
+
// Log the State
|
18
|
+
var State = History.getState(); // Note: We are using History.getState() instead of event.state
|
19
|
+
var p;
|
20
|
+
|
21
|
+
//History.log('statechange:', State.data, State.title, State.url);
|
22
|
+
if (State.title == "") {
|
23
|
+
p = 1;
|
24
|
+
} else {
|
25
|
+
p = State.data.page;
|
26
|
+
}
|
27
|
+
|
28
|
+
fNewsdoAjaxRequest(p);
|
29
|
+
});
|
30
|
+
};
|
31
|
+
|
32
|
+
fNewsdoAjaxRequest = function (page/*integer*/,callback/*function*/) {
|
33
|
+
|
34
|
+
var $ajax_div = $('.ajax_div'); // к этому контейнеру изначально прикреплены кое-какие данные
|
35
|
+
|
36
|
+
$.ajax({
|
37
|
+
url: "/news_guru",
|
38
|
+
type: "POST",
|
39
|
+
data: {
|
40
|
+
page: page,
|
41
|
+
is_render_paginator: $ajax_div.data('is_render_paginator'), // эти переменные
|
42
|
+
partial_name: $ajax_div.data('partial_name'), // уходят транзитом
|
43
|
+
css_class_news_block: $ajax_div.data('css_class_news_block') // на render_news_block
|
44
|
+
},
|
45
|
+
dataType: "script"
|
46
|
+
}).done(callback);
|
47
|
+
};
|
48
|
+
|
49
|
+
fNewsProccessPaginateLinks = function () {
|
50
|
+
//console.log("fNewsProccessPaginateLinks");
|
51
|
+
$(".news_block .div_will_paginate a").click(function (e) {
|
52
|
+
e.preventDefault();
|
53
|
+
var page = $(this).attr('href').split("?page=")[1];
|
54
|
+
History.pushState({page:page},window.document.title,"?page="+page);
|
55
|
+
});
|
56
|
+
};
|
57
|
+
|
58
|
+
fNewsStartWillPaginateAjax = function () {
|
59
|
+
if ($(".news_block .div_will_paginate a").length > 0) {
|
60
|
+
fNewsProccessPaginateLinks();
|
61
|
+
fNewsBindHistoryAdapter();
|
62
|
+
}
|
63
|
+
};
|
64
|
+
|
65
|
+
fNewsProcessBlocks = function() {
|
66
|
+
$(".fact img").click(function (e) {
|
67
|
+
// NB:: parent().parent() хардкод: картинка лежит в ссылке, ссылка лежит в диве
|
68
|
+
window.location.href = $(this).parent().parent().data('url');
|
69
|
+
});
|
70
|
+
};
|
71
|
+
|
72
|
+
fNewsStartWillPaginateAjax();
|
73
|
+
fNewsProcessBlocks();
|
74
|
+
|
75
|
+
}
|
76
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
#= require_tree ./ti
|
@@ -0,0 +1,27 @@
|
|
1
|
+
ul.offers_list {
|
2
|
+
list-style: none;
|
3
|
+
margin: 0;
|
4
|
+
padding: 0;
|
5
|
+
|
6
|
+
> li {
|
7
|
+
margin-bottom: 20px;
|
8
|
+
|
9
|
+
a.lazy-image-wrapper {
|
10
|
+
display: inline-block;
|
11
|
+
width: 1250px;
|
12
|
+
height: 260px;
|
13
|
+
overflow: hidden;
|
14
|
+
|
15
|
+
}
|
16
|
+
|
17
|
+
h5 {
|
18
|
+
a {
|
19
|
+
color: #676666;
|
20
|
+
text-decoration: none;
|
21
|
+
tex-transform: uppercase;
|
22
|
+
text-transform: uppercase;
|
23
|
+
font-size: 20px;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Of
|
2
|
+
class OfferDecorator < ::ApplicationDecorator
|
3
|
+
decorates 'Of::Offer'
|
4
|
+
delegate_all
|
5
|
+
|
6
|
+
def items_list(thumb_size = 'thumb_md', page=1, per_page = 16)
|
7
|
+
its = model.items
|
8
|
+
.includes(item_props: {prop_name: [:uom, :related]})
|
9
|
+
.includes(:iphotos)
|
10
|
+
.includes(:strsubcat)
|
11
|
+
.paginate(page: page, per_page: per_page)
|
12
|
+
items = C80Yax::ItemDecorator.decorate_collection(its)
|
13
|
+
|
14
|
+
h.render partial: 'c80_yax/items/index',
|
15
|
+
locals: {
|
16
|
+
items: items,
|
17
|
+
without_paginator: false,
|
18
|
+
will_paginate_items: its,
|
19
|
+
thumb_size: thumb_size
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Of
|
2
|
+
module OffersListHelper
|
3
|
+
|
4
|
+
# Выдать html unordered list Акций
|
5
|
+
#
|
6
|
+
def render_ul_offers_list(&make_offer_url)
|
7
|
+
|
8
|
+
p_make_offer_url = Proc.new &make_offer_url
|
9
|
+
offers = Offer.all
|
10
|
+
|
11
|
+
render :partial => 'of/offers_list',
|
12
|
+
:locals => {
|
13
|
+
offers: offers,
|
14
|
+
p_make_offer_url: p_make_offer_url
|
15
|
+
}
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
def render_ul_offers_list_flat(&make_offer_url)
|
20
|
+
|
21
|
+
p_make_offer_url = Proc.new &make_offer_url
|
22
|
+
offers = Offer.all
|
23
|
+
|
24
|
+
render :partial => 'of/offers_list_flat',
|
25
|
+
:locals => {
|
26
|
+
offers: offers,
|
27
|
+
p_make_offer_url: p_make_offer_url
|
28
|
+
}
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Of
|
2
|
+
class Offer < ActiveRecord::Base
|
3
|
+
has_many :ophotos, :dependent => :destroy
|
4
|
+
accepts_nested_attributes_for :ophotos,
|
5
|
+
:reject_if => lambda { |attributes|
|
6
|
+
!attributes.present?
|
7
|
+
},
|
8
|
+
:allow_destroy => true
|
9
|
+
has_and_belongs_to_many :items,
|
10
|
+
class_name: 'C80Yax::Item',
|
11
|
+
foreign_key: 'item_id',
|
12
|
+
join_table: 'of_items_offers',
|
13
|
+
association_foreign_key: 'offer_id'
|
14
|
+
|
15
|
+
# validates_with DocValidator
|
16
|
+
default_scope {order(:created_at => :desc)}
|
17
|
+
|
18
|
+
def cover_url(thumb_size='thumb_md')
|
19
|
+
res = ''
|
20
|
+
unless ophotos.size.zero?
|
21
|
+
res = ophotos.first.image.send(thumb_size).url
|
22
|
+
end
|
23
|
+
res
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
module Of
|
2
|
+
class OphotoUploader < BaseFileUploader
|
3
|
+
|
4
|
+
# ограничение оригинальной картинки
|
5
|
+
process :resize_to_limit => [1600,1600]
|
6
|
+
|
7
|
+
def store_dir
|
8
|
+
"uploads/offers/#{format('%02d', model.offer_id)}"
|
9
|
+
end
|
10
|
+
|
11
|
+
version :thumb_lg do
|
12
|
+
process :resize_to_lg
|
13
|
+
end
|
14
|
+
|
15
|
+
version :thumb_md do
|
16
|
+
process :resize_to_md
|
17
|
+
end
|
18
|
+
|
19
|
+
version :thumb_sm do
|
20
|
+
process :resize_to_sm
|
21
|
+
end
|
22
|
+
|
23
|
+
# ------------------------------------------------------------------------------------------------------------------------
|
24
|
+
|
25
|
+
def resize_to_lg
|
26
|
+
# byebug
|
27
|
+
|
28
|
+
w = 1250
|
29
|
+
h = 260
|
30
|
+
|
31
|
+
manipulate! do |img|
|
32
|
+
img.resize "#{w}x#{h}^"
|
33
|
+
img.gravity 'center'
|
34
|
+
img.extent "#{w}x#{h}"
|
35
|
+
img = yield(img) if block_given?
|
36
|
+
img
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
def resize_to_md
|
42
|
+
|
43
|
+
manipulate! do |img|
|
44
|
+
|
45
|
+
w = 600
|
46
|
+
h = 130
|
47
|
+
|
48
|
+
img.resize "#{w}x#{h}^"
|
49
|
+
img.gravity 'center'
|
50
|
+
img.extent "#{w}x#{h}"
|
51
|
+
img = yield(img) if block_given?
|
52
|
+
img
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
def resize_to_sm
|
59
|
+
|
60
|
+
manipulate! do |img|
|
61
|
+
|
62
|
+
w = 300
|
63
|
+
h = 60
|
64
|
+
|
65
|
+
img.resize "#{w}x#{h}^"
|
66
|
+
img.gravity 'center'
|
67
|
+
img.extent "#{w}x#{h}"
|
68
|
+
img = yield(img) if block_given?
|
69
|
+
img
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<div class="offer_show offer_<%= offer.id %>">
|
2
|
+
<div class="fst">
|
3
|
+
<%= render_image_link_lazy({
|
4
|
+
:alt_image => offer.title,
|
5
|
+
:image => offer.cover_url('thumb_lg'),
|
6
|
+
:a_href => '#',
|
7
|
+
:a_rel => 'nofollow'
|
8
|
+
}) %>
|
9
|
+
</div>
|
10
|
+
<div class="second">
|
11
|
+
<%= offer.items_list %>
|
12
|
+
</div>
|
13
|
+
<div class="third">
|
14
|
+
<%= offer.desc.html_safe if offer.desc.present? %>
|
15
|
+
</div>
|
16
|
+
</div>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<ul class="offers_list">
|
2
|
+
<% offers.each do |offer| %>
|
3
|
+
<li class="o_<%=offer.id%>">
|
4
|
+
<h5><%= link_to offer.title, p_make_offer_url.call(offer), title: offer.title %> </h5>
|
5
|
+
<%= render_image_link_lazy({
|
6
|
+
:alt_image => offer.title,
|
7
|
+
:image => offer.cover_url('thumb_lg'),
|
8
|
+
:a_href => p_make_offer_url.call(offer),
|
9
|
+
:a_rel => 'nofollow'
|
10
|
+
})%>
|
11
|
+
</li>
|
12
|
+
<% end %>
|
13
|
+
</ul>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "c80_news"
|
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
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateOfJoinTableItemsOffers < ActiveRecord::Migration[5.0]
|
2
|
+
def change
|
3
|
+
create_table :of_items_offers, :id => false do |t|
|
4
|
+
t.integer :item_id, :null => false
|
5
|
+
t.integer :offer_id, :null => false
|
6
|
+
end
|
7
|
+
|
8
|
+
add_index :of_items_offers, [:item_id, :offer_id], :unique => true, :name => 'of_index1'
|
9
|
+
add_index :of_items_offers, [:offer_id, :item_id], :unique => true, :name => 'of_index2'
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# rake db:seed:ti_02_fill_test_data
|
2
|
+
|
3
|
+
Ti::Category.delete_all
|
4
|
+
Ti::Category.create!([
|
5
|
+
{ ord: 10, id: 1, title: 'Монтажные инструкции' }
|
6
|
+
])
|
7
|
+
|
8
|
+
Ti::Category.create!([
|
9
|
+
{ ord: 100, title: 'Водосточные системы', parent_category_id: 1},
|
10
|
+
{ ord: 110, title: 'Снегозадержатели', parent_category_id: 1},
|
11
|
+
{ ord: 120, title: 'Лестницы', parent_category_id: 1},
|
12
|
+
{ ord: 130, title: 'Кровельные мостики и ограждения', parent_category_id: 1},
|
13
|
+
{ ord: 140, title: 'Продукция из меди', parent_category_id: 1}
|
14
|
+
])
|
15
|
+
|
16
|
+
Ti::Doc.delete_all
|
17
|
+
Ti::Doc.create!([
|
18
|
+
{ title: 'Монтаж круглой водосточной системы P87', category_ids: [100] },
|
19
|
+
{ title: 'Монтаж круглого водосточного желоба P13', category_ids: [100] },
|
20
|
+
{ title: 'Монтаж прямоугольной водосточной системы K12', category_ids: [100] },
|
21
|
+
{ title: 'Установка водосточной трубы P10 и K9x9', category_ids: [100] },
|
22
|
+
{ title: 'Установка внутреннего кронштейна прямоугольной водосточной системы', category_ids: [100] }
|
23
|
+
])
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Of
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
isolate_namespace Of
|
4
|
+
|
5
|
+
initializer :of_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/models/concerns/**/"]
|
9
|
+
ActiveAdmin.application.load_paths += Dir["#{config.root}/app/admin/ti/**/"]
|
10
|
+
# ActiveAdmin.application.load_paths += Dir["#{config.root}/app/jobs/**/"]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
initializer :append_migrations do |app|
|
15
|
+
unless app.root.to_s.match root.to_s
|
16
|
+
config.paths['db/migrate'].expanded.each do |expanded_path|
|
17
|
+
app.config.paths['db/migrate'] << expanded_path
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module Ti
|
2
|
+
module TechInfoListHelper
|
3
|
+
|
4
|
+
# Выдать html unordered nested list Дилеров (включая Офисы),
|
5
|
+
# разложенный по Регионам, построенный
|
6
|
+
# на основе данных +rdo+ - Regions-Dealers-Offices.
|
7
|
+
# Список выводится слева от карты.
|
8
|
+
# (**) Не выводим регионы, у которых нет дилеров.
|
9
|
+
#
|
10
|
+
# Структура списка:
|
11
|
+
# * Регион
|
12
|
+
# * Дилер
|
13
|
+
# * Офис 1
|
14
|
+
# * адрес офиса
|
15
|
+
# * телефон офиса
|
16
|
+
# * Офис 2
|
17
|
+
# * адрес офиса
|
18
|
+
# * телефон офиса
|
19
|
+
# * сайт дилера
|
20
|
+
# * email дилера
|
21
|
+
#
|
22
|
+
def __render_ul_dealers_list(rdo)
|
23
|
+
|
24
|
+
res = ''
|
25
|
+
|
26
|
+
rdo.each do |region|
|
27
|
+
r = "<h2 class='region_title'>#{region.title}</h2>"
|
28
|
+
ds = ul_region_dealers(region)
|
29
|
+
next if ds.blank? # (**)
|
30
|
+
r += ds
|
31
|
+
res += "<li class='li_region' id='region_#{region.id}'>#{r}</li>"
|
32
|
+
end
|
33
|
+
|
34
|
+
"<ul class='ul_dealers_list'>#{res}</ul>".html_safe
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
# используется только в render_dealers_list
|
41
|
+
# (*) не выводим список дилеров, если он пуст
|
42
|
+
def ul_region_dealers(region)
|
43
|
+
res = ''
|
44
|
+
# noinspection RubyResolve
|
45
|
+
region.dealers.each do |dealer|
|
46
|
+
d = "<h3 class='dealer_title'>#{dealer.title}</h3>"
|
47
|
+
d += ul_dealer_offices(dealer)
|
48
|
+
res += "<li class='li_dealer' id='dealer_#{dealer.id}'>#{d}</li>"
|
49
|
+
end
|
50
|
+
return res if res.blank? # (*)
|
51
|
+
"<ul class='ul_region_dealers'>#{res}</ul>" #.html_safe
|
52
|
+
end
|
53
|
+
|
54
|
+
# используется только в ul_region_dealers
|
55
|
+
def ul_dealer_offices(dealer)
|
56
|
+
res = ''
|
57
|
+
# noinspection RubyResolve
|
58
|
+
dealer.offices.each_with_index do |office|
|
59
|
+
o = "<h4 class='office_title'>#{office.title}</h4>"
|
60
|
+
o += ul_office_props(office)
|
61
|
+
res += "<li class='li_office' id='office_#{office.id}' data-id='#{office.id}'>#{o}</li>"
|
62
|
+
end
|
63
|
+
res += "<li class='dealer_email'>#{dealer.email}</li>"
|
64
|
+
res += "<li class='dealer_site'>#{dealer.site}</li>"
|
65
|
+
"<ul class='ul_dealer_offices'>#{res}</ul>" #.html_safe
|
66
|
+
end
|
67
|
+
|
68
|
+
# используется только в ul_dealer_offices
|
69
|
+
def ul_office_props(office)
|
70
|
+
res = ''
|
71
|
+
res += "<li class='office_addr'>#{office.addr}</li>"
|
72
|
+
res += "<li class='office_tel'>#{office.tel}</li>"
|
73
|
+
"<ul class='ul_office_props'>#{res}</ul>" #.html_safe
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
end
|
@@ -5,7 +5,7 @@ module Ti
|
|
5
5
|
process :resize_to_limit => [1600,1600]
|
6
6
|
|
7
7
|
def store_dir
|
8
|
-
"uploads/docs/#{format('%02d', model.
|
8
|
+
"uploads/docs/#{format('%02d', model.doc_id)}"
|
9
9
|
end
|
10
10
|
|
11
11
|
# ---[ идут в контент новости ]---[ размер зависит от SiteProps.page_content_width ]--------------------------------------------------------------------------------------------------------------------
|
data/lib/c80_yax/version.rb
CHANGED
data/lib/c80_yax.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: c80_yax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- C80609A
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -235,6 +235,35 @@ files:
|
|
235
235
|
- db/migrate/20170625180000_create_c80_yax_join_table_colors_items.rb
|
236
236
|
- db/migrate/20170707060000_create_c80_yax_join_table_items_items_similar.rb
|
237
237
|
- db/seeds/c80_yax_01_fill_props.rb
|
238
|
+
- engines/of/README.md
|
239
|
+
- engines/of/app/admin/ti/offers.rb
|
240
|
+
- engines/of/app/assets/javascripts/ti.coffee
|
241
|
+
- engines/of/app/assets/javascripts/ti/facts_ajax.js
|
242
|
+
- engines/of/app/assets/stylesheets/of.scss
|
243
|
+
- engines/of/app/assets/stylesheets/of/offer_show.scss
|
244
|
+
- engines/of/app/assets/stylesheets/of/offers_list.scss
|
245
|
+
- engines/of/app/controllers/ti/application_controller.rb
|
246
|
+
- engines/of/app/decorators/of/offer_decorator.rb
|
247
|
+
- engines/of/app/helpers/of/offer_show_helper.rb
|
248
|
+
- engines/of/app/helpers/of/offers_list_helper.rb
|
249
|
+
- engines/of/app/models/of/offer.rb
|
250
|
+
- engines/of/app/models/of/offer_validator.rb
|
251
|
+
- engines/of/app/models/of/ophoto.rb
|
252
|
+
- engines/of/app/uploaders/of/ophoto_uploader.rb
|
253
|
+
- engines/of/app/views/of/_offer.html.erb
|
254
|
+
- engines/of/app/views/of/_offers_list.html.erb
|
255
|
+
- engines/of/app/views/of/_offers_list_flat.html.erb
|
256
|
+
- engines/of/bin/console
|
257
|
+
- engines/of/bin/setup
|
258
|
+
- engines/of/config/locales/ru.yml
|
259
|
+
- engines/of/config/routes.rb
|
260
|
+
- engines/of/db/migrate/20170716095757_create_of_offers.rb
|
261
|
+
- engines/of/db/migrate/20170716095858_create_of_ophotos.rb
|
262
|
+
- engines/of/db/migrate/20170716100707_create_of_join_table_items_offers.rb
|
263
|
+
- engines/of/db/seeds/ti_02_fill_test_data.rb
|
264
|
+
- engines/of/lib/of.rb
|
265
|
+
- engines/of/lib/of/engine.rb
|
266
|
+
- engines/of/lib/of/version.rb
|
238
267
|
- engines/pack/README.md
|
239
268
|
- engines/pack/app/admin/pack/suites.rb
|
240
269
|
- engines/pack/app/assets/javascripts/backend/suites.js
|
@@ -257,6 +286,7 @@ files:
|
|
257
286
|
- engines/ti/app/assets/stylesheets/ti/will_paginate.scss
|
258
287
|
- engines/ti/app/controllers/ti/application_controller.rb
|
259
288
|
- engines/ti/app/helpers/ti/application_helper.rb
|
289
|
+
- engines/ti/app/helpers/ti/tech_info_list_helper.rb
|
260
290
|
- engines/ti/app/models/ti/category.rb
|
261
291
|
- engines/ti/app/models/ti/doc.rb
|
262
292
|
- engines/ti/app/models/ti/doc_validator.rb
|