Commit 839757598bfa92da509ec52d696ed748d3c7b8d7

Authored by Dmitriy Zaporozhets
1 parent 8ffb6126

Wiki pages page

app/controllers/wikis_controller.rb
@@ -6,6 +6,10 @@ class WikisController < ApplicationController @@ -6,6 +6,10 @@ class WikisController < ApplicationController
6 before_filter :authorize_admin_wiki!, :only => :destroy 6 before_filter :authorize_admin_wiki!, :only => :destroy
7 layout "project" 7 layout "project"
8 8
  9 + def pages
  10 + @wikis = @project.wikis.group(:slug).order("created_at")
  11 + end
  12 +
9 def show 13 def show
10 if params[:old_page_id] 14 if params[:old_page_id]
11 @wiki = @project.wikis.find(params[:old_page_id]) 15 @wiki = @project.wikis.find(params[:old_page_id])
app/views/wikis/history.html.haml
1 -%h3.page_title Versions 1 +%h3.page_title
  2 + %span.cgray History for
  3 + = @wikis.last.title
2 %br 4 %br
3 %table.admin-table 5 %table.admin-table
4 %thead 6 %thead
app/views/wikis/pages.html.haml 0 → 100644
@@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
  1 +%h3.page_title All Pages
  2 +%br
  3 +%table.admin-table
  4 + %thead
  5 + %tr
  6 + %th Title
  7 + %th slug
  8 + %th created by
  9 + %tbody
  10 + - @wikis.each_with_index do |wiki_page, i|
  11 + %tr
  12 + %td
  13 + = link_to wiki_page.title, project_wiki_path(@project, wiki_page, :old_page_id => wiki_page.id)
  14 + (#{time_ago_in_words(wiki_page.created_at)}
  15 + ago)
  16 + %td= wiki_page.slug
  17 + %td= wiki_page.user.name
  18 +
app/views/wikis/show.html.haml
1 -%h3 1 +%h3.page_title
2 = @wiki.title 2 = @wiki.title
3 %span.right 3 %span.right
  4 + = link_to pages_project_wikis_path(@project), :class => "btn small grouped" do
  5 + Pages
4 - if can? current_user, :write_wiki, @project 6 - if can? current_user, :write_wiki, @project
5 = link_to history_project_wiki_path(@project, @wiki), :class => "btn small grouped" do 7 = link_to history_project_wiki_path(@project, @wiki), :class => "btn small grouped" do
6 History 8 History
config/routes.rb
@@ -98,6 +98,10 @@ Gitlab::Application.routes.draw do @@ -98,6 +98,10 @@ Gitlab::Application.routes.draw do
98 end 98 end
99 99
100 resources :wikis, :only => [:show, :edit, :destroy, :create] do 100 resources :wikis, :only => [:show, :edit, :destroy, :create] do
  101 + collection do
  102 + get :pages
  103 + end
  104 +
101 member do 105 member do
102 get "history" 106 get "history"
103 end 107 end