<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>app/views/admin/pages/_attachment.html.haml</filename>
    </added>
    <added>
      <filename>app/views/admin/pages/_attachments_box.html.haml</filename>
    </added>
    <added>
      <filename>features/attachments.feature</filename>
    </added>
    <added>
      <filename>features/step_definitions/attachment_steps.rb</filename>
    </added>
    <added>
      <filename>features/support/env.rb</filename>
    </added>
    <added>
      <filename>features/support/paths.rb</filename>
    </added>
    <added>
      <filename>public/images/admin/drag_order.png</filename>
    </added>
    <added>
      <filename>public/javascripts/admin/page_attachments.js</filename>
    </added>
    <added>
      <filename>public/stylesheets/admin/page_attachments.css</filename>
    </added>
    <added>
      <filename>spec/controllers/pages_controller_spec.rb</filename>
    </added>
    <added>
      <filename>spec/fixtures/foo.txt</filename>
    </added>
    <added>
      <filename>spec/fixtures/rails.png</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -11,15 +11,6 @@ Installation
 
 If you want `page_attachments` to generate and display thumbnails of your uploaded images you'll first need to install one of, [`image_science`][is], [`mini-magick`][mm] or [`rmagick`][rm] on your server. This is completely optional, `page_attachments` will still function in every other way without any of these packages installed.
 
-Next, you need to install the `attachment_fu` plugin.
-
-    cd /path/to/radiant
-    git clone git://github.com/technoweenie/attachment_fu.git vendor/plugins/attachment_fu
-
-If you don't have `git` installed you can simply [download a tarball][af] of `attachment_fu`, upload and unpack it to your `vendor/plugins` directory.
-
-**Failing to install the `attachment_fu` plugin before proceeding will result in an &quot;`uninitialized constant Technoweenie::AttachmentFu`&quot; error when you try to install `page_attachments`.**
-
 Now you're ready to install `page_attachments`.
 
     cd /path/to/radiant
@@ -29,8 +20,6 @@ Now you're ready to install `page_attachments`.
 
 If you don't have `git` you can [download a tarball][pa].
 
-During the `migrate` task you may encounter an &quot;`uninitialized constant Technoweenie::AttachmentFu::Backends`&quot;. If this happens try `git clone git://github.com/technoweenie/attachment_fu.git vendor/extensions/page_attachments/vendor/plugins/attachment_fu` and re-run the `migrate` task.
-
 Attachment thumbnails for images default to `:icon =&gt; '50x50&gt;'`. You can customize that by setting
 `PAGE_ATTACHMENT_SIZES` to whatever you need in your `config/environment.rb` file
 
@@ -38,6 +27,10 @@ Attachment thumbnails for images default to `:icon =&gt; '50x50&gt;'`. You can customi
 
 Restart your server and refresh the admin interface.
 
+Running features and specs
+---
+The Cucumber features use Webrat and Selenium.  You'll need the webrat 0.5.1 and selenium-client 1.2.16 gems installed and you'll need to change the version of webrat specified in environments/test.rb.
+
 Managing Attachments
 ---
 </diff>
      <filename>README.md</filename>
    </modified>
    <modified>
      <diff>@@ -26,12 +26,15 @@ $LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base)
 require 'spec/rake/spectask'
 # require 'spec/translator'
 
+$:.unshift(RAILS_ROOT + '/vendor/plugins/cucumber/lib')
+require 'cucumber/rake/task'
+
 # Cleanup the RADIANT_ROOT constant so specs will load the environment
 Object.send(:remove_const, :RADIANT_ROOT)
 
 extension_root = File.expand_path(File.dirname(__FILE__))
 
-task :default =&gt; :spec
+task :default =&gt; [:features, :spec]
 task :stats =&gt; &quot;spec:statsetup&quot;
 
 desc &quot;Run all specs in spec directory&quot;
@@ -40,6 +43,10 @@ Spec::Rake::SpecTask.new(:spec) do |t|
   t.spec_files = FileList['spec/**/*_spec.rb']
 end
 
+Cucumber::Rake::Task.new(:features) do |t|
+  t.cucumber_opts = &quot;--format progress&quot;
+end
+
 namespace :spec do
   desc &quot;Run all specs in spec directory with RCov&quot;
   Spec::Rake::SpecTask.new(:rcov) do |t|</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -5,9 +5,8 @@ module PageAttachmentAssociations
                :class_name =&gt; &quot;PageAttachment&quot;,
                :dependent =&gt; :destroy,
                :order =&gt; 'position'
-      attr_accessor :add_attachments
-      after_save :save_attachments
       include InstanceMethods
+      accepts_nested_attributes_for :attachments, :allow_destroy =&gt; true
     }
   end
 
@@ -17,19 +16,5 @@ module PageAttachmentAssociations
       att = attachments.find(:first, :conditions =&gt; [&quot;filename LIKE ?&quot;, name.to_s])
       att.blank? ? ((parent.attachment(name) if parent) or nil) : att
     end
-
-    def save_attachments
-      if @add_attachments &amp;&amp; ! @add_attachments['file'].blank?
-        i = 0
-        @add_attachments['file'].each do |page_attach|
-          attach = PageAttachment.new(:uploaded_data =&gt; page_attach)
-          attach.title = @add_attachments['title'][i]
-          attach.description = @add_attachments['description'][i]
-          attachments &lt;&lt; attach
-          i += 1
-        end
-      end
-      @add_attachments = nil
-    end
   end
 end</diff>
      <filename>app/models/page_attachment_associations.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,7 +11,8 @@ module PageAttachmentsInterface
     def add_page_attachment_partials
       @buttons_partials ||= []
       @buttons_partials &lt;&lt; &quot;attachments_box&quot;
