c80_map_floors 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.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/buttons/button_back_to_map.js +3 -2
  3. data/app/assets/javascripts/c80_map_floors.js.coffee +1 -0
  4. data/app/assets/javascripts/lib/obj_size.js +31 -0
  5. data/app/assets/javascripts/map_objects/area.js +14 -14
  6. data/app/assets/javascripts/map_objects/building.js +27 -10
  7. data/app/assets/javascripts/src/main.js +48 -47
  8. data/app/assets/javascripts/src/state_controller.js +76 -18
  9. data/app/assets/javascripts/src/utils/i18n.js +26 -0
  10. data/app/assets/javascripts/ui/tabs/tabs.js +114 -31
  11. data/app/assets/javascripts/view/building_info/building_info.js +20 -9
  12. data/app/assets/javascripts/view/building_info/mobj_info_parser.js +57 -0
  13. data/app/assets/stylesheets/c80_map_floors.scss +1 -0
  14. data/app/assets/stylesheets/ui/tabs_js.scss +32 -0
  15. data/app/assets/stylesheets/view/elems/building_info.scss +0 -19
  16. data/app/controllers/c80_map_floors/ajax_controller.rb +1 -0
  17. data/app/models/c80_map_floors/area.rb +15 -6
  18. data/app/models/c80_map_floors/area_representator.rb +19 -2
  19. data/app/models/c80_map_floors/base_map_object.rb +8 -3
  20. data/app/models/c80_map_floors/building_representator.rb +27 -3
  21. data/app/models/c80_map_floors/floor.rb +52 -0
  22. data/app/models/c80_map_floors/floor_representator.rb +65 -0
  23. data/app/models/c80_map_floors/map_building.rb +127 -7
  24. data/app/models/c80_map_floors/map_json.rb +2 -2
  25. data/app/views/c80_map_floors/ajax/shared/_select_list_unlinked_buildings.html.erb +1 -1
  26. data/db/migrate/20161015190003_add_building_representator_to_c80_map_floors_buildings.rb +1 -1
  27. data/db/migrate/20161128181616_add_map_floor_representator_to_c80_map_floors_floors.rb +6 -0
  28. data/lib/c80_map_floors/version.rb +1 -1
  29. metadata +8 -2
@@ -30,12 +30,13 @@ function StateController() {
30
30
  mode = _map.prev_mode;
31
31
  }
32
32
 
33
- clog('<StateController.setMode> mode = ' + mode);
33
+ console.log('<StateController.setMode> Переводим карту в режим: mode = ' + mode);
34
34
 
35
35
  _map.prev_mode = _map.mode;
36
36
  _map.mode = mode;
37
37
 
38
- // этот код коррелирует с [x9cs7]. Возможно, нужен рефакторинг.
38
+ //<editor-fold desc="Впишем режим в cssClass контейнера карты">
39
+ // NOTE: этот код коррелирует с [x9cs7]. Возможно, нужен рефакторинг
39
40
  _map.container.removeClass("viewing");
40
41
  _map.container.removeClass("editing");
41
42
  _map.container.removeClass("creating");
@@ -45,12 +46,14 @@ function StateController() {
45
46
  _map.container.removeClass("view_area");
46
47
  _map.container.removeClass("edit_area");
47
48
  _map.container.addClass(mode);
49
+ //</editor-fold>
48
50
 
49
51
  _this.checkMode();
50
52
  };
51
53
 
