c80_catoffers 0.1.0.3 → 0.1.0.4

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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/app/admin/c80_catoffers/csamples.rb +69 -0
  3. data/app/admin/c80_catoffers/csprops.rb +41 -0
  4. data/app/assets/javascripts/c80_catoffers/offer_full_desc.js +52 -47
  5. data/app/assets/javascripts/c80_catoffers/offers_ajax.js +89 -0
  6. data/app/assets/stylesheets/c80_catoffers/offer_full_desc.scss +3 -2
  7. data/app/assets/stylesheets/c80_catoffers/offer_list_grouped.scss +23 -0
  8. data/app/assets/stylesheets/c80_catoffers/offer_list_widget.scss +19 -15
  9. data/app/assets/stylesheets/c80_catoffers/will_paginate.scss +65 -0
  10. data/app/controllers/c80_catoffers/application_controller.rb +25 -0
  11. data/app/helpers/c80_catoffers/app_helper.rb +47 -4
  12. data/app/helpers/c80_catoffers/csamples_helper.rb +52 -0
  13. data/app/helpers/c80_catoffers/inner/modal_helper.rb +16 -0
  14. data/app/helpers/c80_catoffers/price_helper.rb +17 -0
  15. data/app/helpers/c80_catoffers/urls_helper.rb +7 -3
  16. data/app/models/c80_catoffers/crow.rb +22 -0
  17. data/app/models/c80_catoffers/csample.rb +40 -0
  18. data/app/models/c80_catoffers/csprop.rb +5 -0
  19. data/app/models/c80_catoffers/offer.rb +7 -0
  20. data/app/uploaders/c80_catoffers/csphoto_uploader.rb +49 -0
  21. data/app/views/c80_catoffers/_bs_modal.html.erb +18 -0
  22. data/app/views/c80_catoffers/_csamples_widget.html.erb +43 -0
  23. data/app/views/c80_catoffers/_offers_list_grouped.html.erb +5 -2
  24. data/app/views/c80_catoffers/_offers_list_widget.html.erb +54 -48
  25. data/app/views/c80_catoffers/_offers_page.html.erb +23 -0
  26. data/app/views/c80_catoffers/_popup_price.html.erb +2 -0
  27. data/app/views/c80_catoffers/application/fake_main.html.erb +0 -0
  28. data/app/views/c80_catoffers/application/offers_guru.js.erb +10 -0
  29. data/app/views/c80_catoffers/application/price_me.js.erb +19 -0
  30. data/config/locales/ru.yml +6 -0
  31. data/config/routes.rb +3 -9
  32. data/db/migrate/20161105123939_c80_catoffers_add_per_page_to_props.rb +5 -0
  33. data/db/migrate/20161106154221_create_c80_catoffers_csamples.rb +13 -0
  34. data/db/migrate/20161106191544_create_c80_catoffers_crows.rb +13 -0
  35. data/db/migrate/20161107115555_c80_catoffers_create_csprops.rb +7 -0
  36. data/db/migrate/20161107123333_c80_catoffers_create_join_table_csprops_csamples.rb +11 -0
  37. data/db/seeds/c80_catoffers_01_fill_props.rb +2 -1
  38. data/lib/c80_catoffers/version.rb +1 -1
  39. metadata +27 -2
@@ -2,55 +2,61 @@
2
2
  # в списке представить в виде блока с указанным списком свойств +list_props+
3
3
  %>
4
4
 
