refinerycms-pdf_newsletters 1.2 → 1.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,19 @@
|
|
1
|
+
module PdfNewslettersHelper
|
2
|
+
def newsletter_description(newsletter)
|
3
|
+
"Volume #{newsletter.volume} Issue #{newsletter.issue} - #{newsletter.month} #{newsletter.year}"
|
4
|
+
end
|
5
|
+
|
6
|
+
def each_year(newsletters)
|
7
|
+
newsletters_list = newsletters
|
8
|
+
newsletter = newsletters_list.shift
|
9
|
+
while newsletter.present?
|
10
|
+
year_list = []
|
11
|
+
@year = newsletter.year
|
12
|
+
while newsletter && newsletter.year == @year
|
13
|
+
year_list << newsletter
|
14
|
+
newsletter = newsletters_list.shift
|
15
|
+
end
|
16
|
+
yield year_list
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -1,17 +1,11 @@
|
|
1
|
-
<%
|
2
|
-
|
3
|
-
<%
|
4
|
-
|
5
|
-
<% unless newsletter.editor.blank? %>
|
6
|
-
<p>(By Editor <%=newsletter.editor%>)</p>
|
1
|
+
<% each_year(newsletters) do |year_list| %>
|
2
|
+
<h2><%=year_list.first.year-%> Newsletters</h2>
|
3
|
+
<% unless year_list.first.editor.blank? %>
|
4
|
+
<p>(By Editor <%=year_list.first.editor%>)</p>
|
7
5
|
<% end %>
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
<li>
|
12
|
-
<%= render :partial => 'newsletter', :object => newsletter %>
|
13
|
-
</li>
|
14
|
-
<% newsletter = newsletters_list.shift %>
|
6
|
+
<ul>
|
7
|
+
<% year_list.each do |newsletter| %>
|
8
|
+
<li><%= render :partial => 'newsletter', :object => newsletter %></li>
|
15
9
|
<% end %>
|
16
10
|
</ul>
|
17
11
|
<% end %>
|
@@ -1,2 +1 @@
|
|
1
|
-
<%= link_to
|
2
|
-
newsletter.pdf.url %>
|
1
|
+
<%= link_to newsletter_description(newsletter), newsletter.pdf.url %>
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: refinerycms-pdf_newsletters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: "1.
|
5
|
+
version: "1.3"
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Doug Bradbury <doug@8thlight.com>
|
@@ -33,6 +33,7 @@ files:
|
|
33
33
|
- config/routes.rb
|
34
34
|
- app/controllers/admin/pdf_newsletters_controller.rb
|
35
35
|
- app/controllers/pdf_newsletters_controller.rb
|
36
|
+
- app/helpers/pdf_newsletters_helper.rb
|
36
37
|
- app/models/pdf_newsletter.rb
|
37
38
|
- app/views/admin/pdf_newsletters/_actions.html.erb
|
38
39
|
- app/views/admin/pdf_newsletters/_form.html.erb
|