Changeset 87
- Timestamp:
- 04/16/08 22:13:27 (7 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 7 modified
-
CHANGELOG.txt (modified) (1 diff)
-
app/controllers/recipes_controller.rb (modified) (1 diff)
-
app/helpers/recipes_helper.rb (modified) (1 diff)
-
app/views/recipes/_form.html.erb (modified) (1 diff)
-
app/views/recipes/_preview.html.erb (added)
-
app/views/recipes/show.html.erb (modified) (1 diff)
-
config/routes.rb (modified) (1 diff)
-
test/functional/recipes_controller_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/CHANGELOG.txt
r85 r87 1 1 2 2 * SVN * 3 4 * Ajax-Preview on recipe edit. Provided by Mathias Meyer 3 5 4 6 * Update Capistrano to 2.2.0 and Net::SFTP to 1.1.1 -
trunk/app/controllers/recipes_controller.rb
r60 r87 80 80 end 81 81 end 82 83 def preview 84 @recipe = Recipe.new(params[:recipe]) 85 respond_to do |format| 86 format.js { 87 render :update do |page| 88 page.replace_html :preview, :partial => "preview", :locals => {:recipe => @recipe} 89 page.show :preview_fieldset 90 end 91 } 92 end 93 end 82 94 end -
trunk/app/helpers/recipes_helper.rb
r1 r87 1 1 module RecipesHelper 2 def highlight_syntax(code) 3 Syntax::Convertors::HTML.for_syntax("ruby").convert(code) 4 end 2 5 end -
trunk/app/views/recipes/_form.html.erb
r73 r87 14 14 <%= text_area 'recipe', 'body', :style =>'width:600px; height: 400px;' %> 15 15 </p> 16 17 <%= observe_field "recipe_body", :frequency => 2.5, :with => "Form.Element.serialize('recipe_body')", :url => preview_recipes_url%> 18 19 <fieldset class="fieldset" id="preview_fieldset" style="display:none"> 20 <legend>Code-Preview</legend> 21 <div id="preview" style="display"></div> 22 </fieldset> 23 <br/> -
trunk/app/views/recipes/show.html.erb
r73 r87 49 49 <fieldset class="fieldset"> 50 50 <legend>Body</legend> 51 <div class="log_output ruby"> 52 <%= Syntax::Convertors::HTML.for_syntax("ruby").convert(@recipe.body) %> 53 </div> 51 <%= render :partial => 'preview', :locals => {:recipe => @recipe} %> 54 52 </fieldset> -
trunk/config/routes.rb
r77 r87 19 19 20 20 map.resources :hosts 21 map.resources :recipes 21 map.resources :recipes, :collection => {:preview => :get} 22 22 map.resources :projects, :member => {:dashboard => :get} do |projects| 23 23 projects.resources :project_configurations -
trunk/test/functional/recipes_controller_test.rb
r44 r87 120 120 end 121 121 122 def test_should_preview_the_recipe 123 @user = admin_login 124 125 xhr :get, :preview, :recipe => {:body => @recipe.body} 126 assert_select_rjs :replace_html, "preview" 127 end 128 122 129 end
