remove trailing white-spaces from wiki controller source.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5824 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
4eb3af53d0
commit
5b8dfe0372
@ -5,12 +5,12 @@
|
|||||||
# modify it under the terms of the GNU General Public License
|
# modify it under the terms of the GNU General Public License
|
||||||
# as published by the Free Software Foundation; either version 2
|
# as published by the Free Software Foundation; either version 2
|
||||||
# of the License, or (at your option) any later version.
|
# of the License, or (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
@ -36,9 +36,9 @@ class WikiController < ApplicationController
|
|||||||
before_filter :find_wiki, :authorize
|
before_filter :find_wiki, :authorize
|
||||||
before_filter :find_existing_or_new_page, :only => [:show, :edit, :update]
|
before_filter :find_existing_or_new_page, :only => [:show, :edit, :update]
|
||||||
before_filter :find_existing_page, :only => [:rename, :protect, :history, :diff, :annotate, :add_attachment, :destroy]
|
before_filter :find_existing_page, :only => [:rename, :protect, :history, :diff, :annotate, :add_attachment, :destroy]
|
||||||
|
|
||||||
helper :attachments
|
helper :attachments
|
||||||
include AttachmentsHelper
|
include AttachmentsHelper
|
||||||
helper :watchers
|
helper :watchers
|
||||||
|
|
||||||
# List of pages, sorted alphabetically and by parent (hierarchy)
|
# List of pages, sorted alphabetically and by parent (hierarchy)
|
||||||
@ -46,7 +46,7 @@ class WikiController < ApplicationController
|
|||||||
load_pages_for_index
|
load_pages_for_index
|
||||||
@pages_by_parent_id = @pages.group_by(&:parent_id)
|
@pages_by_parent_id = @pages.group_by(&:parent_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
# List of page, by last update
|
# List of page, by last update
|
||||||
def date_index
|
def date_index
|
||||||
load_pages_for_index
|
load_pages_for_index
|
||||||
@ -83,12 +83,12 @@ class WikiController < ApplicationController
|
|||||||
@editable = editable?
|
@editable = editable?
|
||||||
render :action => 'show'
|
render :action => 'show'
|
||||||
end
|
end
|
||||||
|
|
||||||
# edit an existing page or a new one
|
# edit an existing page or a new one
|
||||||
def edit
|
def edit
|
||||||
return render_403 unless editable?
|
return render_403 unless editable?
|
||||||
@page.content = WikiContent.new(:page => @page) if @page.new_record?
|
@page.content = WikiContent.new(:page => @page) if @page.new_record?
|
||||||
|
|
||||||
@content = @page.content_for_version(params[:version])
|
@content = @page.content_for_version(params[:version])
|
||||||
@content.text = initial_page_content(@page) if @content.text.blank?
|
@content.text = initial_page_content(@page) if @content.text.blank?
|
||||||
# don't keep previous comment
|
# don't keep previous comment
|
||||||
@ -103,7 +103,7 @@ class WikiController < ApplicationController
|
|||||||
def update
|
def update
|
||||||
return render_403 unless editable?
|
return render_403 unless editable?
|
||||||
@page.content = WikiContent.new(:page => @page) if @page.new_record?
|
@page.content = WikiContent.new(:page => @page) if @page.new_record?
|
||||||
|
|
||||||
@content = @page.content_for_version(params[:version])
|
@content = @page.content_for_version(params[:version])
|
||||||
@content.text = initial_page_content(@page) if @content.text.blank?
|
@content.text = initial_page_content(@page) if @content.text.blank?
|
||||||
# don't keep previous comment
|
# don't keep previous comment
|
||||||
@ -145,7 +145,7 @@ class WikiController < ApplicationController
|
|||||||
redirect_to :action => 'show', :project_id => @project, :id => @page.title
|
redirect_to :action => 'show', :project_id => @project, :id => @page.title
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :post, :only => :protect, :redirect_to => { :action => :show }
|
verify :method => :post, :only => :protect, :redirect_to => { :action => :show }
|
||||||
def protect
|
def protect
|
||||||
@page.update_attribute :protected, params[:protected]
|
@page.update_attribute :protected, params[:protected]
|
||||||
@ -156,8 +156,8 @@ class WikiController < ApplicationController
|
|||||||
def history
|
def history
|
||||||
@version_count = @page.content.versions.count
|
@version_count = @page.content.versions.count
|
||||||
@version_pages = Paginator.new self, @version_count, per_page_option, params['p']
|
@version_pages = Paginator.new self, @version_count, per_page_option, params['p']
|
||||||
# don't load text
|
# don't load text
|
||||||
@versions = @page.content.versions.find :all,
|
@versions = @page.content.versions.find :all,
|
||||||
:select => "id, author_id, comments, updated_on, version",
|
:select => "id, author_id, comments, updated_on, version",
|
||||||
:order => 'version DESC',
|
:order => 'version DESC',
|
||||||
:limit => @version_pages.items_per_page + 1,
|
:limit => @version_pages.items_per_page + 1,
|
||||||
@ -165,12 +165,12 @@ class WikiController < ApplicationController
|
|||||||
|
|
||||||
render :layout => false if request.xhr?
|
render :layout => false if request.xhr?
|
||||||
end
|
end
|
||||||
|
|
||||||
def diff
|
def diff
|
||||||
@diff = @page.diff(params[:version], params[:version_from])
|
@diff = @page.diff(params[:version], params[:version_from])
|
||||||
render_404 unless @diff
|
render_404 unless @diff
|
||||||
end
|
end
|
||||||
|
|
||||||
def annotate
|
def annotate
|
||||||
@annotate = @page.annotate(params[:version])
|
@annotate = @page.annotate(params[:version])
|
||||||
render_404 unless @annotate
|
render_404 unless @annotate
|
||||||
@ -181,7 +181,7 @@ class WikiController < ApplicationController
|
|||||||
# Children can be either set as root pages, removed or reassigned to another parent page
|
# Children can be either set as root pages, removed or reassigned to another parent page
|
||||||
def destroy
|
def destroy
|
||||||
return render_403 unless editable?
|
return render_403 unless editable?
|
||||||
|
|
||||||
@descendants_count = @page.descendants.size
|
@descendants_count = @page.descendants.size
|
||||||
if @descendants_count > 0
|
if @descendants_count > 0
|
||||||
case params[:todo]
|
case params[:todo]
|
||||||
@ -216,7 +216,7 @@ class WikiController < ApplicationController
|
|||||||
redirect_to :action => 'show', :project_id => @project, :id => nil
|
redirect_to :action => 'show', :project_id => @project, :id => nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def preview
|
def preview
|
||||||
page = @wiki.find_page(params[:id])
|
page = @wiki.find_page(params[:id])
|
||||||
# page is nil when previewing a new page
|
# page is nil when previewing a new page
|
||||||
@ -237,7 +237,7 @@ class WikiController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def find_wiki
|
def find_wiki
|
||||||
@project = Project.find(params[:project_id])
|
@project = Project.find(params[:project_id])
|
||||||
@wiki = @project.wiki
|
@wiki = @project.wiki
|
||||||
@ -245,7 +245,7 @@ private
|
|||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
render_404
|
render_404
|
||||||
end
|
end
|
||||||
|
|
||||||
# Finds the requested page or a new page if it doesn't exist
|
# Finds the requested page or a new page if it doesn't exist
|
||||||
def find_existing_or_new_page
|
def find_existing_or_new_page
|
||||||
@page = @wiki.find_or_new_page(params[:id])
|
@page = @wiki.find_or_new_page(params[:id])
|
||||||
@ -253,7 +253,7 @@ private
|
|||||||
redirect_to params.update(:id => @page.title)
|
redirect_to params.update(:id => @page.title)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Finds the requested page and returns a 404 error if it doesn't exist
|
# Finds the requested page and returns a 404 error if it doesn't exist
|
||||||
def find_existing_page
|
def find_existing_page
|
||||||
@page = @wiki.find_page(params[:id])
|
@page = @wiki.find_page(params[:id])
|
||||||
@ -265,7 +265,7 @@ private
|
|||||||
redirect_to params.update(:id => @page.title)
|
redirect_to params.update(:id => @page.title)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns true if the current user is allowed to edit the page, otherwise false
|
# Returns true if the current user is allowed to edit the page, otherwise false
|
||||||
def editable?(page = @page)
|
def editable?(page = @page)
|
||||||
page.editable_by?(User.current)
|
page.editable_by?(User.current)
|
||||||
@ -277,7 +277,7 @@ private
|
|||||||
extend helper unless self.instance_of?(helper)
|
extend helper unless self.instance_of?(helper)
|
||||||
helper.instance_method(:initial_page_content).bind(self).call(page)
|
helper.instance_method(:initial_page_content).bind(self).call(page)
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_pages_for_index
|
def load_pages_for_index
|
||||||
@pages = @wiki.pages.with_updated_on.all(:order => 'title', :include => {:wiki => :project})
|
@pages = @wiki.pages.with_updated_on.all(:order => 'title', :include => {:wiki => :project})
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user