c80_push 0.1.0 → 0.1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba1fbec25d65fb7ac76579aa964df7eac47f9e4f
4
- data.tar.gz: cfe8de83b8d9a2717e8e4a1e5b70aed41d7989fd
3
+ metadata.gz: bc71bf6b52804cacd8264f3b6c11f871a0a98941
4
+ data.tar.gz: fda41529b939dfb82b720d781a5e809fd346a96b
5
5
  SHA512:
6
- metadata.gz: a3fb805974f58a22f39e483839878b31d919780511c0188f1a8f26d6685b48b32fe9da5da0e4794e566184513165c7a520252a99386ae4614e448a15b1e4a614
7
- data.tar.gz: f3d557be622dcd8c03f749c5ea3a2d01103846480d4c30e6f2e8d465989c45ae9edc7d8d8205ca196d743cf1eac65141f3cc117729240059bce4892ec102accd
6
+ metadata.gz: 1aaf65ac0642e9df24e8b7741e6f8a0f33d1d0d5c2c1ab7e9039f2af2ee132aeb546989ca1e20c6480d9323dfa171d02f7d0e260193e50b361dce565fe9adae5
7
+ data.tar.gz: d968c22cf4ee2de729b71fa4caf2befb8685e2b536578dfb3bdd16aa18ff4d11446398caa769f1882423a07f83ef3ce494e68f885ba7bdbe64ed57cce9a2fae7
data/README.md CHANGED
@@ -18,6 +18,10 @@
18
18
 
19
19
  ## Usage
20
20
 
21
+ Available helpers:
22
+
23
+ * `c80_push_render_page_dealers`: отрисует js-компонент с yandex картой
24
+ и фильтруемым списком дилеров слева.
21
25
 
22
26
  ## Installation
23
27
 
@@ -40,15 +44,27 @@ Add this line to host app's `application_controller.rb`:
40
44
  helper C80Push::Engine.helpers
41
45
  ```
42
46
 
43
- Add these to host app's `active_admin.js.coffee`:
47
+ Add these lines to host app's `active_admin.js.coffee`:
44
48
 
45
49
  ```js
46
50
  #= require bootstrap
47
51
  #= require bootstrap-select
48
52
  #= require c80_yax
53
+ #= require c80_push_backend
54
+ ```
55
+
56
+ Add these lines to host app's 'application.js.coffee':
57
+
58
+ ```js
49
59
  #= require c80_push
