diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-04-22 17:47:11 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-04-22 17:47:11 +0000 |
commit | bda78a4679bc947dfd42ab92adfc043afd1d2f60 (patch) | |
tree | 39ad1356f3024f2dd9ee3a8710e8d9bd46334efc /app/controllers/wiki_controller.rb | |
parent | b56f77322ac2f6a900ba011e767446e17401cf6f (diff) | |
download | redmine-bda78a4679bc947dfd42ab92adfc043afd1d2f60.tar.gz redmine-bda78a4679bc947dfd42ab92adfc043afd1d2f60.zip |
Adds "New wiki page" link to create a new wiki page (#5536).
git-svn-id: http://svn.redmine.org/redmine/trunk@15346 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/wiki_controller.rb')
-rw-r--r-- | app/controllers/wiki_controller.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index 46dec485c..2f174877f 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -60,6 +60,23 @@ class WikiController < ApplicationController @pages_by_date = @pages.group_by {|p| p.updated_on.to_date} end + def new + @page = WikiPage.new(:wiki => @wiki, :title => params[:title]) + unless User.current.allowed_to?(:edit_wiki_pages, @project) && editable? + render_403 + end + if request.post? + @page.validate + if @page.errors[:title].blank? + path = project_wiki_page_path(@project, @page.title) + respond_to do |format| + format.html { redirect_to path } + format.js { render :js => "window.location = #{path.to_json}" } + end + end + end + end + # display a page (in editing mode if it doesn't exist) def show if params[:version] && !User.current.allowed_to?(:view_wiki_edits, @project) |