c80_news_tz 0.1.1.16 → 0.1.1.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/c80_news_tz/frontend/facts_ajax.js +2 -2
- data/app/assets/stylesheets/c80_news_tz/application.scss +1 -1
- data/app/assets/stylesheets/c80_news_tz/frontend/pubs_medium.scss +64 -0
- data/app/helpers/c80_news_tz/publications_helper.rb +138 -0
- data/app/helpers/c80_news_tz/subj_helper.rb +9 -8
- data/app/models/c80_news_tz/fact.rb +5 -0
- data/app/views/c80_news_tz/application/guru.js.erb +1 -2
- data/app/views/shared/_news_block.html.erb +6 -2
- data/app/views/shared/_news_list.html.erb +24 -10
- data/lib/c80_news_tz/version.rb +1 -1
- metadata +3 -3
- data/app/assets/javascripts/c80_news_tz/frontend/facts_wookmark.js +0 -10
- data/app/assets/stylesheets/c80_news_tz/facts_wookmark.scss +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b30eb00f6acd82c4e2638a66fd1fcea98a19d5c
|
4
|
+
data.tar.gz: c10b06c811911ab2a47b6f0c5dd286d1191a4203
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef9e6496cd14e68f22a74088549332cd9bcddd8d6250d6b15c8f4c45d8d1e84fb3aae036e49536a173c79c9de454f8e8bcce5a2d0b677edb8d5efcdbdd3d1604
|
7
|
+
data.tar.gz: 2517b5726ab4bbad36a0ca8788abdcdc5e816446d7ef6305dd19993b335c05a5bbae00d7e406d76e3edf4d0d340be9bcea652d9e4a598c34907c9af8ab99bbb9
|
@@ -9,7 +9,7 @@ var fNewsStartWillPaginateAjax;
|
|
9
9
|
var fNewsProcessBlocks; // при клике по preview-картинке новости будет происходить переход на просмотр новости
|
10
10
|
|
11
11
|
$(function () {
|
12
|
-
if ($("body#
|
12
|
+
if ($("body#rubric").length == 1) {
|
13
13
|
|
14
14
|
fNewsBindHistoryAdapter = function () {
|
15
15
|
History.Adapter.bind(window,'statechange',function(){ // Note: We are using statechange instead of popstate
|
@@ -33,7 +33,7 @@ $(function () {
|
|
33
33
|
$.ajax({
|
34
34
|
url: "/news_guru",
|
35
35
|
type: "POST",
|
36
|
-
data: {page: page},
|
36
|
+
data: {page: page, rubric_slug:rubric_slug }, // rubric_slug - вставлена в _news_block
|
37
37
|
dataType: "script"
|
38
38
|
}).done(callback);
|
39
39
|
};
|
@@ -0,0 +1,64 @@
|
|
1
|
+
/* preview блок публикации, medium вариант */
|
2
|
+
/* три публикации в ряд */
|
3
|
+
|
4
|
+
div.pub_medium {
|
5
|
+
float: left;
|
6
|
+
height: 310px;
|
7
|
+
width: 223px;
|
8
|
+
position: relative;
|
9
|
+
|
10
|
+
&.pub_medium_1 {
|
11
|
+
margin: 0 71px;
|
12
|
+
}
|
13
|
+
|
14
|
+
div.time {
|
15
|
+
height: 24px;
|
16
|
+
line-height: 24px;
|
17
|
+
font-size: 12px;
|
18
|
+
color: #9c9c9c;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.rubric_title {
|
22
|
+
height: 30px;
|
23
|
+
min-width: 130px;
|
24
|
+
color: #3c4f65;
|
25
|
+
font-size: 12px;
|
26
|
+
padding: 2px 0 0 0;
|
27
|
+
line-height: 30px;
|
28
|
+
overflow: hidden;
|
29
|
+
white-space: nowrap;
|
30
|
+
}
|
31
|
+
|
32
|
+
div.title {
|
33
|
+
margin-bottom: 10px;
|
34
|
+
a {
|
35
|
+
color: black;
|
36
|
+
text-decoration: underline;
|
37
|
+
font-size: 16px;
|
38
|
+
&:hover { color: #2e2e2e;}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
div.comments {
|
43
|
+
cursor: pointer;
|
44
|
+
color: #9c9c9c;
|
45
|
+
font-size: 12px;
|
46
|
+
|
47
|
+
position: absolute;
|
48
|
+
bottom: 5px;
|
49
|
+
|
50
|
+
i {
|
51
|
+
width: 12px;
|
52
|
+
height: 12px;
|
53
|
+
color: #F5633E;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
a.company_logo {
|
58
|
+
background: transparent !important;
|
59
|
+
position: absolute;
|
60
|
+
bottom:0;
|
61
|
+
right:0;
|
62
|
+
}
|
63
|
+
|
64
|
+
}
|
@@ -0,0 +1,138 @@
|
|
1
|
+
module C80NewsTz
|
2
|
+
module PublicationsHelper
|
3
|
+
|
4
|
+
# собрать информацию для отрисовки preview блока публикации
|
5
|
+
def arrange_preview_pub(pub, thumb_size = 'medium')
|
6
|
+
|
7
|
+
# Определимся с размерами области под preview картинки.
|
8
|
+
size = calc_thumb_size(thumb_size)
|
9
|
+
ww = size[0]
|
10
|
+
hh = size[1]
|
11
|
+
|
12
|
+
# определяемся с preview картинкой
|
13
|
+
photo_preview = 'nil.gif'
|
14
|
+
if pub.photo_preview.present?
|
15
|
+
|
16
|
+
if thumb_size == 'big'
|
17
|
+
photo_preview = pub.photo_preview.thumb_preview_big
|
18
|
+
elsif thumb_size == 'small'
|
19
|
+
photo_preview = pub.photo_preview.thumb_preview_small
|
20
|
+
else
|
21
|
+
# по умолчанию - возьмем среднюю
|
22
|
+
photo_preview = pub.photo_preview.thumb_preview_medium
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
# options hash для отрисовки preview image главной публикации
|
28
|
+
pi = {
|
29
|
+
:alt_image => pub.title,
|
30
|
+
:image => photo_preview,
|
31
|
+
:ww => ww,
|
32
|
+
:hh => hh,
|
33
|
+
:a_href => url_for_fact(pub)
|
34
|
+
}
|
35
|
+
|
36
|
+
# соберём характеристики компании главной публикации
|
37
|
+
cl = nil
|
38
|
+
company_logo_image = nil
|
39
|
+
company_url = ''
|
40
|
+
company_alt = ''
|
41
|
+
|
42
|
+
# определяемся с картинкой логотипа компании
|
43
|
+
if pub.company_logo.present?
|
44
|
+
# company_logo_image = pub.company_logo.thumb_fit
|
45
|
+
|
46
|
+
if thumb_size == 'big'
|
47
|
+
company_logo_image = pub.company_logo.thumb_preview_big
|
48
|
+
elsif thumb_size == 'small'
|
49
|
+
company_logo_image = pub.company_logo.thumb_preview_small
|
50
|
+
else
|
51
|
+
# по умолчанию - возьмем среднюю
|
52
|
+
company_logo_image = pub.company_logo.thumb_preview_medium
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
if company_logo_image.present?
|
58
|
+
# вешаем ссылку на компанию на логотип компании
|
59
|
+
if pub.companies.count > 0
|
60
|
+
company_url = apph_url_for_company(pub.companies.first.slug)
|
61
|
+
company_alt = pub.companies.first.title
|
62
|
+
end
|
63
|
+
|
64
|
+
# options hash для отрисовки логотипа компании главной публикации
|
65
|
+
cl = {
|
66
|
+
:alt_image => company_alt,
|
67
|
+
:image => company_logo_image,
|
68
|
+
:a_href => company_url,
|
69
|
+
:a_class => 'company_logo'
|
70
|
+
}
|
71
|
+
end
|
72
|
+
|
73
|
+
result = {
|
74
|
+
pi: pi, # preview image
|
75
|
+
cl: cl, # company logo
|
76
|
+
title: pub.title,
|
77
|
+
rubric: pub.rubric_title,
|
78
|
+
time: local_time(pub[:created_at], format: '%H:%M %d.%m.%Y'),
|
79
|
+
comments_count: 12
|
80
|
+
}
|
81
|
+
|
82
|
+
result
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
# выдать информацию для отрисовки preview болванки
|
87
|
+
def get_billet_pub(thumb_size = 'medium')
|
88
|
+
|
89
|
+
# Определимся с размерами области под preview картинки.
|
90
|
+
size = calc_thumb_size(thumb_size)
|
91
|
+
ww = size[0]
|
92
|
+
hh = size[1]
|
93
|
+
|
94
|
+
result = {
|
95
|
+
pi: { # preview image
|
96
|
+
:alt_image => 'Укажите публикацию',
|
97
|
+
:image => 'nil.gif',
|
98
|
+
:ww => ww,
|
99
|
+
:hh => hh,
|
100
|
+
:a_href => '/'
|
101
|
+
},
|
102
|
+
cl: nil,
|
103
|
+
title: 'На этом месте должна быть публикация',
|
104
|
+
rubric: 'Какая такая рубрика?',
|
105
|
+
time: '12:30 17.08.1998',
|
106
|
+
comments_count: 666
|
107
|
+
}
|
108
|
+
result
|
109
|
+
end
|
110
|
+
|
111
|
+
private
|
112
|
+
|
113
|
+
# В зависимости от thumb_size выдать размер картинки для preview блока публикации
|
114
|
+
def calc_thumb_size(thumb_size)
|
115
|
+
# Размеры бывают трёх видов:
|
116
|
+
# * big: 500x321 - главная публикация
|
117
|
+
# * small: 126x84 - публикация в правом блоке (места 2 и 3); также используется в выдаче публикаций рубрик
|
118
|
+
# * medium: 223x149 - публикация в горизонтальном блоке (например: места 4,5,6)
|
119
|
+
# Текстовые идентификаторы (TAG) коррелируют с именами thumb_preview_{TAG} загрузчика FphotoUploader
|
120
|
+
|
121
|
+
# по умолчанию - возьмём размер средней картинки
|
122
|
+
ww = 223
|
123
|
+
hh = 149
|
124
|
+
|
125
|
+
if thumb_size == 'big'
|
126
|
+
ww = 500
|
127
|
+
hh = 321
|
128
|
+
elsif thumb_size == 'small'
|
129
|
+
ww = 126
|
130
|
+
hh = 84
|
131
|
+
end
|
132
|
+
|
133
|
+
[ww,hh]
|
134
|
+
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
138
|
+
end
|
@@ -2,21 +2,22 @@ module C80NewsTz
|
|
2
2
|
module SubjHelper
|
3
3
|
|
4
4
|
include LocalTimeHelper
|
5
|
+
include PageContentHelper # NB:: хардкод: хелпер нах. не внутри гема, а в host приложении. Оформляет lazy-картинки.
|
5
6
|
|
6
|
-
def render_news_block(
|
7
|
+
def render_news_block(rubric_slug, page=1)
|
8
|
+
per_page = Prop.first.per_page
|
9
|
+
news = Fact.where_rubric(rubric_slug).paginate(:page => page,:per_page => per_page)
|
7
10
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
else
|
12
|
-
per_widget = C80NewsTz::Prop.first.per_widget
|
13
|
-
news = Fact.limit(per_widget)
|
11
|
+
news_for_render = []
|
12
|
+
news.each do |p|
|
13
|
+
news_for_render << arrange_preview_pub(p,'medium')
|
14
14
|
end
|
15
15
|
|
16
16
|
render :partial => "shared/news_block",
|
17
17
|
:locals => {
|
18
|
+
:news_for_render => news_for_render,
|
18
19
|
:news_list => news,
|
19
|
-
:
|
20
|
+
:rubric_slug => rubric_slug
|
20
21
|
}
|
21
22
|
end
|
22
23
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
var $cc = $(".ajax_div");
|
2
|
-
var html_str = "<%= j render_news_block(
|
2
|
+
var html_str = "<%= j render_news_block(params[:rubric_slug], params[:page]) %>";
|
3
3
|
|
4
4
|
$cc.html(html_str);
|
5
5
|
Holder.run(".ajax_div img");
|
@@ -7,4 +7,3 @@ fLazyStart();
|
|
7
7
|
|
8
8
|
fNewsProccessPaginateLinks();
|
9
9
|
fNewsProcessBlocks();
|
10
|
-
$('.div_facts').wookmark({ align:"left", offset:20 });
|
@@ -1,8 +1,12 @@
|
|
1
|
+
<%# эту переменную возьмёт fact_ajax.js: а именно - fNewsdoAjaxRequest пошлёт как параметр на guru.js %>
|
2
|
+
<script>
|
3
|
+
rubric_slug = "<%= rubric_slug %>";
|
4
|
+
</script>
|
1
5
|
<div class="ajax_div">
|
2
6
|
<%= render :partial => "shared/news_list",
|
3
7
|
:locals => {
|
4
|
-
:
|
5
|
-
:
|
8
|
+
:news_for_render => news_for_render,
|
9
|
+
:news_list => news_list
|
6
10
|
}
|
7
11
|
%>
|
8
12
|
</div>
|
@@ -1,12 +1,26 @@
|
|
1
|
-
<div class="
|
2
|
-
<%
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
<div class="div_pubs clearfix">
|
2
|
+
<% news_for_render.each_with_index do |pub,index| %>
|
3
|
+
<% k = index%3 %>
|
4
|
+
<div class="pub_medium pub_medium_<%= k %>">
|
5
|
+
<div class="time"><%= pub[:time] %></div>
|
6
|
+
<%= render_image_link_lazy_holder(pub[:pi]) %>
|
7
|
+
<div class="rubric_title">
|
8
|
+
<%= pub[:rubric] %>
|
9
|
+
</div>
|
10
|
+
<div class="title">
|
11
|
+
<a title="<%= pub[:title] %>" href="<%= pub[:pi][:a_href]%>"><%= pub[:title] %></a>
|
12
|
+
</div>
|
13
|
+
<%= render_image_link_lazy(pub[:cl]) if pub[:cl].present? %>
|
14
|
+
<div class="comments" title="Комментариев: <%= pub[:comments_count]%>">
|
15
|
+
<i class="fa fa-comment"></i>
|
16
|
+
<%= pub[:comments_count]%>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
<% if k == 2 && index != news_for_render.count-1 %>
|
20
|
+
<div class="hr"></div>
|
21
|
+
<% end %>
|
6
22
|
<% end %>
|
7
23
|
</div>
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
</div>
|
12
|
-
<% end %>
|
24
|
+
<div class="div_will_paginate">
|
25
|
+
<%= will_paginate news_list %>
|
26
|
+
</div>
|
data/lib/c80_news_tz/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: c80_news_tz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.1.
|
4
|
+
version: 0.1.1.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- C80609A
|
@@ -106,15 +106,15 @@ files:
|
|
106
106
|
- app/assets/javascripts/c80_news_tz/backend.js.coffee
|
107
107
|
- app/assets/javascripts/c80_news_tz/backend/collapsable-groups.js
|
108
108
|
- app/assets/javascripts/c80_news_tz/frontend/facts_ajax.js
|
109
|
-
- app/assets/javascripts/c80_news_tz/frontend/facts_wookmark.js
|
110
109
|
- app/assets/stylesheets/c80_news_tz/application.scss
|
111
110
|
- app/assets/stylesheets/c80_news_tz/backend.scss
|
112
111
|
- app/assets/stylesheets/c80_news_tz/backend/collapsed.scss
|
113
112
|
- app/assets/stylesheets/c80_news_tz/backend/companies.scss
|
114
113
|
- app/assets/stylesheets/c80_news_tz/backend/notices.scss
|
115
|
-
- app/assets/stylesheets/c80_news_tz/
|
114
|
+
- app/assets/stylesheets/c80_news_tz/frontend/pubs_medium.scss
|
116
115
|
- app/controllers/c80_news_tz/application_controller.rb
|
117
116
|
- app/helpers/c80_news_tz/application_helper.rb
|
117
|
+
- app/helpers/c80_news_tz/publications_helper.rb
|
118
118
|
- app/helpers/c80_news_tz/subj_helper.rb
|
119
119
|
- app/models/c80_news_tz/adress.rb
|
120
120
|
- app/models/c80_news_tz/company.rb
|
@@ -1,27 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Grid container
|
3
|
-
*/
|
4
|
-
.div_facts {
|
5
|
-
position: relative; /** Needed to ensure items are laid out relative to this container **/
|
6
|
-
padding: 0;
|
7
|
-
margin: 0;
|
8
|
-
display: none;
|
9
|
-
|
10
|
-
.fact {
|
11
|
-
display: block;
|
12
|
-
float: left;
|
13
|
-
width: 229px;
|
14
|
-
max-height: 350px;
|
15
|
-
overflow: hidden;
|
16
|
-
margin-bottom: 20px;
|
17
|
-
|
18
|
-
img {
|
19
|
-
margin-bottom: 10px;
|
20
|
-
}
|
21
|
-
}
|
22
|
-
|
23
|
-
}
|
24
|
-
|
25
|
-
div.news_widget {
|
26
|
-
background-color: #b0b0b0;
|
27
|
-
}
|