5
- <div class="offer_list_widget clearfix list_count_<%= list_offers.count %> <%= css_style_for_block %>">
6
-
7
- <ul class="clearfix">
8
-
9
- <%# перебираем предложения, формируем список %>
10
- <% list_offers.each_with_index do |offer, offer_index| %>
11
- <li class="clearfix">
12
-
13
- <%# перебираем все имена свойств и для каждого предложения строим список %>
14
- <% list_props.each_with_index do |prop_name, prop_index| %>
15
-
16
- <%# ради возможных стилизаций будем вести счетчик и впишем его в класс каждого блока свойства %>
17
- <% prop_name_counter_class = "pr_#{prop_index}" %>
18
-
19
- <%# NOTE:: переберём имена свойств и под каждое применим свои правила форматирования %>
20
-
21
- <%# обложку предложения помещаем в ссылку и делаем lazy %>
22
- <% if prop_name['thumb'].present? %>
23
- <%= render_image_link_lazy({
24
- :alt_image => offer.title,
25
- :image => offer.ophoto_thumb(prop_name), # prop_name = thumb_sm, например
26
- :a_href => my_url_for_offer(offer),
27
- :a_class => prop_name_counter_class,
28
- :a_css_style => css_for_a,
29
- :a_rel => 'nofollow'
30
- }) %>
31
-
32
- <%# название обложки делаем кликабельным %>
33
- <% elsif prop_name['title'].present? %>
34
- <%= link_to offer.title,
35
- my_url_for_offer(offer),
36
- title: offer.title,
37
- style: css_for_title,
38
- class: "title #{prop_name_counter_class}"
39
- %>
40
-
41
- <%# остальные свойства выводим стопкой именованных дивов %>
42
- <% else %>
43
- <div class="<%= "#{prop_name} #{prop_name_counter_class}" %>" style="<%= css_for_title %>">
44
- <%= list_of_values_lists[offer_index][prop_index] %> <%# NOTE:: извлекаем значение prop_index-свойства для offer_index-предложения %>
45
- </div>
46
- <% end %>
47
-
48
- <%# NOTE:: закончили перебирать имена свойств %>
5
+ <div class="offer_list_widget_wrapper">
6
+ <% if h3_title.present? %>
7
+ <h3 class="section_title h3_for_offer_list_widget"><%= h3_title %></h3>
8
+ <% end %>
9
+
10
+ <div class="offer_list_widget clearfix list_count_<%= list_offers.count %> <%= css_style_for_block %>">
11
+
12
+ <ul class="clearfix">
13
+
14
+ <%# перебираем предложения, формируем список %>
15
+ <% list_offers.each_with_index do |offer, offer_index| %>
16
+ <li class="clearfix">
17
+
18
+ <%# перебираем все имена свойств и для каждого предложения строим список %>
19
+ <% list_props.each_with_index do |prop_name, prop_index| %>
20
+
21
+ <%# ради возможных стилизаций будем вести счетчик и впишем его в класс каждого блока свойства %>
22
+ <% prop_name_counter_class = "pr_#{prop_index}" %>
23
+
24
+ <%# NOTE:: переберём имена свойств и под каждое применим свои правила форматирования %>
25
+
26
+ <%# обложку предложения помещаем в ссылку и делаем lazy %>
27
+ <% if prop_name['thumb'].present? %>
28
+ <%= render_image_link_lazy({
29
+ :alt_image => offer.title,
30
+ :image => offer.ophoto_thumb(prop_name), # prop_name = thumb_sm, например
31
+ :a_href => my_url_for_offer(offer),
32
+ :a_class => prop_name_counter_class,
33
+ :a_css_style => css_for_a,
34
+ :a_rel => 'nofollow'
35
+ }) %>
36
+
37
+ <%# название обложки делаем кликабельным %>
38
+ <% elsif prop_name['title'].present? %>
39
+ <%= link_to offer.title,
40
+ my_url_for_offer(offer),
41
+ title: offer.title,
42
+ style: css_for_title,
43
+ class: "title #{prop_name_counter_class}"
44
+ %>
45
+
46
+ <%# остальные свойства выводим стопкой именованных дивов %>
47
+ <% else %>
48
+ <div class="<%= "#{prop_name} #{prop_name_counter_class}" %>" style="<%= css_for_title %>">
49
+ <%= list_of_values_lists[offer_index][prop_index] %> <%# NOTE:: извлекаем значение prop_index-свойства для offer_index-предложения %>
50
+ </div>
51
+ <% end %>
52
+
53
+ <%# NOTE:: закончили перебирать имена свойств %>
49
54
 
50
- <% end %>
55
+ <% end %>
51
56
 
52
- </li>
53
- <% end %>
54
- </ul>
57
+ </li>
58
+ <% end %>
59
+ </ul>
55
60
 
61
+ </div>
56
62
  </div>
