As far as I can tell, the attachment was stripped, so here's the patch
inline:
Index: app/models/page_attachment_tags.rb
===================================================================
--- app/models/page_attachment_tags.rb (revision 58)
+++ app/models/page_attachment_tags.rb (working copy)
@@ -35,7 +35,7 @@
attachment.public_filename(size)
end
- [:content_type, :size, :width, :height].each do |key|
+ [:content_type, :size, :width, :height, :description].each do |key|
desc %{
Renders the `#{key}' attribute of the attachment.
The 'name' attribute is required on this tag or the parent tag. The
optional 'size'
Index: app/models/page_attachment_associations.rb
===================================================================
--- app/models/page_attachment_associations.rb (revision 58)
+++ app/models/page_attachment_associations.rb (working copy)
@@ -4,6 +4,7 @@
has_many :attachments, :class_name => "PageAttachment", :dependent =>
:destroy
attr_accessor :add_attachments
+ attr_accessor :describe_attachments
attr_accessor :delete_attachments
after_save :save_attachments
after_save :destroy_attachments
@@ -29,11 +30,11 @@
def save_attachments
if @add_attachments
- @add_attachments.each do |attachment|
- attachments << PageAttachment.new(:uploaded_data => attachment)
+ @add_attachments.zip(@describe_attachments).each do |attachment,
description|
+ attachments << PageAttachment.new(:uploaded_data => attachment,
:description => description)
end
end
@add_attachments = nil
end
end
-end
\ No newline at end of file
+end
Index: app/views/admin/page/_attachment.rhtml
===================================================================
--- app/views/admin/page/_attachment.rhtml (revision 58)
+++ app/views/admin/page/_attachment.rhtml (working copy)
@@ -4,6 +4,7 @@
image_tag(attachment.thumbnails.first.public_filename,
:class => "thumbnail")%></td>
<td> <%= File.basename(attachment.public_filename) %></td>
+ <td> <%= attachment.description %></td>
<td><%= link_to_function image("minus", :title => "Remove attachment"),
"remove_attachment(#{attachment.id})" %></td>
</tr>
-</table>
\ No newline at end of file
+</table>
Index: db/migrate/001_create_page_attachments_extension_schema.rb
===================================================================
--- db/migrate/001_create_page_attachments_extension_schema.rb (revision 58)
+++ db/migrate/001_create_page_attachments_extension_schema.rb (working copy)
@@ -13,10 +13,11 @@
t.column "updated_at", :datetime
t.column "updated_by", :integer
t.column "page_id", :integer
+ t.column "description", :string
end
end
def self.down
drop_table "page_attachments"
end
-end
\ No newline at end of file
+end
Index: public/javascripts/page_attachments.js
===================================================================
--- public/javascripts/page_attachments.js (revision 58)
+++ public/javascripts/page_attachments.js (working copy)
@@ -1,6 +1,6 @@
function add_attachment() {
var attachments_box = $('attachments');
- var template = new Template('<p class="attachment"
id="file_#{id}"><label>Upload file: </label><input type="file"
name="page[add_attachments][]" /> <a href="#"
onclick="Element.remove(\'file_#{id}\')">Cancel</a></p>');
+ var template = new Template('<p class="attachment"
id="file_#{id}"><label>Upload file: </label><input type="file"
name="page[add_attachments][]" /> <label>Description:</label><input type="text"
name="page[describe_attachments][]" /><a href="#"
onclick="Element.remove(\'file_#{id}\')">Cancel</a></p>');
new Insertion.Bottom(attachments_box, template.evaluate({id:
Math.round(Math.random() * 100000)}));
}
function remove_attachment(id){
@@ -15,4 +15,4 @@
}
new Effect.Highlight('attachments-deleted');
}
-}
\ No newline at end of file
+}
_______________________________________________
Radiant mailing list
Post: [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant