c80_map_floors 0.1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.travis.yml +3 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +67 -0
- data/Rakefile +1 -0
- data/app/admin/c80_map_floors/floors.rb +57 -0
- data/app/admin/c80_map_floors/map_buildings.rb +49 -0
- data/app/admin/c80_map_floors/settings.rb +32 -0
- data/app/assets/javascripts/buttons/admin_buttons/button_area_link.js +91 -0
- data/app/assets/javascripts/buttons/admin_buttons/button_building_link.js +91 -0
- data/app/assets/javascripts/buttons/admin_buttons/button_cancel_create.js +21 -0
- data/app/assets/javascripts/buttons/admin_buttons/button_cancel_remove.js +23 -0
- data/app/assets/javascripts/buttons/admin_buttons/button_complete_create.js +22 -0
- data/app/assets/javascripts/buttons/admin_buttons/button_edit.js +96 -0
- data/app/assets/javascripts/buttons/admin_buttons/button_new.js +46 -0
- data/app/assets/javascripts/buttons/admin_buttons/button_remove.js +23 -0
- data/app/assets/javascripts/buttons/admin_buttons/button_save.js +111 -0
- data/app/assets/javascripts/buttons/button_back_to_map.js +84 -0
- data/app/assets/javascripts/buttons/zoom_buttons.js +78 -0
- data/app/assets/javascripts/c80_map_floors.js.coffee +23 -0
- data/app/assets/javascripts/events/app_event.js +15 -0
- data/app/assets/javascripts/map_objects/area.js +251 -0
- data/app/assets/javascripts/map_objects/building.js +294 -0
- data/app/assets/javascripts/map_objects/dot.js +14 -0
- data/app/assets/javascripts/map_objects/floor.js +10 -0
- data/app/assets/javascripts/src/main.js +1421 -0
- data/app/assets/javascripts/src/state_controller.js +322 -0
- data/app/assets/javascripts/src/utils/map_utils.js +23 -0
- data/app/assets/javascripts/src/utils/opacity_buttons_utils.js +15 -0
- data/app/assets/javascripts/src/utils/utils.js +140 -0
- data/app/assets/javascripts/svg_elements/area_label.js +25 -0
- data/app/assets/javascripts/svg_elements/building_label.js +65 -0
- data/app/assets/javascripts/svg_elements/helper.js +36 -0
- data/app/assets/javascripts/svg_elements/polygon.js +194 -0
- data/app/assets/javascripts/view/save_preloader.js +30 -0
- data/app/assets/stylesheets/c80_map_floors.scss +4 -0
- data/app/assets/stylesheets/map.scss +1464 -0
- data/app/assets/stylesheets/view/buttons/area_order_button.scss +16 -0
- data/app/assets/stylesheets/view/buttons/back_to_map_button.scss +28 -0
- data/app/assets/stylesheets/view/elems/building_info.scss +54 -0
- data/app/assets/stylesheets/view/elems/free_areas_label.scss +116 -0
- data/app/assets/stylesheets/view/elems/map_objects/map_object_image_bg.scss +10 -0
- data/app/assets/stylesheets/view/modal_window.scss +13 -0
- data/app/assets/stylesheets/view/save_preloader.scss +206 -0
- data/app/controllers/c80_map_floors/ajax_controller.rb +65 -0
- data/app/controllers/c80_map_floors/application_controller.rb +6 -0
- data/app/controllers/c80_map_floors/map_ajax_controller.rb +70 -0
- data/app/helpers/c80_map_floors/application_helper.rb +28 -0
- data/app/models/c80_map_floors/area.rb +20 -0
- data/app/models/c80_map_floors/area_representator.rb +75 -0
- data/app/models/c80_map_floors/base_map_object.rb +41 -0
- data/app/models/c80_map_floors/building_representator.rb +72 -0
- data/app/models/c80_map_floors/floor.rb +37 -0
- data/app/models/c80_map_floors/map_building.rb +45 -0
- data/app/models/c80_map_floors/map_json.rb +35 -0
- data/app/models/c80_map_floors/setting.rb +32 -0
- data/app/uploaders/c80_map_floors/building_image_uploader.rb +31 -0
- data/app/uploaders/c80_map_floors/floor_image_uploader.rb +33 -0
- data/app/uploaders/c80_map_floors/map_image_uploader.rb +31 -0
- data/app/views/c80_map_floors/_map_row_index.html.erb +40 -0
- data/app/views/c80_map_floors/ajax/fetch_unlinked_areas.js.erb +7 -0
- data/app/views/c80_map_floors/ajax/fetch_unlinked_buildings.js.erb +7 -0
- data/app/views/c80_map_floors/ajax/map_edit_buttons.js.erb +36 -0
- data/app/views/c80_map_floors/ajax/shared/_map_creating.html.erb +6 -0
- data/app/views/c80_map_floors/ajax/shared/_map_editing.html.erb +4 -0
- data/app/views/c80_map_floors/ajax/shared/_map_removing.html.erb +5 -0
- data/app/views/c80_map_floors/ajax/shared/_select_list_unlinked_areas.html.erb +6 -0
- data/app/views/c80_map_floors/ajax/shared/_select_list_unlinked_buildings.html.erb +10 -0
- data/app/views/c80_map_floors/shared/_modal_window.html.erb +28 -0
- data/app/views/c80_map_floors/shared/_save_preloader.html.erb +3 -0
- data/app/views/c80_map_floors/shared/map_row/_area_order_button.html.erb +7 -0
- data/app/views/c80_map_floors/shared/map_row/_building_info.html.erb +17 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/c80_map_floors.gemspec +28 -0
- data/config/routes.rb +4 -0
- data/db/migrate/20161015190000_create_c80_map_floors_settings.rb +8 -0
- data/db/migrate/20161015190001_create_c80_map_floors_map_buildings.rb +10 -0
- data/db/migrate/20161015190002_create_c80_map_floors_areas.rb +12 -0
- data/db/migrate/20161015190003_add_building_representator_to_c80_map_floors_buildings.rb +6 -0
- data/db/migrate/20161015190004_create_c80_map_floors_floors.rb +16 -0
- data/db/migrate/20161019111010_add_title_to_c80_map_floors_buildings.rb +5 -0
- data/db/migrate/20161020184040_add_coords_img_to_c80_map_floors_buildings.rb +5 -0
- data/db/seeds/c80_map_floors_01_fill_map_settings.rb +6 -0
- data/db/seeds/c80_map_floors_02_create_test_area.rb +7 -0
- data/lib/c80_map_floors.rb +8 -0
- data/lib/c80_map_floors/engine.rb +23 -0
- data/lib/c80_map_floors/version.rb +3 -0
- metadata +218 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 73a33b12c304c5e1f211955a1d4adca4a02eb42d
|
4
|
+
data.tar.gz: 03302adfec9ac74cce5e91eadec8da7339ee9240
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f728f024eb6a8becab35ad28936e2f52c1610fb05daa996bf7269b3d06b085ef3484a9ad05547d303892535ee8dc6b30c1ad67610ca1d262d61f6052fc2e8ae8
|
7
|
+
data.tar.gz: e943feba78c61ea26a4514ca45be2a674b68639c6bca14f0fb70baa3e3d7855c1b3a8cbcb487d198e706117a4343d9954ee4c790d87d17ad2bec59ef6713c7a1
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 C80609A
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# C80MapFloors
|
2
|
+
|
3
|
+
The gem adds interactive map (with floors) to a site.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your host app's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'historyjs-rails'
|
11
|
+
gem 'bootstrap-sass', '~> 3.3.4'
|
12
|
+
gem 'bootstrap-select-rails'
|
13
|
+
gem 'c80_map_floors'
|
14
|
+
```
|
15
|
+
|
16
|
+
Host app's `application.js.coffee` requires:
|
17
|
+
|
18
|
+
```
|
19
|
+
#= require c80_map_floors
|
20
|
+
```
|
21
|
+
|
22
|
+
Add this to `application.scss`:
|
23
|
+
|
24
|
+
```
|
25
|
+
@import "c80_map_floors";
|
26
|
+
```
|
27
|
+
|
28
|
+
Add this to host app's `application_controller.rb`:
|
29
|
+
|
30
|
+
```
|
31
|
+
helper C80MapFloors::Engine.helpers
|
32
|
+
```
|
33
|
+
|
34
|
+
Add this to `routes.rb`:
|
35
|
+
|
36
|
+
```
|
37
|
+
mount C80MapFloors::Engine => '/'
|
38
|
+
```
|
39
|
+
|
40
|
+
# Configure
|
41
|
+
|
42
|
+
Use seeds:
|
43
|
+
|
44
|
+
```
|
45
|
+
$ rake db:seed:801_fill_map_settings
|
46
|
+
```
|
47
|
+
|
48
|
+
|
49
|
+
## Start
|
50
|
+
|
51
|
+
Create in host app's assets\javascripts:
|
52
|
+
|
53
|
+
```js
|
54
|
+
$(document).ready(function() {
|
55
|
+
if ($('#map_wrapper').length) {
|
56
|
+
InitMap({
|
57
|
+
dnd_enable:false
|
58
|
+
});
|
59
|
+
}
|
60
|
+
});
|
61
|
+
```
|
62
|
+
|
63
|
+
|
64
|
+
# Helpers
|
65
|
+
```
|
66
|
+
render_map
|
67
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,57 @@
|
|
1
|
+
ActiveAdmin.register C80MapFloors::Floor, as: 'Floor' do
|
2
|
+
|
3
|
+
menu :label => "Этажи", :parent => 'Карта'#, :if => proc { current_admin_user.email == 'tz007@mail.ru' }
|
4
|
+
|
5
|
+
before_filter :skip_sidebar!, :only => :index
|
6
|
+
|
7
|
+
permit_params :title,
|
8
|
+
:img_bg,
|
9
|
+
:img_overlay,
|
10
|
+
:coords,
|
11
|
+
:tag,
|
12
|
+
:ord,
|
13
|
+
:map_building_id
|
14
|
+
|
15
|
+
config.sort_order = 'id_asc'
|
16
|
+
|
17
|
+
index do
|
18
|
+
column :map_building
|
19
|
+
column :title
|
20
|
+
column :ord
|
21
|
+
column :tag
|
22
|
+
# column :coords
|
23
|
+
column 'img_bg' do |floor|
|
24
|
+
"#{ link_to image_tag(floor.img_bg.thumb.url, :style => 'background-color: #cfcfcf;'), floor.img_bg.url, :target => '_blank' }<br>
|
25
|
+
".html_safe
|
26
|
+
end
|
27
|
+
column :areas do |floor|
|
28
|
+
res = ''
|
29
|
+
floor.areas.all.map { |area| res += "<li>Полигон площади id=#{area.id}</li>" }
|
30
|
+
res += "<li><strong>Всего полигонов: #{floor.areas.count}</strong></li>"
|
31
|
+
"<ul>#{res}</ul>".html_safe
|
32
|
+
end
|
33
|
+
# column 'img_overlay' do |sp|
|
34
|
+
# "#{ link_to image_tag(sp.img_overlay.thumb.url), sp.img_overlay.url, :target => '_blank' }<br>
|
35
|
+
# ".html_safe
|
36
|
+
# end
|
37
|
+
actions
|
38
|
+
end
|
39
|
+
|
40
|
+
form(:html => {:multipart => true}) do |f|
|
41
|
+
|
42
|
+
f.inputs 'Properties' do
|
43
|
+
f.input :title
|
44
|
+
f.input :tag
|
45
|
+
f.input :ord
|
46
|
+
f.input :coords
|
47
|
+
f.input :img_bg, :hint => "#{image_tag(f.object.img_bg.thumb.url)}".html_safe
|
48
|
+
# f.input :img_overlay, :hint => "#{image_tag(f.object.img_overlay.thumb.url)}".html_safe
|
49
|
+
f.input :map_building,
|
50
|
+
:collection => C80MapFloors::MapBuilding.all.map { |building| ["#{building.title} (id=#{building.id})", building.id]}
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
f.actions
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
ActiveAdmin.register C80MapFloors::MapBuilding, as: 'MapBuilding' do
|
2
|
+
|
3
|
+
menu :label => 'Полигоны зданий', :parent => 'Карта'#, :if => proc { current_admin_user.email == 'tz007@mail.ru' }
|
4
|
+
|
5
|
+
before_filter :skip_sidebar!, :only => :index
|
6
|
+
|
7
|
+
permit_params :img,
|
8
|
+
:coords,
|
9
|
+
:coords_img,
|
10
|
+
:tag,
|
11
|
+
:title
|
12
|
+
|
13
|
+
config.sort_order = 'id_asc'
|
14
|
+
|
15
|
+
index do
|
16
|
+
column :id
|
17
|
+
column :tag
|
18
|
+
column :title
|
19
|
+
column :coords do |mp|
|
20
|
+
d = mp.coords
|
21
|
+
"<div style='width:100px;overflow:hidden;'>#{d}</div>".html_safe
|
22
|
+
end
|
23
|
+
column :coords_img do |mp|
|
24
|
+
d = mp.coords_img
|
25
|
+
"<div style='width:70px;overflow:hidden;'>#{d}</div>".html_safe
|
26
|
+
end
|
27
|
+
column :created_at
|
28
|
+
column :updated_at
|
29
|
+
# column 'img' do |sp|
|
30
|
+
# "#{ link_to image_tag(sp.img.thumb.url, :style => 'background-color: #cfcfcf;'), sp.img.url, :target => '_blank' }<br>
|
31
|
+
# ".html_safe
|
32
|
+
# end
|
33
|
+
actions
|
34
|
+
end
|
35
|
+
|
36
|
+
form(:html => {:multipart => true}) do |f|
|
37
|
+
|
38
|
+
f.inputs 'Свойства' do
|
39
|
+
f.input :tag
|
40
|
+
f.input :title
|
41
|
+
f.input :coords
|
42
|
+
f.input :coords_img
|
43
|
+
# f.input :img, :hint => "#{image_tag(f.object.img.thumb.url) if f.object.img.present?}".html_safe
|
44
|
+
end
|
45
|
+
|
46
|
+
f.actions
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
ActiveAdmin.register C80MapFloors::Setting, as: 'Setting' do
|
2
|
+
|
3
|
+
menu :label => "Свойства", :parent => 'Карта', :if => proc { current_admin_user.email == 'tz007@mail.ru' }
|
4
|
+
|
5
|
+
before_filter :skip_sidebar!, :only => :index
|
6
|
+
|
7
|
+
permit_params :map_image
|
8
|
+
|
9
|
+
config.sort_order = 'id_asc'
|
10
|
+
|
11
|
+
# controller do
|
12
|
+
# cache_sweeper :suit_sweeper, :only => [:update,:create,:destroy]
|
13
|
+
# end
|
14
|
+
|
15
|
+
index do
|
16
|
+
column '' do |sp|
|
17
|
+
"#{ link_to image_tag(sp.map_image.thumb.url), sp.map_image.url, :target => '_blank' }<br>
|
18
|
+
".html_safe
|
19
|
+
end
|
20
|
+
actions
|
21
|
+
end
|
22
|
+
|
23
|
+
form(:html => {:multipart => true}) do |f|
|
24
|
+
|
25
|
+
f.inputs 'Свойства карты' do
|
26
|
+
f.input :map_image, :hint => "#{image_tag(f.object.map_image.thumb.url)}".html_safe
|
27
|
+
end
|
28
|
+
|
29
|
+
f.actions
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
// при клике на эту кнопку произойдет:
|
4
|
+
// * показ прелоадера,
|
5
|
+
// * запрос за несвязанными площадями,
|
6
|
+
// * после получения ответа - показ модального окна _modal_window.html.erb куда будет подставлен %modal-title% и %modal-body%
|
7
|
+
|
8
|
+
function AreaLinkButton() {
|
9
|
+
|
10
|
+
var _map = null;
|
11
|
+
var _this = this;
|
12
|
+
_this.el = null;
|
13
|
+
|
14
|
+
var show_modal_window = function () {
|
15
|
+
|
16
|
+
//var $dialog = $('#modal_window');
|
17
|
+
//$dialog.find("h4").text($t.data("wtitle"));
|
18
|
+
//$dialog.find("#form_comment").css('display','block');
|
19
|
+
//$dialog.find("input#comment_part_id").val(partid);
|
20
|
+
//$dialog.find("input#comment_author").val(author);
|
21
|
+
|
22
|
+
var $m = $('#modal_window');
|
23
|
+
var $cc = $m.find('.modal-body');
|
24
|
+
$m.find('.modal-title').text('Укажите площадь, соответствующую полигону на карте');
|
25
|
+
|
26
|
+
setTimeout(function () {
|
27
|
+
$("select#unlinked_areas").selectpicker({size: 50, tickIcon: 'hidden'});
|
28
|
+
}, 1);
|
29
|
+
|
30
|
+
setTimeout(function () {
|
31
|
+
//console.log($cc.find("button"));
|
32
|
+
$cc.find("button").on('click', function () {
|
33
|
+
if ($(this).attr('id') == "submit_area_link") {
|
34
|
+
_map.link_area();
|
35
|
+
}
|
36
|
+
});
|
37
|
+
}, 1000);
|
38
|
+
|
39
|
+
$link_show_modal_window.click();
|
40
|
+
|
41
|
+
};
|
42
|
+
|
43
|
+
var fetch_free_areas = function () {
|
44
|
+
$.ajax({
|
45
|
+
url:'/ajax/fetch_unlinked_areas',
|
46
|
+
type:'POST',
|
47
|
+
data: {building_id:"building_id"},
|
48
|
+
dataType:'script'
|
49
|
+
}).done(fetch_free_areas_done);
|
50
|
+
};
|
51
|
+
var fetch_free_areas_done = function (data, result) {
|
52
|
+
_map.save_preloader_klass.hide();
|
53
|
+
show_modal_window();
|
54
|
+
};
|
55
|
+
|
56
|
+
var $link_show_modal_window = null;
|
57
|
+
|
58
|
+
_this.onClick = function (e) {
|
59
|
+
if (_this.el.hasClass('disabled')) return;
|
60
|
+
e.preventDefault();
|
61
|
+
|
62
|
+
console.log("<AreaLinkButton.click>");
|
63
|
+
|
64
|
+
_map.save_preloader_klass.show();
|
65
|
+
|
66
|
+
fetch_free_areas();
|
67
|
+
};
|
68
|
+
|
69
|
+
_this.init = function (button_css_selector, link_to_map) {
|
70
|
+
_map = link_to_map;
|
71
|
+
_this.el = $(button_css_selector);
|
72
|
+
_this.el.on('click', _this.onClick);
|
73
|
+
_this.hide();
|
74
|
+
|
75
|
+
// найдем кнопку, клик по которой покажет окно [_modal_window.html.erb]
|
76
|
+
$link_show_modal_window = $('.show_modal_window');
|
77
|
+
|
78
|
+
//console.log("<AreaLinkButton.init>");
|
79
|
+
//console.log(this.el);
|
80
|
+
};
|
81
|
+
|
82
|
+
_this.hide = function () {
|
83
|
+
_this.el.css('display','none');
|
84
|
+
};
|
85
|
+
|
86
|
+
_this.show = function () {
|
87
|
+
console.log("<AreaLinkButton.show>");
|
88
|
+
_this.el.css('display','block');
|
89
|
+
};
|
90
|
+
|
91
|
+
}
|
@@ -0,0 +1,91 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
// при клике на эту кнопку произойдет:
|
4
|
+
// * показ прелоадера,
|
5
|
+
// * запрос за несвязанными ЗДАНИЯМИ,
|
6
|
+
// * после получения ответа - показ модального окна _modal_window.html.erb куда будет подставлен %modal-title% и %modal-body%
|
7
|
+
|
8
|
+
function BuildingLinkButton() {
|
9
|
+
|
10
|
+
var _map = null;
|
11
|
+
var _this = this;
|
12
|
+
_this.el = null;
|
13
|
+
|
14
|
+
var show_modal_window = function () {
|
15
|
+
|
16
|
+
//var $dialog = $('#modal_window');
|
17
|
+
//$dialog.find("h4").text($t.data("wtitle"));
|
18
|
+
//$dialog.find("#form_comment").css('display','block');
|
19
|
+
//$dialog.find("input#comment_part_id").val(partid);
|
20
|
+
//$dialog.find("input#comment_author").val(author);
|
21
|
+
|
22
|
+
var $m = $('#modal_window');
|
23
|
+
var $cc = $m.find('.modal-body');
|
24
|
+
$m.find('.modal-title').text('Укажите здание, соответствующее полигону на карте');
|
25
|
+
|
26
|
+
setTimeout(function () {
|
27
|
+
$("select#unlinked_buildings").selectpicker({size: 50, tickIcon: 'hidden'});
|
28
|
+
}, 1);
|
29
|
+
|
30
|
+
setTimeout(function () {
|
31
|
+
//console.log($cc.find("button"));
|
32
|
+
$cc.find("button").on('click', function () {
|
33
|
+
if ($(this).attr('id') == "submit_building_link") {
|
34
|
+
_map.link_building();
|
35
|
+
}
|
36
|
+
});
|
37
|
+
}, 1000);
|
38
|
+
|
39
|
+
$link_show_modal_window.click();
|
40
|
+
|
41
|
+
};
|
42
|
+
|
43
|
+
var fetch_free_buildings = function () {
|
44
|
+
$.ajax({
|
45
|
+
url:'/ajax/fetch_unlinked_buildings',
|
46
|
+
type:'POST',
|
47
|
+
data: {building_id:"building_id"},
|
48
|
+
dataType:'script'
|
49
|
+
}).done(fetch_free_buildings_done);
|
50
|
+
};
|
51
|
+
var fetch_free_buildings_done = function (data, result) {
|
52
|
+
_map.save_preloader_klass.hide();
|
53
|
+
show_modal_window();
|
54
|
+
};
|
55
|
+
|
56
|
+
var $link_show_modal_window = null;
|
57
|
+
|
58
|
+
_this.onClick = function (e) {
|
59
|
+
if (_this.el.hasClass('disabled')) return;
|
60
|
+
e.preventDefault();
|
61
|
+
|
62
|
+
console.log("<BuildingLinkButton.click>");
|
63
|
+
|
64
|
+
_map.save_preloader_klass.show();
|
65
|
+
|
66
|
+
fetch_free_buildings();
|
67
|
+
};
|
68
|
+
|
69
|
+
_this.init = function (button_css_selector, link_to_map) {
|
70
|
+
_map = link_to_map;
|
71
|
+
_this.el = $(button_css_selector);
|
72
|
+
_this.el.on('click', _this.onClick);
|
73
|
+
_this.hide();
|
74
|
+
|
75
|
+
// найдем кнопку, клик по которой покажет окно [_modal_window.html.erb]
|
76
|
+
$link_show_modal_window = $('.show_modal_window');
|
77
|
+
|
78
|
+
//console.log("<BuildingLinkButton.init>");
|
79
|
+
//console.log(this.el);
|
80
|
+
};
|
81
|
+
|
82
|
+
_this.hide = function () {
|
83
|
+
_this.el.css('display','none');
|
84
|
+
};
|
85
|
+
|
86
|
+
_this.show = function () {
|
87
|
+
console.log("<BuildingLinkButton.show>");
|
88
|
+
_this.el.css('display','block');
|
89
|
+
};
|
90
|
+
|
91
|
+
}
|