Permalink
Browse files

* Merge djcp's patch for updating attachments.

* Display attachments when viewing the file.
  • Loading branch information...
2 parents d19a206 + e789cf7 commit 4d8c05eb68cd953363f666ae219f1e9f265cfb3d @peakpg peakpg committed Jan 13, 2012
Showing with 5 additions and 4 deletions.
  1. +2 −2 app/models/news_article.rb
  2. +3 −0 app/views/cms/news_articles/render.html.erb
  3. +0 −2 bcms_news.gemspec
@@ -51,13 +51,13 @@ def month
end
def set_attachment_section
- if new_record? && !attachment_file.blank?
+ if !attachment_file.blank?
attachment.section = Section.first(:conditions => {:name => 'News'})
end
end
def set_attachment_file_path
- if new_record? && !attachment_file.blank?
+ if !attachment_file.blank?
attachment.file_path = "/news/articles/attachment/#{Time.now.to_s(:year_month_day)}/#{name.to_slug}.#{attachment_file.original_filename.split('.').last.to_s.downcase}"
end
end
@@ -1,2 +1,5 @@
<h2><%=h @content_block.name %></h2>
<p><%= @content_block.body.html_safe %></p>
+<% if @content_block.attachment %>
+<%= link_to "Attachment", @content_block.attachment_file_path %>
+<% end %>
View
@@ -31,8 +31,6 @@ Gem::Specification.new do |s|
s.rubyforge_project = s.name
s.summary = %q{The News Module for BrowserCMS}
s.test_files = Dir["test/**/*"]
-
s.add_dependency(%q<browsercms>, ["~> 3.3.0"])
-
end

0 comments on commit 4d8c05e

Please sign in to comment.