52
54
  _this.checkMode = function () {
53
55
 
56
+ //<editor-fold desc="Предварительно проверим, все ли участники доступны">
54
57
  if (_this.new_button.length == 0) _this.new_button = $('.mapplic-new-button');
55
58
  if (_this.remove_button.length == 0) _this.remove_button = $('.mapplic-remove-button');
56
59
  if (_this.edit_button.length == 0) _this.edit_button = $('.mapplic-edit-button');
@@ -65,12 +68,13 @@ function StateController() {
65
68
  if (_this.building_info.length == 0) _this.building_info = $('.building_info');
66
69
  if (_this.area_order_button.length == 0) _this.area_order_button = $('.area_order_button');
67
70
  if (_this.masked.length == 0) _this.masked = $("#masked");
71
+ //</editor-fold>
68
72
 
69
73
  switch (_map.mode) {
70
74
 
71
- // перешли в состояние
72
- // редактирования карты
75
+ // перешли в состояние редактирования карты
73
76
  case "editing":
77
+ //<editor-fold desc="...">
74
78
 
75
79
  // спрячем надписи "цена за метр" и адрес с телефоном
76
80
  _this.left_side.css("top", -300);
@@ -99,11 +103,12 @@ function StateController() {
99
103
  // скроем подсказки - сколько свободных площадей где есть
100
104
  _map.hide_free_areas_hint();
101
105
 
102
- break;
106
+ //</editor-fold>
107
+ break;
103
108
 
104
- // перешли в состояние
105
- // просмотра карты, все здания с крышами
109
+ // перешли в состояние просмотра карты, видны все здания с крышами
106
110
  case "viewing":
111
+ //<editor-fold desc="...">
107
112
  //clog("_this.left_side.data('init') = " + _this.left_side.data('init'));
108
113
 
109
114
  // покажем надписи "цена за метр" и адрес с телефоном
@@ -158,22 +163,24 @@ function StateController() {
158
163
 
159
164
  // покажем подсказки - сколько свободных площадей где есть
160
165
  _map.show_free_areas_hint();
161
-
162
- break;
166
+ //</editor-fold>
167
+ break;
163
168
 
164
169
  // перешли в состояние рисования полигона
165
170
  case "creating":
171
+ //<editor-fold desc="...">
166
172
  //_this.mzoom_buttons.css('opacity', '0');
167
173
  _this.map_creating.css('display', 'block');
168
174
  _this.map_editing.css('display', 'none');
169
175
  _this.map_removing.css('display', 'none');
170
176
 
171
177
  _this.main_map.css('opacity', '1');
172
-
178
+ //</editor-fold>
173
179
  break;
174
180
 
175
181
  // перешли в состояние удаления полигона
176
182
  case "removing":
183
+ //<editor-fold desc="...">
177
184
  //_this.mzoom_buttons.css('opacity', '0');
178
185
  _this.map_creating.css('display', 'none');
179
186
  _this.map_editing.css('display', 'none');
@@ -187,12 +194,12 @@ function StateController() {
187
194
  OpacityButtonsUtils.hide(_this.new_button);
188
195
  OpacityButtonsUtils.hide(_this.remove_button);
189
196
  OpacityButtonsUtils.hide(_this.edit_button);
190
-
197
+ //</editor-fold>
191
198
  break;
192
199
 
193
200
  // вошли в здание
194
201
  case "view_building":
195
-
202
+ //<editor-fold desc="...">
196
203
  // покажем кнопку "обратно на карту"
197
204
  _map.back_to_map_button_klass.show();
198
205
 
@@ -221,12 +228,12 @@ function StateController() {
221
228
 
222
229
  // скроем подсказки - сколько свободных площадей где есть
223
230
  _map.hide_free_areas_hint();
224
-
231
+ //</editor-fold>
225
232
  break;
226
233
 
227
234
  // редактируем, находясь в здании
228
235
  case "edit_building":
229
-
236
+ //<editor-fold desc="...">
230
237
  // спрячем кнопку "обратно на карту"
231
238
  _map.back_to_map_button_klass.hide();
232
239
 
@@ -264,11 +271,12 @@ function StateController() {
264
271
 
265
272
  _map.save_button_klass.show();
266
273
  _map.save_button_klass.check_and_enable();
267
-
274
+ //</editor-fold>
268
275
  break;
269
276
 
270
277
  // вошли в площадь
271
278
  case "view_area":
279
+ //<editor-fold desc="...">
272
280
  _map.back_to_map_button_klass.show();
273
281
  _this.masked.removeClass('hiddn');
274
282
  var t = _this.building_info.height() + _this.building_info.offset().top;
@@ -288,12 +296,12 @@ function StateController() {
288
296
  OpacityButtonsUtils.hide(_this.remove_button);
289
297
 
290
298
  _this.mzoom_buttons.css('opacity', '1');
291
-
299
+ //</editor-fold>
292
300
  break;
293
301
 
294
302
  // начали редактировать площадь
295
303
  case 'edit_area':
296
-
304
+ //<editor-fold desc="...">
297
305
  // спрячем кнопку "обратно на карту"
298
306
  _map.back_to_map_button_klass.hide();
299
307
 
@@ -310,8 +318,58 @@ function StateController() {
310
318
  OpacityButtonsUtils.show(_this.edit_button);
311
319
 
312
320
  _map.edit_button_klass.setState('edit_area', true); // [a1x7]
321
+ //</editor-fold>
322
+ break;
323
+
324
+ // вошли на этаж
325
+ case "view_floor":
326
+ //<editor-fold desc="...">
327
+
328
+ // спрячем надписи "цена за метр" и адрес с телефоном
329
+ _this.left_side.css("top", -300);
330
+ _this.right_side.css("top", -300);
331
+
332
+ //_this.main_map.css('opacity','0.7');
333
+
334
+ // включим слой svg_overlay - а кто там живёт (запомятовал)?
335
+ _this.svg_overlay.css('display', 'block');
336
+
337
+ // выдвигаем инфо-панель
338
+ _this.building_info.css("top", _this.building_info.data("init"));
339
+
340
+ // покажем кнопку "обратно на карту"
341
+ _map.back_to_map_button_klass.show();
342
+
343
+ // прячем masked слой - а там что (запомятовал)?
344
+ _this.masked.addClass('hiddn');
345
+
346
+ // скроем кнопку "связать здание с полигоном"
347
+ _map.building_link_button_klass.hide();
348
+
349
+ // прячем кнопку "отправить заявку на аренду площади"
350
+ _this.area_order_button.css('display', 'none');
351
+
352
+ // кнопку "редактировать переводим в СООТВЕТСТВУЮЩЕЕ состояние
353
+ _map.edit_button_klass.setState('edit_button_view_floor', true); // [a1x7]
354
+
355
+ // сбросим z-index (пояснение "что это" см. в комментах к resetOverlayZindex)
356
+ //if (_map.current_building != undefined) _map.current_building.resetOverlayZindex();
357
+
358
+ // спрячем кнопку "сохранить"
359
+ _map.save_button_klass.hide();
360
+
361
+ // спрячем кнопки "добавить полигон" и "удалить полигон"
362
+ OpacityButtonsUtils.hide(_this.new_button);
363
+ OpacityButtonsUtils.hide(_this.remove_button);
364
+
365
+ // покажем zoom кнопки
366
+ _this.mzoom_buttons.css('opacity', '1');
367
+
368
+ // скроем подсказки - сколько свободных площадей где есть
369
+ _map.hide_free_areas_hint();
370
+ //</editor-fold>
371
+ break;
313
372
 
314
- break;
315
373
  }
316
374
  };
317
375
 
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ var I18n = function () {
4
+
5
+ var _dictionary = {
6
+ square : 'Общая площадь',
7
+ square_free : 'Свободная площадь',
8
+ floor_height : 'Высота потолков',
9
+ communications: 'Коммуникации',
10
+
11
+ areas_count : 'Площадей',
12
+ areas_free_count: 'Свободных площадей',
13
+ price_string : ''
14
+ };
15
+
16
+ this.t = function (key) {
17
+ return _dictionary[key];
18
+ };
19
+
20
+ var _fInit = function () {
21
+
22
+ };
23
+
24
+ _fInit();
25
+
26
+ }
@@ -15,7 +15,9 @@ function Tabs(options) {
15
15
  var _this = this;
16
16
 
17
17
  // параметры, по которым построен компонент
18
- var _options;
18
+ var _options = {
19
+ info_helper: null // помогает преобразовывать json в человеческий текст
20
+ };
19
21
 
20
22
  // view контейнеры, в которых живут кнопки и контент
21
23
  var _$div_tabs;
@@ -25,9 +27,6 @@ function Tabs(options) {
25
27
  // массив кнопок
26
28
  var _tab_buttons = [];
27
29
 
28
- // массив содержимого вкладок
29
- var _tab_contents = [];
30
-
31
30
  // айди текущей просматриваемой вкладки
32
31
  var _current_tab_id = -1;
33
32
 
@@ -46,7 +45,7 @@ function Tabs(options) {
46
45
  * Удалить все элементы: кнопки, вкладки и данные
47
46
  */
48
47
  this.removeAll = function () {
49
- console.log('<removeAll>');
48
+ console.log('<Tabs.removeAll> Начинаем удалять все элементы: кнопки, вкладки и данные.');
50
49
 
51
50
  // очистим данные
52
51
  _data = {};
@@ -58,37 +57,42 @@ function Tabs(options) {
58
57
  _current_tab_id = -1;
59
58
 
60
59
  // удалим все кнопки и слушатели
61
- for (var i = 0; i < _tab_buttons.length; i++) {
62
- var $ibuttn = _tab_buttons[i];
63
- $ibuttn.remove();
64
- $ibuttn.off('click', this._onTabButtonClick)
65
- }
60
+ _this._buttonRemoveAll();
61
+
62
+ // очистим _$div_tab_content
63
+ _$div_tab_content.html('<i></i>');
66
64
 
67
65
  };
68
66
 
69
67
  /**
70
- * Добавить именованную вкладку.
71
- *
68
+ * Добавить именованную вкладку (вкладка = tab-button + tab-content).
72
69
  *
73
70
  * @param tab_title
74
- * @param tab_id
75
- * @param on_tab_show
71
+ * @param tab_id ID вкладки равен ID Полигона Этажа // NOTE:fidfid
72
+ * @param on_tab_show Колбэк: сигнал наверх, когда по tab-кнопке кликнули
73
+ * @param params Опции: tab_data - данные для отображения в tab-content.
76
74
  *
77
75
  */
78
- this.addTab = function (tab_title, tab_id, on_tab_show) {
76
+ this.addTab = function (tab_title, tab_id, on_tab_show, params) {
77
+ console.log("<Tabs.addTab> Добавить вкладку, title: " + tab_title);
79
78
 
80
79
  // создадим кнопку и контент
81
- var btn = this._buttonAdd(tab_title, tab_id, on_tab_show);
82
- //var cnt = this._contentAdd();
80
+ var btn = _this._buttonAdd(tab_title, tab_id, on_tab_show);
81
+ var cnt;
82
+
83
+ if (params != undefined) {
84
+ if (params['tab_data'] != undefined) {
85
+ cnt = params['tab_data'];
86
+ }
87
+ }
83
88
 
84
89
  // запишем это в структуру
85
- _data[tab_id] = {
90
+ _data[tab_id] = { // tab_id это ID Полигона Этажа // NOTE:fidfid
86
91
  tab_button: btn,
87
- tab_content: null
92
+ tab_content: cnt
88
93
  };
89
94
 
90
- // поместим в массивы
91
- //_tab_contents.push(cnt);
95
+ //console.log('for breakpoint');
92
96
 
93
97
  };
94
98
 
@@ -105,18 +109,20 @@ function Tabs(options) {
105
109
  //console.log(e);
106
110
  e.preventDefault();
107
111
 
112
+ //<editor-fold desc="//Подготовка - фиксируем переменные...">
108
113
  // фиксируем кнопку
109
114
  var $clicked_button = $(e.target);
110
115
 
111
116
  // зафиксируем id нажатой кнопки
112
- var clicked_id = $clicked_button.data('id');
117
+ var clicked_id = $clicked_button.data('id'); // Это ID Полигона Этажа // NOTE:fidfid
113
118
  //console.log('<_onTabButtonClick> clicked_id: ' + clicked_id);
114
119
 
115
120
  // зафиксируем index нажатой кнопки
116
121
  var clicked_index = $clicked_button.data('index');
117
122
  //console.log('<_onTabButtonClick> clicked_index: ' + clicked_index);
123
+ //</editor-fold>
118
124
 
119
- // сравним с курсором, колбэк вызовем, только если есть изменения
125
+ // колбэк вызовем, только тогда, когда "tab-курсор" в самом деле изменился
120
126
  if (_current_tab_id != clicked_id) {
121
127
 
122
128
  _current_tab_id = clicked_id;
@@ -129,47 +135,121 @@ function Tabs(options) {
129
135
 
130
136
  }
131
137
 
132
- // сделаем эту кнопку активной
138
+ //<editor-fold desc="// сделаем эту кнопку активной...">
133
139
  _$div_tab_buttons
134
140
  .find('a')
135
141
  .removeClass('active');
136
142
  _$div_tab_buttons
137
143
  .find('a[data-index='+clicked_index+']')
138
144
  .addClass('active');
145
+ //</editor-fold>
146
+
147
+ // Отобразим во вкладке соответствующие данные
148
+ _this._displayContent(_data[clicked_id]['tab_content']);
139
149
 
140
150
  };
141
151
 
142
152
  //--[ private ]----------------------------------------------------------------------------------------------------------------------
143
153
 
154
+ /** Добавить tab-кнопку.
155
+ *
156
+ * @param tab_button_title
157
+ * @param button_id Это ID Полигона Этажа // NOTE:fidfid
158
+ * @param on_click_callback
159
+ * @private
160
+ */
144
161
  this._buttonAdd = function (tab_button_title, button_id, on_click_callback) {
145
- console.log('<_addTabButton> tab_button_title: ' + tab_button_title);
162
+ console.log('<Tabs._addTabButton> Добавляем одну кнопку: tab_button_title: ' + tab_button_title);
146
163
 
147
164
  // создадим кнопку
165
+ //noinspection JSUnresolvedFunction
148
166
  var b = $('<a href="#"></a>')
149
167
  .text(tab_button_title)
150
- .attr('data-id',button_id)
168
+ .attr('data-id',button_id) // Это ID Полигона Этажа // NOTE:fidfid
151
169
  .attr('data-index', _tab_buttons.length)
152
170
  //.data('id', button_id)
153
171
  //.data('index', _tab_buttons.length)
154
172
  .appendTo(_$div_tab_buttons)
155
- .on('click', this._onTabButtonClick);
173
+ .on('click', _this._onTabButtonClick);
156
174
 
157
175
  // её колбэк поместим в отдельный массив
158
176
  _callbacks[button_id] = on_click_callback;
159
177
 
160
178
  _tab_buttons.push(b);
161
179
 
162
- };
180
+ return b;
163
181
 
164
- this._contentAdd = function () {
182
+ };
165
183
 
184
+ //this._contentAdd = function () {
185
+ //
186
+ //};
187
+
188
+ // удалить все кнопки
189
+ this._buttonRemoveAll = function () {
190
+ console.log("<Tabs._buttonRemoveAll> Начинаем удалять все кнопки-вкладки:");
191
+
192
+ //var n = _tab_buttons.length;
193
+ //for (var i = 0; i < n; i++) {
194
+ // var $ibuttn = _tab_buttons[i];
195
+ // $ibuttn.remove();
196
+ // $ibuttn.off('click', this._onTabButtonClick)
197
+ //}
198
+
199
+ var $ibuttn;
200
+ while (_tab_buttons.length) {
201
+ $ibuttn = _tab_buttons.pop();
202
+ _this._buttonRemove($ibuttn);
203
+ }
166
204
  };
167
205
 
206
+ // удалить одну кнопку
168
207
  this._buttonRemove = function ($a_button) {
169
-
208
+ console.log("<Tabs._buttonRemove> Удаляем одну кнопку: tab_button_title = " + $a_button.text());
209
+ $a_button.remove();
210
+ //noinspection JSUnresolvedFunction
211
+ $a_button.off('click', _this._onTabButtonClick);
170
212
  };
171
213
 
172
- this._contentRemove = function () {
214
+ //this._contentRemove = function () {
215
+ //
216
+ //};
217
+
218
+ /** Отобразить во вкладке данные [об Этаже/Здании/Площади].
219
+ *
220
+ * @param json Конкретный узел полигона Этажа/Здания/Площади
221
+ * @private
222
+ */
223
+ this._displayContent = function (json) {
224
+ console.log("<Tabs._displayContent> Отобразить во вкладке данные об Этаже/Здании/Площади, json: ");
225
+ console.log(json);
226
+
227
+ // если будет true - значит будет показано сообщение об ошибке
228
+ var mark_error_occurs = false;
229
+
230
+ if (_options['info_helper'] != undefined) {
231
+ if (json != undefined && json['data'] != null) {
232
+ if (json['class_name'] != undefined) {
233
+
234
+ var json_as_html_text = _options['info_helper'].makeHtmlText(json);
235
+ _$div_tab_content.html(json_as_html_text);
236
+ }
237
+
238
+ else {
239
+ mark_error_occurs = true;
240
+ }
241
+ } else {
242
+ mark_error_occurs = true;
243
+ }
244
+ } else {
245
+ alert('Error, refer log for details.');
246
+ console.log('<_displayContent> [ERROR] info_helper не определён.');
247
+ }
248
+
249
+ if (mark_error_occurs) {
250
+ alert('data error, refer log for details.');
251
+ console.log('<_displayContent> [ERROR] Что-то не то с данными.');
252
+ }
173
253
 
174
254
  };
175
255
 
@@ -182,6 +262,9 @@ function Tabs(options) {
182
262
  _$div_tab_content = _$div_tabs.find('.tab_content');
183
263
  }
184
264
 
265
+ //info_helper
266
+ _options = $.extend(_options, options);
267
+
185
268
  };
186
269
 
187
270
  //--[ startup ]----------------------------------------------------------------------------------------------------------------------
@@ -15,11 +15,15 @@ function BuildingInfo(options) {
15
15
  // заголовок - название здания
16
16
  var _$title;
17
17
 
18
+ // помощник в преобразовании JSON характеристик в human-читаемые текста
19
+ var _mobj_info_parser = null;
20
+
18
21
  // компонент "вкладки"
19
22
  var _tabs = null;
20
23
 
21
24
  // привязка данных об этажах здания ко вкладкам в этом удобном хэше
22
- var _tabs_floors_data = {};
25
+ // NOTE:: но нахуя он был добавлен - пока загадка. В комменты его. Детективная история, главная улика - слово "удобный".
26
+ //var _tabs_floors_data = {};
23
27
 
24
28
  //-[ public ]-----------------------------------------------------------------------------------------------------------------------
25
29
 
@@ -28,7 +32,7 @@ function BuildingInfo(options) {
28
32
  * @param map_building_json Это данные от C80MapFloors::MapBuilding
29
33
  */
30
34
  this.setData = function (map_building_json) {
31
- //console.log('<BuildingInfo.setData>');
35
+ console.log('<BuildingInfo.setData> Получили данные для отображения - map_building_json.');
32
36
  //console.log(map_building_json);
33
37
 
34
38
  _cur_map_building_json = map_building_json;
@@ -69,8 +73,13 @@ function BuildingInfo(options) {
69
73
  // TODO:: _options extend options
70
74
  _options = $.extend(_options, options);
71
75
 
76
+ // кастуем помощника
77
+ _mobj_info_parser = new MobjInfoParser();
78
+
72
79
  // создаём компонент "вкладки"
73
- _tabs = new Tabs();
80
+ _tabs = new Tabs({
81
+ info_helper: _mobj_info_parser
82
+ });
74
83
 
75
84
  // находим заголовок
76
85
  _$title = $('.building_info').find('h3');
@@ -78,7 +87,7 @@ function BuildingInfo(options) {
78
87
  };
79
88
 
80
89
  this._parseData = function () {
81
- console.log('<BuildingInfo._parseData>');
90
+ console.log('<BuildingInfo._parseData> Парсим map_building_json, заполняем Tabs компонент:');
82
91
 
83
92
  // установим заголовок окна
84
93
  _$title.text(_cur_map_building_json["title"]);
@@ -91,12 +100,14 @@ function BuildingInfo(options) {
91
100
  //console.log(ifloor_data); // => see C80MapFloors::Floor.as_json
92
101
 
93
102
  // создадим вкладку
94
- _tabs.addTab(ifloor_data["title"], ifloor_id, this._onTabShow);
103
+ _tabs.addTab(ifloor_data["title"], ifloor_id, this._onTabShow, {
104
+ tab_data: ifloor_data
105
+ });
95
106
 
96
107
  // свяжем её по id с даными
97
- _tabs_floors_data[ifloor_id] = {
98
- tab_data: ifloor_data
99
- }
108
+ //_tabs_floors_data[ifloor_id] = {
109
+ // tab_data: ifloor_data
110
+ //}
100
111
  }
101
112
  };
102
113
 
@@ -108,7 +119,7 @@ function BuildingInfo(options) {
108
119
  this._removeAll = function () {
109
120
 
110
121
  _$title.text('');
111
- _tabs_floors_data = {};
122
+ //_tabs_floors_data = {};
112
123
  _tabs.removeAll();
113
124
  };
114
125
 
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ // в задачи этого кода входит преобразование JSON объектов в human-читаемый текст с характеристиками
4
+
5
+ var MobjInfoParser = function () {
6
+
7
+ var _this = this;
8
+
9
+ // с помощью этого хелпера можно понять, например, что square это "общая площадь" (типа locales/ru.yml)
10
+ var _i18n = null;
11
+
12
+ /** Лабаем html текст из json-данных полигона Этажа/Здания/Площади
13
+ *
14
+ * @param json
15
+ */
16
+ this.makeHtmlText = function (json) {
17
+ console.log("<makeHtmlText> Лабаем html текст из json данных полигона.");
18
+
19
+ var result = "";
20
+
21
+ //#-> предполагается, что json в поряде и данные целостны (т.е. уровнем выше была проверка json на корректность)
22
+ switch (json["class_name"]) {
23
+ case "C80MapFloors::Floor":
24
+ result += _this._row('square', json);
25
+ result += _this._row('square_free', json);
26
+ result += _this._row('floor_height', json);
27
+ result += _this._row('areas_count', json);
28
+ result += _this._row('areas_free_count', json);
29
+ result += _this._row('price_string', json);
30
+ break;
31
+ }
32
+
33
+ result = "<ul>" + result + "</ul>";
34
+ return result;
35
+
36
+ };
37
+
38
+ this._row = function (key, json) {
39
+ var s = '';
40
+ if (key == 'price_string') {
41
+ s = "<li>" + json['data'][key] + "</li>";
42
+ } else {
43
+ s = "<li>" + _i18n.t(key) + ": " + "<span class='dd'>" + json['data'][key] + "</span>" + "</li>"
44
+ }
45
+ return s;
46
+ };
47
+
48
+ var _fInit = function () {
49
+
50
+ // кастуем locales-помощника
51
+ _i18n = new I18n();
52
+
53
+ };
54
+
55
+ _fInit();
56
+ };
57
+
@@ -1,4 +1,5 @@
1
1
  @import "bootstrap-sprockets";
2
2
  @import "bootstrap";
3
3
  @import "map";
4
+ @import "ui/**/*";
4
5
  @import "view/**/*";
@@ -0,0 +1,32 @@
1
+ div.tabs_js {
2
+
3
+ div.tab_buttons {
4
+
5
+ }
6
+
7
+ div.tab_content {
8
+ padding: 5px 15px 15px 20px;
9
+ color: #1A1A1A;
10
+
11
+ ul {
12
+ list-style: none;
13
+ margin-left: 0;
14
+ padding-left: 0;
15
+ /*@include frankRegular(15px);*/
16
+
17
+ li {
18
+ overflow: hidden;
19
+
20
+ -webkit-transition: all 0.3s;
21
+ -moz-transition: all 0.3s;
22
+ transition: all 0.3s;
23
+
24
+ span {
25
+ color: #6f6f6f;
26
+ }
27
+ }
28
+ }
29
+
30
+ }
31
+
32
+ }