c80_estate 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/CODE_OF_CONDUCT.md +49 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +67 -0
  7. data/Rakefile +2 -0
  8. data/app/admin/c80_estate/areas.rb +56 -0
  9. data/app/admin/c80_estate/atypes.rb +44 -0
  10. data/app/admin/c80_estate/prop_names.rb +48 -0
  11. data/app/admin/c80_estate/properties.rb +38 -0
  12. data/app/admin/c80_estate/role_types.rb +40 -0
  13. data/app/admin/c80_estate/uoms.rb +33 -0
  14. data/app/assets/javascript/c80_estate/backend/admin/areas.js +423 -0
  15. data/app/assets/javascript/c80_estate/backend/init.js +36 -0
  16. data/app/assets/javascript/c80_estate/backend/init_selectpicker.js +6 -0
  17. data/app/assets/javascript/c80_estate/lib/jalert.js +16 -0
  18. data/app/assets/javascript/c80_estate_active_admin.js.coffee +4 -0
  19. data/app/assets/stylesheets/c80_estate/backend/admin_areas.scss +109 -0
  20. data/app/assets/stylesheets/c80_estate/backend/admin_users.scss +27 -0
  21. data/app/assets/stylesheets/c80_estate/backend/common.scss +3 -0
  22. data/app/assets/stylesheets/c80_estate/lib/mixins.scss +17 -0
  23. data/app/assets/stylesheets/c80_estate_active_admin.scss +2 -0
  24. data/app/controllers/c80_estate/ajax_controller.rb +17 -0
  25. data/app/models/c80_estate/aphoto.rb +6 -0
  26. data/app/models/c80_estate/area.rb +26 -0
  27. data/app/models/c80_estate/astatus.rb +6 -0
  28. data/app/models/c80_estate/atphoto.rb +6 -0
  29. data/app/models/c80_estate/atype.rb +132 -0
  30. data/app/models/c80_estate/comment.rb +7 -0
  31. data/app/models/c80_estate/item_prop.rb +70 -0
  32. data/app/models/c80_estate/owner.rb +62 -0
  33. data/app/models/c80_estate/pphoto.rb +5 -0
  34. data/app/models/c80_estate/prop_name.rb +19 -0
  35. data/app/models/c80_estate/property.rb +15 -0
  36. data/app/models/c80_estate/role.rb +6 -0
  37. data/app/models/c80_estate/role_type.rb +5 -0
  38. data/app/models/c80_estate/uom.rb +5 -0
  39. data/app/uploaders/c80_estate/aphoto_uploader.rb +21 -0
  40. data/app/uploaders/c80_estate/atphoto_uploader.rb +21 -0
  41. data/app/uploaders/c80_estate/pphoto_uploader.rb +21 -0
  42. data/bin/console +14 -0
  43. data/bin/setup +8 -0
  44. data/c80_estate.gemspec +25 -0
  45. data/config/routes.rb +3 -0
  46. data/db/migrate/20160629033533_create_c80_estate_areas.rb +13 -0
  47. data/db/migrate/20160629033535_create_c80_estate_properties.rb +15 -0
  48. data/db/migrate/20160629034444_create_c80_prop_names.rb +12 -0
  49. data/db/migrate/20160629041414_create_c80_estate_uoms.rb +10 -0
  50. data/db/migrate/20160629090606_create_c80_estate_aphotos.rb +9 -0
  51. data/db/migrate/20160629091313_create_c80_estate_astatuses.rb +9 -0
  52. data/db/migrate/20160629092323_create_c80_item_props.rb +14 -0
  53. data/db/migrate/20160629093030_create_c80_estate_comments.rb +12 -0
  54. data/db/migrate/20160629100505_create_c80_atypes.rb +10 -0
  55. data/db/migrate/20160629205151_create_c80_estate_atphotos.rb +9 -0
  56. data/db/migrate/20160630012727_create_c80_estate_pphotos.rb +9 -0
  57. data/db/migrate/20160630013636_create_join_table_areas_astatuses.rb +12 -0
  58. data/db/migrate/20160630013737_create_join_table_atypes_prop_names.rb +12 -0
  59. data/db/migrate/20160704050000_create_c80_estate_role_types.rb +9 -0
  60. data/db/migrate/20160704063131_create_c80_estate_roles.rb +10 -0
  61. data/db/seeds/50_fill_uoms.rb.example +8 -0
  62. data/db/seeds/55_fill_prop_names.rb.example +51 -0
  63. data/db/seeds/60_fill_atypes.rb.example +29 -0
  64. data/lib/c80_estate.rb +8 -0
  65. data/lib/c80_estate/engine.rb +23 -0
  66. data/lib/c80_estate/version.rb +3 -0
  67. metadata +151 -0
