c80_catoffers 0.1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) 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 +44 -0
  7. data/Rakefile +2 -0
  8. data/app/admin/c80_catoffers/categories.rb +49 -0
  9. data/app/admin/c80_catoffers/offers.rb +69 -0
  10. data/app/admin/c80_catoffers/props.rb +44 -0
  11. data/app/assets/javascripts/c80_catoffers/offer_full_desc.js +53 -0
  12. data/app/assets/javascripts/c80_catoffers.js.coffee +1 -0
  13. data/app/assets/stylesheets/c80_catoffers/offer_full_desc.scss +24 -0
  14. data/app/assets/stylesheets/c80_catoffers/offer_full_desc_slick_custom.scss +112 -0
  15. data/app/assets/stylesheets/c80_catoffers/offer_list_grouped.scss +3 -0
  16. data/app/assets/stylesheets/c80_catoffers/offer_list_iconed.scss +80 -0
  17. data/app/assets/stylesheets/c80_catoffers.scss +1 -0
  18. data/app/assets/stylesheets/c80_catoffers_backend/page_admin_props.scss +19 -0
  19. data/app/assets/stylesheets/c80_catoffers_backend.scss +1 -0
  20. data/app/helpers/c80_catoffers/app_helper.rb +93 -0
  21. data/app/helpers/c80_catoffers/urls_helper.rb +22 -0
  22. data/app/models/c80_catoffers/category.rb +21 -0
  23. data/app/models/c80_catoffers/offer.rb +62 -0
  24. data/app/models/c80_catoffers/ophoto.rb +8 -0
  25. data/app/models/c80_catoffers/prop.rb +5 -0
  26. data/app/uploaders/c80_catoffers/ophoto_uploader.rb +29 -0
  27. data/app/views/c80_catoffers/_offer_full_desc.html.erb +61 -0
  28. data/app/views/c80_catoffers/_offers_list_by_cat.html.erb +14 -0
  29. data/app/views/c80_catoffers/_offers_list_grouped.html.erb +28 -0
  30. data/app/views/c80_catoffers/_offers_list_iconed.html.erb +23 -0
  31. data/bin/console +14 -0
  32. data/bin/setup +8 -0
  33. data/c80_catoffers.gemspec +26 -0
  34. data/config/routes.rb +13 -0
  35. data/db/migrate/201609221321_c80_catoffers_create_props.rb +19 -0
  36. data/db/migrate/201609221322_c80_catoffers_create_categories.rb +13 -0
  37. data/db/migrate/201609221333_c80_catoffers_create_offers.rb +14 -0
  38. data/db/migrate/201609221334_c80_catoffers_create_ophotos.rb +10 -0
  39. data/db/migrate/20160922152020_c80_catoffers_add_join_table_categories_offers.rb +11 -0
  40. data/db/migrate/20161008123434_c80_catoffers_add_thumb_sm_to_props.rb +6 -0
  41. data/db/migrate/20161008134848_c80_catoffers_add_join_table_offers_props.rb +11 -0
  42. data/db/migrate/20161008151414_c80_catoffers_add_positions_count_to_props.rb +5 -0
  43. data/db/seeds/c80_catoffers_01_fill_props.rb +13 -0
  44. data/db/seeds/x02_fill_categories.rb +42 -0
  45. data/db/seeds/x03_fill_offers.rb +20 -0
  46. data/lib/c80_catoffers/engine.rb +23 -0
  47. data/lib/c80_catoffers/version.rb +3 -0
  48. data/lib/c80_catoffers.rb +8 -0
  49. metadata +133 -0
