c80_estate 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 +4 -4
- data/.gitignore +1 -0
- data/app/admin/c80_estate/areas.rb +39 -4
- data/app/admin/c80_estate/astatuses.rb +38 -0
- data/app/admin/c80_estate/atypes.rb +2 -2
- data/app/admin/c80_estate/prop_names.rb +6 -5
- data/app/admin/c80_estate/properties.rb +37 -5
- data/app/admin/c80_estate/role_types.rb +2 -2
- data/app/admin/c80_estate/uoms.rb +2 -1
- data/app/models/c80_estate/area.rb +46 -0
- data/app/models/c80_estate/atype.rb +1 -1
- data/app/models/c80_estate/item_prop.rb +1 -1
- data/app/models/c80_estate/owner.rb +9 -1
- data/app/models/c80_estate/property.rb +10 -0
- data/db/migrate/20160629033535_create_c80_estate_properties.rb +3 -1
- data/db/migrate/{20160629033533_create_c80_estate_areas.rb → 20160629033538_create_c80_estate_areas.rb} +2 -0
- data/db/migrate/20160629092323_create_c80_item_props.rb +1 -1
- data/lib/c80_estate/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7026b2c7a64312ec5ce4d64dc56c1348a8e80802
|
4
|
+
data.tar.gz: c1ea25b1914fa8c6150f3397e84b5986fc7cf225
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d908754c97482adeffd78c824df3e3418ce57334840c530439bb0b49fbff876ce73ead761ed014da6431cb956a56b0aca821d5894e84cf3e9ac96be0d5cc87a8
|
7
|
+
data.tar.gz: c5834bb08f8632b2c97c159b0cd37e36dc3a56b3f11d43df12f3352bd695866e300348731e93c1ae1a8a4263a461e476d644c2385912591039c14c02b6e18886
|
data/.gitignore
CHANGED
@@ -8,17 +8,46 @@ ActiveAdmin.register C80Estate::Area, as: 'Area' do
|
|
8
8
|
:desc,
|
9
9
|
:owner_id,
|
10
10
|
:owner_type,
|
11
|
+
:assigned_person_id,
|
12
|
+
:assigned_person_type,
|
11
13
|
:atype_id,
|
12
14
|
:property_id,
|
15
|
+
:astatus_ids => [],
|
13
16
|
:aphotos_attributes => [:id,:image,:_destroy],
|
14
17
|
:item_props_attributes => [:value, :_destroy, :prop_name_id, :id]
|
15
18
|
|
16
19
|
config.sort_order = 'id_asc'
|
17
20
|
|
21
|
+
filter :title
|
22
|
+
filter :property_id,
|
23
|
+
:as => :select,
|
24
|
+
:collection => -> {C80Estate::Property.all.map { |p| ["#{p.title}", p.id]}},
|
25
|
+
:input_html => { :class => 'selectpicker', 'data-size' => "10", 'data-width' => '100%'}
|
26
|
+
filter :assigned_person_id,
|
27
|
+
:as => :select,
|
28
|
+
:collection => -> {AdminUser.all.map{|u| ["#{u.email}", u.id]}},
|
29
|
+
:input_html => { :class => 'selectpicker', 'data-size' => "10", 'data-width' => '100%'}
|
30
|
+
filter :created_at
|
31
|
+
filter :updated_at
|
32
|
+
|
33
|
+
scope "All", :all_areas
|
34
|
+
scope "Free", :free_areas
|
35
|
+
scope "Busy", :busy_areas
|
36
|
+
|
18
37
|
index do
|
38
|
+
selectable_column
|
19
39
|
column :title
|
20
40
|
column :atype do |area|
|
21
|
-
area.
|
41
|
+
area.atype_title
|
42
|
+
end
|
43
|
+
column :property do |area|
|
44
|
+
area.property_title
|
45
|
+
end
|
46
|
+
column :astatuses do |area|
|
47
|
+
area.astatus_title
|
48
|
+
end
|
49
|
+
column :assigned_person do |area|
|
50
|
+
area.assigned_person_title
|
22
51
|
end
|
23
52
|
actions
|
24
53
|
end
|
@@ -27,11 +56,17 @@ ActiveAdmin.register C80Estate::Area, as: 'Area' do
|
|
27
56
|
|
28
57
|
f.inputs 'Свойства' do
|
29
58
|
f.input :title
|
30
|
-
f.input :atype, :input_html => { :class => 'selectpicker', 'data-size' => "
|
31
|
-
f.input :property, :input_html => { :class => 'selectpicker', 'data-size' => "
|
59
|
+
f.input :atype, :input_html => { :class => 'selectpicker', 'data-size' => "10", 'data-width' => '400px'}
|
60
|
+
f.input :property, :input_html => { :class => 'selectpicker', 'data-size' => "10", 'data-width' => '400px'}
|
61
|
+
f.input :assigned_person,
|
62
|
+
:input_html => { :class => 'selectpicker', 'data-size' => "10", 'data-width' => '400px'},
|
63
|
+
:collection => AdminUser.all.map{|u| ["#{u.email}", u.id]}
|
64
|
+
f.input :assigned_person_type, :input_html => { :value => "AdminUser" }, as: :hidden
|
65
|
+
f.input :astatuses,
|
66
|
+
:input_html => { :class => 'selectpicker', 'data-size' => "10", 'data-width' => '400px', :multiple => false}
|
32
67
|
f.input :desc, :as => :ckeditor
|
33
68
|
|
34
|
-
f.inputs "
|
69
|
+
f.inputs "Свойства" do
|
35
70
|
|
36
71
|
f.has_many :item_props, :allow_destroy => true do |item_prop|
|
37
72
|
item_prop.input :prop_name
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# ПОДкатегории строительных материалов
|
2
|
+
ActiveAdmin.register C80Estate::Astatus, :as => 'Astatus' do
|
3
|
+
|
4
|
+
menu :label => "Статусы", :parent => "Настройки"
|
5
|
+
|
6
|
+
permit_params :title
|
7
|
+
|
8
|
+
config.sort_order = 'id_asc'
|
9
|
+
|
10
|
+
# controller do
|
11
|
+
# cache_sweeper :strsubcat_sweeper, :only => [:update,:create,:destroy]
|
12
|
+
# end
|
13
|
+
|
14
|
+
before_filter :skip_sidebar!, :only => :index
|
15
|
+
|
16
|
+
# filter :title
|
17
|
+
|
18
|
+
# controller do
|
19
|
+
# cache_sweeper :suit_sweeper, :only => [:update,:create,:destroy]
|
20
|
+
# end
|
21
|
+
|
22
|
+
index do
|
23
|
+
selectable_column
|
24
|
+
id_column
|
25
|
+
column :title
|
26
|
+
actions
|
27
|
+
end
|
28
|
+
|
29
|
+
form(:html => {:multipart => true}) do |f|
|
30
|
+
|
31
|
+
f.inputs "Свойства" do
|
32
|
+
f.input :title
|
33
|
+
end
|
34
|
+
|
35
|
+
f.actions
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -13,9 +13,9 @@ ActiveAdmin.register C80Estate::Atype, :as => 'Atype' do
|
|
13
13
|
# cache_sweeper :strsubcat_sweeper, :only => [:update,:create,:destroy]
|
14
14
|
# end
|
15
15
|
|
16
|
-
|
16
|
+
before_filter :skip_sidebar!, :only => :index
|
17
17
|
|
18
|
-
filter :title
|
18
|
+
# filter :title
|
19
19
|
|
20
20
|
# controller do
|
21
21
|
# cache_sweeper :suit_sweeper, :only => [:update,:create,:destroy]
|
@@ -9,10 +9,11 @@ ActiveAdmin.register C80Estate::PropName, as: 'PropName' do
|
|
9
9
|
|
10
10
|
config.sort_order = 'title_asc'
|
11
11
|
|
12
|
-
|
13
|
-
filter :
|
14
|
-
filter :
|
15
|
-
filter :
|
12
|
+
before_filter :skip_sidebar!, :only => :index
|
13
|
+
# filter :title
|
14
|
+
# filter :atypes
|
15
|
+
# filter :is_excluded_from_filtering
|
16
|
+
# filter :is_normal_price
|
16
17
|
|
17
18
|
# controller do
|
18
19
|
# cache_sweeper :suit_sweeper, :only => [:update,:create,:destroy]
|
@@ -34,7 +35,7 @@ ActiveAdmin.register C80Estate::PropName, as: 'PropName' do
|
|
34
35
|
|
35
36
|
f.inputs "Свойства" do
|
36
37
|
f.input :title
|
37
|
-
f.input :uom, :input_html => { :class => 'selectpicker', 'data-size' => "5", 'data-width' => '
|
38
|
+
f.input :uom, :input_html => { :class => 'selectpicker', 'data-size' => "5", 'data-width' => '400px'}
|
38
39
|
f.input :is_excluded_from_filtering,
|
39
40
|
:hint => "Если да, то это свойство не будет фигурировать в списке фильтрации".html_safe
|
40
41
|
|
@@ -9,17 +9,35 @@ ActiveAdmin.register C80Estate::Property, as: 'Property' do
|
|
9
9
|
:address,
|
10
10
|
:latitude,
|
11
11
|
:longitude,
|
12
|
-
:atype_id,
|
12
|
+
# :atype_id,
|
13
13
|
:owner_id,
|
14
|
-
:owner_type
|
14
|
+
:owner_type,
|
15
|
+
:assigned_person_id,
|
16
|
+
:assigned_person_type
|
15
17
|
|
16
18
|
config.sort_order = 'id_asc'
|
17
19
|
|
20
|
+
filter :title
|
21
|
+
filter :created_at
|
22
|
+
filter :updated_at
|
23
|
+
filter :assigned_person_id,
|
24
|
+
:as => :select,
|
25
|
+
:collection => -> {AdminUser.all.map{|u| ["#{u.email}", u.id]}},
|
26
|
+
:input_html => { :class => 'selectpicker', 'data-size' => "10", 'data-width' => '100%'}
|
27
|
+
|
18
28
|
index do
|
29
|
+
selectable_column
|
19
30
|
column :title
|
20
|
-
column :
|
21
|
-
|
31
|
+
column :address
|
32
|
+
column :gps do |prop|
|
33
|
+
"#{prop.latitude},#{prop.longitude}"
|
34
|
+
end
|
35
|
+
column :assigned_person do |prop|
|
36
|
+
prop.assigned_person_title
|
22
37
|
end
|
38
|
+
# column :atype do |prop|
|
39
|
+
# prop.atype.title
|
40
|
+
# end
|
23
41
|
actions
|
24
42
|
end
|
25
43
|
|
@@ -27,9 +45,23 @@ ActiveAdmin.register C80Estate::Property, as: 'Property' do
|
|
27
45
|
|
28
46
|
f.inputs 'Свойства' do
|
29
47
|
f.input :title
|
30
|
-
f.input :
|
48
|
+
f.input :assigned_person,
|
49
|
+
:input_html => { :class => 'selectpicker', 'data-size' => "10", 'data-width' => '400px'},
|
50
|
+
:collection => AdminUser.all.map{|u| ["#{u.email}", u.id]}
|
51
|
+
f.input :assigned_person_type, :input_html => { :value => "AdminUser" }, as: :hidden
|
52
|
+
# f.input :atype, :input_html => { :class => 'selectpicker', 'data-size' => "5", 'data-width' => '400px'}
|
31
53
|
f.input :owner_id, :input_html => { :value => current_admin_user.id }, as: :hidden
|
32
54
|
f.input :owner_type, :input_html => { :value => "AdminUser" }, as: :hidden
|
55
|
+
f.input :address
|
56
|
+
f.input :latitude
|
57
|
+
f.input :longitude
|
58
|
+
|
59
|
+
f.has_many :pphotos, :allow_destroy => true do |gp|
|
60
|
+
gp.input :image,
|
61
|
+
:as => :file,
|
62
|
+
:hint => image_tag(gp.object.image.thumb512)
|
63
|
+
end
|
64
|
+
|
33
65
|
end
|
34
66
|
|
35
67
|
f.actions
|
@@ -12,9 +12,9 @@ ActiveAdmin.register C80Estate::RoleType, :as => 'RoleType' do
|
|
12
12
|
# cache_sweeper :strsubcat_sweeper, :only => [:update,:create,:destroy]
|
13
13
|
# end
|
14
14
|
|
15
|
-
|
15
|
+
before_filter :skip_sidebar!, :only => :index
|
16
16
|
|
17
|
-
filter :title
|
17
|
+
# filter :title
|
18
18
|
|
19
19
|
# controller do
|
20
20
|
# cache_sweeper :suit_sweeper, :only => [:update,:create,:destroy]
|
@@ -3,6 +3,7 @@ module C80Estate
|
|
3
3
|
belongs_to :property
|
4
4
|
belongs_to :atype
|
5
5
|
belongs_to :owner, :polymorphic => true
|
6
|
+
belongs_to :assigned_person, :polymorphic => true
|
6
7
|
has_many :item_props, :dependent => :destroy
|
7
8
|
accepts_nested_attributes_for :item_props,
|
8
9
|
:reject_if => lambda { |attributes|
|
@@ -22,5 +23,50 @@ module C80Estate
|
|
22
23
|
has_many :comments, :dependent => :destroy # площадь можно прокомментировать
|
23
24
|
has_and_belongs_to_many :astatuses, # единственный статус: либо занята, либо свободна
|
24
25
|
:join_table => 'c80_estate_areas_astatuses'
|
26
|
+
|
27
|
+
def self.all_areas
|
28
|
+
self.all
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.free_areas
|
32
|
+
self.joins(:astatuses).where(:c80_estate_astatuses => { tag: 'free'})
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.busy_areas
|
36
|
+
self.joins(:astatuses).where(:c80_estate_astatuses => { tag: 'busy'})
|
37
|
+
end
|
38
|
+
|
39
|
+
def atype_title
|
40
|
+
res = "-"
|
41
|
+
if atype.present?
|
42
|
+
res = atype.title
|
43
|
+
end
|
44
|
+
res
|
45
|
+
end
|
46
|
+
|
47
|
+
def property_title
|
48
|
+
res = "-"
|
49
|
+
if property.present?
|
50
|
+
res = property.title
|
51
|
+
end
|
52
|
+
res
|
53
|
+
end
|
54
|
+
|
55
|
+
def astatus_title
|
56
|
+
res = "-"
|
57
|
+
if astatuses.count > 0
|
58
|
+
res = astatuses.first.title
|
59
|
+
end
|
60
|
+
res
|
61
|
+
end
|
62
|
+
|
63
|
+
def assigned_person_title
|
64
|
+
res = "-"
|
65
|
+
if assigned_person.present?
|
66
|
+
res = assigned_person.email
|
67
|
+
end
|
68
|
+
res
|
69
|
+
end
|
70
|
+
|
25
71
|
end
|
26
72
|
end
|
@@ -11,7 +11,7 @@ module C80Estate
|
|
11
11
|
:after_remove => :after_remove_prop_names
|
12
12
|
|
13
13
|
has_many :areas, :dependent => :destroy
|
14
|
-
has_many :properties, :dependent => :destroy
|
14
|
+
# has_many :properties, :dependent => :destroy
|
15
15
|
has_many :atphotos, :dependent => :destroy # одна или несколько фоток
|
16
16
|
|
17
17
|
extend FriendlyId
|
@@ -18,10 +18,12 @@ module C80Estate
|
|
18
18
|
|
19
19
|
def act_as_owner
|
20
20
|
class_eval do
|
21
|
+
|
21
22
|
# эти взаимосвязи можно трактовать, как "создатель объектов этих классов"
|
22
23
|
has_many :areas, :as => :owner, :class_name => 'C80Estate::Area', :dependent => :nullify
|
23
24
|
has_many :properties, :as => :owner, :class_name => 'C80Estate::Property', :dependent => :nullify
|
24
25
|
has_many :comments, :as => :owner, :class_name => 'C80Estate::Comment', :dependent => :destroy
|
26
|
+
|
25
27
|
# эта взаимосвязь трактуется, как "роль, назначенная персоне"
|
26
28
|
has_many :roles, :as => :owner, :class_name => 'C80Estate::Role', :dependent => :destroy
|
27
29
|
accepts_nested_attributes_for :roles,
|
@@ -30,10 +32,16 @@ module C80Estate
|
|
30
32
|
},
|
31
33
|
:allow_destroy => true
|
32
34
|
|
35
|
+
# эта взаимосвязь трактуется, как "площадь, назначенная сотруднику"
|
36
|
+
has_many :assigned_areas, :as => :assigned_person, :class_name => 'C80Estate::Area', :dependent => :nullify
|
37
|
+
|
38
|
+
# эта взаимосвязь трактуется, как "площадь, назначенная сотруднику"
|
39
|
+
has_many :assigned_properties, :as => :assigned_person, :class_name => 'C80Estate::Property', :dependent => :nullify
|
40
|
+
|
33
41
|
after_create :create_role
|
34
42
|
|
35
43
|
def create_role
|
36
|
-
Rails.logger.debug('<Owner.create_role>')
|
44
|
+
# Rails.logger.debug('<Owner.create_role>')
|
37
45
|
r = C80Estate::Role.create({ role_type_id: nil })
|
38
46
|
roles << r
|
39
47
|
end
|
@@ -2,6 +2,7 @@ module C80Estate
|
|
2
2
|
class Property < ActiveRecord::Base
|
3
3
|
belongs_to :atype
|
4
4
|
belongs_to :owner, :polymorphic => true
|
5
|
+
belongs_to :assigned_person, :polymorphic => true
|
5
6
|
has_many :item_props, :dependent => :destroy
|
6
7
|
has_many :pphotos, :dependent => :destroy # одна или несколько фоток
|
7
8
|
accepts_nested_attributes_for :pphotos,
|
@@ -11,5 +12,14 @@ module C80Estate
|
|
11
12
|
:allow_destroy => true
|
12
13
|
has_many :areas, :dependent => :destroy
|
13
14
|
has_many :comments, :dependent => :destroy
|
15
|
+
|
16
|
+
def assigned_person_title
|
17
|
+
res = "-"
|
18
|
+
if assigned_person.present?
|
19
|
+
res = assigned_person.email
|
20
|
+
end
|
21
|
+
res
|
22
|
+
end
|
23
|
+
|
14
24
|
end
|
15
25
|
end
|
@@ -8,7 +8,9 @@ class CreateC80EstateProperties < ActiveRecord::Migration
|
|
8
8
|
t.string :longitude
|
9
9
|
t.string :owner_type
|
10
10
|
t.references :owner, index: true
|
11
|
-
t.references :atype, index: true
|
11
|
+
# t.references :atype, index: true
|
12
|
+
t.string :assigned_person_type
|
13
|
+
t.references :assigned_person, index: true
|
12
14
|
t.timestamps
|
13
15
|
end
|
14
16
|
end
|
@@ -3,7 +3,7 @@ class CreateC80ItemProps < ActiveRecord::Migration
|
|
3
3
|
create_table :c80_estate_item_props, :options => 'COLLATE=utf8_unicode_ci' do |t|
|
4
4
|
t.string :value
|
5
5
|
t.references :area, index: true
|
6
|
-
t.references :property, index: true
|
6
|
+
# t.references :property, index: true
|
7
7
|
t.references :prop_name, index: true
|
8
8
|
|
9
9
|
t.timestamps null: false
|
data/lib/c80_estate/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: c80_estate
|
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: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,7 @@ files:
|
|
66
66
|
- README.md
|
67
67
|
- Rakefile
|
68
68
|
- app/admin/c80_estate/areas.rb
|
69
|
+
- app/admin/c80_estate/astatuses.rb
|
69
70
|
- app/admin/c80_estate/atypes.rb
|
70
71
|
- app/admin/c80_estate/prop_names.rb
|
71
72
|
- app/admin/c80_estate/properties.rb
|
@@ -103,8 +104,8 @@ files:
|
|
103
104
|
- bin/setup
|
104
105
|
- c80_estate.gemspec
|
105
106
|
- config/routes.rb
|
106
|
-
- db/migrate/20160629033533_create_c80_estate_areas.rb
|
107
107
|
- db/migrate/20160629033535_create_c80_estate_properties.rb
|
108
|
+
- db/migrate/20160629033538_create_c80_estate_areas.rb
|
108
109
|
- db/migrate/20160629034444_create_c80_prop_names.rb
|
109
110
|
- db/migrate/20160629041414_create_c80_estate_uoms.rb
|
110
111
|
- db/migrate/20160629090606_create_c80_estate_aphotos.rb
|