##// END OF EJS Templates
pdf: add a new feature to export wiki pdf (#401)...
Toshi MARUYAMA -
r7621:00faf35e05eb
parent child
Show More
@@ -1,284 +1,288
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
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
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.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 require 'diff'
18 require 'diff'
19
19
20 # The WikiController follows the Rails REST controller pattern but with
20 # The WikiController follows the Rails REST controller pattern but with
21 # a few differences
21 # a few differences
22 #
22 #
23 # * index - shows a list of WikiPages grouped by page or date
23 # * index - shows a list of WikiPages grouped by page or date
24 # * new - not used
24 # * new - not used
25 # * create - not used
25 # * create - not used
26 # * show - will also show the form for creating a new wiki page
26 # * show - will also show the form for creating a new wiki page
27 # * edit - used to edit an existing or new page
27 # * edit - used to edit an existing or new page
28 # * update - used to save a wiki page update to the database, including new pages
28 # * update - used to save a wiki page update to the database, including new pages
29 # * destroy - normal
29 # * destroy - normal
30 #
30 #
31 # Other member and collection methods are also used
31 # Other member and collection methods are also used
32 #
32 #
33 # TODO: still being worked on
33 # TODO: still being worked on
34 class WikiController < ApplicationController
34 class WikiController < ApplicationController
35 default_search_scope :wiki_pages
35 default_search_scope :wiki_pages
36 before_filter :find_wiki, :authorize
36 before_filter :find_wiki, :authorize
37 before_filter :find_existing_or_new_page, :only => [:show, :edit, :update]
37 before_filter :find_existing_or_new_page, :only => [:show, :edit, :update]
38 before_filter :find_existing_page, :only => [:rename, :protect, :history, :diff, :annotate, :add_attachment, :destroy]
38 before_filter :find_existing_page, :only => [:rename, :protect, :history, :diff, :annotate, :add_attachment, :destroy]
39
39
40 helper :attachments
40 helper :attachments
41 include AttachmentsHelper
41 include AttachmentsHelper
42 helper :watchers
42 helper :watchers
43 include Redmine::Export::PDF
43
44
44 # List of pages, sorted alphabetically and by parent (hierarchy)
45 # List of pages, sorted alphabetically and by parent (hierarchy)
45 def index
46 def index
46 load_pages_for_index
47 load_pages_for_index
47 @pages_by_parent_id = @pages.group_by(&:parent_id)
48 @pages_by_parent_id = @pages.group_by(&:parent_id)
48 end
49 end
49
50
50 # List of page, by last update
51 # List of page, by last update
51 def date_index
52 def date_index
52 load_pages_for_index
53 load_pages_for_index
53 @pages_by_date = @pages.group_by {|p| p.updated_on.to_date}
54 @pages_by_date = @pages.group_by {|p| p.updated_on.to_date}
54 end
55 end
55
56
56 # display a page (in editing mode if it doesn't exist)
57 # display a page (in editing mode if it doesn't exist)
57 def show
58 def show
58 if @page.new_record?
59 if @page.new_record?
59 if User.current.allowed_to?(:edit_wiki_pages, @project) && editable?
60 if User.current.allowed_to?(:edit_wiki_pages, @project) && editable?
60 edit
61 edit
61 render :action => 'edit'
62 render :action => 'edit'
62 else
63 else
63 render_404
64 render_404
64 end
65 end
65 return
66 return
66 end
67 end
67 if params[:version] && !User.current.allowed_to?(:view_wiki_edits, @project)
68 if params[:version] && !User.current.allowed_to?(:view_wiki_edits, @project)
68 # Redirects user to the current version if he's not allowed to view previous versions
69 # Redirects user to the current version if he's not allowed to view previous versions
69 redirect_to :version => nil
70 redirect_to :version => nil
70 return
71 return
71 end
72 end
72 @content = @page.content_for_version(params[:version])
73 @content = @page.content_for_version(params[:version])
73 if User.current.allowed_to?(:export_wiki_pages, @project)
74 if User.current.allowed_to?(:export_wiki_pages, @project)
74 if params[:format] == 'html'
75 if params[:format] == 'pdf'
76 send_data(wiki_to_pdf(@page, @project), :type => 'application/pdf', :filename => "#{@page.title}.pdf")
77 return
78 elsif params[:format] == 'html'
75 export = render_to_string :action => 'export', :layout => false
79 export = render_to_string :action => 'export', :layout => false
76 send_data(export, :type => 'text/html', :filename => "#{@page.title}.html")
80 send_data(export, :type => 'text/html', :filename => "#{@page.title}.html")
77 return
81 return
78 elsif params[:format] == 'txt'
82 elsif params[:format] == 'txt'
79 send_data(@content.text, :type => 'text/plain', :filename => "#{@page.title}.txt")
83 send_data(@content.text, :type => 'text/plain', :filename => "#{@page.title}.txt")
80 return
84 return
81 end
85 end
82 end
86 end
83 @editable = editable?
87 @editable = editable?
84 render :action => 'show'
88 render :action => 'show'
85 end
89 end
86
90
87 # edit an existing page or a new one
91 # edit an existing page or a new one
88 def edit
92 def edit
89 return render_403 unless editable?
93 return render_403 unless editable?
90 @page.content = WikiContent.new(:page => @page) if @page.new_record?
94 @page.content = WikiContent.new(:page => @page) if @page.new_record?
91
95
92 @content = @page.content_for_version(params[:version])
96 @content = @page.content_for_version(params[:version])
93 @content.text = initial_page_content(@page) if @content.text.blank?
97 @content.text = initial_page_content(@page) if @content.text.blank?
94 # don't keep previous comment
98 # don't keep previous comment
95 @content.comments = nil
99 @content.comments = nil
96
100
97 # To prevent StaleObjectError exception when reverting to a previous version
101 # To prevent StaleObjectError exception when reverting to a previous version
98 @content.version = @page.content.version
102 @content.version = @page.content.version
99 end
103 end
100
104
101 verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed }
105 verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed }
102 # Creates a new page or updates an existing one
106 # Creates a new page or updates an existing one
103 def update
107 def update
104 return render_403 unless editable?
108 return render_403 unless editable?
105 @page.content = WikiContent.new(:page => @page) if @page.new_record?
109 @page.content = WikiContent.new(:page => @page) if @page.new_record?
106
110
107 @content = @page.content_for_version(params[:version])
111 @content = @page.content_for_version(params[:version])
108 @content.text = initial_page_content(@page) if @content.text.blank?
112 @content.text = initial_page_content(@page) if @content.text.blank?
109 # don't keep previous comment
113 # don't keep previous comment
110 @content.comments = nil
114 @content.comments = nil
111
115
112 if !@page.new_record? && params[:content].present? && @content.text == params[:content][:text]
116 if !@page.new_record? && params[:content].present? && @content.text == params[:content][:text]
113 attachments = Attachment.attach_files(@page, params[:attachments])
117 attachments = Attachment.attach_files(@page, params[:attachments])
114 render_attachment_warning_if_needed(@page)
118 render_attachment_warning_if_needed(@page)
115 # don't save if text wasn't changed
119 # don't save if text wasn't changed
116 redirect_to :action => 'show', :project_id => @project, :id => @page.title
120 redirect_to :action => 'show', :project_id => @project, :id => @page.title
117 return
121 return
118 end
122 end
119 @content.attributes = params[:content]
123 @content.attributes = params[:content]
120 @content.author = User.current
124 @content.author = User.current
121 # if page is new @page.save will also save content, but not if page isn't a new record
125 # if page is new @page.save will also save content, but not if page isn't a new record
122 if (@page.new_record? ? @page.save : @content.save)
126 if (@page.new_record? ? @page.save : @content.save)
123 attachments = Attachment.attach_files(@page, params[:attachments])
127 attachments = Attachment.attach_files(@page, params[:attachments])
124 render_attachment_warning_if_needed(@page)
128 render_attachment_warning_if_needed(@page)
125 call_hook(:controller_wiki_edit_after_save, { :params => params, :page => @page})
129 call_hook(:controller_wiki_edit_after_save, { :params => params, :page => @page})
126 redirect_to :action => 'show', :project_id => @project, :id => @page.title
130 redirect_to :action => 'show', :project_id => @project, :id => @page.title
127 else
131 else
128 render :action => 'edit'
132 render :action => 'edit'
129 end
133 end
130
134
131 rescue ActiveRecord::StaleObjectError
135 rescue ActiveRecord::StaleObjectError
132 # Optimistic locking exception
136 # Optimistic locking exception
133 flash.now[:error] = l(:notice_locking_conflict)
137 flash.now[:error] = l(:notice_locking_conflict)
134 render :action => 'edit'
138 render :action => 'edit'
135 end
139 end
136
140
137 # rename a page
141 # rename a page
138 def rename
142 def rename
139 return render_403 unless editable?
143 return render_403 unless editable?
140 @page.redirect_existing_links = true
144 @page.redirect_existing_links = true
141 # used to display the *original* title if some AR validation errors occur
145 # used to display the *original* title if some AR validation errors occur
142 @original_title = @page.pretty_title
146 @original_title = @page.pretty_title
143 if request.post? && @page.update_attributes(params[:wiki_page])
147 if request.post? && @page.update_attributes(params[:wiki_page])
144 flash[:notice] = l(:notice_successful_update)
148 flash[:notice] = l(:notice_successful_update)
145 redirect_to :action => 'show', :project_id => @project, :id => @page.title
149 redirect_to :action => 'show', :project_id => @project, :id => @page.title
146 end
150 end
147 end
151 end
148
152
149 verify :method => :post, :only => :protect, :redirect_to => { :action => :show }
153 verify :method => :post, :only => :protect, :redirect_to => { :action => :show }
150 def protect
154 def protect
151 @page.update_attribute :protected, params[:protected]
155 @page.update_attribute :protected, params[:protected]
152 redirect_to :action => 'show', :project_id => @project, :id => @page.title
156 redirect_to :action => 'show', :project_id => @project, :id => @page.title
153 end
157 end
154
158
155 # show page history
159 # show page history
156 def history
160 def history
157 @version_count = @page.content.versions.count
161 @version_count = @page.content.versions.count
158 @version_pages = Paginator.new self, @version_count, per_page_option, params['p']
162 @version_pages = Paginator.new self, @version_count, per_page_option, params['p']
159 # don't load text
163 # don't load text
160 @versions = @page.content.versions.find :all,
164 @versions = @page.content.versions.find :all,
161 :select => "id, author_id, comments, updated_on, version",
165 :select => "id, author_id, comments, updated_on, version",
162 :order => 'version DESC',
166 :order => 'version DESC',
163 :limit => @version_pages.items_per_page + 1,
167 :limit => @version_pages.items_per_page + 1,
164 :offset => @version_pages.current.offset
168 :offset => @version_pages.current.offset
165
169
166 render :layout => false if request.xhr?
170 render :layout => false if request.xhr?
167 end
171 end
168
172
169 def diff
173 def diff
170 @diff = @page.diff(params[:version], params[:version_from])
174 @diff = @page.diff(params[:version], params[:version_from])
171 render_404 unless @diff
175 render_404 unless @diff
172 end
176 end
173
177
174 def annotate
178 def annotate
175 @annotate = @page.annotate(params[:version])
179 @annotate = @page.annotate(params[:version])
176 render_404 unless @annotate
180 render_404 unless @annotate
177 end
181 end
178
182
179 verify :method => :delete, :only => [:destroy], :redirect_to => { :action => :show }
183 verify :method => :delete, :only => [:destroy], :redirect_to => { :action => :show }
180 # Removes a wiki page and its history
184 # Removes a wiki page and its history
181 # Children can be either set as root pages, removed or reassigned to another parent page
185 # Children can be either set as root pages, removed or reassigned to another parent page
182 def destroy
186 def destroy
183 return render_403 unless editable?
187 return render_403 unless editable?
184
188
185 @descendants_count = @page.descendants.size
189 @descendants_count = @page.descendants.size
186 if @descendants_count > 0
190 if @descendants_count > 0
187 case params[:todo]
191 case params[:todo]
188 when 'nullify'
192 when 'nullify'
189 # Nothing to do
193 # Nothing to do
190 when 'destroy'
194 when 'destroy'
191 # Removes all its descendants
195 # Removes all its descendants
192 @page.descendants.each(&:destroy)
196 @page.descendants.each(&:destroy)
193 when 'reassign'
197 when 'reassign'
194 # Reassign children to another parent page
198 # Reassign children to another parent page
195 reassign_to = @wiki.pages.find_by_id(params[:reassign_to_id].to_i)
199 reassign_to = @wiki.pages.find_by_id(params[:reassign_to_id].to_i)
196 return unless reassign_to
200 return unless reassign_to
197 @page.children.each do |child|
201 @page.children.each do |child|
198 child.update_attribute(:parent, reassign_to)
202 child.update_attribute(:parent, reassign_to)
199 end
203 end
200 else
204 else
201 @reassignable_to = @wiki.pages - @page.self_and_descendants
205 @reassignable_to = @wiki.pages - @page.self_and_descendants
202 return
206 return
203 end
207 end
204 end
208 end
205 @page.destroy
209 @page.destroy
206 redirect_to :action => 'index', :project_id => @project
210 redirect_to :action => 'index', :project_id => @project
207 end
211 end
208
212
209 # Export wiki to a single html file
213 # Export wiki to a single html file
210 def export
214 def export
211 if User.current.allowed_to?(:export_wiki_pages, @project)
215 if User.current.allowed_to?(:export_wiki_pages, @project)
212 @pages = @wiki.pages.find :all, :order => 'title'
216 @pages = @wiki.pages.find :all, :order => 'title'
213 export = render_to_string :action => 'export_multiple', :layout => false
217 export = render_to_string :action => 'export_multiple', :layout => false
214 send_data(export, :type => 'text/html', :filename => "wiki.html")
218 send_data(export, :type => 'text/html', :filename => "wiki.html")
215 else
219 else
216 redirect_to :action => 'show', :project_id => @project, :id => nil
220 redirect_to :action => 'show', :project_id => @project, :id => nil
217 end
221 end
218 end
222 end
219
223
220 def preview
224 def preview
221 page = @wiki.find_page(params[:id])
225 page = @wiki.find_page(params[:id])
222 # page is nil when previewing a new page
226 # page is nil when previewing a new page
223 return render_403 unless page.nil? || editable?(page)
227 return render_403 unless page.nil? || editable?(page)
224 if page
228 if page
225 @attachements = page.attachments
229 @attachements = page.attachments
226 @previewed = page.content
230 @previewed = page.content
227 end
231 end
228 @text = params[:content][:text]
232 @text = params[:content][:text]
229 render :partial => 'common/preview'
233 render :partial => 'common/preview'
230 end
234 end
231
235
232 def add_attachment
236 def add_attachment
233 return render_403 unless editable?
237 return render_403 unless editable?
234 attachments = Attachment.attach_files(@page, params[:attachments])
238 attachments = Attachment.attach_files(@page, params[:attachments])
235 render_attachment_warning_if_needed(@page)
239 render_attachment_warning_if_needed(@page)
236 redirect_to :action => 'show', :id => @page.title, :project_id => @project
240 redirect_to :action => 'show', :id => @page.title, :project_id => @project
237 end
241 end
238
242
239 private
243 private
240
244
241 def find_wiki
245 def find_wiki
242 @project = Project.find(params[:project_id])
246 @project = Project.find(params[:project_id])
243 @wiki = @project.wiki
247 @wiki = @project.wiki
244 render_404 unless @wiki
248 render_404 unless @wiki
245 rescue ActiveRecord::RecordNotFound
249 rescue ActiveRecord::RecordNotFound
246 render_404
250 render_404
247 end
251 end
248
252
249 # Finds the requested page or a new page if it doesn't exist
253 # Finds the requested page or a new page if it doesn't exist
250 def find_existing_or_new_page
254 def find_existing_or_new_page
251 @page = @wiki.find_or_new_page(params[:id])
255 @page = @wiki.find_or_new_page(params[:id])
252 if @wiki.page_found_with_redirect?
256 if @wiki.page_found_with_redirect?
253 redirect_to params.update(:id => @page.title)
257 redirect_to params.update(:id => @page.title)
254 end
258 end
255 end
259 end
256
260
257 # Finds the requested page and returns a 404 error if it doesn't exist
261 # Finds the requested page and returns a 404 error if it doesn't exist
258 def find_existing_page
262 def find_existing_page
259 @page = @wiki.find_page(params[:id])
263 @page = @wiki.find_page(params[:id])
260 if @page.nil?
264 if @page.nil?
261 render_404
265 render_404
262 return
266 return
263 end
267 end
264 if @wiki.page_found_with_redirect?
268 if @wiki.page_found_with_redirect?
265 redirect_to params.update(:id => @page.title)
269 redirect_to params.update(:id => @page.title)
266 end
270 end
267 end
271 end
268
272
269 # Returns true if the current user is allowed to edit the page, otherwise false
273 # Returns true if the current user is allowed to edit the page, otherwise false
270 def editable?(page = @page)
274 def editable?(page = @page)
271 page.editable_by?(User.current)
275 page.editable_by?(User.current)
272 end
276 end
273
277
274 # Returns the default content of a new wiki page
278 # Returns the default content of a new wiki page
275 def initial_page_content(page)
279 def initial_page_content(page)
276 helper = Redmine::WikiFormatting.helper_for(Setting.text_formatting)
280 helper = Redmine::WikiFormatting.helper_for(Setting.text_formatting)
277 extend helper unless self.instance_of?(helper)
281 extend helper unless self.instance_of?(helper)
278 helper.instance_method(:initial_page_content).bind(self).call(page)
282 helper.instance_method(:initial_page_content).bind(self).call(page)
279 end
283 end
280
284
281 def load_pages_for_index
285 def load_pages_for_index
282 @pages = @wiki.pages.with_updated_on.all(:order => 'title', :include => {:wiki => :project})
286 @pages = @wiki.pages.with_updated_on.all(:order => 'title', :include => {:wiki => :project})
283 end
287 end
284 end
288 end
@@ -1,68 +1,69
1 <div class="contextual">
1 <div class="contextual">
2 <% if @editable %>
2 <% if @editable %>
3 <%= link_to_if_authorized(l(:button_edit), {:action => 'edit', :id => @page.title}, :class => 'icon icon-edit', :accesskey => accesskey(:edit)) if @content.version == @page.content.version %>
3 <%= link_to_if_authorized(l(:button_edit), {:action => 'edit', :id => @page.title}, :class => 'icon icon-edit', :accesskey => accesskey(:edit)) if @content.version == @page.content.version %>
4 <%= watcher_tag(@page, User.current) %>
4 <%= watcher_tag(@page, User.current) %>
5 <%= link_to_if_authorized(l(:button_lock), {:action => 'protect', :id => @page.title, :protected => 1}, :method => :post, :class => 'icon icon-lock') if !@page.protected? %>
5 <%= link_to_if_authorized(l(:button_lock), {:action => 'protect', :id => @page.title, :protected => 1}, :method => :post, :class => 'icon icon-lock') if !@page.protected? %>
6 <%= link_to_if_authorized(l(:button_unlock), {:action => 'protect', :id => @page.title, :protected => 0}, :method => :post, :class => 'icon icon-unlock') if @page.protected? %>
6 <%= link_to_if_authorized(l(:button_unlock), {:action => 'protect', :id => @page.title, :protected => 0}, :method => :post, :class => 'icon icon-unlock') if @page.protected? %>
7 <%= link_to_if_authorized(l(:button_rename), {:action => 'rename', :id => @page.title}, :class => 'icon icon-move') if @content.version == @page.content.version %>
7 <%= link_to_if_authorized(l(:button_rename), {:action => 'rename', :id => @page.title}, :class => 'icon icon-move') if @content.version == @page.content.version %>
8 <%= link_to_if_authorized(l(:button_delete), {:action => 'destroy', :id => @page.title}, :method => :delete, :confirm => l(:text_are_you_sure), :class => 'icon icon-del') %>
8 <%= link_to_if_authorized(l(:button_delete), {:action => 'destroy', :id => @page.title}, :method => :delete, :confirm => l(:text_are_you_sure), :class => 'icon icon-del') %>
9 <%= link_to_if_authorized(l(:button_rollback), {:action => 'edit', :id => @page.title, :version => @content.version }, :class => 'icon icon-cancel') if @content.version < @page.content.version %>
9 <%= link_to_if_authorized(l(:button_rollback), {:action => 'edit', :id => @page.title, :version => @content.version }, :class => 'icon icon-cancel') if @content.version < @page.content.version %>
10 <% end %>
10 <% end %>
11 <%= link_to_if_authorized(l(:label_history), {:action => 'history', :id => @page.title}, :class => 'icon icon-history') %>
11 <%= link_to_if_authorized(l(:label_history), {:action => 'history', :id => @page.title}, :class => 'icon icon-history') %>
12 </div>
12 </div>
13
13
14 <%= wiki_page_breadcrumb(@page) %>
14 <%= wiki_page_breadcrumb(@page) %>
15
15
16 <% if @content.version != @page.content.version %>
16 <% if @content.version != @page.content.version %>
17 <p>
17 <p>
18 <%= link_to(("\xc2\xab " + l(:label_previous)),
18 <%= link_to(("\xc2\xab " + l(:label_previous)),
19 :action => 'show', :id => @page.title, :project_id => @page.project,
19 :action => 'show', :id => @page.title, :project_id => @page.project,
20 :version => (@content.version - 1)) + " - " if @content.version > 1 %>
20 :version => (@content.version - 1)) + " - " if @content.version > 1 %>
21 <%= "#{l(:label_version)} #{@content.version}/#{@page.content.version}" %>
21 <%= "#{l(:label_version)} #{@content.version}/#{@page.content.version}" %>
22 <%= '(' + link_to(l(:label_diff), :controller => 'wiki', :action => 'diff',
22 <%= '(' + link_to(l(:label_diff), :controller => 'wiki', :action => 'diff',
23 :id => @page.title, :project_id => @page.project,
23 :id => @page.title, :project_id => @page.project,
24 :version => @content.version) + ')' if @content.version > 1 %> -
24 :version => @content.version) + ')' if @content.version > 1 %> -
25 <%= link_to((l(:label_next) + " \xc2\xbb"), :action => 'show',
25 <%= link_to((l(:label_next) + " \xc2\xbb"), :action => 'show',
26 :id => @page.title, :project_id => @page.project,
26 :id => @page.title, :project_id => @page.project,
27 :version => (@content.version + 1)) + " - " if @content.version < @page.content.version %>
27 :version => (@content.version + 1)) + " - " if @content.version < @page.content.version %>
28 <%= link_to(l(:label_current_version), :action => 'show', :id => @page.title, :project_id => @page.project) %>
28 <%= link_to(l(:label_current_version), :action => 'show', :id => @page.title, :project_id => @page.project) %>
29 <br />
29 <br />
30 <em><%= @content.author ? link_to_user(@content.author) : l(:label_user_anonymous)
30 <em><%= @content.author ? link_to_user(@content.author) : l(:label_user_anonymous)
31 %>, <%= format_time(@content.updated_on) %> </em><br />
31 %>, <%= format_time(@content.updated_on) %> </em><br />
32 <%=h @content.comments %>
32 <%=h @content.comments %>
33 </p>
33 </p>
34 <hr />
34 <hr />
35 <% end %>
35 <% end %>
36
36
37 <%= render(:partial => "wiki/content", :locals => {:content => @content}) %>
37 <%= render(:partial => "wiki/content", :locals => {:content => @content}) %>
38
38
39 <%= link_to_attachments @page %>
39 <%= link_to_attachments @page %>
40
40
41 <% if @editable && authorize_for('wiki', 'add_attachment') %>
41 <% if @editable && authorize_for('wiki', 'add_attachment') %>
42 <div id="wiki_add_attachment">
42 <div id="wiki_add_attachment">
43 <p><%= link_to l(:label_attachment_new), {}, :onclick => "Element.show('add_attachment_form'); Element.hide(this); Element.scrollTo('add_attachment_form'); return false;",
43 <p><%= link_to l(:label_attachment_new), {}, :onclick => "Element.show('add_attachment_form'); Element.hide(this); Element.scrollTo('add_attachment_form'); return false;",
44 :id => 'attach_files_link' %></p>
44 :id => 'attach_files_link' %></p>
45 <% form_tag({ :controller => 'wiki', :action => 'add_attachment', :project_id => @project, :id => @page.title }, :multipart => true, :id => "add_attachment_form", :style => "display:none;") do %>
45 <% form_tag({ :controller => 'wiki', :action => 'add_attachment', :project_id => @project, :id => @page.title }, :multipart => true, :id => "add_attachment_form", :style => "display:none;") do %>
46 <div class="box">
46 <div class="box">
47 <p><%= render :partial => 'attachments/form' %></p>
47 <p><%= render :partial => 'attachments/form' %></p>
48 </div>
48 </div>
49 <%= submit_tag l(:button_add) %>
49 <%= submit_tag l(:button_add) %>
50 <%= link_to l(:button_cancel), {}, :onclick => "Element.hide('add_attachment_form'); Element.show('attach_files_link'); return false;" %>
50 <%= link_to l(:button_cancel), {}, :onclick => "Element.hide('add_attachment_form'); Element.show('attach_files_link'); return false;" %>
51 <% end %>
51 <% end %>
52 </div>
52 </div>
53 <% end %>
53 <% end %>
54
54
55 <% other_formats_links do |f| %>
55 <% other_formats_links do |f| %>
56 <%= f.link_to 'PDF', :url => {:id => @page.title, :version => @content.version} %>
56 <%= f.link_to 'HTML', :url => {:id => @page.title, :version => @content.version} %>
57 <%= f.link_to 'HTML', :url => {:id => @page.title, :version => @content.version} %>
57 <%= f.link_to 'TXT', :url => {:id => @page.title, :version => @content.version} %>
58 <%= f.link_to 'TXT', :url => {:id => @page.title, :version => @content.version} %>
58 <% end if User.current.allowed_to?(:export_wiki_pages, @project) %>
59 <% end if User.current.allowed_to?(:export_wiki_pages, @project) %>
59
60
60 <% content_for :header_tags do %>
61 <% content_for :header_tags do %>
61 <%= stylesheet_link_tag 'scm' %>
62 <%= stylesheet_link_tag 'scm' %>
62 <% end %>
63 <% end %>
63
64
64 <% content_for :sidebar do %>
65 <% content_for :sidebar do %>
65 <%= render :partial => 'sidebar' %>
66 <%= render :partial => 'sidebar' %>
66 <% end %>
67 <% end %>
67
68
68 <% html_title @page.pretty_title %>
69 <% html_title @page.pretty_title %>
General Comments 0
You need to be logged in to leave comments. Login now