c80_yax 0.1.0.14 → 0.1.0.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af28ea59b7c5619dc7d3e3c28a38a309ddea0fd3
4
- data.tar.gz: 830cfc563b58ca2498db2332c873c5ff4f0407f7
3
+ metadata.gz: 34dc65fa5a2cfeff8fdb2fab6c8302f2b686e221
4
+ data.tar.gz: 406a5f17ca523dd7d13b635d48cf46183753b4b6
5
5
  SHA512:
6
- metadata.gz: 9097891f08bbb7e32b648441e3490d7eb6a0e911c5f59c4fba2d1730a865ede892a6953482dd4d30bd5bf0a6aff335de8e8d2b4ef21436c1d8636b25608780c5
7
- data.tar.gz: 46c7d9bc9102bddaecb4d1a6ccfb9e150fe5194f9d8cf1a22a996633650da459fb486fd2906860540b935544e05b5189f231dfc9944166d3943b25ab2ae980ae
6
+ metadata.gz: bd626611875a14290e58c0ea059c5a939dc0733e44e212cf4436a8a26b87b443b76ad5d1d50971ff78fab59343a52511430e85e69adff1958eff9b13312d858a
7
+ data.tar.gz: 14095acd0a89d7a8e6a9b9d38350c86ed4ef12fa64c049b6d65f3036605932cf030c9229515fdf0368e84823c3e4b006c2b8c78e6d81e1434b860889c3bba525
@@ -0,0 +1 @@
1
+ # require_tree ./of
@@ -1 +1 @@
1
- #= require_tree ./ti
1
+ # require_tree ./ti
@@ -5,10 +5,5 @@ module Ti
5
5
 
6
6
  helper C80LazyImages::Engine.helpers
7
7
 
8
- def guru
9
- respond_to do |format|
10
- format.js
11
- end
12
- end
13
8
  end
14
9
  end
@@ -1,96 +1,5 @@
1
1
  module Ti
2
2
  module ApplicationHelper
3
3
 
4
- include LocalTimeHelper
5
-
6
- def render_news_block(is_news_page=false, page=1, options={})
7
-
8
- # 1. на странице НОВОСТИ выводим per_page новостей, в виджете выводим per_widget новостей
9
- # 2. на странице НОВОСТИ div.news_block имеет класс is_news_page
10
- # 3. к div.news_block можно дописать стиль, типа style_photostudio
11
-
12
- per_page = Prop.first.per_widget
13
- css_class_news_block = ''
14
- if is_news_page
15
- css_class_news_block = 'is_news_page'
16
- per_page = Prop.first.per_page
17
- end
18
- per_block_row = Prop.first.per_widget
19
-
20
- #
21
- if options[:css_class_news_block].present?
22
- css_class_news_block += " #{options[:css_class_news_block]}"
23
- end
24
-
25
- news = Fact.paginate(:page => page, :per_page => per_page)
26
-
27
- is_render_paginator = options[:is_render_paginator].present? \
28
- ? options[:is_render_paginator] \
29
- : is_news_page
30
-
31
- render :partial => "shared/news_block",
32
- :locals => {
33
- :news_list => news,
34
- :is_news_page => is_news_page,
35
- :per_block_row => per_block_row,
36
- :partial_name => options[:partial_name],
37
- :is_render_paginator => is_render_paginator,
38
- :thumb_size => options[:thumb_size],
39
- :css_class_news_block => css_class_news_block,
40
- :h3_title => options[:h3_title]
41
- }
42
- end
43
-
44
- def render_one_fact(fact, partial_name='fact', thumb_size='thumb_md', additional_css_class=nil)
45
-
46
-
47
- unless thumb_size.present?
48
- thumb_size = 'thumb_md'
49
- end
50
-
51
- # Rails.logger.debug "[TRACE] <render_one_fact> thumb_size: #{thumb_size}"
52
-
53
- # свойства модуля
54
- p = Prop.first
55
-
56
- # чтобы вёрстка не прыгала - зафиксируем размер картинки
57
- w = p.send("#{thumb_size}_width")
58
- h = p.send("#{thumb_size}_width")
59
-
60
- render :partial => "shared/#{partial_name}",
61
- :locals => {
62
- fact: fact,
63
- css_common_width_height: "width:#{w}px;height:#{h}px",
64
- css_common_width: "width:#{w}px;",
65
- thumb_size:thumb_size,
66
- additional_css_class:additional_css_class
67
- }
68
- end
69
-
70
- def url_for_fact(fact)
71
- "/news/#{fact.slug}"
72
- end
73
-
74
- # метод добавлен, чтобы сократить количество символов в строке, которую надо вставить в
75
- # 256-символьное структурное поле Страницы (Page) типа after_main (в админке), чтобы отрендерить новостной виджет
76
- def render_news_widget(css_class_news_block='style_default',
77
- partial_name='fact_inverted',
78
- thumb_size='thumb_preview',
79
- h3_title=' '
80
- )
81
-
82
- if h3_title == ' '
83
- h3_title = I18n.t('c80_news.news_widget.h3_title')
84
- end
85
-
86
- render_news_block(false, params[:page], {
87
- :partial_name => partial_name,
88
- :thumb_size => thumb_size,
89
- :css_class_news_block => css_class_news_block,
90
- :h3_title => h3_title
91
- }
92
- )
93
- end
94
-
95
4
  end