-      include_javascript 'page_attachments'
+      include_javascript 'admin/page_attachments'
+      include_javascript 'dragdrop'
       include_stylesheet 'admin/page_attachments'
     end
   end</diff>
      <filename>app/models/page_attachments_interface.rb</filename>
    </modified>
    <modified>
      <diff>@@ -19,8 +19,8 @@ namespace :radiant do
         Dir[PageAttachmentsExtension.root + &quot;/public/**/*&quot;].reject(&amp;is_svn_or_dir).each do |file|
           path = file.sub(PageAttachmentsExtension.root, '')
           directory = File.dirname(path)
-          mkdir_p RAILS_ROOT + directory, :verbose =&gt; false
-          cp file, RAILS_ROOT + path, :verbose =&gt; false
+          mkdir_p RAILS_ROOT + directory
+          cp file, RAILS_ROOT + path
         end
       end
     end</diff>
      <filename>lib/tasks/page_attachments_extension_tasks.rake</filename>
    </modified>
    <modified>
      <diff>@@ -14,7 +14,7 @@ class PageAttachmentsDataset &lt; Dataset::Base
     def page_attachment_params(attributes={})
       page = pages(:home)
       { 
-        :size =&gt; File.join(File.dirname(__FILE__), '/files/', attributes[:filename]).size,
+        :size =&gt; File.join(File.dirname(__FILE__), '/../fixtures/', attributes[:filename]).size,
         :page =&gt; page,
         :position =&gt; next_position(page),
         :created_by =&gt; users(:admin)</diff>
      <filename>spec/datasets/page_attachments_dataset.rb</filename>
    </modified>
    <modified>
      <diff>@@ -12,9 +12,6 @@ describe Page, 'page attachments' do
     Page.instance_methods.should include(&quot;attachments&quot;)
     Page.instance_methods.should include(&quot;attachments=&quot;)
     Page.instance_methods.should include(&quot;attachment&quot;)
-    Page.instance_methods.should include(&quot;add_attachments&quot;)
-    Page.instance_methods.should include(&quot;add_attachments=&quot;)
-    Page.instance_methods.should include(&quot;save_attachments&quot;)
 
     Page.instance_methods.should include(&quot;tag:attachment&quot;)
     [:content_type, :size, :width, :height, :date, :image, :link, :author, :title, :short_title, :short_description, :short_filename, :description, :position].each do |key|
@@ -22,4 +19,14 @@ describe Page, 'page attachments' do
     end
   end
   
+  it &quot;should receive nested attributes for attachments&quot; do
+    page = pages(:home)
+    page.attachments.length.should == 2
+    file = 
+    
+    page.attachments_attributes = [{:uploaded_data =&gt; fixture_file_upload(&quot;#{PageAttachmentsExtension.root}/spec/fixtures/rails.png&quot;, 'image/png')}]
+    page.save!
+    page.reload.attachments.length.should == 1
+  end
+  
 end</diff>
      <filename>spec/models/page_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,6 +11,8 @@ unless defined? RADIANT_ROOT
 end
 require &quot;#{RADIANT_ROOT}/spec/spec_helper&quot;
 
+require 'webrat'
+
 Dataset::Resolver.default &lt;&lt; (File.dirname(__FILE__) + &quot;/datasets&quot;)
 
 if File.directory?(File.dirname(__FILE__) + &quot;/matchers&quot;)
@@ -33,4 +35,5 @@ Spec::Runner.configure do |config|
   #
   # If you declare global fixtures, be aware that they will be declared
   # for all of your examples, even those that don't use them.
+  config.include Webrat::Matchers, :type =&gt; [:views]
 end
\ No newline at end of file</diff>
      <filename>spec/spec_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>app/controllers/page_attachments_controller.rb</filename>
    </removed>
    <removed>
      <filename>app/views/admin/pages/_attachment.html.erb</filename>
    </removed>
    <removed>
      <filename>app/views/admin/pages/_attachments_box.html.erb</filename>
    </removed>
    <removed>
      <filename>public/images/admin/move_higher.png</filename>
    </removed>
    <removed>
      <filename>public/images/admin/move_lower.png</filename>
    </removed>
    <removed>
      <filename>public/javascripts/page_attachments.js</filename>
    </removed>
    <removed>
      <filename>public/stylesheets/page_attachments.css</filename>
    </removed>
    <removed>
      <filename>spec/datasets/files/foo.txt</filename>
    </removed>
    <removed>
      <filename>spec/datasets/files/rails.png</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>a6bd78a95ca0fca7c13c46a4da9006a84ad484c4</id>
    </parent>
  </parents>
  <author>
    <name>Jason Garber</name>
    <email>jg@jasongarber.com</email>
  </author>
  <url>http://github.com/radiant/radiant-page-attachments-extension/commit/8105853c35071712ab130e668d14e813a95f5ebe</url>
  <id>8105853c35071712ab130e668d14e813a95f5ebe</id>
  <committed-date>2009-09-01T11:28:34-07:00</committed-date>
  <authored-date>2009-08-23T03:34:39-07:00</authored-date>
  <message>Use nested attributes to save, reorder attachments.  Test with cucumber + webrat + selenium</message>
  <tree>24c50da557a4f2f2f4af35294f491bfe975b92aa</tree>
  <committer>
    <name>Jason Garber</name>
    <email>jg@jasongarber.com</email>
  </committer>
</commit>
