From 4b045badcfde2eb27b63023ca8f3c30334d7f00f Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Mon, 25 Oct 2010 16:16:46 +0000 Subject: Refactor: Rename WikiController#page_index to #index index is the action that should list a collection of records, which is what #page_index does. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4290 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/wiki_controller.rb | 25 ++++++++++++++++++++----- app/views/wiki/_sidebar.rhtml | 2 +- app/views/wiki/index.html.erb | 26 ++++++++++++++++++++++++++ app/views/wiki/page_index.html.erb | 26 -------------------------- 4 files changed, 47 insertions(+), 32 deletions(-) create mode 100644 app/views/wiki/index.html.erb delete mode 100644 app/views/wiki/page_index.html.erb (limited to 'app') diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index 1c42ab5cd..c7b866239 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -17,6 +17,20 @@ require 'diff' +# The WikiController follows the Rails REST controller pattern but with +# a few differences +# +# * index - shows a list of WikiPages grouped by page or date +# * new - not used +# * create - not used +# * show - will also show the form for creating a new wiki page +# * edit - used to edit an existing or new page +# * update - used to save a wiki page update to the database, including new pages +# * destroy - normal +# +# Other member and collection methods are also used +# +# TODO: still being worked on class WikiController < ApplicationController default_search_scope :wiki_pages before_filter :find_wiki, :authorize @@ -28,6 +42,11 @@ class WikiController < ApplicationController include AttachmentsHelper helper :watchers + # List of pages, sorted alphabetically and by parent (hierarchy) + def index + load_pages_grouped_by_date_without_content + end + # display a page (in editing mode if it doesn't exist) def show page_title = params[:page] @@ -180,7 +199,7 @@ class WikiController < ApplicationController end end @page.destroy - redirect_to :action => 'page_index', :project_id => @project + redirect_to :action => 'index', :project_id => @project end # Export wiki to a single html file @@ -194,10 +213,6 @@ class WikiController < ApplicationController end end - def page_index - load_pages_grouped_by_date_without_content - end - def date_index load_pages_grouped_by_date_without_content end diff --git a/app/views/wiki/_sidebar.rhtml b/app/views/wiki/_sidebar.rhtml index efb24af06..7f60825aa 100644 --- a/app/views/wiki/_sidebar.rhtml +++ b/app/views/wiki/_sidebar.rhtml @@ -5,5 +5,5 @@

<%= l(:label_wiki) %>

<%= link_to l(:field_start_page), {:action => 'show', :page => nil} %>
-<%= link_to l(:label_index_by_title), {:action => 'page_index'} %>
+<%= link_to l(:label_index_by_title), {:action => 'index'} %>
<%= link_to l(:label_index_by_date), {:action => 'date_index'} %>
diff --git a/app/views/wiki/index.html.erb b/app/views/wiki/index.html.erb new file mode 100644 index 000000000..7e7155fda --- /dev/null +++ b/app/views/wiki/index.html.erb @@ -0,0 +1,26 @@ +
+<%= watcher_tag(@wiki, User.current) %> +
+ +

<%= l(:label_index_by_title) %>

+ +<% if @pages.empty? %> +

<%= l(:label_no_data) %>

+<% end %> + +<%= render_page_hierarchy(@pages_by_parent_id) %> + +<% content_for :sidebar do %> + <%= render :partial => 'sidebar' %> +<% end %> + +<% unless @pages.empty? %> +<% other_formats_links do |f| %> + <%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'show', :id => @project, :show_wiki_edits => 1, :key => User.current.rss_key} %> + <%= f.link_to('HTML', :url => {:action => 'export'}) if User.current.allowed_to?(:export_wiki_pages, @project) %> +<% end %> +<% end %> + +<% content_for :header_tags do %> +<%= auto_discovery_link_tag(:atom, :controller => 'activities', :action => 'show', :id => @project, :show_wiki_edits => 1, :format => 'atom', :key => User.current.rss_key) %> +<% end %> diff --git a/app/views/wiki/page_index.html.erb b/app/views/wiki/page_index.html.erb deleted file mode 100644 index 7e7155fda..000000000 --- a/app/views/wiki/page_index.html.erb +++ /dev/null @@ -1,26 +0,0 @@ -
-<%= watcher_tag(@wiki, User.current) %> -
- -

<%= l(:label_index_by_title) %>

- -<% if @pages.empty? %> -

<%= l(:label_no_data) %>

-<% end %> - -<%= render_page_hierarchy(@pages_by_parent_id) %> - -<% content_for :sidebar do %> - <%= render :partial => 'sidebar' %> -<% end %> - -<% unless @pages.empty? %> -<% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'show', :id => @project, :show_wiki_edits => 1, :key => User.current.rss_key} %> - <%= f.link_to('HTML', :url => {:action => 'export'}) if User.current.allowed_to?(:export_wiki_pages, @project) %> -<% end %> -<% end %> - -<% content_for :header_tags do %> -<%= auto_discovery_link_tag(:atom, :controller => 'activities', :action => 'show', :id => @project, :show_wiki_edits => 1, :format => 'atom', :key => User.current.rss_key) %> -<% end %> -- cgit v1.2.3