@@ -0,0 +1,93 @@
1
+ module C80Catoffers
2
+ module AppHelper
3
+
4
+ def render_offer_full_desc(offer_tag)
5
+
6
+ offer = Offer.where(:slug => offer_tag).first
7
+
8
+ if offer.present?
9
+ render :partial => 'c80_catoffers/offer_full_desc',
10
+ :locals => {
11
+ :frames => offer.ophotos,
12
+ :image_alt => offer.title,
13
+ :desc => offer.desc,
14
+ :price => offer.price,
15
+ :order_button_label => 'Оставить заявку',
16
+ :predefined_text_in_order_form => "Добрый день! Оставляю заявку на услугу '#{ offer.title }'.",
17
+ :subj_id => offer.id
18
+ }
19
+ end
20
+
21
+ end
22
+
23
+ # выдать текстовый список предложений из указанной категории
24
+ def render_offers_list_by_cat(category_tag)
25
+
26
+ offers = C80Catoffers::Offer.joins(:categories).where(:c80_catoffers_categories => {:slug => category_tag})
27
+
28
+ render :partial => 'c80_catoffers/offers_list_by_cat',
29
+ :locals => {
30
+ list: offers
31
+ }
32
+
33
+ end
34
+
35
+ def render_offers_list_grouped
36
+
37
+ # результат соберём тут
38
+ res = []
39
+
40
+ # сначала выведем предложения без категории
41
+ res << { cat_title: nil, offers: Offer.without_category }
42
+
43
+ # затем выведем предложения с категориями
44
+ Category.all.each do |cat|
45
+ res << { cat_title: cat.title, offers: cat.offers }
46
+ end
47
+
48
+ render :partial => 'c80_catoffers/offers_list_grouped',
49
+ :locals => {
50
+ list: res
51
+ }
52
+
53
+ end
54
+
55
+ # выведем линейный список категорий с иконками
56
+ def render_offers_list_iconed(css_style:'default')
57
+
58
+ # свойства модуля
59
+ p = Prop.first
60
+
61
+ # список категорий, которые надо вывести в виджете
62
+ list = Offer.all_widgeted.def_order
63
+
64
+ # сколько должно быть позиций?
65
+ positions_count = p.positions_count
66
+ # Rails.logger.debug "[TRACE] positions_count: #{positions_count}; list.count: #{list.count}"
67
+
68
+ # если всего в списке меньше, чем надо - добьём список слотами
69
+ if list.count < positions_count
70
+ delta = positions_count - list.count
71
+ delta.times do |i|
72
+ # Rails.logger.debug "[TRACE] Offer.new"
73
+ list << Offer.new({ title: '' })
74
+ end
75
+ end
76
+
77
+ # чтобы вёрстка не прыгала - зафиксируем размер картинки
78
+ w = p.thumb_sm_width
79
+ h = p.thumb_sm_height
80
+
81
+ render :partial => 'c80_catoffers/offers_list_iconed',
82
+ :locals => {
83
+ list: list,
84
+ css_style_for_block: css_style,
85
+ css_for_a: "width:#{w}px;height:#{h}px",
86
+ css_for_title: "height:#{h}px;line-height:#{h}px"
87
+ }
88
+
89
+
90
+ end
91
+
92
+ end
93
+ end
@@ -0,0 +1,22 @@
1
+ module C80Catoffers
2
+ module UrlsHelper
3
+
4
+ def my_url_for_offer(offer)
5
+
6
+ s = ''
7
+ if offer.has_category?
8
+ s = "#{root_url}#{offer.category.slug}/#{offer.slug}"
9
+ else
10
+ s = "#{root_url}offers/#{offer.slug}" # TODO_MY:: хардкод в урле [аналогично в routes.rb]
11
+ end
12
+
13
+ s
14
+
15
+ end
16
+
17
+ def my_url_for_category(category)
18
+ "#{root_url}categories/#{category.slug}"
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,21 @@
1
+ require "babosa"
2
+
3
+ module C80Catoffers
4
+ class Category < ActiveRecord::Base
5
+
6
+ has_many :child_categories, :class_name => 'Category', :foreign_key => 'parent_category_id'
7
+ belongs_to :parent_category, :class_name => 'Category'
8
+ has_and_belongs_to_many :offers
9
+
10
+ extend FriendlyId
11
+ friendly_id :title, use: :slugged
12
+ def normalize_friendly_id(input)
13
+ input.to_s.to_slug.normalize(transliterations: :russian).to_s
14
+ end
15
+
16
+ def slug_candidates
17
+ [:title] + Array.new(6) {|index| [:title, index+2]}
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,62 @@
1
+ require "babosa"
2
+
3
+ module C80Catoffers
4
+ class Offer < ActiveRecord::Base
5
+
6
+ has_many :ophotos, :dependent => :destroy
7
+ accepts_nested_attributes_for :ophotos,
8
+ :reject_if => lambda { |attributes|
9
+ !attributes.present?
10
+ },
11
+ :allow_destroy => true
12
+
13
+ scope :def_order, -> {order(:created_at => :desc)}
14
+
15
+ has_and_belongs_to_many :categories
16
+ has_and_belongs_to_many :props
17
+
18
+ extend FriendlyId
19
+ friendly_id :title, use: :slugged
20
+ def normalize_friendly_id(input)
21
+ input.to_s.to_slug.normalize(transliterations: :russian).to_s
22
+ end
23
+
24
+ def slug_candidates
25
+ [:title] + Array.new(6) {|index| [:title, index+2]}
26
+ end
27
+
28
+ def has_category?
29
+ self.categories.count > 0
30
+ end
31
+
32
+ def category
33
+ res = nil
34
+ if self.has_category?
35
+ res = self.categories.first
36
+ end
37
+ res
38
+ end
39
+
40
+ # добавил возможность получить предложения, которым не назначена категория
41
+ def self.without_category
42
+ habtm_table = Arel::Table.new(:c80_catoffers_categories_offers)
43
+ join_table_with_condition = habtm_table.project(habtm_table[:offer_id])
44
+ where(Offer.arel_table[:id].not_in(join_table_with_condition))
45
+ end
46
+
47
+ # выдать список тех предложений, которые должны выводиться в виджете
48
+ def self.all_widgeted
49
+ self.joins(:props)
50
+ end
51
+
52
+ def ophoto_thumb_sm
53
+ res = ''
54
+ if ophotos.count > 0
55
+ res = ophotos.first.image.thumb_sm
56
+ end
57
+ res
58
+ end
59
+
60
+ end
61
+
62
+ end
@@ -0,0 +1,8 @@
1
+ module C80Catoffers
2
+ class Ophoto < ActiveRecord::Base
3
+
4
+ belongs_to :offer
5
+ mount_uploader :image, OphotoUploader
6
+ end
7
+
8
+ end
@@ -0,0 +1,5 @@
1
+ module C80Catoffers
2
+ class Prop < ActiveRecord::Base
3
+ has_and_belongs_to_many :offers
4
+ end
5
+ end
@@ -0,0 +1,29 @@
1
+ module C80Catoffers
2
+
3
+ # грузит картинку услуги
4
+ class OphotoUploader < BaseFileUploader
5
+
6
+ process :resize_to_limit => [1024,768]
7
+
8
+ version :thumb_big_one do
9
+ p = C80Catoffers::Prop.first
10
+ process :resize_to_fill => [p.big_one_width, p.big_one_height]
11
+ end
12
+
13
+ version :thumb_preview do
14
+ p = C80Catoffers::Prop.first
15
+ process :resize_to_fill => [p.preview_width, p.preview_height]
16
+ end
17
+
18
+ version :thumb_sm do
19
+ p = C80Catoffers::Prop.first
20
+ process :resize_to_fill => [p.thumb_sm_width, p.thumb_sm_height]
21
+ end
22
+
23
+ def store_dir
24
+ 'uploads/oimages'
25
+ end
26
+
27
+ end
28
+
29
+ end
@@ -0,0 +1,61 @@
1
+ <div class="offer_full_desc skin_default">
2
+
3
+ <div class="left">
4
+
5
+ <div class="top">
6
+ <div class="big_gallery_wrapper" id="offer_gallery"> <%# offer_gallery только для того добавлен, чтобы связать slick между собой (asNavFor: '#offer_gallery',) %>
7
+ <% frames.each do |frame| %>
8
+ <div>
9
+
10
+ <%= link_to image_tag('',
11
+ :alt => image_alt,
12
+ :data => {
13
+ :lazy => image_path(frame.image.thumb_big_one)
14
+ }
15
+ ),
16
+ image_path(frame.image),
17
+ :title => image_alt
18
+ %>
19
+
20
+ </div>
21
+ <% end %>
22
+ </div>
23
+ </div>
24
+
25
+ <div class="bottom count_<%=frames.count%>"> <%# класс count_N добавлен для того, чтобы можно было скрыть мелкую навигационную галерею, состоящую из одного фрейма %>
26
+ <div class="nav_gallery_wrapper" id="offer_gallery_nav"> <%# offer_gallery_nav только для того добавлен, чтобы запустить slick в этом контейнере (asNavFor: '#offer_gallery') %>
27
+ <% frames.each do |frame| %>
28
+ <div>
29
+
30
+ <%= image_tag('',
31
+ :alt => image_alt,
32
+ :data => {
33
+ :lazy => image_path(frame.image.thumb_preview)
34
+ }
35
+ )
36
+ %>
37
+
38
+ </div>
39
+ <% end %>
40
+ </div>
41
+ </div>
42
+
43
+ </div>
44
+
45
+ <div class="right">
46
+ <%= desc.html_safe if desc.present? %>
47
+ <p class="price"><%= price %></p>
48
+ <div id="row_button">
49
+ <%= link_to order_button_label,
50
+ "#",
51
+ :title => order_button_label,
52
+ :class => 'c80_order_invoking_btn',
53
+ :data => {
54
+ :comment_text => predefined_text_in_order_form,
55
+ :subj_id => subj_id
56
+ }
57
+ %>
58
+ </div>
59
+ </div>
60
+
61
+ </div>
@@ -0,0 +1,14 @@
1
+ <%# выдать текстовый список предложений из указанной категории%>
2
+ <div class="offer_list">
3
+
4
+ <ul>
5
+ <% list.each do |offer| %>
6
+ <li>
7
+
8
+ <%= link_to offer.title, my_url_for_offer(offer), title: offer.title %>
9
+
10
+ </li>
11
+ <% end %>
12
+ </ul>
13
+
14
+ </div>
@@ -0,0 +1,28 @@
1
+ <%# выдать текстовый список предложений, сгруппированный по категориям %>
2
+ <div class="offer_list_grouped">
3
+
4
+ <ul>
5
+ <% list.each do |obj| %> <%# obj: {cat,offers} %>
6
+
7
+ <% if obj[:cat_title].present? %>
8
+ <li>
9
+ <h5><%= obj[:cat_title] %></h5>
10
+ <ul>
11
+ <% obj[:offers].each do |offer| %>
12
+ <li>
13
+ <%= link_to offer.title, my_url_for_offer(offer), title: offer.title %>
14
+ </li>
15
+ <% end %>
16
+ </ul>
17
+ </li>
18
+ <% else %>
19
+ <% obj[:offers].each do |offer| %>
20
+ <li>
21
+ <%= link_to offer.title, my_url_for_offer(offer), title: offer.title %>
22
+ </li>
23
+ <% end %>
24
+ <% end %>
25
+ <% end %>
26
+ </ul>
27
+
28
+ </div>
@@ -0,0 +1,23 @@
1
+ <%# выдать линейный список предложений с иконками %>
2
+ <div class="offer_list_iconed clearfix list_count_<%=list.count%> <%= css_style_for_block %>">
3
+
4
+ <ul class="clearfix">
5
+ <% list.each do |offer| %>
6
+ <li class="clearfix">
7
+ <% Rails.logger.debug "[TRACE] #{offer}" %>
8
+ <%= render_image_link_lazy({
9
+ :alt_image => offer.title,
10
+ :image => offer.ophoto_thumb_sm,
11
+ :a_href => my_url_for_offer(offer),
12
+ :a_class => '',
13
+ :a_css_style => css_for_a,
14
+ :a_rel => 'nofollow'
15
+ }) %>
16
+
17
+ <%= link_to offer.title, my_url_for_offer(offer), title: offer.title, style: css_for_title, class: 'title' %>
18
+
19
+ </li>
20
+ <% end %>
21
+ </ul>
22
+
23
+ </div>
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "c80_catoffers"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'c80_catoffers/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "c80_catoffers"
8
+ spec.version = C80Catoffers::VERSION
9
+ spec.authors = ["C80609A"]
10
+ spec.email = ["c080609a@gmail.com"]
11
+
12
+ spec.summary = "Offers gem"
13
+ spec.description = "Gem adds categories and offers"
14
+ spec.homepage = "https://github.com/c080609a/c80_catoffers"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.12"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_dependency 'activesupport', ['>= 3.0.0']
25
+
26
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,13 @@
1
+ C80Catoffers::Engine.routes.draw do
2
+
3
+ # get 'offers/(:offer_slug)', :to => 'site#view_gallery'
4
+
5
+ # match 'news_guru', :to => 'application#guru', :via => :post
6
+ # match 'rb', :to => 'banners#counter', :via => :post
7
+
8
+ # get '/auth/:provider/callback', to: 'sessions#create'
9
+ # delete '/logout', to: 'sessions#destroy'
10
+
11
+ # resources :comments, :only => :create
12
+
13
+ end
@@ -0,0 +1,19 @@
1
+ class C80CatoffersCreateProps < ActiveRecord::Migration
2
+ def change
3
+ create_table :c80_catoffers_props, :options => 'COLLATE=utf8_unicode_ci' do |t|
4
+
5
+ # количество услуг в одном ряду (в списке услуг)
6
+ t.integer :per_row
7
+
8
+ # размеры картинки в списке услуг
9
+ t.integer :preview_width
10
+ t.integer :preview_height
11
+
12
+ # размеры большой картинки на странице просмотра услуги
13
+ t.integer :big_one_width
14
+ t.integer :big_one_height
15
+
16
+ t.timestamps null: false
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,13 @@
1
+ class C80CatoffersCreateCategories < ActiveRecord::Migration
2
+ def change
3
+ create_table :c80_catoffers_categories, :options => 'COLLATE=utf8_unicode_ci' do |t|
4
+ t.integer :ord
5
+ t.string :title
6
+ t.string :slug
7
+ t.references :parent_category, index: true
8
+ t.text :desc
9
+
10
+ t.timestamps null: false
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ class C80CatoffersCreateOffers < ActiveRecord::Migration
2
+ def change
3
+ create_table :c80_catoffers_offers, :options => 'COLLATE=utf8_unicode_ci' do |t|
4
+ t.integer :ord
5
+ t.string :title
6
+ t.string :slug
7
+ t.string :price
8
+ t.text :short_desc
9
+ t.text :desc
10
+
11
+ t.timestamps null: false
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,10 @@
1
+ class C80CatoffersCreateOphotos < ActiveRecord::Migration
2
+ def change
3
+ create_table :c80_catoffers_ophotos, :options => 'COLLATE=utf8_unicode_ci' do |t|
4
+ t.string :image
5
+ t.references :offer
6
+
7
+ t.timestamps null: false
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ class C80CatoffersAddJoinTableCategoriesOffers < ActiveRecord::Migration
2
+ def change
3
+ create_table :c80_catoffers_categories_offers, :id => false do |t|
4
+ t.integer :category_id, :null => false
5
+ t.integer :offer_id, :null => false
6
+ end
7
+
8
+ add_index :c80_catoffers_categories_offers, [:offer_id, :category_id], :unique => true, :name => 'my_index'
9
+
10
+ end
11
+ end
@@ -0,0 +1,6 @@
1
+ class C80CatoffersAddThumbSmToProps < ActiveRecord::Migration
2
+ def change
3
+ add_column :c80_catoffers_props, :thumb_sm_width, :integer
4
+ add_column :c80_catoffers_props, :thumb_sm_height, :integer
5
+ end
6
+ end
@@ -0,0 +1,11 @@
1
+ class C80CatoffersAddJoinTableOffersProps < ActiveRecord::Migration
2
+ def change
3
+ create_table :c80_catoffers_offers_props, :id => false do |t|
4
+ t.integer :offer_id, :null => false
5
+ t.integer :prop_id, :null => false
6
+ end
7
+
8
+ add_index :c80_catoffers_offers_props, [:offer_id, :prop_id], :unique => true, :name => 'my_index_2'
9
+
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ class C80CatoffersAddPositionsCountToProps < ActiveRecord::Migration
2
+ def change
3
+ add_column :c80_catoffers_props, :positions_count, :integer
4
+ end
5
+ end
@@ -0,0 +1,13 @@
1
+ # rake db:seed:c80_catoffers_01_fill_props
2
+
3
+ C80Catoffers::Prop.delete_all
4
+ C80Catoffers::Prop.create!({
5
+ per_row:3,
6
+ preview_width:250, # NOTE:: [x090] синхронизировано с css
7
+ preview_height:164, # NOTE:: [x090] синхронизировано с css
8
+ big_one_width:621, # NOTE:: [x090] синхронизировано с css
9
+ big_one_height: 377, # NOTE:: [x090] синхронизировано с css
10
+ thumb_sm_width:80,
11
+ thumb_sm_height: 50,
12
+ positions_count: 4
13
+ })
@@ -0,0 +1,42 @@
1
+ # rake db:seed:x02_fill_categories
2
+
3
+ C80Catoffers::Category.delete_all
4
+ C80Catoffers::Category.create!([
5
+ {title: 'Фотоуслуги',
6
+ id: 10,
7
+ ord: 10
8
+ },
9
+ {title: 'Печать',
10
+ id: 20,
11
+ ord: 20
12
+ },
13
+ {title: 'Фотокурсы',
14
+ id: 30,
15
+ ord: 30
16
+ },
17
+ {title: 'Услуги визажиста',
18
+ id: 40,
19
+ ord: 40
20
+ },
21
+
22
+ {title: 'Сканирование',
23
+ id: 100,
24
+ ord: 100,
25
+ parent_category_id: 20
26
+ },
27
+ {title: 'Цветная печать',
28
+ id: 110,
29
+ ord: 110,
30
+ parent_category_id: 20
31
+ },
32
+ {title: 'Копирование и печать чертежей',
33
+ id: 120,
34
+ ord: 120,
35
+ parent_category_id: 20
36
+ },
37
+ {title: 'Багетирование',
38
+ id: 130,
39
+ ord: 130,
40
+ parent_category_id: 20
41
+ }
42
+ ])
@@ -0,0 +1,20 @@
1
+ # rake db:seed:x03_fill_offers
2
+
3
+ C80Catoffers::Offer.delete_all
4
+ C80Catoffers::Offer.create!([
5
+ {
6
+ id:1,
7
+ ord:20,
8
+ title:'Фотоуслуги'
9
+ },
10
+ {
11
+ id:2,
12
+ ord:20,
13
+ title:'Фотокурсы'
14
+ },
15
+ {
16
+ id:3,
17
+ ord:30,
18
+ title:'Услуги визажиста'
19
+ }
20
+ ])
@@ -0,0 +1,23 @@
1
+ module C80Catoffers
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace C80Catoffers
4
+
5
+ initializer :c80_catoffers_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_catoffers/**/"]
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 C80Catoffers
2
+ VERSION = "0.1.0.1"
3
+ end
@@ -0,0 +1,8 @@
1
+ require "c80_catoffers/version"
2
+ require "c80_catoffers/engine"
3
+
4
+ module C80Catoffers
5
+ def self.table_name_prefix
6
+ 'c80_catoffers_'
7
+ end
8
+ end