<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test/helpers/caching_test_helper.rb</filename>
    </added>
    <added>
      <filename>test/helpers/page_part_test_helper.rb</filename>
    </added>
    <added>
      <filename>test/helpers/page_test_helper.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -6,6 +6,7 @@ The _ConcurrentDraft_ extension enables default draft versions of pages, snippet
 
 h3. Version History
 
+* 1.1 - Upgrade to Radiant 0.7.x compatibility
 * 1.0 - Initial Release - Radiant 0.6.9 compatible
 
 h3. Requirements</diff>
      <filename>README.textile</filename>
    </modified>
    <modified>
      <diff>@@ -13,7 +13,7 @@
       - else
         %em Draft promotion unscheduled 
     %ul.dropdown
-      - if current_user.admin? || current_user.publisher?
+      - if @controller.authorized_user?
         %li.schedule_draft= link_to 'Schedule promotion', '#schedule-draft-popup'
         %li.publish= link_to 'Promote now', {:action =&gt; 'schedule_draft_promotion', :commit =&gt; @controller.model_class.promote_now_text}, :method =&gt; :post
         - if @controller.model.has_draft_promotion_scheduled?
@@ -24,7 +24,7 @@
           %li.revert= link_to 'Revert draft', '#'
 
 - content_for :popups do
-  - if current_user.admin? || current_user.publisher?
+  - if @controller.authorized_user?
     #schedule-draft-popup.popup{:style =&gt; 'display:none'}
       %h3 Schedule draft promotion
       - form_for @controller.model, :url =&gt; {:action =&gt; 'schedule_draft_promotion'}, :html =&gt; {:method =&gt; :post} do |f|</diff>
      <filename>app/views/admin/_draft_controls.html.haml</filename>
    </modified>
    <modified>
      <diff>@@ -4,7 +4,7 @@
 %p.buttons
   = save_model_and_continue_editing_button(@controller.model)
   = save_model_button(@controller.model)
-  - if current_user.admin? || current_user.publisher?
+  - if @controller.authorized_user?
     = save_model_and_promote_button(@controller.model)
   or
   = link_to 'Cancel', :action =&gt; 'index'
\ No newline at end of file</diff>
      <filename>app/views/admin/_edit_buttons.html.haml</filename>
    </modified>
    <modified>
      <diff>@@ -2,18 +2,18 @@
 require_dependency 'application'
 
 class ConcurrentDraftExtension &lt; Radiant::Extension
-  version &quot;1.0&quot;
+  version &quot;1.1&quot;
   description &quot;Enables default draft versions of pages, snippets and layouts, which can be scheduled for promotion to Production&quot;
   url &quot;http://github.com/avonderluft/concurrent_draft/tree/master&quot;
 
   define_routes do |map|
-    map.page_schedule_draft_promotion 'admin/pages/schedule_draft_promotion/:id',
+    map.page_schedule_draft_promotion 'admin/pages/:id/schedule_draft_promotion',
       :controller =&gt; 'admin/pages', :action =&gt; 'schedule_draft_promotion'
-    map.snippet_schedule_draft_promotion 'admin/snippet/schedule_draft_promotion/:id',
+    map.snippet_schedule_draft_promotion 'admin/snippet/:id/schedule_draft_promotion',
       :controller =&gt; 'admin/snippets', :action =&gt; 'schedule_draft_promotion'
-    map.layout_schedule_draft_promotion 'admin/layout/schedule_draft_promotion/:id',
+    map.layout_schedule_draft_promotion 'admin/layout/:id/schedule_draft_promotion',
       :controller =&gt; 'admin/layouts', :action =&gt; 'schedule_draft_promotion'
-    map.page_unpublish 'admin/pages/unpublish/:id', :controller =&gt; 'admin/pages', :action =&gt; 'unpublish'
+    map.page_unpublish 'admin/pages/:id/unpublish', :controller =&gt; 'admin/pages', :action =&gt; 'unpublish'
   end
 
   def activate</diff>
      <filename>concurrent_draft_extension.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,22 +1,26 @@
 module ConcurrentDraft::AdminControllerExtensions
   def self.included(base)
     base.class_eval do
