Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Print publications to pdf

  • Loading branch information...
commit 69eae29d5e1260ab3768750906d4e3f5ff364eec 1 parent d7a566d
@evserykh evserykh authored
View
6 app/models/publication.rb
@@ -3,7 +3,11 @@ class Publication < ActiveRecord::Base
belongs_to :work_programm
- alias_attribute :to_s, :text
+ validates_presence_of :text
has_enum :publication_kind
+
+ def to_s
+ "#{text}".tap { |s| s << ". URL: #{url}" if url? }
+ end
end
View
36 app/views/reports/_publications.pdf.erb
@@ -0,0 +1,36 @@
+<div class='publications_page'>
+ <h1 class='uppercase strong'>3. Учебно-методические материалы по дисциплине</h1>
+
+ <h2 class='strong'>3.1 Основная литература</h2>
+ <ol>
+ <% resource.publications_by_kind('basic').each do |publication| %>
+ <li><%= publication %></li>
+ <% end %>
+ </ol>
+
+ <h2 class='strong'>3.2 Дополнительная литература</h2>
+ <% if resource.publications_by_kind('additional').any? %>
+ <ol>
+ <% resource.publications_by_kind('additional').each do |publication| %>
+ <li><%= publication %></li>
+ <% end %>
+ </ol>
+ <% else %>
+ <p>Не указано</p>
+ <% end %>
+
+ <h2 class='strong'>3.3 Перечень учебно-методических пособий (УМП) </h2>
+ <% resource.ump_publication_kinds.each_with_index do |kind, index| %>
+ <h4 class="strong center">3.3.<%= index + 1 %> <%= t("activerecord.attributes.publication.publication_kind_enum.ump_#{kind}") %></h4>
+
+ <% if resource.publications_by_kind("ump_#{kind}").any? %>
+ <ol>
+ <% resource.publications_by_kind("ump_#{kind}").each do |publication| %>
+ <li><%= publication %></li>
+ <% end %>
+ </ol>
+ <% else %>
+ <p>Не указано</p>
+ <% end %>
+ <% end %>
+</div>
View
1  app/views/reports/work_programm.html.erb
@@ -11,5 +11,6 @@
<%= render :partial => 'reports/purposes_and_tasks' %>
<%= render :partial => 'reports/content_chapter' %>
<%= render :partial => 'reports/self_education' %>
+ <%= render :partial => 'reports/publications' %>
</body>
</html>
Please sign in to comment.
Something went wrong with that request. Please try again.