Changeset 854

Show
Ignore:
Timestamp:
05/03/08 21:45:58 (2 months ago)
Author:
seancribbs
Message:

Remove clear cache action, always clear cache after saving a page.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/radiant/app/controllers/admin/page_controller.rb

    r826 r854  
    3333      @page.destroy 
    3434      redirect_to page_index_url 
    35     end 
    36   end 
    37  
    38   def clear_cache 
    39     if request.post? 
    40       @cache.clear 
    41       announce_cache_cleared 
    42       redirect_to page_index_url 
    43     else 
    44       render :text => 'Do not access this URL directly.' 
    4535    end 
    4636  end 
     
    121111     
    122112    def clear_model_cache 
    123       @cache.expire_response(@old_page_url || @page.url)       
     113      @cache.clear 
    124114    end 
    125115end 
  • trunk/radiant/app/views/admin/page/index.html.erb

    r820 r854  
    2222</table> 
    2323 
    24 <form action="<%= clear_cache_url %>" method="post"> 
    25   <p> 
    2624<% unless @homepage -%> 
     25<p> 
    2726    <%= link_to image('new-homepage', :alt => 'New Homepage'), homepage_new_url %> 
     27</p> 
    2828<% end -%> 
    29     <%= image_submit 'clear-page-cache' %> 
    30   </p> 
    31 </form> 
  • trunk/radiant/spec/controllers/admin/page_controller_spec.rb

    r763 r854  
    9696 
    9797    Page.find_by_title("New Page").should_not be_nil 
    98     @cache.expired_path.should == '/new-page/' 
     98    @cache.should be_cleared 
    9999  end 
    100100 
     
    166166    page = pages(:home) 
    167167    page.title.should == "Updated Home Page" 
    168     @cache.expired_path.should == '/' 
     168    @cache.should be_cleared 
    169169  end 
    170170 
     
    176176  end 
    177177 
    178   it "should expire the cache correctly when you change a page's slug" do 
    179     @cache = @controller.cache = FakeResponseCache.new 
    180     post :edit, :id => page_id(:first), :page => { :slug => 'monkey' } 
    181     response.should be_redirect 
    182     page = pages(:first) 
    183     page.slug.should == 'monkey' 
    184     @cache.expired_path.should == '/first/' 
    185   end 
    186  
    187178  it "should allow you to save changes to a page and its parts" do 
    188179    create_page("New Page") do 
     
    223214    response.should have_tag('textarea', 'changed-1') 
    224215  end 
    225  
     216   
    226217  it "should prompt you when deleting a page" do 
    227218    page = pages(:first) 
     
    247238    flash[:notice].should match(/removed/) 
    248239    Page.find_by_id(page.id).should be_nil 
    249   end 
    250  
    251   it "should prompt you when clearing the page cache" do 
    252     @cache = @controller.cache = FakeResponseCache.new 
    253     get :clear_cache 
    254     response.should be_success 
    255     @response.body.should match(/Do.*?not.*?access/i) 
    256     @cache.should_not be_cleared 
    257   end 
    258  
    259   it "should allow you to clear the page cache" do 
    260     @cache = @controller.cache = FakeResponseCache.new 
    261     post :clear_cache 
    262     response.should redirect_to(page_index_url) 
    263     flash[:notice].should match(/cache.*clear/i) 
    264     @cache.should be_cleared 
    265240  end 
    266241