@@ -0,0 +1,23 @@
1
+ <% # Нарисовать страницу просмотра всех Предложений.
2
+ #
3
+ %>
4
+
5
+ <div class="ajax_div_offers offers_page <%= css_style_for_block %>" data-css_class_offers_block="<%= css_style_for_block %>">
6
+
7
+ <%= render :partial => 'c80_catoffers/offers_list_widget',
8
+ :locals => {
9
+ list_props: list_props,
10
+ css_style_for_block: css_style_for_block,
11
+ list_offers: list_offers,
12
+ list_of_values_lists: list_of_values_lists,
13
+ css_for_a: css_for_a,
14
+ css_for_title: css_for_title,
15
+ h3_title: nil
16
+ }
17
+ %>
18
+
19
+ <div class="div_will_paginate">
20
+ <%= will_paginate list_offers %>
21
+ </div>
22
+
23
+ </div>
@@ -0,0 +1,2 @@
1
+ <% bs_modal = _render_bs_modal(content,title) %>
2
+ <%= bs_modal.html_safe %>
@@ -0,0 +1,10 @@
1
+ <%# TODO:: убрать временный хардкод %w(thumb_md title price) %>
2
+ var html_str = "<%= j render_offers_page(%w(thumb_md title price), 'sokol', 'thumb_md', params[:page]) %>";
3
+
4
+ var $aa = fOffersGetBlock();
5
+ $aa.replaceWith(html_str);
6
+
7
+ Holder.run($aa.find("img"));
8
+ fLazyStart();
9
+
10
+ fOffersProccessPaginateLinks();
@@ -0,0 +1,19 @@
1
+
2
+ var $body = $('body');
3
+
4
+ // вставим окно
5
+ var html_str = "<%= j render_popup_price %>";
6
+ var $m = $(html_str);
7
+ $body.append($m);
8
+
9
+ // покажем окно
10
+ $('#c80_catoffers_bs_modal').modal('show');
11
+
12
+ // настроим форму
13
+ //var $form = $("form#form_feedback");
14
+ //
15
+ //$form.bind("ajax:error", function (event, data, status, xhr) {
16
+ // $form.render_form_errors($.parseJSON(data.responseText));
17
+ //});
18
+ //
19
+ //$form.modal_success();
@@ -0,0 +1,6 @@
1
+ ru:
2
+ c80_catoffers:
3
+ offer_list_widget:
4
+ h3_title: 'Услуги'
5
+ csamples_widget:
6
+ h3_title: 'Пример рассчёта стоимости'
data/config/routes.rb CHANGED
@@ -1,13 +1,7 @@
1
1
  C80Catoffers::Engine.routes.draw do
2
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
3
+ # root to: 'application#fake_main' # NOTE:: добавлен только чтобы работал UrlsHelper
4
+ match 'offers_guru', :to => 'application#offers_guru', :via => :post
5
+ match 'price_me', :to => 'application#price_me', :via => :post
12
6
 
13
7
  end
@@ -0,0 +1,5 @@
1
+ class C80CatoffersAddPerPageToProps < ActiveRecord::Migration
2
+ def change
3
+ add_column :c80_catoffers_props, :per_page, :integer
4
+ end
5
+ end
@@ -0,0 +1,13 @@
1
+ class CreateC80CatoffersCsamples < ActiveRecord::Migration
2
+ def change
3
+ create_table :c80_catoffers_csamples, :options => 'COLLATE=utf8_unicode_ci' do |t|
4
+ t.string :title
5
+ t.string :sub_title
6
+ t.string :csphoto
7
+ t.integer :ord
8
+ t.integer :summ_price
9
+
10
+ t.timestamps null: false
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ class CreateC80CatoffersCrows < ActiveRecord::Migration
2
+ def change
3
+ create_table :c80_catoffers_crows, :options => 'COLLATE=utf8_unicode_ci' do |t|
4
+ t.integer :ord
5
+ t.references :csample, index: true
6
+ t.references :offer, index: true
7
+
8
+ t.timestamps null: false
9
+ end
10
+ # add_foreign_key :c80_catoffers_crows, :csamples
11
+ # add_foreign_key :c80_catoffers_crows, :offers
12
+ end
13
+ end
@@ -0,0 +1,7 @@
1
+ class C80CatoffersCreateCsprops < ActiveRecord::Migration
2
+ def change
3
+ create_table :c80_catoffers_csprops, :options => 'COLLATE=utf8_unicode_ci' do |t|
4
+ t.timestamps null: false
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ class C80CatoffersCreateJoinTableCspropsCsamples < ActiveRecord::Migration
2
+ def change
3
+ create_table :c80_catoffers_csamples_csprops, :id => false do |t|
4
+ t.integer :csprop_id, :null => false
5
+ t.integer :csample_id, :null => false
6
+ end
7
+
8
+ add_index :c80_catoffers_csamples_csprops, [:csprop_id, :csample_id], :unique => true, :name => 'my_index_23'
9
+
10
+ end
11
+ end
@@ -13,5 +13,6 @@ C80Catoffers::Prop.create!({
13
13
  thumb_md_height: 160, # NOTE:: просто стандартный размер
14
14
  thumb_lg_width: 1000, # NOTE:: просто стандартный размер
15
15
  thumb_lg_height: 550, # NOTE:: просто стандартный размер
16
- positions_count: 4
16
+ positions_count: 4,
17
+ per_page: 6 # сколько Предложений вывести в хелпере render_offers_page
17
18
  })
@@ -1,3 +1,3 @@
1
1
  module C80Catoffers
2
- VERSION = "0.1.0.3"
2
+ VERSION = "0.1.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: c80_catoffers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.3
4
+ version: 0.1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - C80609A
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-03 00:00:00.000000000 Z
11
+ date: 2016-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,10 +66,13 @@ files:
66
66
  - README.md
67
67
  - Rakefile
68
68
  - app/admin/c80_catoffers/categories.rb
