Ticket #27: status.diff
| File status.diff, 3.5 kB (added by paul@vudmaska.com, 2 years ago) |
|---|
-
test/functional/admin/page_controller_test.rb
old new 171 171 assert ! %r{<head>}.match(@response.body) 172 172 assert_equal 'text/html;charset=utf-8', @response.headers['Content-Type'] 173 173 end 174 175 def test_update_status 176 get :update_status, :id => 1, :value => 1 177 assert_response :success 178 end 174 179 end -
app/controllers/admin/page_controller.rb
old new 60 60 response.headers['Content-Type'] = 'text/html;charset=utf-8' 61 61 render(:layout => false) 62 62 end 63 64 def update_status#_with_ajax 65 @page = Page.update(params[:id], :status_id => params[:value]) 66 render :text => @page.status.name 67 end 63 68 64 69 private 65 70 def announce_page_saved -
app/views/admin/page/_node.rhtml
old new 34 34 </span> 35 35 </td> 36 36 <% unless simple -%> 37 <td class="status <%= page.status.name.downcase %>-status"><%= page.status.name %></td> 37 <td id="td-status<%= page.id %>" class="status <%= page.status.name.downcase %>-status"> 38 <span id="page-status<%= page.id %>"><%= page.status.name %></span> 39 <script type="text/javascript"> 40 new Ajax.InPlaceCollectionEditor( 41 'page-status<%= page.id %>', 42 '/admin/pages/update_status/<%= page.id %>', 43 { oldPageStatus : '<%= page.status.name.downcase %>', 44 onComplete:function(rq){ 45 if(!rq){return} // Don't do anything on cancel 46 /* 47 * Burying old page status class - so we can delete it before adding the new one 48 * 49 ****************************/ 50 new Effect.Shake('page-status<%= page.id %>') 51 new Element.removeClassName('td-status<%= page.id %>',this.oldPageStatus + '-status') 52 this.oldPageStatus = rq.responseText.toLowerCase() 53 new Element.addClassName('td-status<%= page.id %>', this.oldPageStatus + '-status') 54 55 },value:'<%= page.status_id %>',collection: [[1,'Draft'],[50,'Reviewed'],[100,'Published'],[101,'Hidden']]}); 56 </script> 57 </td> 38 58 <td class="add-child"><%= link_to image_tag('add-child', :alt => 'add child'), page_new_url(:parent_id => page) %></td> 39 59 <td class="remove"><%= link_to image_tag('remove', :alt => 'remove page'), page_remove_url(:id => page) %></td> 40 60 <% end -%> -
config/routes.rb
old new 16 16 page.homepage_new 'admin/pages/new/homepage', :action => 'new', :slug => '/', :breadcrumb => 'Home' 17 17 page.page_remove 'admin/pages/remove/:id', :action => 'remove' 18 18 page.page_add_part 'admin/ui/pages/part/add', :action => 'add_part' 19 page.page_update_status 'admin/pages/update_status/:id', :action => 'update_status' 19 20 page.page_children 'admin/ui/pages/children/:id/:level', :action => 'children', :level => '1' 20 21 page.clear_cache 'admin/pages/cache/clear', :action => 'clear_cache' 21 22 end