50
60
  ```
51
61
 
62
+ Add these lines to host app's 'application.scss':
63
+
64
+ ```css
65
+ @include "c80_push";
66
+ ```
67
+
52
68
  ## Цитата из ТЗ
53
69
 
54
70
  > Данный раздел представляет собой список компаний, у которых указаны
@@ -0,0 +1,13 @@
1
+ $(document).ready(function() {
2
+
3
+ var dealers_map;
4
+
5
+ ymaps.ready(function() {
6
+ dealers_map = new ymaps.Map('dealers_map_container', {
7
+ center: [55, 37],
8
+ zoom: 10,
9
+ controls: ['zoomControl']
10
+ });
11
+ });
12
+
13
+ });
@@ -1,3 +1 @@
1
- #= require lib_backend/init
2
- #= require lib_backend/init_select_picker
3
- #= require_tree ./backend
1
+ #= require_tree ./c80_push/frontend
@@ -0,0 +1,3 @@
1
+ #= require c80_push/lib_backend/init
2
+ #= require c80_push/lib_backend/init_select_picker
3
+ #= require_tree ./c80_push/backend
@@ -0,0 +1,35 @@
1
+ div.c80_push_page_dealers {
2
+ @include clearfix;
3
+
4
+ > div {
5
+ float: left;
6
+ width: 100%;
7
+ }
8
+
9
+ div.select_region_row {
10
+ height: 53px;
11
+ margin-bottom: 25px;
12
+ }
13
+
14
+ div.bottom_row {
15
+ @include clearfix;
16
+
17
+ > div {
18
+ float: left;
19
+ }
20
+
21
+ div.dealers_list {
22
+ margin: 0 15px 0 0;
23
+ width: 305px;
24
+ height: 600px;
25
+ overflow-y: auto;
26
+ }
27
+
28
+ div#dealers_map_container {
29
+ width: calc(100% - 320px);
30
+ height: 600px;
31
+ }
32
+
33
+ }
34
+
35
+ }
@@ -0,0 +1,14 @@
1
+ div.c80_push_page_dealers {
2
+
3
+ > div {
4
+ }
5
+
6
+ div.select_region_row {
7
+ background-color: #E0001A;
8
+ }
9
+
10
+ div#dealers_map_container {
11
+
12
+ }
13
+
14
+ }
@@ -0,0 +1,119 @@
1
+ .ul_dealers_list {
2
+ margin: 0;
3
+ padding: 0;
4
+ list-style: none;
5
+
6
+ .li_region {
7
+
8
+ h2.region_title {
9
+ display: none;
10
+ margin:0;
11
+ padding:0;
12
+ /*font-size: 20px;*/
13
+ }
14
+
15
+ .ul_region_dealers {
16
+ padding: 0; //5px 5px 10px 15px;
17
+ list-style: none;
18
+ border: 1px #B2B2B2 solid;
19
+
20
+ .li_dealer {
21
+ padding: 15px;
22
+ border-bottom: 1px #B2B2B2 solid;
23
+
24
+ h3.dealer_title {
25
+ margin: 0 0 5px 0;
26
+ padding: 0;
27
+ font-size: 20px;
28
+ color: #E0001A;
29
+ font-weight: bold;
30
+ }
31
+
32
+ .ul_dealer_offices {
33
+ margin: 0;
34
+ padding: 0;
35
+ list-style: none;
36
+
37
+ .li_office {
38
+ border-bottom: 1px #dcdcdc solid;
39
+ padding: 7px 0 7px 0;
40
+ color: #b2b2b2;
41
+ position: relative;
42
+
43
+ h4.office_title {
44
+ margin: 0 0 5px 0;
45
+ padding: 0;
46
+ font-weight: bold;
47
+ font-size: 13px;
48
+ }
49
+
50
+ .ul_office_props {
51
+ margin: 0;
52
+ padding: 0;
53
+ list-style: none;
54
+ font-size: 17px;
55
+
56
+ li.office_addr {
57
+
58
+ }
59
+ li.office_tel {
60
+
61
+ }
62
+ }
63
+
64
+ &:after {
65
+ position: absolute;
66
+ content: ' ';
67
+ display: none;
68
+ height: calc(100% + 2px);
69
+ width: calc(100% + 30px);
70
+ top: -1px;
71
+ left: -15px;
72
+ z-index: -1;
73
+ }
74
+
75
+ &:hover {
76
+ border-bottom: 1px transparent solid;
77
+ &:after {
78
+ display: block;
79
+ background-color: #e8e8e8;
80
+ }
81
+ }
82
+
83
+ &.active {
84
+ border-bottom: 1px transparent solid;
85
+ color: #e4e0e0;
86
+ position: relative;
87
+
88
+ &:after {
89
+ display: block;
90
+ background-color: #626262;
91
+ top: 0;
92
+ }
93
+
94
+ &:hover {
95
+ &:after {
96
+ display: block;
97
+ background-color: #626262;
98
+ top: 0;
99
+ }
100
+ }
101
+ }
102
+
103
+ }
104
+
105
+ li.dealer_email {
106
+ margin-top: 10px;
107
+ color: #E0001A;
108
+ }
109
+
110
+ li.dealer_site {
111
+ color: #E0001A;
112
+ }
113
+ }
114
+
115
+ }
116
+ }
117
+ }
118
+
119
+ }
@@ -0,0 +1,5 @@
1
+ /*
2
+ *= require_self
3
+ */
4
+
5
+ @import "c80_push/**/*";
@@ -0,0 +1,5 @@
1
+ /*
2
+ *= require_self
3
+ */
4
+
5
+ //@import "c80_push/backend/**/*";
@@ -15,7 +15,7 @@ module C80Push
15
15
  res = '-'
16
16
  unless subj.offices.count.zero?
17
17
  res = ''
18
- subj.offices.def_order.each do |office|
18
+ subj.offices.each do |office|
19
19
  e = "<li>#{office.title}</li>"
20
20
  res += e
21
21
  end
@@ -29,7 +29,7 @@ module C80Push
29
29
  res = '-'
30
30
  unless subj.dealers.count.zero?
31
31
  res = ''
32
- subj.dealers.def_order.each do |dealer|
32
+ subj.dealers.each do |dealer|
33
33
  e = "<li>#{dealer.title}</li>"
34
34
  res += e
35
35
  end
@@ -1,4 +1,15 @@
1
1
  module C80Push
2
+
3
+ # Предоставляет внешний интерфейс -
4
+ # методы, которыми можно пользоваться
5
+ # в host приложении
2
6
  module ApplicationHelper
7
+
8
+ def c80_push_render_page_dealers
9
+ render partial: 'c80_push/shared/page_dealers',
10
+ locals: {
11
+ }
12
+ end
13
+
3
14
  end
4
15
  end
@@ -0,0 +1,77 @@
1
+ module C80Push
2
+ module PageDealers
3
+ module PageDealersHelper
4
+
5
+ # Выдать список Дилеров (включая Офисы),
6
+ # разложенный по Регионам.
7
+ # Список выводится слева от карты.
8
+ # (**) Не выводим регионы, у которых нет дилеров.
9
+ #
10
+ # * Регион
11
+ # * Дилер
12
+ # * Офис 1
13
+ # * адрес офиса
14
+ # * телефон офиса
15
+ # * Офис 2
16
+ # * адрес офиса
17
+ # * телефон офиса
18
+ # * сайт дилера
19
+ # * email дилера
20
+ #
21
+ def render_ul_dealers_list
22
+
23
+ res = ''
24
+
25
+ Region.includes(dealers: :offices).each do |region|
26
+ r = "<h2 class='region_title'>#{region.title}</h2>"
27
+ ds = ul_region_dealers(region)
28
+ next if ds.blank? # (**)
29
+ r += ds
30
+ res += "<li class='li_region' id='region_#{region.id}'>#{r}</li>"
31
+ end
32
+
33
+ "<ul class='ul_dealers_list'>#{res}</ul>".html_safe
34
+
35
+ end
36
+
37
+ private
38
+
39
+ # используется только в render_dealers_list
40
+ # (*) не выводим список дилеров, если он пуст
41
+ def ul_region_dealers(region)
42
+ res = ''
43
+ # noinspection RubyResolve
44
+ region.dealers.each do |dealer|
45
+ d = "<h3 class='dealer_title'>#{dealer.title}</h3>"
46
+ d += ul_dealer_offices(dealer)
47
+ res += "<li class='li_dealer' id='dealer_#{dealer.id}'>#{d}</li>"
48
+ end
49
+ return res if res.blank? # (*)
50
+ "<ul class='ul_region_dealers'>#{res}</ul>"#.html_safe
51
+ end
52
+
53
+ # используется только в ul_region_dealers
54
+ def ul_dealer_offices(dealer)
55
+ res = ''
56
+ # noinspection RubyResolve
57
+ dealer.offices.each_with_index do |office|
58
+ o = "<h4 class='office_title'>#{office.title}</h4>"
59
+ o += ul_office_props(office)
60
+ res += "<li class='li_office' id='office_#{office.id}'>#{o}</li>"
61
+ end
62
+ res += "<li class='dealer_email'>#{dealer.email}</li>"
63
+ res += "<li class='dealer_site'>#{dealer.site}</li>"
64
+ "<ul class='ul_dealer_offices'>#{res}</ul>"#.html_safe
65
+ end
66
+
67
+ # используется только в ul_dealer_offices
68
+ def ul_office_props(office)
69
+ res = ''
70
+ res += "<li class='office_addr'>#{office.addr}</li>"
71
+ res += "<li class='office_tel'>#{office.tel}</li>"
72
+ "<ul class='ul_office_props'>#{res}</ul>"#.html_safe
73
+ end
74
+
75
+ end
76
+ end
77
+ end
@@ -15,7 +15,7 @@ module C80Push
15
15
  validates :ord,
16
16
  :presence => true
17
17
 
18
- scope :def_order, -> { order(:ord => :asc) }
18
+ default_scope -> { order(:ord => :asc) }
19
19
 
20
20
  end
21
21
  end
@@ -3,7 +3,7 @@ module C80Push
3
3
  has_and_belongs_to_many :regions
4
4
  belongs_to :dealer
5
5
 
6
- scope :def_order, -> { order(:ord => :asc) }
6
+ default_scope -> { order(:ord => :asc) }
7
7
 
8
8
  validates :ord,
9
9
  :presence => true
@@ -3,7 +3,7 @@ module C80Push
3
3
  has_and_belongs_to_many :dealers
4
4
  has_and_belongs_to_many :offices
5
5
 
6
- scope :def_order, -> { order(:ord => :asc) }
6
+ default_scope -> { order(:ord => :asc) }
7
7
 
8
8
  validates :title,
9
9
  :uniqueness => true,
@@ -0,0 +1,21 @@
1
+ <div class="c80_push_page_dealers">
2
+
3
+ <div class="select_region_row">
4
+
5
+ </div>
6
+
7
+ <div class="bottom_row">
8
+
9
+ <div class="dealers_list">
10
+ <%= render_ul_dealers_list %>
11
+ </div>
12
+
13
+ <div id="dealers_map_container">
14
+
15
+ </div>
16
+
17
+ </div>
18
+
19
+ </div>
20
+
21
+ <script src="https://api-maps.yandex.ru/2.1/?lang=ru_RU" type="text/javascript"></script>
@@ -1,3 +1,3 @@
1
1
  module C80Push
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.0.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: c80_push
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - C80609A
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-26 00:00:00.000000000 Z
11
+ date: 2017-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -38,17 +38,25 @@ files:
38
38
  - app/admin/c80_push/regions.rb
39
39
  - app/admin/c80_push/x_c80_push.rb
40
40
  - app/assets/config/c80_push_manifest.js
41
- - app/assets/javascripts/backend/dealers.js
42
41
  - app/assets/javascripts/c80_push.js.coffee
43
- - app/assets/javascripts/lib_backend/init.js
44
- - app/assets/javascripts/lib_backend/init_select_picker.js
45
- - app/assets/stylesheets/c80_push/application.css
42
+ - app/assets/javascripts/c80_push/backend/dealers.js
43
+ - app/assets/javascripts/c80_push/frontend/c80_push_page_dealers/init_yandex_map.js
44
+ - app/assets/javascripts/c80_push/lib_backend/init.js
45
+ - app/assets/javascripts/c80_push/lib_backend/init_select_picker.js
46
+ - app/assets/javascripts/c80_push_backend.js.coffee
47
+ - app/assets/stylesheets/c80_push.scss
48
+ - app/assets/stylesheets/c80_push/c80_push_page_dealers/_layout.scss
49
+ - app/assets/stylesheets/c80_push/c80_push_page_dealers/_style.scss
50
+ - app/assets/stylesheets/c80_push/c80_push_page_dealers/map_dealers_list.scss
51
+ - app/assets/stylesheets/c80_push_backend.scss
46
52
  - app/helpers/c80_push/admin_helper.rb
47
53
  - app/helpers/c80_push/application_helper.rb
54
+ - app/helpers/c80_push/page_dealers/page_dealers_helper.rb
48
55
  - app/models/c80_push/application_record.rb
49
56
  - app/models/c80_push/dealer.rb
50
57
  - app/models/c80_push/office.rb
51
58
  - app/models/c80_push/region.rb
59
+ - app/views/c80_push/shared/_page_dealers.html.erb
52
60
  - config/locales/dealer/ru.yml
53
61
  - config/locales/office/ru.yml
54
62
  - config/locales/region/ru.yml
@@ -1,15 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
- * files in this directory. Styles in this file should be added after the last require_* statement.
11
- * It is generally better to create a new file per style scope.
12
- *
13
- *= require_tree .
14
- *= require_self
15
- */