@@ -0,0 +1,9 @@
1
+ class CreateC80EstateAtphotos < ActiveRecord::Migration
2
+ def change
3
+ create_table :c80_estate_atphotos, :options => 'COLLATE=utf8_unicode_ci' do |t|
4
+ t.string :image
5
+ t.references :atype, index: true
6
+ t.timestamps null: false
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class CreateC80EstatePphotos < ActiveRecord::Migration
2
+ def change
3
+ create_table :c80_estate_pphotos, :options => 'COLLATE=utf8_unicode_ci' do |t|
4
+ t.string :image
5
+ t.references :property, index: true
6
+ t.timestamps null: false
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ class CreateJoinTableAreasAstatuses < ActiveRecord::Migration
2
+ def change
3
+ create_table :c80_estate_areas_astatuses, :id => false do |t|
4
+ t.integer :area_id, :null => false
5
+ t.integer :astatus_id, :null => false
6
+ end
7
+
8
+ # Add table index
9
+ add_index :c80_estate_areas_astatuses, [:astatus_id, :area_id], :unique => true, :name => 'my_index'
10
+
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ class CreateJoinTableAtypesPropNames < ActiveRecord::Migration
2
+ def change
3
+ create_table :c80_estate_atypes_prop_names, :id => false do |t|
4
+ t.integer :atype_id, :null => false
5
+ t.integer :prop_name_id, :null => false
6
+ end
7
+
8
+ # Add table index
9
+ add_index :c80_estate_atypes_prop_names, [:prop_name_id, :atype_id], :unique => true, :name => 'my_index2'
10
+
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ class CreateC80EstateRoleTypes < ActiveRecord::Migration
2
+ def change
3
+ create_table :c80_estate_role_types, :options => 'COLLATE=utf8_unicode_ci' do |t|
4
+ t.string :title
5
+ t.text :desc
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ class CreateC80EstateRoles < ActiveRecord::Migration
2
+ def change
3
+ create_table :c80_estate_roles, :options => 'COLLATE=utf8_unicode_ci' do |t|
4
+ t.references :role_type, index: true
5
+ t.string :owner_type
6
+ t.references :owner, index: true
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,8 @@
1
+ # rake db:seed:50_fill_uoms
2
+
3
+ C80Estate::Uom.delete_all
4
+ C80Estate::Uom.create!([
5
+ { id:1, title: 'м', comment: 'Метр погонный', is_number: true},
6
+ { id:2, title: 'м.кв.', comment: 'Метр квадратный', is_number: true},
7
+ { id:3, title: 'руб', comment: 'Рубль', is_number: true}
8
+ ])
@@ -0,0 +1,51 @@
1
+ # rake db:seed:55_fill_prop_names
2
+
3
+ C80Estate::PropName.delete_all
4
+
5
+ arr = [
6
+ {
7
+ prop_name: {
8
+ id: 1,
9
+ title: 'Цена за м.кв.',
10
+ is_normal_price: true,
11
+ is_excluded_from_filtering: true
12
+ },
13
+ uom: 'руб'
14
+ },
15
+ {
16
+ prop_name: {
17
+ id: 2,
18
+ title: 'Высота потолков',
19
+ is_normal_price: false,
20
+ is_excluded_from_filtering: false
21
+ },
22
+ uom: 'м'
23
+ },
24
+ {
25
+ prop_name: {
26
+ id: 3,
27
+ title: 'Шаг колонн',
28
+ is_normal_price: false,
29
+ is_excluded_from_filtering: false
30
+ },
31
+ uom: 'м'
32
+ },
33
+ {
34
+ prop_name: {
35
+ id: 4,
36
+ title: 'Тип ворот',
37
+ is_normal_price: false,
38
+ is_excluded_from_filtering: false
39
+ }
40
+ }
41
+ ]
42
+
43
+ arr.each do |elem|
44
+ p = C80Estate::PropName.create!(elem[:prop_name])
45
+ if elem[:uom].present?
46
+ u = C80Estate::Uom.where(:title => elem[:uom]).first
47
+ u.prop_names << p
48
+ u.save
49
+ end
50
+ p.save
51
+ end
@@ -0,0 +1,29 @@
1
+ # rake db:seed:60_fill_atypes
2
+
3
+ arr = [
4
+ {
5
+ id: 1,
6
+ title: 'Здание',
7
+ props: ['Высота потолков', 'Цена за м.кв.']
8
+ },
9
+ {
10
+ id: 2,
11
+ title: 'Складское помещение',
12
+ props: ['Высота потолков', 'Цена за м.кв.', 'Шаг колонн', 'Тип ворот']
13
+ },
14
+ {
15
+ id: 3,
16
+ title: 'Офис',
17
+ props: ['Цена за м.кв.']
18
+ }
19
+ ]
20
+
21
+ C80Estate::Atype.delete_all
22
+ arr.each do |elem|
23
+ at = C80Estate::Atype.create!({ id:elem[:id], title:elem[:title] })
24
+ elem[:props].each do |prop_title|
25
+ p = C80Estate::PropName.where(:title => prop_title).first
26
+ at.prop_names << p
27
+ end
28
+ at.save
29
+ end
data/lib/c80_estate.rb ADDED
@@ -0,0 +1,8 @@
1
+ require "c80_estate/version"
2
+ require "c80_estate/engine"
3
+
4
+ module C80Estate
5
+ def self.table_name_prefix
6
+ 'c80_estate_'
7
+ end
8
+ end
@@ -0,0 +1,23 @@
1
+ module C80Estate
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace C80Estate
4
+
5
+ initializer :c80_estate_engine do
6
+ if defined?(ActiveAdmin)
7
+ ActiveAdmin.application.load_paths += Dir["#{config.root}/app/models/**/"]
8
+ #ActiveAdmin.application.load_paths += Dir["#{config.root}/app/models/concerns/**/"]
9
+ ActiveAdmin.application.load_paths += Dir["#{config.root}/app/admin/c80_estate/**/"]
10
+ # ActiveAdmin.application.load_paths += Dir["#{config.root}/app/jobs/**/"]
11
+ end
12
+ end
13
+
14
+ initializer :append_migrations do |app|
15
+ unless app.root.to_s.match root.to_s
16
+ config.paths["db/migrate"].expanded.each do |expanded_path|
17
+ app.config.paths["db/migrate"] << expanded_path
18
+ end
19
+ end
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,3 @@
1
+ module C80Estate
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,151 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: c80_estate
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - C80609A
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-07-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.12'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.12'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: activesupport
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 3.0.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 3.0.0
55
+ description: for real estate app
56
+ email:
57
+ - c080609a@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - CODE_OF_CONDUCT.md
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - app/admin/c80_estate/areas.rb
69
+ - app/admin/c80_estate/atypes.rb
70
+ - app/admin/c80_estate/prop_names.rb
71
+ - app/admin/c80_estate/properties.rb
72
+ - app/admin/c80_estate/role_types.rb
73
+ - app/admin/c80_estate/uoms.rb
74
+ - app/assets/javascript/c80_estate/backend/admin/areas.js
75
+ - app/assets/javascript/c80_estate/backend/init.js
76
+ - app/assets/javascript/c80_estate/backend/init_selectpicker.js
77
+ - app/assets/javascript/c80_estate/lib/jalert.js
78
+ - app/assets/javascript/c80_estate_active_admin.js.coffee
79
+ - app/assets/stylesheets/c80_estate/backend/admin_areas.scss
80
+ - app/assets/stylesheets/c80_estate/backend/admin_users.scss
81
+ - app/assets/stylesheets/c80_estate/backend/common.scss
82
+ - app/assets/stylesheets/c80_estate/lib/mixins.scss
83
+ - app/assets/stylesheets/c80_estate_active_admin.scss
84
+ - app/controllers/c80_estate/ajax_controller.rb
85
+ - app/models/c80_estate/aphoto.rb
86
+ - app/models/c80_estate/area.rb
87
+ - app/models/c80_estate/astatus.rb
88
+ - app/models/c80_estate/atphoto.rb
89
+ - app/models/c80_estate/atype.rb
90
+ - app/models/c80_estate/comment.rb
91
+ - app/models/c80_estate/item_prop.rb
92
+ - app/models/c80_estate/owner.rb
93
+ - app/models/c80_estate/pphoto.rb
94
+ - app/models/c80_estate/prop_name.rb
95
+ - app/models/c80_estate/property.rb
96
+ - app/models/c80_estate/role.rb
97
+ - app/models/c80_estate/role_type.rb
98
+ - app/models/c80_estate/uom.rb
99
+ - app/uploaders/c80_estate/aphoto_uploader.rb
100
+ - app/uploaders/c80_estate/atphoto_uploader.rb
101
+ - app/uploaders/c80_estate/pphoto_uploader.rb
102
+ - bin/console
103
+ - bin/setup
104
+ - c80_estate.gemspec
105
+ - config/routes.rb
106
+ - db/migrate/20160629033533_create_c80_estate_areas.rb
107
+ - db/migrate/20160629033535_create_c80_estate_properties.rb
108
+ - db/migrate/20160629034444_create_c80_prop_names.rb
109
+ - db/migrate/20160629041414_create_c80_estate_uoms.rb
110
+ - db/migrate/20160629090606_create_c80_estate_aphotos.rb
111
+ - db/migrate/20160629091313_create_c80_estate_astatuses.rb
112
+ - db/migrate/20160629092323_create_c80_item_props.rb
113
+ - db/migrate/20160629093030_create_c80_estate_comments.rb
114
+ - db/migrate/20160629100505_create_c80_atypes.rb
115
+ - db/migrate/20160629205151_create_c80_estate_atphotos.rb
116
+ - db/migrate/20160630012727_create_c80_estate_pphotos.rb
117
+ - db/migrate/20160630013636_create_join_table_areas_astatuses.rb
118
+ - db/migrate/20160630013737_create_join_table_atypes_prop_names.rb
119
+ - db/migrate/20160704050000_create_c80_estate_role_types.rb
120
+ - db/migrate/20160704063131_create_c80_estate_roles.rb
121
+ - db/seeds/50_fill_uoms.rb.example
122
+ - db/seeds/55_fill_prop_names.rb.example
123
+ - db/seeds/60_fill_atypes.rb.example
124
+ - lib/c80_estate.rb
125
+ - lib/c80_estate/engine.rb
126
+ - lib/c80_estate/version.rb
127
+ homepage: http://bc-acond.ru
128
+ licenses:
129
+ - MIT
130
+ metadata: {}
131
+ post_install_message:
132
+ rdoc_options: []
133
+ require_paths:
134
+ - lib
135
+ required_ruby_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ requirements: []
146
+ rubyforge_project:
147
+ rubygems_version: 2.5.1
148
+ signing_key:
149
+ specification_version: 4
150
+ summary: Estate Gem
151
+ test_files: []