69
+ - app/admin/c80_catoffers/csamples.rb
70
+ - app/admin/c80_catoffers/csprops.rb
69
71
  - app/admin/c80_catoffers/offers.rb
70
72
  - app/admin/c80_catoffers/props.rb
71
73
  - app/assets/javascripts/c80_catoffers.js.coffee
72
74
  - app/assets/javascripts/c80_catoffers/offer_full_desc.js
75
+ - app/assets/javascripts/c80_catoffers/offers_ajax.js
73
76
  - app/assets/stylesheets/c80_catoffers.scss
74
77
  - app/assets/stylesheets/c80_catoffers/_mixins/default_li_iconed.scss
75
78
  - app/assets/stylesheets/c80_catoffers/offer_full_desc.scss
@@ -78,25 +81,42 @@ files:
78
81
  - app/assets/stylesheets/c80_catoffers/offer_list_iconed.scss
79
82
  - app/assets/stylesheets/c80_catoffers/offer_list_iconed_columns.scss
80
83
  - app/assets/stylesheets/c80_catoffers/offer_list_widget.scss
84
+ - app/assets/stylesheets/c80_catoffers/will_paginate.scss
81
85
  - app/assets/stylesheets/c80_catoffers_backend.scss
82
86
  - app/assets/stylesheets/c80_catoffers_backend/page_admin_props.scss
87
+ - app/controllers/c80_catoffers/application_controller.rb
83
88
  - app/helpers/c80_catoffers/app_helper.rb
89
+ - app/helpers/c80_catoffers/csamples_helper.rb
84
90
  - app/helpers/c80_catoffers/inner/css_helper.rb
91
+ - app/helpers/c80_catoffers/inner/modal_helper.rb
92
+ - app/helpers/c80_catoffers/price_helper.rb
85
93
  - app/helpers/c80_catoffers/urls_helper.rb
86
94
  - app/models/c80_catoffers/category.rb
95
+ - app/models/c80_catoffers/crow.rb
96
+ - app/models/c80_catoffers/csample.rb
97
+ - app/models/c80_catoffers/csprop.rb
87
98
  - app/models/c80_catoffers/offer.rb
88
99
  - app/models/c80_catoffers/ophoto.rb
89
100
  - app/models/c80_catoffers/prop.rb
101
+ - app/uploaders/c80_catoffers/csphoto_uploader.rb
90
102
  - app/uploaders/c80_catoffers/ophoto_uploader.rb
103
+ - app/views/c80_catoffers/_bs_modal.html.erb
104
+ - app/views/c80_catoffers/_csamples_widget.html.erb
91
105
  - app/views/c80_catoffers/_offer_full_desc.html.erb
92
106
  - app/views/c80_catoffers/_offers_list_by_cat.html.erb
93
107
  - app/views/c80_catoffers/_offers_list_grouped.html.erb
94
108
  - app/views/c80_catoffers/_offers_list_iconed.html.erb
95
109
  - app/views/c80_catoffers/_offers_list_iconed_columns.html.erb
96
110
  - app/views/c80_catoffers/_offers_list_widget.html.erb
111
+ - app/views/c80_catoffers/_offers_page.html.erb
112
+ - app/views/c80_catoffers/_popup_price.html.erb
113
+ - app/views/c80_catoffers/application/fake_main.html.erb
114
+ - app/views/c80_catoffers/application/offers_guru.js.erb
115
+ - app/views/c80_catoffers/application/price_me.js.erb
97
116
  - bin/console
98
117
  - bin/setup
99
118
  - c80_catoffers.gemspec
119
+ - config/locales/ru.yml
100
120
  - config/routes.rb
101
121
  - db/migrate/201609221321_c80_catoffers_create_props.rb
102
122
  - db/migrate/201609221322_c80_catoffers_create_categories.rb
@@ -107,6 +127,11 @@ files:
107
127
  - db/migrate/20161008134848_c80_catoffers_add_join_table_offers_props.rb
108
128
  - db/migrate/20161008151414_c80_catoffers_add_positions_count_to_props.rb
109
129
  - db/migrate/20161023115252_c80_catoffers_add_thumb_md_to_props.rb
130
+ - db/migrate/20161105123939_c80_catoffers_add_per_page_to_props.rb
131
+ - db/migrate/20161106154221_create_c80_catoffers_csamples.rb
132
+ - db/migrate/20161106191544_create_c80_catoffers_crows.rb
133
+ - db/migrate/20161107115555_c80_catoffers_create_csprops.rb
134
+ - db/migrate/20161107123333_c80_catoffers_create_join_table_csprops_csamples.rb
110
135
  - db/seeds/c80_catoffers_01_fill_props.rb
111
136
  - db/seeds/c80_catoffers_02_fill_offers.rb
112
137
  - db/seeds/x02_fill_categories.rb