Feature #27368 » comment-preview.patch
| app/controllers/previews_controller.rb (working copy) | ||
|---|---|---|
|
render :partial => 'common/preview'
|
||
|
end
|
||
|
def comment
|
||
|
@text = params[:comment][:comments]
|
||
|
render partial: 'common/preview'
|
||
|
end
|
||
|
private
|
||
|
def find_project
|
||
| app/views/news/show.html.erb (working copy) | ||
|---|---|---|
|
<%= text_area 'comment', 'comments', :cols => 80, :rows => 15, :class => 'wiki-edit' %>
|
||
|
<%= wikitoolbar_for 'comment_comments' %>
|
||
|
</div>
|
||
|
<p><%= submit_tag l(:button_add) %></p>
|
||
|
<p>
|
||
|
<%= submit_tag l(:button_add) %>
|
||
|
<%= preview_link preview_comment_path(project_id: @project), 'add_comment_form', 'comment-preview' %>
|
||
|
</p>
|
||
|
<% end %>
|
||
|
<div id="comment-preview" class="wiki"></div>
|
||
|
<% end %>
|
||
|
<% html_title @news.title -%>
|
||
| config/routes.rb (working copy) | ||
|---|---|---|
|
match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue', :via => [:get, :post, :put, :patch]
|
||
|
match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue', :via => [:get, :post, :put, :patch]
|
||
|
match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue', :via => [:get, :post, :put, :patch]
|
||
|
match '/comments/preview', to: 'previews#comment', as: 'preview_comment', via: [:post]
|
||
|
match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post
|
||
|
match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post]
|
||
| test/functional/previews_controller_test.rb (working copy) | ||
|---|---|---|
|
assert_response :success
|
||
|
assert_select 'fieldset.preview', :text => /News description/
|
||
|
end
|
||
|
def test_preview_comment
|
||
|
post :comment, params: {
|
||
|
project_id: 1,
|
||
|
comment: {
|
||
|
comments: 'Comment content :)'
|
||
|
}
|
||
|
}
|
||
|
assert_response :success
|
||
|
assert_select 'fieldset.preview', text: /Comment content :\)/
|
||
|
end
|
||
|
end
|
||
| test/integration/routing/previews_test.rb (working copy) | ||
|---|---|---|
|
should_route 'POST /issues/preview/edit/321' => 'previews#issue', :id => '321'
|
||
|
should_route 'GET /news/preview' => 'previews#news'
|
||
|
should_route 'POST /comments/preview' => 'previews#comment'
|
||
|
end
|
||
|
end
|
||