Index: app/models/attachment.rb =================================================================== --- app/models/attachment.rb (revision 141) +++ app/models/attachment.rb (working copy) @@ -1,6 +1,6 @@ class Attachment < ActiveRecord::Base - ATTACHMENT_DIR = "#{RADIANT_ROOT}/db/attachments" + ATTACHMENT_DIR = "#{RAILS_ROOT}/db/attachments" belongs_to :created_by, :class_name => 'User', :foreign_key => 'created_by' belongs_to :updated_by, :class_name => 'User', :foreign_key => 'updated_by' Index: lib/part_attachments/site_controller_extension.rb =================================================================== --- lib/part_attachments/site_controller_extension.rb (revision 141) +++ lib/part_attachments/site_controller_extension.rb (working copy) @@ -51,7 +51,7 @@ @page = Page.find_by_url(params[:page_url], live?) @attachment = @page.attachments.find(:first, :conditions => ['filename = ?', params[:attachment_id]]) unless @page.nil? if(@attachment) - response.headers['Last-Modified'] = Time.now.rfc2822 + response.headers['Last-Modified'] = @attachment.updated_at.rfc2822 show_uncached_attachment(@attachment) @cache.cache_response(url, response) if live? and @page and @page.cache? else Index: lib/attachment_tags.rb =================================================================== --- lib/attachment_tags.rb (revision 141) +++ lib/attachment_tags.rb (working copy) @@ -9,7 +9,12 @@ # Returns an Attachment found by either the Attachment Name or Id. # To do: an attachments:each tag, using tags or categories. # + desc %{ + ... + Returns an Attachment found by either the Attachment Name or Id. + To do: an attachments:each tag, using tags or categories. + } tag "attachment" do |tag| attachment = find_attachment_by_attrs(tag) raise TagError.new("Attachment cannot be found") unless attachment @@ -25,7 +30,14 @@ # the original image will be used. This attribute only works for images, not other content types. Otherwise it is # ignored. To do: Title, Rel, Class for styling and using with Lightbox and other Javascript galleries. # + desc %{ + + Returns the URL of the attachment. Use the "size" attribute to define an image size, + such as "icon", "thumbnail", "normal". These only work if RMagick is installed. If no size is defined, + the original image will be used. This attribute only works for images, not other content types. Otherwise it is + ignored. To do: Title, Rel, Class for styling and using with Lightbox and other Javascript galleries. + } tag "attachment_url" do |tag| attachment = find_attachment_by_attrs(tag) || tag.locals.attachment attachment.url(tag.attr['transform']||'default') @@ -35,6 +47,9 @@ # Returns the title of the attachment # + desc %{ + Returns the title of the attachment + } tag "attachment:title" do |tag| attachment = tag.locals.attachment attachment.title @@ -46,7 +61,12 @@ # Returns an img tag of the image in the size given. An alt attribute is also # provided and remains empty if none is given. To do: Class and ID for CSS styling. # + desc %{ + + Returns an img tag of the image in the size given. An alt attribute is also + provided and remains empty if none is given. To do: Class and ID for CSS styling. + } tag "image" do |tag| attachment = find_attachment_by_attrs(tag) || tag.locals.attachment raise TagError.new("Attachment `#{tag.attr['name']}' not found") unless attachment @@ -105,6 +125,14 @@ # provided and remains empty if none is given. To do: Class and ID for CSS styling. # + desc %{ + + + Returns an img tag of the image as a thumbnail. It also adds a link to the larger image + the size attribute refers to the linked image, not the thumbnail. + An alt attribute is also + provided and remains empty if none is given. To do: Class and ID for CSS styling. + } tag "thumbnail" do |tag| attachment = tag.locals.attachment attachment = find_attachment_by_attrs(tag) unless attachment @@ -119,10 +147,10 @@ size = size.to_sym if size alt = tag.attr['alt'] if link - url = attachment.url(transform) - %{#{alt}} + url = attachment.url(tag.attr['transform']) + %{#{alt}} else - %{#{alt}} + %{#{alt}} end end @@ -131,7 +159,11 @@ # # Returns the content type of an image. Just used for diagnostics. # + desc %{ + + Returns the content type of an image. Just used for diagnostics. + } tag "attachment_type" do |tag| attachment = tag.locals.attachment attachment.content_type