@@ -1,3 +1,20 | |||
|
1 | # Redmine - project management software | |
|
2 | # Copyright (C) 2006-2011 Jean-Philippe Lang | |
|
3 | # | |
|
4 | # This program is free software; you can redistribute it and/or | |
|
5 | # modify it under the terms of the GNU General Public License | |
|
6 | # as published by the Free Software Foundation; either version 2 | |
|
7 | # of the License, or (at your option) any later version. | |
|
8 | # | |
|
9 | # This program is distributed in the hope that it will be useful, | |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
12 | # GNU General Public License for more details. | |
|
13 | # | |
|
14 | # You should have received a copy of the GNU General Public License | |
|
15 | # along with this program; if not, write to the Free Software | |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
|
17 | ||
|
1 | 18 | class PreviewsController < ApplicationController |
|
2 | 19 | before_filter :find_project |
|
3 | 20 |
@@ -5,7 +5,17 | |||
|
5 | 5 | :rows => (@journal.notes.blank? ? 10 : [[10, @journal.notes.length / 50].max, 100].min) %> |
|
6 | 6 | <%= call_hook(:view_journals_notes_form_after_notes, { :journal => @journal}) %> |
|
7 | 7 | <p><%= submit_tag l(:button_save) %> |
|
8 | <%= link_to_remote l(:label_preview), | |
|
9 | { :url => preview_issue_path(:project_id => @project, :id => @journal.issue), | |
|
10 | :method => 'post', | |
|
11 | :update => "journal_#{@journal.id}_preview", | |
|
12 | :with => "Form.serialize('journal-#{@journal.id}-form')", | |
|
13 | :complete => "Element.scrollTo('journal_#{@journal.id}_preview')" | |
|
14 | }, :accesskey => accesskey(:preview) %> | |
|
15 | | | |
|
8 | 16 | <%= link_to l(:button_cancel), '#', :onclick => "Element.remove('journal-#{@journal.id}-form'); " + |
|
9 | 17 | "Element.show('journal-#{@journal.id}-notes'); return false;" %></p> |
|
18 | ||
|
19 | <div id="journal_<%= @journal.id %>_preview" class="wiki"></div> | |
|
10 | 20 | <% end %> |
|
11 | 21 | <%= wikitoolbar_for "journal_#{@journal.id}_notes" %> |
@@ -1,3 +1,20 | |||
|
1 | # Redmine - project management software | |
|
2 | # Copyright (C) 2006-2011 Jean-Philippe Lang | |
|
3 | # | |
|
4 | # This program is free software; you can redistribute it and/or | |
|
5 | # modify it under the terms of the GNU General Public License | |
|
6 | # as published by the Free Software Foundation; either version 2 | |
|
7 | # of the License, or (at your option) any later version. | |
|
8 | # | |
|
9 | # This program is distributed in the hope that it will be useful, | |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
12 | # GNU General Public License for more details. | |
|
13 | # | |
|
14 | # You should have received a copy of the GNU General Public License | |
|
15 | # along with this program; if not, write to the Free Software | |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
|
17 | ||
|
1 | 18 | require File.expand_path('../../test_helper', __FILE__) |
|
2 | 19 | |
|
3 | 20 | class PreviewsControllerTest < ActionController::TestCase |
@@ -19,6 +36,15 class PreviewsControllerTest < ActionController::TestCase | |||
|
19 | 36 | assert_not_nil assigns(:notes) |
|
20 | 37 | end |
|
21 | 38 | |
|
39 | def test_preview_journal_notes_for_update | |
|
40 | @request.session[:user_id] = 2 | |
|
41 | post :issue, :project_id => '1', :id => 1, :notes => 'Foo' | |
|
42 | assert_response :success | |
|
43 | assert_template 'preview' | |
|
44 | assert_not_nil assigns(:notes) | |
|
45 | assert_tag :p, :content => 'Foo' | |
|
46 | end | |
|
47 | ||
|
22 | 48 | def test_news |
|
23 | 49 | get :news, :project_id => 1, |
|
24 | 50 | :news => {:title => '', |
General Comments 0
You need to be logged in to leave comments.
Login now