-      # helper_method :model
-      # helper_method :model_class
-      # public :model, :model_class
-      # alias_method_chain :handle_new_or_edit_post, :promotion
+      helper_method :model
+      helper_method :model_class
+      public :model, :model_class
       only_allow_access_to :schedule_draft_promotion, :unpublish,
           :when =&gt; [:publisher, :admin],
           :denied_message =&gt; &quot;You must have publisher privileges to execute this action.&quot;,
           :denied_url =&gt; {:action =&gt; 'edit'}
+      after_filter :check_for_promote_now, :only =&gt; :update
     end
   end
 
-  # def handle_new_or_edit_post_with_promotion(options = {})
-  #   returning handle_new_or_edit_post_without_promotion(options) do |result|
-  #     model.promote_draft! if params[:promote] &amp;&amp; !result &amp;&amp; (current_user.publisher? || current_user.admin?)
-  #   end
-  # end
+  def authorized_user?
+    (current_user.publisher? || current_user.admin?)
+  end
+
+  def check_for_promote_now
+    model.promote_draft! if params[:promote] &amp;&amp; authorized_user?
+    flash[:notice] = &quot;The existing draft #{model_class.to_s.downcase} has been saved and promoted, and is now live.&quot;
+    flash.keep
+  end
 
   def schedule_draft_promotion
     self.model = model_class.find(params[:id])
@@ -36,12 +40,12 @@ module ConcurrentDraft::AdminControllerExtensions
     end
     redirect_to :action =&gt; &quot;edit&quot;
   end
-  
+
   def unpublish
     self.model = model_class.find(params[:id])
-    model.unpublish
+    model.unpublish!
     flash[:notice] = &quot;#{model_class} has been unpublished and reset to draft mode -- no draft promotion scheduled.&quot;
     redirect_to :action =&gt; &quot;edit&quot;
   end
-  
-end
\ No newline at end of file
+
+end</diff>
      <filename>lib/concurrent_draft/admin_controller_extensions.rb</filename>
    </modified>
    <modified>
      <diff>@@ -21,7 +21,7 @@ module ConcurrentDraft::HelperExtensions
       %{&lt;p class=&quot;clear&quot;&gt;&amp;nbsp;&lt;/p&gt;}
     end
   end
-  
+
   def save_model_button(_model)
     label = _model.new_record? ? &quot;Create&quot; : &quot;Save&quot;
     submit_tag &quot;#{label} and Exit&quot;, :class =&gt; 'button'</diff>
      <filename>lib/concurrent_draft/helper_extensions.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,7 +5,6 @@ module ConcurrentDraft::ModelExtensions
     base.class_eval do
       validate :promotion_date_in_future
     end
-    
   end
 
   module ClassMethods
@@ -45,7 +44,7 @@ module ConcurrentDraft::ModelExtensions
     update_attributes(&quot;draft_promotion_scheduled_at&quot; =&gt; nil, &quot;draft_promoted_at&quot; =&gt; Time.now) if respond_to?(:draft_promoted_at)
   end
   
-  def unpublish
+  def unpublish!
     update_attributes(&quot;content&quot; =&gt; nil) if respond_to?(:content) &amp;&amp; respond_to?(:draft_content)
     update_attributes(&quot;draft_promotion_scheduled_at&quot; =&gt; nil, &quot;draft_promoted_at&quot; =&gt; nil) if respond_to?(:draft_promoted_at)
   end</diff>
      <filename>lib/concurrent_draft/model_extensions.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,8 +6,8 @@ module ConcurrentDraft::PageExtensions
     super
   end
   
-  def unpublish
-    parts.each(&amp;:unpublish)
+  def unpublish!
+    parts.each(&amp;:unpublish!)
     update_attributes('published_at' =&gt; nil, 'status_id' =&gt; Status[:draft].id)
     super
   end</diff>
      <filename>lib/concurrent_draft/page_extensions.rb</filename>
    </modified>
    <modified>
      <diff>@@ -8,7 +8,7 @@ shared_examples_for 'controller with scheduled draft promotion' do
     controller.cache.clear
     login_as :admin
     @klass = controller.class.model_class
