c80_push 0.1.0
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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +97 -0
- data/Rakefile +24 -0
- data/app/admin/c80_push/dealers.rb +96 -0
- data/app/admin/c80_push/regions.rb +42 -0
- data/app/admin/c80_push/x_c80_push.rb +5 -0
- data/app/assets/config/c80_push_manifest.js +2 -0
- data/app/assets/javascripts/backend/dealers.js +14 -0
- data/app/assets/javascripts/c80_push.js.coffee +3 -0
- data/app/assets/javascripts/lib_backend/init.js +28 -0
- data/app/assets/javascripts/lib_backend/init_select_picker.js +13 -0
- data/app/assets/stylesheets/c80_push/application.css +15 -0
- data/app/helpers/c80_push/admin_helper.rb +60 -0
- data/app/helpers/c80_push/application_helper.rb +4 -0
- data/app/models/c80_push/application_record.rb +5 -0
- data/app/models/c80_push/dealer.rb +21 -0
- data/app/models/c80_push/office.rb +23 -0
- data/app/models/c80_push/region.rb +17 -0
- data/config/locales/dealer/ru.yml +22 -0
- data/config/locales/office/ru.yml +22 -0
- data/config/locales/region/ru.yml +16 -0
- data/config/locales/ru.yml +5 -0
- data/config/routes.rb +2 -0
- data/db/migrate/20170626123939_create_c80_push_dealers.rb +11 -0
- data/db/migrate/20170626125252_create_c80_push_offices.rb +16 -0
- data/db/migrate/20170626125858_create_c80_push_regions.rb +9 -0
- data/db/migrate/20170626130000_create_c80_push_join_table_dealers_regions.rb +12 -0
- data/db/migrate/20170626130303_create_c80_push_join_table_offices_regions.rb +12 -0
- data/lib/c80_push/engine.rb +25 -0
- data/lib/c80_push/version.rb +3 -0
- data/lib/c80_push.rb +7 -0
- data/lib/tasks/c80_push_tasks.rake +4 -0
- metadata +90 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ba1fbec25d65fb7ac76579aa964df7eac47f9e4f
|
4
|
+
data.tar.gz: cfe8de83b8d9a2717e8e4a1e5b70aed41d7989fd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a3fb805974f58a22f39e483839878b31d919780511c0188f1a8f26d6685b48b32fe9da5da0e4794e566184513165c7a520252a99386ae4614e448a15b1e4a614
|
7
|
+
data.tar.gz: f3d557be622dcd8c03f749c5ea3a2d01103846480d4c30e6f2e8d465989c45ae9edc7d8d8205ca196d743cf1eac65141f3cc117729240059bce4892ec102accd
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2017 C80609A
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
# C80Push
|
2
|
+
|
3
|
+
Добавляет функционал дилеров и офисов продаж.
|
4
|
+
Это *ActiveAdmin* plugin.
|
5
|
+
Использует *Bootstrap* и *Bootstrap Select*.
|
6
|
+
|
7
|
+
Содержит модели:
|
8
|
+
|
9
|
+
* Дилер
|
10
|
+
* Офис
|
11
|
+
* Регион
|
12
|
+
|
13
|
+
Добавляет пункт меню:
|
14
|
+
|
15
|
+
* Дилеры
|
16
|
+
* Список дилеров
|
17
|
+
* Регионы
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
|
22
|
+
## Installation
|
23
|
+
|
24
|
+
Add this line to your application's Gemfile:
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
gem 'c80_push'
|
28
|
+
```
|
29
|
+
|
30
|
+
And then execute:
|
31
|
+
|
32
|
+
```bash
|
33
|
+
$ bundle
|
34
|
+
$ rake db:migrate
|
35
|
+
```
|
36
|
+
|
37
|
+
Add this line to host app's `application_controller.rb`:
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
helper C80Push::Engine.helpers
|
41
|
+
```
|
42
|
+
|
43
|
+
Add these to host app's `active_admin.js.coffee`:
|
44
|
+
|
45
|
+
```js
|
46
|
+
#= require bootstrap
|
47
|
+
#= require bootstrap-select
|
48
|
+
#= require c80_yax
|
49
|
+
#= require c80_push
|
50
|
+
```
|
51
|
+
|
52
|
+
## Цитата из ТЗ
|
53
|
+
|
54
|
+
> Данный раздел представляет собой список компаний, у которых указаны
|
55
|
+
> адреса офисов продаж и другие контактные данные.
|
56
|
+
>
|
57
|
+
> Эти данные пользователь видит на интерактивной карте
|
58
|
+
> (от GoogleMaps или Яндекс. Карты - на выбор).
|
59
|
+
>
|
60
|
+
> Попадая на данную страницу, пользователь сначала видит интерактивную
|
61
|
+
> карту (на которой отмечены все адреса офисов продаж и дилеров) и
|
62
|
+
> селект, с помощью которого можно выбрать один из регионов.
|
63
|
+
>
|
64
|
+
> Выбрав тот или иной регион, пользователь видит слева от
|
65
|
+
> интерактивной карты список компаний, а также адреса их офисов продаж.
|
66
|
+
>
|
67
|
+
> Офисы продаж ORIMA и копании-дилеры (и адреса их офисов продаж)
|
68
|
+
> разграничены на интерактивной карте маркерами разного цвета.
|
69
|
+
>
|
70
|
+
> В списке слева от интерактивной карты сначала отображаются офисы
|
71
|
+
> продаж компании ORIMA, а затем список компаний-дилеров
|
72
|
+
> (и адресов их офисов продаж).
|
73
|
+
>
|
74
|
+
> С помощью инструментов панели управления сайтом можно создавать
|
75
|
+
> редактировать и удалять компании, задавать/изменять/удалять
|
76
|
+
> адреса офисов продаж и другие характеристики характеристики:
|
77
|
+
>
|
78
|
+
> - Название*
|
79
|
+
> - Офисы продаж (как минимум один):
|
80
|
+
> - Название*
|
81
|
+
> - Адрес*
|
82
|
+
> - gps*
|
83
|
+
> - Телефон*
|
84
|
+
> - Сайт
|
85
|
+
> - Принадлежность к региону (офиса)
|
86
|
+
> - Принадлежность к региону (дилера)
|
87
|
+
>
|
88
|
+
> По клику на один из пунктов в списке слева пользователю на
|
89
|
+
> карте демонстрируется только один маркер, который соответствует
|
90
|
+
> данному пункту.
|
91
|
+
>
|
92
|
+
> На странице присутсвует возможность фильтрации по региону.
|
93
|
+
> Выбрав регион пользователь видит в списке слева и на
|
94
|
+
> интерактивной карте только те офисы продаж/склады и дилеров,
|
95
|
+
> которые соответствую данному региону.
|
96
|
+
> Каждая компания имеет заранее предопределенное свойство "id".
|
97
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'C80Push'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
load 'rails/tasks/statistics.rake'
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
require 'bundler/gem_tasks'
|
24
|
+
|
@@ -0,0 +1,96 @@
|
|
1
|
+
ActiveAdmin.register C80Push::Dealer, as: 'Dealer' do
|
2
|
+
|
3
|
+
menu :label => proc{ I18n.t('c80_push.active_admin.menu.dealer')},
|
4
|
+
:parent => 'x_c80_push',
|
5
|
+
:priority => 1
|
6
|
+
|
7
|
+
permit_params :title,
|
8
|
+
:ord,
|
9
|
+
:site,
|
10
|
+
:email,
|
11
|
+
:region_ids => [],
|
12
|
+
:offices_attributes => [
|
13
|
+
:id,
|
14
|
+
:ord,
|
15
|
+
:title,
|
16
|
+
:addr,
|
17
|
+
:gps,
|
18
|
+
:tel,
|
19
|
+
:site,
|
20
|
+
:email,
|
21
|
+
:_destroy,
|
22
|
+
:region_ids => []
|
23
|
+
]
|
24
|
+
|
25
|
+
config.batch_actions = false
|
26
|
+
config.sort_order = 'ord_asc'
|
27
|
+
before_filter :skip_sidebar!, :only => :index
|
28
|
+
|
29
|
+
index do
|
30
|
+
id_column
|
31
|
+
column :ord
|
32
|
+
column :title do |dealer|
|
33
|
+
dealer_col_title(dealer)
|
34
|
+
end
|
35
|
+
# column :site
|
36
|
+
# column :email
|
37
|
+
column :regions do |dealer|
|
38
|
+
first_region(dealer)
|
39
|
+
end
|
40
|
+
column :offices do |dealer|
|
41
|
+
ul_offices(dealer)
|
42
|
+
end
|
43
|
+
|
44
|
+
actions
|
45
|
+
end
|
46
|
+
|
47
|
+
form(:html => {:multipart => true}) do |f|
|
48
|
+
|
49
|
+
f.inputs 'Свойства' do
|
50
|
+
f.input :title
|
51
|
+
f.input :ord
|
52
|
+
f.input :site, hint: I18n.t('c80_push.active_admin.hints.site')
|
53
|
+
f.input :email, hint: I18n.t('c80_push.active_admin.hints.email')
|
54
|
+
f.input :regions,
|
55
|
+
:as => :select,
|
56
|
+
:input_html => {
|
57
|
+
:title => '',
|
58
|
+
:class => 'selectpicker',
|
59
|
+
:data => {
|
60
|
+
:size => 10,
|
61
|
+
:width => '600px'
|
62
|
+
},
|
63
|
+
:multiple => false
|
64
|
+
},
|
65
|
+
:include_blank => true
|
66
|
+
|
67
|
+
f.has_many :offices,
|
68
|
+
:allow_destroy => true,
|
69
|
+
:heading => I18n.t('activerecord.models.office.other') do |office|
|
70
|
+
office.input :title
|
71
|
+
office.input :ord
|
72
|
+
office.input :addr
|
73
|
+
office.input :gps
|
74
|
+
office.input :tel, hint: I18n.t('c80_push.active_admin.hints.tel')
|
75
|
+
office.input :site, hint: I18n.t('c80_push.active_admin.hints.site')
|
76
|
+
office.input :email, hint: I18n.t('c80_push.active_admin.hints.email')
|
77
|
+
office.input :regions,
|
78
|
+
:as => :select,
|
79
|
+
:input_html => {
|
80
|
+
:title => '',
|
81
|
+
:class => 'selectpicker',
|
82
|
+
:data => {
|
83
|
+
:size => 10,
|
84
|
+
:width => '600px'
|
85
|
+
},
|
86
|
+
:multiple => false
|
87
|
+
},
|
88
|
+
:include_blank => true
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
f.actions
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
ActiveAdmin.register C80Push::Region, as: 'Region' do
|
2
|
+
|
3
|
+
menu :label => proc{ I18n.t('c80_push.active_admin.menu.region')},
|
4
|
+
:parent => 'x_c80_push',
|
5
|
+
:priority => 2
|
6
|
+
|
7
|
+
permit_params :title,
|
8
|
+
:ord,
|
9
|
+
:office_ids => [],
|
10
|
+
:dealer_ids => []
|
11
|
+
|
12
|
+
config.batch_actions = false
|
13
|
+
config.sort_order = 'ord_asc'
|
14
|
+
before_filter :skip_sidebar!, :only => :index
|
15
|
+
|
16
|
+
index do
|
17
|
+
id_column
|
18
|
+
column :title
|
19
|
+
column :ord
|
20
|
+
column :offices do |region|
|
21
|
+
ul_offices(region)
|
22
|
+
end
|
23
|
+
column :dealers do |region|
|
24
|
+
ul_dealers(region)
|
25
|
+
end
|
26
|
+
|
27
|
+
actions
|
28
|
+
end
|
29
|
+
|
30
|
+
form(:html => {:multipart => true}) do |f|
|
31
|
+
|
32
|
+
f.inputs 'Свойства' do
|
33
|
+
f.input :title
|
34
|
+
f.input :ord
|
35
|
+
f.input :offices, :as => :check_boxes
|
36
|
+
f.input :dealers, :as => :check_boxes
|
37
|
+
end
|
38
|
+
|
39
|
+
f.actions
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
// initialize your global object will all your model names
|
2
|
+
var C80_PUSH = {
|
3
|
+
|
4
|
+
};
|
5
|
+
|
6
|
+
jQuery(document).ready(function ($) {
|
7
|
+
// get the page action
|
8
|
+
var action, model, b = $("body");
|
9
|
+
if (b.hasClass("edit")) {
|
10
|
+
action = "edit";
|
11
|
+
} else if (b.hasClass("view")) {
|
12
|
+
action = "view";
|
13
|
+
} else if (b.hasClass("index")) {
|
14
|
+
action = "index"
|
15
|
+
} else if (b.hasClass("new")) {
|
16
|
+
action = "new"
|
17
|
+
}
|
18
|
+
|
19
|
+
// run the code specific to a model and an action
|
20
|
+
for (var m in C80_PUSH) {
|
21
|
+
if (b.hasClass("admin_" + m)) {
|
22
|
+
if (C80_PUSH[m][action] && typeof C80_PUSH[m][action] == "function") {
|
23
|
+
C80_PUSH[m][action]();
|
24
|
+
break;
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
});
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
// при клике по habtm кнопке "добавить",
|
4
|
+
// на всякий случай,
|
5
|
+
// инициализируем в появившемся на экране блоке
|
6
|
+
// возможный bootstrap select picker
|
7
|
+
var init_select_picker = function (){
|
8
|
+
$('.has_many_add').on('click', function (){
|
9
|
+
setTimeout(function() {
|
10
|
+
$('.selectpicker').selectpicker();
|
11
|
+
}, 40);
|
12
|
+
});
|
13
|
+
};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module C80Push
|
2
|
+
module AdminHelper
|
3
|
+
|
4
|
+
# noinspection RubyResolve
|
5
|
+
def first_region(subj)
|
6
|
+
res = '-'
|
7
|
+
unless subj.regions.count.zero?
|
8
|
+
res = subj.regions.first.title
|
9
|
+
end
|
10
|
+
res.html_safe
|
11
|
+
end
|
12
|
+
|
13
|
+
# noinspection RubyResolve
|
14
|
+
def ul_offices(subj)
|
15
|
+
res = '-'
|
16
|
+
unless subj.offices.count.zero?
|
17
|
+
res = ''
|
18
|
+
subj.offices.def_order.each do |office|
|
19
|
+
e = "<li>#{office.title}</li>"
|
20
|
+
res += e
|
21
|
+
end
|
22
|
+
res = "<ul>#{res}</ul>".html_safe
|
23
|
+
end
|
24
|
+
res
|
25
|
+
end
|
26
|
+
|
27
|
+
# noinspection RubyResolve
|
28
|
+
def ul_dealers(subj)
|
29
|
+
res = '-'
|
30
|
+
unless subj.dealers.count.zero?
|
31
|
+
res = ''
|
32
|
+
subj.dealers.def_order.each do |dealer|
|
33
|
+
e = "<li>#{dealer.title}</li>"
|
34
|
+
res += e
|
35
|
+
end
|
36
|
+
res = "<ul>#{res}</ul>".html_safe
|
37
|
+
end
|
38
|
+
res
|
39
|
+
end
|
40
|
+
|
41
|
+
def dealer_col_title(dealer)
|
42
|
+
res = "#{dealer.title}"
|
43
|
+
res += "<br><sub>email: #{format_val(dealer.email)}</sub>"
|
44
|
+
res += "<br><sub>site: #{format_val(dealer.site)}</sub>"
|
45
|
+
res.html_safe
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def format_val(val)
|
51
|
+
res = '-'
|
52
|
+
unless val.blank?
|
53
|
+
res = val
|
54
|
+
end
|
55
|
+
"<span class='c80_md_link_color'>#{res}</span>".html_safe
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module C80Push
|
2
|
+
class Dealer < ActiveRecord::Base
|
3
|
+
has_and_belongs_to_many :regions
|
4
|
+
has_many :offices, :dependent => :destroy
|
5
|
+
accepts_nested_attributes_for :offices,
|
6
|
+
:reject_if => lambda { |attributes|
|
7
|
+
!attributes.present?
|
8
|
+
},
|
9
|
+
:allow_destroy => true
|
10
|
+
|
11
|
+
validates :title,
|
12
|
+
:uniqueness => true,
|
13
|
+
:presence => true
|
14
|
+
|
15
|
+
validates :ord,
|
16
|
+
:presence => true
|
17
|
+
|
18
|
+
scope :def_order, -> { order(:ord => :asc) }
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module C80Push
|
2
|
+
class Office < ActiveRecord::Base
|
3
|
+
has_and_belongs_to_many :regions
|
4
|
+
belongs_to :dealer
|
5
|
+
|
6
|
+
scope :def_order, -> { order(:ord => :asc) }
|
7
|
+
|
8
|
+
validates :ord,
|
9
|
+
:presence => true
|
10
|
+
|
11
|
+
validates :title,
|
12
|
+
:presence => true
|
13
|
+
|
14
|
+
validates :addr,
|
15
|
+
:presence => true
|
16
|
+
|
17
|
+
validates :gps,
|
18
|
+
:presence => true
|
19
|
+
|
20
|
+
validates :tel,
|
21
|
+
:presence => true
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module C80Push
|
2
|
+
class Region < ActiveRecord::Base
|
3
|
+
has_and_belongs_to_many :dealers
|
4
|
+
has_and_belongs_to_many :offices
|
5
|
+
|
6
|
+
scope :def_order, -> { order(:ord => :asc) }
|
7
|
+
|
8
|
+
validates :title,
|
9
|
+
:uniqueness => true,
|
10
|
+
:presence => true,
|
11
|
+
:length => { in: 2..90 }
|
12
|
+
|
13
|
+
validates :ord,
|
14
|
+
:presence => true
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
ru:
|
2
|
+
c80_push:
|
3
|
+
active_admin:
|
4
|
+
hints:
|
5
|
+
site: 'Если сайтов несколько, перечислите их через запятую'
|
6
|
+
email: 'Если адресов несколько, перечислите их через запятую'
|
7
|
+
menu:
|
8
|
+
dealer: 'Список дилеров'
|
9
|
+
activerecord:
|
10
|
+
models:
|
11
|
+
dealer:
|
12
|
+
one: 'дилера'
|
13
|
+
other: 'Дилеры'
|
14
|
+
attributes:
|
15
|
+
c80_push/dealer:
|
16
|
+
id: 'id'
|
17
|
+
ord: 'Порядковый №'
|
18
|
+
title: 'Название'
|
19
|
+
site: 'Сайт(ы)'
|
20
|
+
email: 'Email адрес(а)'
|
21
|
+
regions: 'Регион'
|
22
|
+
offices: 'Офисы'
|
@@ -0,0 +1,22 @@
|
|
1
|
+
ru:
|
2
|
+
c80_push:
|
3
|
+
active_admin:
|
4
|
+
hints:
|
5
|
+
tel: 'Если номеров несколько, перечислите их через запятую'
|
6
|
+
site: 'Если сайтов несколько, перечислите их через запятую'
|
7
|
+
email: 'Если адресов несколько, перечислите их через запятую'
|
8
|
+
activerecord:
|
9
|
+
models:
|
10
|
+
office:
|
11
|
+
one: 'офис'
|
12
|
+
other: 'Офисы'
|
13
|
+
attributes:
|
14
|
+
c80_push/office:
|
15
|
+
ord: 'Порядковый №'
|
16
|
+
title: 'Название'
|
17
|
+
addr: 'Адрес'
|
18
|
+
gps: 'GPS-координаты'
|
19
|
+
tel: 'Телефон(ы)'
|
20
|
+
site: 'Сайт(ы)'
|
21
|
+
email: 'Email адрес(а)'
|
22
|
+
regions: 'Регион'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
ru:
|
2
|
+
c80_push:
|
3
|
+
active_admin:
|
4
|
+
menu:
|
5
|
+
region: 'Регионы'
|
6
|
+
activerecord:
|
7
|
+
models:
|
8
|
+
region:
|
9
|
+
one: 'регион'
|
10
|
+
other: 'Регионы'
|
11
|
+
attributes:
|
12
|
+
c80_push/region:
|
13
|
+
ord: 'Порядковый №'
|
14
|
+
title: 'Название'
|
15
|
+
dealers: 'Дилеры'
|
16
|
+
offices: 'Офисы'
|
data/config/routes.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
class CreateC80PushDealers < ActiveRecord::Migration[5.0]
|
2
|
+
def change
|
3
|
+
create_table :c80_push_dealers do |t|
|
4
|
+
t.integer :ord, null: false, default: 0
|
5
|
+
t.string :title, null: false, limit: 90
|
6
|
+
t.string :site
|
7
|
+
t.string :email
|
8
|
+
t.timestamps null: false
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateC80PushOffices < ActiveRecord::Migration[5.0]
|
2
|
+
def change
|
3
|
+
create_table :c80_push_offices do |t|
|
4
|
+
t.string :ord, null: false, default: 0
|
5
|
+
t.string :title, null: false
|
6
|
+
t.string :addr, null: false
|
7
|
+
t.string :gps, null: false
|
8
|
+
t.string :tel, null: false
|
9
|
+
t.string :email
|
10
|
+
t.string :site
|
11
|
+
t.references :dealer, index: true
|
12
|
+
|
13
|
+
t.timestamps null: false
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateC80PushJoinTableDealersRegions < ActiveRecord::Migration[5.0]
|
2
|
+
def change
|
3
|
+
create_table :c80_push_dealers_regions, :id => false do |t|
|
4
|
+
t.integer :dealer_id, :null => false
|
5
|
+
t.integer :region_id, :null => false
|
6
|
+
end
|
7
|
+
|
8
|
+
add_index :c80_push_dealers_regions, [:dealer_id, :region_id], name: 'too_long_push1'
|
9
|
+
add_index :c80_push_dealers_regions, [:region_id, :dealer_id], name: 'too_long_push2'
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateC80PushJoinTableOfficesRegions < ActiveRecord::Migration[5.0]
|
2
|
+
def change
|
3
|
+
create_table :c80_push_offices_regions, :id => false do |t|
|
4
|
+
t.integer :office_id, :null => false
|
5
|
+
t.integer :region_id, :null => false
|
6
|
+
end
|
7
|
+
|
8
|
+
add_index :c80_push_offices_regions, [:office_id, :region_id], name: 'too_long_push3'
|
9
|
+
add_index :c80_push_offices_regions, [:region_id, :office_id], name: 'too_long_push4'
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module C80Push
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
config.i18n.load_path += Dir[config.root.join('config', 'locales', '*','*.{yml}').to_s]
|
4
|
+
isolate_namespace C80Push
|
5
|
+
|
6
|
+
initializer :c80_push_engine do
|
7
|
+
if defined?(ActiveAdmin)
|
8
|
+
ActiveAdmin.application.load_paths += Dir["#{config.root}/app/helpers/**/"]
|
9
|
+
ActiveAdmin.application.load_paths += Dir["#{config.root}/app/models/**/"]
|
10
|
+
#ActiveAdmin.application.load_paths += Dir["#{config.root}/app/models/concerns/**/"]
|
11
|
+
ActiveAdmin.application.load_paths += Dir["#{config.root}/app/admin/c80_push/**/"]
|
12
|
+
# ActiveAdmin.application.load_paths += Dir["#{config.root}/app/jobs/**/"]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
initializer :append_migrations do |app|
|
17
|
+
unless app.root.to_s.match root.to_s
|
18
|
+
config.paths['db/migrate'].expanded.each do |expanded_path|
|
19
|
+
app.config.paths['db/migrate'] << expanded_path
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
data/lib/c80_push.rb
ADDED
metadata
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: c80_push
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- C80609A
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-06-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Добавляет функционал дилеров и офисов продаж
|
28
|
+
email:
|
29
|
+
- c080609a@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- MIT-LICENSE
|
35
|
+
- README.md
|
36
|
+
- Rakefile
|
37
|
+
- app/admin/c80_push/dealers.rb
|
38
|
+
- app/admin/c80_push/regions.rb
|
39
|
+
- app/admin/c80_push/x_c80_push.rb
|
40
|
+
- app/assets/config/c80_push_manifest.js
|
41
|
+
- app/assets/javascripts/backend/dealers.js
|
42
|
+
- app/assets/javascripts/c80_push.js.coffee
|
43
|
+
- app/assets/javascripts/lib_backend/init.js
|
44
|
+
- app/assets/javascripts/lib_backend/init_select_picker.js
|
45
|
+
- app/assets/stylesheets/c80_push/application.css
|
46
|
+
- app/helpers/c80_push/admin_helper.rb
|
47
|
+
- app/helpers/c80_push/application_helper.rb
|
48
|
+
- app/models/c80_push/application_record.rb
|
49
|
+
- app/models/c80_push/dealer.rb
|
50
|
+
- app/models/c80_push/office.rb
|
51
|
+
- app/models/c80_push/region.rb
|
52
|
+
- config/locales/dealer/ru.yml
|
53
|
+
- config/locales/office/ru.yml
|
54
|
+
- config/locales/region/ru.yml
|
55
|
+
- config/locales/ru.yml
|
56
|
+
- config/routes.rb
|
57
|
+
- db/migrate/20170626123939_create_c80_push_dealers.rb
|
58
|
+
- db/migrate/20170626125252_create_c80_push_offices.rb
|
59
|
+
- db/migrate/20170626125858_create_c80_push_regions.rb
|
60
|
+
- db/migrate/20170626130000_create_c80_push_join_table_dealers_regions.rb
|
61
|
+
- db/migrate/20170626130303_create_c80_push_join_table_offices_regions.rb
|
62
|
+
- lib/c80_push.rb
|
63
|
+
- lib/c80_push/engine.rb
|
64
|
+
- lib/c80_push/version.rb
|
65
|
+
- lib/tasks/c80_push_tasks.rake
|
66
|
+
homepage: https://github.com/c80609a/c80_push
|
67
|
+
licenses:
|
68
|
+
- MIT
|
69
|
+
metadata: {}
|
70
|
+
post_install_message:
|
71
|
+
rdoc_options: []
|
72
|
+
require_paths:
|
73
|
+
- lib
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
requirements: []
|
85
|
+
rubyforge_project:
|
86
|
+
rubygems_version: 2.6.11
|
87
|
+
signing_key:
|
88
|
+
specification_version: 4
|
89
|
+
summary: Пушеры
|
90
|
+
test_files: []
|