c80_map_floors 0.1.0.9 → 0.1.0.10
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/assets/javascripts/lib/awesomplete.js +450 -0
- data/app/assets/javascripts/map_objects/area.js +12 -8
- data/app/assets/javascripts/map_objects/building.js +23 -6
- data/app/assets/javascripts/src/main.js +12 -2
- data/app/assets/javascripts/src/state_controller.js +50 -8
- data/app/assets/javascripts/svg_elements/admin_building_label.js +6 -6
- data/app/assets/javascripts/svg_elements/building_label.js +88 -60
- data/app/assets/javascripts/ui/tabs/tabs.js +55 -2
- data/app/assets/javascripts/view/building_info/building_info.js +85 -8
- data/app/assets/javascripts/view/building_info/mobj_info_parser.js +316 -12
- data/app/assets/javascripts/view/search_gui.js +295 -0
- data/app/assets/stylesheets/c80_map_floors.scss +3 -1
- data/app/assets/stylesheets/lib/awesomplete.scss +104 -0
- data/app/assets/stylesheets/lib_custom/awesomplete.scss +8 -0
- data/app/assets/stylesheets/map.scss +61 -16
- data/app/assets/stylesheets/ui/search_gui.scss +51 -0
- data/app/assets/stylesheets/ui/tabs_js.scss +25 -0
- data/app/assets/stylesheets/view/buttons/back_to_map_button.scss +1 -1
- data/app/assets/stylesheets/view/elems/building_info.scss +1 -1
- data/app/assets/stylesheets/view/elems/free_areas_label.scss +6 -1
- data/app/controllers/c80_map_floors/ajax_controller.rb +82 -0
- data/app/helpers/c80_map_floors/search_gui_helper.rb +19 -0
- data/app/models/c80_map_floors/area.rb +1 -1
- data/app/models/c80_map_floors/area_representator.rb +13 -22
- data/app/models/c80_map_floors/building_representator.rb +8 -1
- data/app/models/c80_map_floors/floor.rb +1 -1
- data/app/models/c80_map_floors/map_building.rb +2 -2
- data/app/models/c80_map_floors/map_json.rb +2 -1
- data/app/views/c80_map_floors/_map_row_index.html.erb +5 -0
- data/app/views/c80_map_floors/shared/map_row/_search_gui.html.erb +11 -0
- data/config/routes.rb +2 -0
- data/lib/c80_map_floors/version.rb +1 -1
- metadata +9 -2
@@ -0,0 +1,104 @@
|
|
1
|
+
.awesomplete [hidden] {
|
2
|
+
display: none;
|
3
|
+
}
|
4
|
+
|
5
|
+
.awesomplete .visually-hidden {
|
6
|
+
position: absolute;
|
7
|
+
clip: rect(0, 0, 0, 0);
|
8
|
+
}
|
9
|
+
|
10
|
+
.awesomplete {
|
11
|
+
display: inline-block;
|
12
|
+
position: relative;
|
13
|
+
}
|
14
|
+
|
15
|
+
.awesomplete > input {
|
16
|
+
display: block;
|
17
|
+
}
|
18
|
+
|
19
|
+
.awesomplete > ul {
|
20
|
+
position: absolute;
|
21
|
+
left: 0;
|
22
|
+
z-index: 1;
|
23
|
+
min-width: 100%;
|
24
|
+
box-sizing: border-box;
|
25
|
+
list-style: none;
|
26
|
+
padding: 0;
|
27
|
+
margin: 0;
|
28
|
+
background: #fff;
|
29
|
+
}
|
30
|
+
|
31
|
+
.awesomplete > ul:empty {
|
32
|
+
display: none;
|
33
|
+
}
|
34
|
+
|
35
|
+
.awesomplete > ul {
|
36
|
+
border-radius: .3em;
|
37
|
+
margin: .2em 0 0;
|
38
|
+
background: hsla(0,0%,100%,.9);
|
39
|
+
background: linear-gradient(to bottom right, white, hsla(0,0%,100%,.8));
|
40
|
+
border: 1px solid rgba(0,0,0,.3);
|
41
|
+
box-shadow: .05em .2em .6em rgba(0,0,0,.2);
|
42
|
+
text-shadow: none;
|
43
|
+
}
|
44
|
+
|
45
|
+
@supports (transform: scale(0)) {
|
46
|
+
.awesomplete > ul {
|
47
|
+
transition: .3s cubic-bezier(.4,.2,.5,1.4);
|
48
|
+
transform-origin: 1.43em -.43em;
|
49
|
+
}
|
50
|
+
|
51
|
+
.awesomplete > ul[hidden],
|
52
|
+
.awesomplete > ul:empty {
|
53
|
+
opacity: 0;
|
54
|
+
transform: scale(0);
|
55
|
+
display: block;
|
56
|
+
transition-timing-function: ease;
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
/* Pointer */
|
61
|
+
.awesomplete > ul:before {
|
62
|
+
content: "";
|
63
|
+
position: absolute;
|
64
|
+
top: -.43em;
|
65
|
+
left: 1em;
|
66
|
+
width: 0; height: 0;
|
67
|
+
padding: .4em;
|
68
|
+
background: white;
|
69
|
+
border: inherit;
|
70
|
+
border-right: 0;
|
71
|
+
border-bottom: 0;
|
72
|
+
-webkit-transform: rotate(45deg);
|
73
|
+
transform: rotate(45deg);
|
74
|
+
}
|
75
|
+
|
76
|
+
.awesomplete > ul > li {
|
77
|
+
position: relative;
|
78
|
+
padding: .2em .5em;
|
79
|
+
cursor: pointer;
|
80
|
+
}
|
81
|
+
|
82
|
+
.awesomplete > ul > li:hover {
|
83
|
+
background: hsl(200, 40%, 80%);
|
84
|
+
color: black;
|
85
|
+
}
|
86
|
+
|
87
|
+
.awesomplete > ul > li[aria-selected="true"] {
|
88
|
+
background: hsl(205, 40%, 40%);
|
89
|
+
color: white;
|
90
|
+
}
|
91
|
+
|
92
|
+
.awesomplete mark {
|
93
|
+
background: hsl(65, 100%, 50%);
|
94
|
+
}
|
95
|
+
|
96
|
+
.awesomplete li:hover mark {
|
97
|
+
background: hsl(68, 100%, 41%);
|
98
|
+
}
|
99
|
+
|
100
|
+
.awesomplete li[aria-selected="true"] mark {
|
101
|
+
background: hsl(86, 100%, 21%);
|
102
|
+
color: inherit;
|
103
|
+
}
|
104
|
+
/*# sourceMappingURL=awesomplete.css.map */
|
@@ -1243,6 +1243,19 @@ div#map_wrapper {
|
|
1243
1243
|
|
1244
1244
|
}
|
1245
1245
|
|
1246
|
+
polygon.found { /* удовлетворяющий поиску полигон ЗДАНИЯ */
|
1247
|
+
fill: rgba(0, 255, 19, 0.40);
|
1248
|
+
stroke: rgba(251, 251, 251, 0.86);
|
1249
|
+
stroke-width: 3px;
|
1250
|
+
stroke-dasharray: 3;
|
1251
|
+
animation: dash 555s linear;
|
1252
|
+
|
1253
|
+
&:hover, &.hover {
|
1254
|
+
fill: rgba(0, 255, 19, 0.50);
|
1255
|
+
stroke: rgba(251, 251, 251, 0.96);
|
1256
|
+
}
|
1257
|
+
}
|
1258
|
+
|
1246
1259
|
g {
|
1247
1260
|
|
1248
1261
|
&.free {
|
@@ -1257,6 +1270,23 @@ div#map_wrapper {
|
|
1257
1270
|
}
|
1258
1271
|
|
1259
1272
|
}
|
1273
|
+
|
1274
|
+
&.viewing_area {
|
1275
|
+
polygon, polyline { /* СВОБОДНЫЙ и ТЕКУЩЕ-ПРОСМАТРИВАЕМЫЙ полигон площади */
|
1276
|
+
/*background: transparent url(image_path('loader_button.gif')) no-repeat 0 0;*/
|
1277
|
+
fill: rgba(0, 255, 19, 0.10);
|
1278
|
+
stroke: rgba(255, 246, 242, 0.59);
|
1279
|
+
stroke-width: 2px;
|
1280
|
+
stroke-dasharray: 10;
|
1281
|
+
animation: dash 555s linear;
|
1282
|
+
|
1283
|
+
&:hover, &.hover {
|
1284
|
+
fill: rgba(0, 255, 19, 0.50);
|
1285
|
+
stroke: rgba(255, 246, 242, 0.79);
|
1286
|
+
}
|
1287
|
+
}
|
1288
|
+
}
|
1289
|
+
|
1260
1290
|
}
|
1261
1291
|
|
1262
1292
|
&.busy {
|
@@ -1270,7 +1300,37 @@ div#map_wrapper {
|
|
1270
1300
|
stroke: rgba(251, 251, 251, 0.86);
|
1271
1301
|
}
|
1272
1302
|
|
1303
|
+
&.found_area { /* удовлетворяющий поиску ЗАНЯТЫЙ polygon площади */
|
1304
|
+
fill: rgba(0, 173, 255, 0.40) !important;
|
1305
|
+
stroke: rgba(251, 251, 251, 0.86) !important;
|
1306
|
+
stroke-width: 3px;
|
1307
|
+
stroke-dasharray: 3;
|
1308
|
+
animation: dash 555s linear;
|
1309
|
+
|
1310
|
+
&:hover, &.hover {
|
1311
|
+
fill: rgba(0, 173, 255, 0.60) !important;
|
1312
|
+
stroke: rgba(251, 251, 251, 0.96) !important;
|
1313
|
+
}
|
1314
|
+
}
|
1315
|
+
|
1273
1316
|
}
|
1317
|
+
|
1318
|
+
&.viewing_area {
|
1319
|
+
polygon, polyline { /* ЗАНЯТЫЙ и ТЕКУЩЕ-ПРОСМАТРИВАЕМЫЙ полигон площади */
|
1320
|
+
/*background: transparent url(image_path('loader_button.gif')) no-repeat 0 0;*/
|
1321
|
+
fill: rgba(255, 4, 0, 0.40);
|
1322
|
+
stroke: rgba(255, 246, 242, 0.59);
|
1323
|
+
stroke-width: 2px;
|
1324
|
+
stroke-dasharray: 10;
|
1325
|
+
animation: dash 555s linear;
|
1326
|
+
|
1327
|
+
&:hover, &.hover {
|
1328
|
+
fill: rgba(255, 4, 0, 0.50);
|
1329
|
+
stroke: rgba(255, 246, 242, 0.79);
|
1330
|
+
}
|
1331
|
+
}
|
1332
|
+
}
|
1333
|
+
|
1274
1334
|
}
|
1275
1335
|
|
1276
1336
|
&.unassigned {
|
@@ -1287,7 +1347,7 @@ div#map_wrapper {
|
|
1287
1347
|
}
|
1288
1348
|
|
1289
1349
|
&.viewing_area {
|
1290
|
-
polygon, polyline { /* НЕНАЗНАЧЕННЫЙ и
|
1350
|
+
polygon, polyline { /* НЕНАЗНАЧЕННЫЙ и ТЕКУЩЕ-ПРОСМАТРИВАЕМЫЙ полигон площади (с пунктиром) */
|
1291
1351
|
/*background: transparent url(image_path('loader_button.gif')) no-repeat 0 0;*/
|
1292
1352
|
fill: rgba(131, 131, 131, 0.50);
|
1293
1353
|
stroke: rgba(131, 131, 131, 0.60);
|
@@ -1304,21 +1364,6 @@ div#map_wrapper {
|
|
1304
1364
|
|
1305
1365
|
}
|
1306
1366
|
|
1307
|
-
&.viewing_area {
|
1308
|
-
polygon, polyline { /* подразумевается НАЗНАЧЕННЫЙ полигон площади */
|
1309
|
-
/*background: transparent url(image_path('loader_button.gif')) no-repeat 0 0;*/
|
1310
|
-
fill: rgba(0, 255, 19, 0.10);
|
1311
|
-
stroke: rgba(255, 246, 242, 0.59);
|
1312
|
-
stroke-width: 2px;
|
1313
|
-
stroke-dasharray: 10;
|
1314
|
-
animation: dash 555s linear;
|
1315
|
-
|
1316
|
-
&:hover, &.hover {
|
1317
|
-
fill: rgba(0, 255, 19, 0.50);
|
1318
|
-
stroke: rgba(255, 246, 242, 0.79);
|
1319
|
-
}
|
1320
|
-
}
|
1321
|
-
}
|
1322
1367
|
}
|
1323
1368
|
|
1324
1369
|
}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
div.container#search_container {
|
2
|
+
|
3
|
+
position: relative;
|
4
|
+
height: 0;
|
5
|
+
z-index: 5;
|
6
|
+
|
7
|
+
-webkit-transition: left .8s cubic-bezier(.25, .8, .25, 1), top .8s cubic-bezier(.25, .8, .25, 1);
|
8
|
+
-moz-transition: left .8s cubic-bezier(.25, .8, .25, 1), top .8s cubic-bezier(.25, .8, .25, 1);
|
9
|
+
transition: left .8s cubic-bezier(.25, .8, .25, 1), top .8s cubic-bezier(.25, .8, .25, 1);
|
10
|
+
|
11
|
+
div#search_gui {
|
12
|
+
display: block;
|
13
|
+
margin: 0 auto;
|
14
|
+
padding-top: 15px;
|
15
|
+
width: 500px;
|
16
|
+
|
17
|
+
form.navbar-form {
|
18
|
+
margin-bottom: 0;
|
19
|
+
|
20
|
+
input.form-control {
|
21
|
+
width: 400px;
|
22
|
+
margin-right: 10px;
|
23
|
+
}
|
24
|
+
|
25
|
+
.btn {
|
26
|
+
padding: 5px 14px;
|
27
|
+
border-width: 1px !important;
|
28
|
+
}
|
29
|
+
|
30
|
+
}
|
31
|
+
|
32
|
+
}
|
33
|
+
|
34
|
+
a.reset {
|
35
|
+
display: none; /* изначально кнопка невидна */
|
36
|
+
font-size: 12px;
|
37
|
+
margin: 0 auto;
|
38
|
+
width: 429px;
|
39
|
+
text-align: right;
|
40
|
+
font-weight: bold;
|
41
|
+
font-family: Arial, Helvetica, sans-serif;
|
42
|
+
color: #000000;
|
43
|
+
text-decoration: none;
|
44
|
+
|
45
|
+
&:hover {
|
46
|
+
text-decoration: underline !important;
|
47
|
+
color: #18669a;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
}
|
@@ -1,7 +1,32 @@
|
|
1
1
|
div.tabs_js {
|
2
2
|
|
3
|
+
/*
|
4
|
+
<div class="tab_buttons clearfix">
|
5
|
+
<a href="#" data-id="6" data-index="0" class="active">Первый этаж</a>
|
6
|
+
<a href="#" data-id="48" data-index="1" class="red">Второй этаж</a>
|
7
|
+
<a href="#" data-id="49" data-index="2">Третий этаж</a>
|
8
|
+
</div>
|
9
|
+
*/
|
3
10
|
div.tab_buttons {
|
11
|
+
> a {
|
12
|
+
&.red {
|
13
|
+
position: relative;
|
14
|
+
&:after {
|
15
|
+
content: attr(data-search-count); /* количество магазинов (удовлетворяющих поиску) на этаже */
|
16
|
+
position: absolute;
|
4
17
|
|
18
|
+
width: 20px;
|
19
|
+
height: 20px;
|
20
|
+
background-color: red;
|
21
|
+
border-radius: 5px;
|
22
|
+
|
23
|
+
font-size: 15px;
|
24
|
+
font-weight: bold;
|
25
|
+
color: #ffffff;
|
26
|
+
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
5
30
|
}
|
6
31
|
|
7
32
|
div.tab_content {
|
@@ -10,8 +10,13 @@ g.free_areas_label {
|
|
10
10
|
font-size: 40px;
|
11
11
|
font-weight: bold;
|
12
12
|
fill: #ffffff;
|
13
|
-
transform: translateY(12px) translateX(-
|
13
|
+
transform: translateY(12px) translateX(-22px);
|
14
14
|
text-shadow: 0 0 1px rgba(0, 0, 0, 0.58);
|
15
|
+
|
16
|
+
&.one_digit {
|
17
|
+
transform: translateY(12px) translateX(-10px);
|
18
|
+
}
|
19
|
+
|
15
20
|
}
|
16
21
|
|
17
22
|
&.pulse {
|
@@ -1,4 +1,5 @@
|
|
1
1
|
module C80MapFloors
|
2
|
+
# noinspection RubyResolve
|
2
3
|
class AjaxController < ApplicationController
|
3
4
|
|
4
5
|
def map_edit_buttons
|
@@ -112,5 +113,86 @@ module C80MapFloors
|
|
112
113
|
|
113
114
|
end
|
114
115
|
|
116
|
+
# от js пришла строка с названием категории. Необходимо найти магазины, соответствующие этой категории.
|
117
|
+
# noinspection RailsChecklist01
|
118
|
+
def find_shops
|
119
|
+
Rails.logger.debug "[TRACE] <AjaxController.find_shops> params = #{params}"
|
120
|
+
# [TRACE] <AjaxController.find_shops> params = {"stext"=>"Хозтовары", "counter"=>"1", "controller"=>"c80_map_floors/ajax", "action"=>"find_shops"}
|
121
|
+
|
122
|
+
# ПЕРВЫЙ ВАРИАНТ
|
123
|
+
# result = {
|
124
|
+
# buildings: [
|
125
|
+
# { id: 7,
|
126
|
+
# floors: [
|
127
|
+
# { id: 2,
|
128
|
+
# areas: [3]
|
129
|
+
# }
|
130
|
+
# ]
|
131
|
+
# },
|
132
|
+
# {
|
133
|
+
# id: 10,
|
134
|
+
# floors: [
|
135
|
+
# { id: 6,
|
136
|
+
# areas: [5,8]
|
137
|
+
# },
|
138
|
+
# { id: 48,
|
139
|
+
# areas: [6]
|
140
|
+
# }
|
141
|
+
# ]
|
142
|
+
# }
|
143
|
+
# ]
|
144
|
+
# }
|
145
|
+
|
146
|
+
if params[:counter].to_i == 1
|
147
|
+
result = {
|
148
|
+
buildings: [7, 10],
|
149
|
+
buildings_shops_count: [3, 12],
|
150
|
+
floors: [2, 6, 48],
|
151
|
+
floors_shops_count: [2, 1, 33],
|
152
|
+
areas: [3, 5, 8, 6]
|
153
|
+
}
|
154
|
+
else
|
155
|
+
result = {
|
156
|
+
buildings: [],
|
157
|
+
buildings_shops_count: [],
|
158
|
+
floors: [],
|
159
|
+
floors_shops_count: [],
|
160
|
+
areas: []
|
161
|
+
}
|
162
|
+
|
163
|
+
# находим 3 рандомных полигона зданий (генерим случайное число для каждого здания)
|
164
|
+
3.times do
|
165
|
+
|
166
|
+
map_building = MapBuilding.offset(rand(MapBuilding.count)).first
|
167
|
+
map_building_count = rand(20)
|
168
|
+
|
169
|
+
result[:buildings] << map_building.id
|
170
|
+
result[:buildings_shops_count] << map_building_count
|
171
|
+
|
172
|
+
# в каждом полигоне здания находим один рандомный полигон этажа (генерим случайное число для каждого этажа)
|
173
|
+
map_floor = map_building.floors.offset(rand(map_building.floors.count)).first
|
174
|
+
map_floor_count = rand(20)
|
175
|
+
|
176
|
+
result[:floors] << map_floor.id
|
177
|
+
result[:floors_shops_count] << map_floor_count
|
178
|
+
|
179
|
+
# просто находим 4 рандомных полигонов площадей
|
180
|
+
4.times do
|
181
|
+
map_area = Area.offset(rand(Area.count)).first
|
182
|
+
result[:areas] << map_area.id
|
183
|
+
end
|
184
|
+
|
185
|
+
end
|
186
|
+
|
187
|
+
end
|
188
|
+
|
189
|
+
Rails.logger.debug "[TRACE] <AjaxController.fetch_unlinked_floors> Отправляем ответ: result = #{result}"
|
190
|
+
|
191
|
+
respond_to do |format|
|
192
|
+
format.json { render json: result }
|
193
|
+
end
|
194
|
+
|
195
|
+
end
|
196
|
+
|
115
197
|
end
|
116
198
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module C80MapFloors
|
2
|
+
module SearchGuiHelper
|
3
|
+
|
4
|
+
# рендер поисковой формы, которая видна сверху поцентру в слое над картой
|
5
|
+
# noinspection RubyResolve
|
6
|
+
def render_search_gui
|
7
|
+
|
8
|
+
# NOTE:: названия всех категорий в алфавитном порядке через запятую в одну строку возьмём из HOST-приложения
|
9
|
+
categories_list = ::Cat.filled_cats.map { |c| c.name }.join(', ')
|
10
|
+
|
11
|
+
render :partial => 'c80_map_floors/shared/map_row/search_gui',
|
12
|
+
:locals => {
|
13
|
+
categories_list: categories_list
|
14
|
+
}
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -1,7 +1,14 @@
|
|
1
1
|
module C80MapFloors
|
2
2
|
|
3
|
+
#==========================================================
|
4
|
+
#
|
5
|
+
# Это Площадь (которая привязывается к полигону на карте)
|
6
|
+
#
|
7
|
+
#==========================================================
|
8
|
+
|
3
9
|
module AreaRepresentator
|
4
10
|
|
11
|
+
# noinspection RubyResolve
|
5
12
|
extend ActiveSupport::Concern
|
6
13
|
|
7
14
|
# ERROR: Cannot define multiple 'included' blocks for a Concern
|
@@ -16,24 +23,14 @@ module C80MapFloors
|
|
16
23
|
|
17
24
|
module ClassMethods
|
18
25
|
|
26
|
+
# noinspection RubyResolve
|
19
27
|
def acts_as_map_area_representator
|
20
28
|
class_eval do
|
21
29
|
|
22
|
-
# has_many :map_areas, :as => :area_representator, :class_name => 'C80MapFloors::Area', :dependent => :nullify
|
23
30
|
has_one :area, :as => :area_representator, :class_name => 'C80MapFloors::Area', :dependent => :nullify
|
24
31
|
|
25
32
|
after_save :update_json
|
26
33
|
|
27
|
-
def self.unlinked_areas
|
28
|
-
res = []
|
29
|
-
self.all.each do |area|
|
30
|
-
if area.map_areas.count == 0
|
31
|
-
res << area
|
32
|
-
end
|
33
|
-
end
|
34
|
-
res
|
35
|
-
end
|
36
|
-
|
37
34
|
# выдать название привязанного к Площади полигона
|
38
35
|
def apolygon_title
|
39
36
|
res = '-'
|
@@ -73,28 +70,22 @@ module C80MapFloors
|
|
73
70
|
end
|
74
71
|
=end
|
75
72
|
|
73
|
+
# Выдать json Площади, которая привязана к полигону на карте
|
74
|
+
# noinspection RubyResolve
|
76
75
|
def my_as_json2
|
77
76
|
result = {
|
78
77
|
id: self.id,
|
79
78
|
title: self.name,
|
80
79
|
square: self.square,
|
81
|
-
square_free: self.square_free,
|
82
80
|
desc: self.desc,
|
83
|
-
floor_height: self.floor_height,
|
84
81
|
price_string: self.price_string,
|
85
|
-
communications: self.communications
|
82
|
+
communications: self.communications,
|
83
|
+
is_free: self.is_free?,
|
84
|
+
shop: self.shop_as_json
|
86
85
|
}
|
87
86
|
result.as_json
|
88
87
|
end
|
89
88
|
|
90
|
-
# свободна ли площадь, привязанная к полигону на карте
|
91
|
-
def is_free?
|
92
|
-
res = true
|
93
|
-
if map_areas.count > 0
|
94
|
-
res = map_areas.first.is_free?
|
95
|
-
end
|
96
|
-
res
|
97
|
-
end
|
98
89
|
end
|
99
90
|
|
100
91
|
end
|
@@ -1,5 +1,11 @@
|
|
1
1
|
module C80MapFloors
|
2
2
|
|
3
|
+
#==========================================================
|
4
|
+
#
|
5
|
+
# Это Здание (которое привязывается к полигону на карте)
|
6
|
+
#
|
7
|
+
#==========================================================
|
8
|
+
|
3
9
|
module BuildingRepresentator
|
4
10
|
|
5
11
|
extend ActiveSupport::Concern
|
@@ -55,7 +61,8 @@ module C80MapFloors
|
|
55
61
|
# noinspection ALL
|
56
62
|
module InstanceMethods
|
57
63
|
|
58
|
-
|
64
|
+
# выдать json Здания, которое привязано к полигону на карте
|
65
|
+
def my_as_json6
|
59
66
|
result = {
|
60
67
|
id: self.id,
|
61
68
|
title: self.title,
|
@@ -24,7 +24,7 @@ module C80MapFloors
|
|
24
24
|
C80MapFloors::Areas.joins(:c80_map_floors_floors).where(:building_id => self.if)
|
25
25
|
end
|
26
26
|
|
27
|
-
def
|
27
|
+
def my_as_json5
|
28
28
|
|
29
29
|
result = {
|
30
30
|
id: self.id,
|
@@ -42,7 +42,7 @@ module C80MapFloors
|
|
42
42
|
end
|
43
43
|
|
44
44
|
if self.building_representator.present?
|
45
|
-
result[:data] = self.building_representator.
|
45
|
+
result[:data] = self.building_representator.my_as_json6
|
46
46
|
end
|
47
47
|
|
48
48
|
result.as_json
|
@@ -12,12 +12,13 @@ module C80MapFloors
|
|
12
12
|
# поместим в него детей - здания со всеми детьми и внуками
|
13
13
|
buildings = []
|
14
14
|
C80MapFloors::MapBuilding.all.each do |map_building|
|
15
|
-
buildings << map_building.
|
15
|
+
buildings << map_building.my_as_json5
|
16
16
|
end
|
17
17
|
|
18
18
|
locs_hash["buildings"] = buildings
|
19
19
|
|
20
20
|
# запишем в файл
|
21
|
+
Rails.logger.debug '[TRACE] <map_json.update_json> Запишем JSON в файл.'
|
21
22
|
File.open(locations_path, 'w') do |f|
|
22
23
|
f.write(locs_hash.to_json)
|
23
24
|
end
|
@@ -28,6 +28,11 @@
|
|
28
28
|
<div class="overlay_layers"></div>
|
29
29
|
<svg id='svg_overlay' xmlns="http://www.w3.org/2000/svg" version="1.2" viewbox='0 0 <%= mapwidth %> <%=mapheight%>' baseProfile="tiny" preserveAspectRatio="xMaxYMax"></svg>
|
30
30
|
</div>
|
31
|
+
|
32
|
+
<div class="container" id="search_container">
|
33
|
+
<%= render_search_gui %>
|
34
|
+
</div>
|
35
|
+
|
31
36
|
<div class="container" id="ui">
|
32
37
|
<%= render "c80_map_floors/shared/map_row/building_info" %>
|
33
38
|
<%# render "layouts/shared/map_row/area_order_button" %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%# обслуживается классом search_gui.js %>
|
2
|
+
|
3
|
+
<div id="search_gui">
|
4
|
+
<form class="navbar-form" role="form">
|
5
|
+
<div class="form-group">
|
6
|
+
<input placeholder="Введите название товара, который вас интересует" class="form-control awesomplete" type="text" data-list="<%= categories_list %>">
|
7
|
+
</div>
|
8
|
+
<button type="submit" class="btn btn-primary"><i class="fa fa-search"></i></button>
|
9
|
+
</form>
|
10
|
+
</div>
|
11
|
+
<%= link_to 'Сброс', '#', :class => 'reset', :title => 'Сбросить результаты поиска' %>
|
data/config/routes.rb
CHANGED
@@ -10,4 +10,6 @@ C80MapFloors::Engine.routes.draw do
|
|
10
10
|
match '/ajax/fetch_unlinked_buildings', to: 'ajax#fetch_unlinked_buildings', via: :post
|
11
11
|
match '/ajax/fetch_unlinked_floors', to: 'ajax#fetch_unlinked_floors', via: :post
|
12
12
|
match '/ajax/fetch_unlinked_areas', to: 'ajax#fetch_unlinked_areas', via: :post
|
13
|
+
match '/ajax/find_shops', to: 'ajax#find_shops', via: :post
|
14
|
+
|
13
15
|
end
|