96
5
  end
@@ -1,3 +1,3 @@
1
1
  module C80Yax
2
- VERSION = '0.1.0.14'
2
+ VERSION = '0.1.0.15'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: c80_yax
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.14
4
+ version: 0.1.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - C80609A
@@ -238,8 +238,7 @@ files:
238
238
  - db/seeds/c80_yax_01_fill_props.rb
239
239
  - engines/of/README.md
240
240
  - engines/of/app/admin/ti/offers.rb
241
- - engines/of/app/assets/javascripts/ti.coffee
242
- - engines/of/app/assets/javascripts/ti/facts_ajax.js
241
+ - engines/of/app/assets/javascripts/of.coffee
243
242
  - engines/of/app/assets/stylesheets/of.scss
244
243
  - engines/of/app/assets/stylesheets/of/offer_show.scss
245
244
  - engines/of/app/assets/stylesheets/of/offers_list.scss
@@ -281,7 +280,6 @@ files:
281
280
  - engines/ti/app/admin/ti/docs.rb
282
281
  - engines/ti/app/admin/ti/x_ti.rb
283
282
  - engines/ti/app/assets/javascripts/ti.coffee
284
- - engines/ti/app/assets/javascripts/ti/facts_ajax.js
285
283
  - engines/ti/app/assets/stylesheets/ti.scss
286
284
  - engines/ti/app/assets/stylesheets/ti/tech_info_list.scss
287
285
  - engines/ti/app/controllers/ti/application_controller.rb
@@ -298,7 +296,6 @@ files:
298
296
  - engines/ti/app/views/shared/_fact_inverted.html.erb
299
297
  - engines/ti/app/views/shared/_news_block.html.erb
300
298
  - engines/ti/app/views/shared/_news_list.html.erb
301
- - engines/ti/app/views/ti/application/guru.js.erb
302
299
  - engines/ti/bin/console
303
300
  - engines/ti/bin/setup
304
301
  - engines/ti/config/locales/ru.yml