-    @model_symbol = controller.send(:model_symbol)
+    @model_symbol = @klass.name.symbolize
     @object = mock_model(controller.class.model_class, :promote_draft! =&gt; nil, :save =&gt; true, :url =&gt; '')
     @object.errors.stub!(:full_messages).and_return([])
     @klass.stub!(:find).and_return(@object)
@@ -21,6 +21,8 @@ shared_examples_for 'controller with scheduled draft promotion' do
 
     it &quot;should load the model&quot; do
       @klass.should_receive(:find).with('1').and_return(@object)
+      puts @object.class
+      @object.should be_a(@object.class)
       do_post
       assigns[@model_symbol].should == @object
     end
@@ -33,13 +35,15 @@ shared_examples_for 'controller with scheduled draft promotion' do
 
     [:admin, :publisher].each do |user|
       before :each do
-        login_as user
+        request.session[:user_id] = user_id(user)
+        rputs *User.all
       end
       
       it &quot;should allow #{user}&quot; do
         do_post
         response.should be_redirect
         response.should redirect_to(:action =&gt; &quot;edit&quot;)
+        puts flash[:error]
         flash[:error].should be_blank
       end
     end
@@ -50,11 +54,10 @@ shared_examples_for 'controller with scheduled draft promotion' do
       end
       
       it &quot;should deny #{user}&quot; do
-        pending &quot;LoginSystem + RSpec wonkiness again makes these fail... works in dev/prod mode&quot;
         do_post
         response.should be_redirect
         response.should redirect_to(:action =&gt; &quot;edit&quot;)
-        flash[:error].should == 'You must have publishing privileges to execute this action.'
+        flash[:error].should == 'You must have publisher privileges to execute this action.'
       end
     end
   end
@@ -135,7 +138,7 @@ shared_examples_for 'controller with scheduled draft promotion' do
   describe &quot;promotion in conjunction with saving&quot; do
     before :each do
       @klass.stub!(:find_by_id).and_return(@object)
-      controller.stub!(:handle_new_or_edit_post_without_promotion).and_return(false)
+      # controller.stub!(:handle_new_or_edit_post_without_promotion).and_return(false)
     end
     
     it &quot;should promote the draft when the 'Save &amp; Promote Now' button was pushed&quot; do</diff>
      <filename>spec/controllers/admin_controller_extensions_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -12,7 +12,9 @@ end
 require &quot;#{RADIANT_ROOT}/spec/spec_helper&quot;
 
 Dataset::Resolver.default &lt;&lt; (File.dirname(__FILE__) + &quot;/datasets&quot;)
-
+if File.directory?(File.dirname(__FILE__) + &quot;/scenarios&quot;)
+  Scenario.load_paths.unshift File.dirname(__FILE__) + &quot;/scenarios&quot;
+end
 if File.directory?(File.dirname(__FILE__) + &quot;/matchers&quot;)
   Dir[File.dirname(__FILE__) + &quot;/matchers/*.rb&quot;].each {|file| require file }
 end</diff>
      <filename>spec/spec_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b53003cf2e6ed98402eafc0dfe7dc6a4176fae84</id>
    </parent>
  </parents>
  <author>
    <name>Andrew vonderLuft</name>
    <email>avonderluft@avlux.net</email>
  </author>
  <url>http://github.com/avonderluft/radiant-concurrent_draft-extension/commit/5331982e2f73d95a66cb4115d41df1f353b93192</url>
  <id>5331982e2f73d95a66cb4115d41df1f353b93192</id>
  <committed-date>2009-04-14T16:20:54-07:00</committed-date>
  <authored-date>2009-04-14T16:20:54-07:00</authored-date>
  <message>updates for 0.7.1 - Save and Promote Now using after_filter in admin_controller_extensions; other minor changes; updated README and specs; some specs still failing.</message>
  <tree>dbba062d82cd881991daebde7f8b02597049f8e5</tree>
  <committer>
    <name>Andrew vonderLuft</name>
    <email>avonderluft@avlux.net</email>
  </committer>
</commit>
