Changeset 854
- Timestamp:
- 05/03/08 21:45:58 (2 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/radiant/app/controllers/admin/page_controller.rb
r826 r854 33 33 @page.destroy 34 34 redirect_to page_index_url 35 end36 end37 38 def clear_cache39 if request.post?40 @cache.clear41 announce_cache_cleared42 redirect_to page_index_url43 else44 render :text => 'Do not access this URL directly.'45 35 end 46 36 end … … 121 111 122 112 def clear_model_cache 123 @cache. expire_response(@old_page_url || @page.url)113 @cache.clear 124 114 end 125 115 end trunk/radiant/app/views/admin/page/index.html.erb
r820 r854 22 22 </table> 23 23 24 <form action="<%= clear_cache_url %>" method="post">25 <p>26 24 <% unless @homepage -%> 25 <p> 27 26 <%= link_to image('new-homepage', :alt => 'New Homepage'), homepage_new_url %> 27 </p> 28 28 <% end -%> 29 <%= image_submit 'clear-page-cache' %>30 </p>31 </form>trunk/radiant/spec/controllers/admin/page_controller_spec.rb
r763 r854 96 96 97 97 Page.find_by_title("New Page").should_not be_nil 98 @cache. expired_path.should == '/new-page/'98 @cache.should be_cleared 99 99 end 100 100 … … 166 166 page = pages(:home) 167 167 page.title.should == "Updated Home Page" 168 @cache. expired_path.should == '/'168 @cache.should be_cleared 169 169 end 170 170 … … 176 176 end 177 177 178 it "should expire the cache correctly when you change a page's slug" do179 @cache = @controller.cache = FakeResponseCache.new180 post :edit, :id => page_id(:first), :page => { :slug => 'monkey' }181 response.should be_redirect182 page = pages(:first)183 page.slug.should == 'monkey'184 @cache.expired_path.should == '/first/'185 end186 187 178 it "should allow you to save changes to a page and its parts" do 188 179 create_page("New Page") do … … 223 214 response.should have_tag('textarea', 'changed-1') 224 215 end 225 216 226 217 it "should prompt you when deleting a page" do 227 218 page = pages(:first) … … 247 238 flash[:notice].should match(/removed/) 248 239 Page.find_by_id(page.id).should be_nil 249 end250 251 it "should prompt you when clearing the page cache" do252 @cache = @controller.cache = FakeResponseCache.new253 get :clear_cache254 response.should be_success255 @response.body.should match(/Do.*?not.*?access/i)256 @cache.should_not be_cleared257 end258 259 it "should allow you to clear the page cache" do260 @cache = @controller.cache = FakeResponseCache.new261 post :clear_cache262 response.should redirect_to(page_index_url)263 flash[:notice].should match(/cache.*clear/i)264 @cache.should be_cleared265 240 end 266 241