@@ -1,76 +0,0 @@
1
- "use strict";
2
-
3
- // Код, реализующий ajax функционал на странице "новости"
4
-
5
- var fNewsBindHistoryAdapter;
6
- var fNewsdoAjaxRequest;
7
- var fNewsProccessPaginateLinks;
8
- var fNewsStartWillPaginateAjax;
9
- var fNewsProcessBlocks; // при клике по preview-картинке новости будет происходить переход на просмотр новости
10
-
11
- $(function () {
12
- if ($('.news_block[data-is_render_paginator="true"]').length) {
13
-
14
- fNewsBindHistoryAdapter = function () {
15
- History.Adapter.bind(window,'statechange',function(){ // Note: We are using statechange instead of popstate
16
-
17
- // Log the State
18
- var State = History.getState(); // Note: We are using History.getState() instead of event.state
19
- var p;
20
-
21
- //History.log('statechange:', State.data, State.title, State.url);
22
- if (State.title == "") {
23
- p = 1;
24
- } else {
25
- p = State.data.page;
26
- }
27
-
28
- fNewsdoAjaxRequest(p);
29
- });
30
- };
31
-
32
- fNewsdoAjaxRequest = function (page/*integer*/,callback/*function*/) {
33
-
34
- var $ajax_div = $('.ajax_div'); // к этому контейнеру изначально прикреплены кое-какие данные
35
-
36
- $.ajax({
37
- url: "/news_guru",
38
- type: "POST",
39
- data: {
40
- page: page,
41
- is_render_paginator: $ajax_div.data('is_render_paginator'), // эти переменные
42
- partial_name: $ajax_div.data('partial_name'), // уходят транзитом
43
- css_class_news_block: $ajax_div.data('css_class_news_block') // на render_news_block
44
- },
45
- dataType: "script"
46
- }).done(callback);
47
- };
48
-
49
- fNewsProccessPaginateLinks = function () {
50
- //console.log("fNewsProccessPaginateLinks");
51
- $(".news_block .div_will_paginate a").click(function (e) {
52
- e.preventDefault();
53
- var page = $(this).attr('href').split("?page=")[1];
54
- History.pushState({page:page},window.document.title,"?page="+page);
55
- });
56
- };
57
-
58
- fNewsStartWillPaginateAjax = function () {
59
- if ($(".news_block .div_will_paginate a").length > 0) {
60
- fNewsProccessPaginateLinks();
61
- fNewsBindHistoryAdapter();
62
- }
63
- };
64
-
65
- fNewsProcessBlocks = function() {
66
- $(".fact img").click(function (e) {
67
- // NB:: parent().parent() хардкод: картинка лежит в ссылке, ссылка лежит в диве
68
- window.location.href = $(this).parent().parent().data('url');
69
- });
70
- };
71
-
72
- fNewsStartWillPaginateAjax();
73
- fNewsProcessBlocks();
74
-
75
- }
76
- });
@@ -1 +0,0 @@
1
- #= require_tree ./ti
@@ -1,76 +0,0 @@
1
- "use strict";
2
-
3
- // Код, реализующий ajax функционал на странице "новости"
4
-
5
- var fNewsBindHistoryAdapter;
6
- var fNewsdoAjaxRequest;
7
- var fNewsProccessPaginateLinks;
8
- var fNewsStartWillPaginateAjax;
9
- var fNewsProcessBlocks; // при клике по preview-картинке новости будет происходить переход на просмотр новости
10
-
11
- $(function () {
12
- if ($('.news_block[data-is_render_paginator="true"]').length) {
13
-
14
- fNewsBindHistoryAdapter = function () {
15
- History.Adapter.bind(window,'statechange',function(){ // Note: We are using statechange instead of popstate
16
-
17
- // Log the State
18
- var State = History.getState(); // Note: We are using History.getState() instead of event.state
19
- var p;
20
-
21
- //History.log('statechange:', State.data, State.title, State.url);
22
- if (State.title == "") {
23
- p = 1;
24
- } else {
25
- p = State.data.page;
26
- }
27
-
28
- fNewsdoAjaxRequest(p);
29
- });
30
- };
31
-
32
- fNewsdoAjaxRequest = function (page/*integer*/,callback/*function*/) {
33
-
34
- var $ajax_div = $('.ajax_div'); // к этому контейнеру изначально прикреплены кое-какие данные
35
-
36
- $.ajax({
37
- url: "/news_guru",
38
- type: "POST",
39
- data: {
40
- page: page,
41
- is_render_paginator: $ajax_div.data('is_render_paginator'), // эти переменные
42
- partial_name: $ajax_div.data('partial_name'), // уходят транзитом
43
- css_class_news_block: $ajax_div.data('css_class_news_block') // на render_news_block
44
- },
45
- dataType: "script"
46
- }).done(callback);
47
- };
48
-
49
- fNewsProccessPaginateLinks = function () {
50
- //console.log("fNewsProccessPaginateLinks");
51
- $(".news_block .div_will_paginate a").click(function (e) {
52
- e.preventDefault();
53
- var page = $(this).attr('href').split("?page=")[1];
54
- History.pushState({page:page},window.document.title,"?page="+page);
55
- });
56
- };
57
-
58
- fNewsStartWillPaginateAjax = function () {
59
- if ($(".news_block .div_will_paginate a").length > 0) {
60
- fNewsProccessPaginateLinks();
61
- fNewsBindHistoryAdapter();
62
- }
63
- };
64
-
65
- fNewsProcessBlocks = function() {
66
- $(".fact img").click(function (e) {
67
- // NB:: parent().parent() хардкод: картинка лежит в ссылке, ссылка лежит в диве
68
- window.location.href = $(this).parent().parent().data('url');
69
- });
70
- };
71
-
72
- fNewsStartWillPaginateAjax();
73
- fNewsProcessBlocks();
74
-
75
- }
76
- });
@@ -1,16 +0,0 @@
1
-
2
- var html_str = "<%= j render_news_block(true,params[:page], {
3
- :partial_name => params[:partial_name],
4
- :is_render_paginator => params[:is_render_paginator],
5
- :css_class_news_block => params[:css_class_news_block]
6
- })
7
- %>";
8
-
9
- var $aa = $('.news_block[data-is_render_paginator="true"]');
10
- $aa.replaceWith(html_str);
11
-
12
- Holder.run($aa.find("img"));
13
- fLazyStart();
14
-
15
- fNewsProccessPaginateLinks();
16
- fNewsProcessBlocks();