Replace current Wiki system with Gollum Wikis.
This commit replaces the old database backed Wiki system with the excellent Gollum git based Wiki system. The UI has been updated to allow for utilizing the extra features that Gollum provides. Specifically: * Edit page now allows you to choose the content format. * Edit page allows you to provide a commit message for the change. * History page now shows Format, Commit Message, and Commit Hash. * A new Git Access page has been added with the Wiki Repo URL. * The default page has been changed to Home from Index to match the Gollum standard. The old Wiki model has been left in tact to provide for the development of a migration script that will move all content stored in the old Wiki system into new Gollum Wikis.
This commit is contained in:
parent
8e8372d5ce
commit
ea9b3687db
21 changed files with 888 additions and 87 deletions
|
@ -41,6 +41,6 @@
|
|||
|
||||
- if @project.wiki_enabled
|
||||
= nav_link(controller: :wikis) do
|
||||
= link_to 'Wiki', project_wiki_path(@project, :index)
|
||||
= link_to 'Wiki', project_wiki_path(@project, :home)
|
||||
|
||||
.content= yield
|
||||
|
|
|
@ -8,9 +8,12 @@
|
|||
|
||||
.ui-box.ui-box-show
|
||||
.ui-box-head
|
||||
= f.label :title
|
||||
.input= f.text_field :title, class: 'span8'
|
||||
= f.hidden_field :slug
|
||||
%h3.page_title
|
||||
.edit-wiki-header
|
||||
= @wiki.title.titleize
|
||||
= f.hidden_field :title, value: @wiki.title
|
||||
= f.select :format, options_for_select(GollumWiki::MARKUPS, {selected: @wiki.format}), {}, class: "pull-right input-medium"
|
||||
= f.label :format, class: "pull-right", style: "padding-right: 20px;"
|
||||
.ui-box-body
|
||||
.input
|
||||
%span.cgray
|
||||
|
@ -22,6 +25,9 @@
|
|||
.ui-box-bottom
|
||||
= f.label :content
|
||||
.input= f.text_area :content, class: 'span8 js-gfm-input'
|
||||
.ui-box-bottom
|
||||
= f.label :commit_message
|
||||
.input= f.text_field :message, class: 'span8'
|
||||
.actions
|
||||
= f.submit 'Save', class: "btn-save btn"
|
||||
= link_to "Cancel", project_wiki_path(@project, :index), class: "btn btn-cancel"
|
||||
|
|
16
app/views/wikis/_main_links.html.haml
Normal file
16
app/views/wikis/_main_links.html.haml
Normal file
|
@ -0,0 +1,16 @@
|
|||
%span.pull-right
|
||||
= link_to project_wiki_path(@project, :home), class: "btn btn-small grouped" do
|
||||
Home
|
||||
= link_to pages_project_wikis_path(@project), class: "btn btn-small grouped" do
|
||||
Pages
|
||||
- if (@wiki && @wiki.persisted?)
|
||||
= link_to history_project_wiki_path(@project, @wiki), class: "btn btn-small grouped" do
|
||||
History
|
||||
- if can?(current_user, :write_wiki, @project)
|
||||
- if @wiki && @wiki.persisted?
|
||||
= link_to edit_project_wiki_path(@project, @wiki), class: "btn btn-small grouped" do
|
||||
%i.icon-edit
|
||||
Edit
|
||||
= link_to git_access_project_wikis_path(@project), class: "btn btn-small grouped" do
|
||||
%i.icon-download-alt
|
||||
Git Access
|
|
@ -1,8 +1,10 @@
|
|||
%h3.page_title Editing page
|
||||
%h3.page_title
|
||||
Editing page
|
||||
= render partial: 'main_links'
|
||||
%hr
|
||||
= render 'form'
|
||||
|
||||
.pull-right
|
||||
- if can? current_user, :admin_wiki, @project
|
||||
= link_to project_wiki_path(@project, @wiki), confirm: "Are you sure you want to delete this page?", method: :delete, class: "btn btn-small btn-remove" do
|
||||
Delete this page
|
||||
= link_to project_wikis_path(@project, @wiki), confirm: "Are you sure you want to delete this page?", method: :delete, class: "btn btn-small btn-remove" do
|
||||
Delete this page
|
||||
|
|
36
app/views/wikis/git_access.html.haml
Normal file
36
app/views/wikis/git_access.html.haml
Normal file
|
@ -0,0 +1,36 @@
|
|||
%h3.page_title
|
||||
Git Access
|
||||
%strong= @gollum_wiki.path_with_namespace
|
||||
= render partial: 'main_links'
|
||||
|
||||
%br
|
||||
.content
|
||||
.project_clone_panel
|
||||
.row
|
||||
.span7
|
||||
.form-horizontal
|
||||
.input-prepend.project_clone_holder
|
||||
%button{class: "btn active", :"data-clone" => @gollum_wiki.ssh_url_to_repo} SSH
|
||||
%button{class: "btn", :"data-clone" => @gollum_wiki.http_url_to_repo}= Gitlab.config.gitlab.protocol.upcase
|
||||
= text_field_tag :project_clone, @gollum_wiki.url_to_repo, class: "one_click_select input-xxlarge", readonly: true
|
||||
.git-empty
|
||||
%fieldset
|
||||
%legend Install Gollum:
|
||||
%pre.dark
|
||||
:preserve
|
||||
gem install gollum
|
||||
|
||||
%legend Clone Your Wiki:
|
||||
%pre.dark
|
||||
:preserve
|
||||
git clone #{@gollum_wiki.path_with_namespace}.git
|
||||
cd #{@gollum_wiki.path_with_namespace}
|
||||
|
||||
%legend Start Gollum And Edit Locally:
|
||||
%pre.dark
|
||||
:preserve
|
||||
gollum
|
||||
== Sinatra/1.3.5 has taken the stage on 4567 for development with backup from Thin
|
||||
>> Thin web server (v1.5.0 codename Knife)
|
||||
>> Maximum connections set to 1024
|
||||
>> Listening on 0.0.0.0:4567, CTRL+C to stop
|
|
@ -1,23 +1,29 @@
|
|||
%h3.page_title
|
||||
%span.cgray History for
|
||||
= @wiki_pages.first.title
|
||||
= @wiki.title.titleize
|
||||
= render partial: 'main_links'
|
||||
%br
|
||||
%table
|
||||
%thead
|
||||
%tr
|
||||
%th Page version
|
||||
%th Author
|
||||
%th Commit Message
|
||||
%th Last updated
|
||||
%th Updated by
|
||||
%th Format
|
||||
%tbody
|
||||
- @wiki_pages.each_with_index do |wiki_page, i|
|
||||
- @wiki.versions.each do |version|
|
||||
- commit = CommitDecorator.new(version)
|
||||
%tr
|
||||
%td
|
||||
%strong
|
||||
= link_to project_wiki_path(@project, wiki_page, version_id: wiki_page.id) do
|
||||
Version
|
||||
= @wiki_pages.count - i
|
||||
= link_to project_wiki_path(@project, @wiki, version_id: commit.id) do
|
||||
= commit.short_id
|
||||
%td= commit.author_link avatar: true, size: 24
|
||||
%td
|
||||
= wiki_page.created_at.to_s(:short)
|
||||
(#{time_ago_in_words(wiki_page.created_at)}
|
||||
ago)
|
||||
%td= link_to_member(@project, wiki_page.user)
|
||||
= commit.title
|
||||
%td
|
||||
= time_ago_in_words(version.date)
|
||||
ago
|
||||
%td
|
||||
%strong
|
||||
= @wiki.page.wiki.page(@wiki.page.name, commit.id).try(:format)
|
||||
|
|
|
@ -1,20 +1,24 @@
|
|||
%h3.page_title All Pages
|
||||
%h3.page_title
|
||||
All Pages
|
||||
= render partial: 'main_links'
|
||||
%br
|
||||
%table
|
||||
%thead
|
||||
%tr
|
||||
%th Title
|
||||
%th Slug
|
||||
%th Format
|
||||
%th Last updated
|
||||
%th Updated by
|
||||
%tbody
|
||||
- @wiki_pages.each do |wiki_page|
|
||||
%tr
|
||||
%td
|
||||
%strong= link_to wiki_page.title, project_wiki_path(@project, wiki_page)
|
||||
%td= wiki_page.slug
|
||||
%strong= link_to wiki_page.title.titleize, project_wiki_path(@project, wiki_page)
|
||||
%td
|
||||
%strong= wiki_page.format
|
||||
%td
|
||||
= wiki_page.created_at.to_s(:short) do
|
||||
(#{time_ago_in_words(wiki_page.created_at)}
|
||||
ago)
|
||||
%td= link_to_member(@project, wiki_page.user)
|
||||
- commit = CommitDecorator.decorate(wiki_page.version)
|
||||
%td= commit.author_link avatar: true, size: 24
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
%h3.page_title
|
||||
= @wiki.title
|
||||
%span.pull-right
|
||||
= link_to pages_project_wikis_path(@project), class: "btn btn-small grouped" do
|
||||
Pages
|
||||
- if can? current_user, :write_wiki, @project
|
||||
= link_to history_project_wiki_path(@project, @wiki), class: "btn btn-small grouped" do
|
||||
History
|
||||
= link_to edit_project_wiki_path(@project, @wiki), class: "btn btn-small grouped" do
|
||||
%i.icon-edit
|
||||
Edit
|
||||
= @wiki.title.titleize
|
||||
= render partial: 'main_links'
|
||||
%br
|
||||
- if @wiki != @most_recent_wiki
|
||||
- if @wiki.historical?
|
||||
.warning_message
|
||||
This is an old version of this page.
|
||||
You can view the #{link_to "most recent version", project_wiki_path(@project, @wiki)} or browse the #{link_to "history", history_project_wiki_path(@project, @wiki)}.
|
||||
|
@ -18,6 +10,7 @@
|
|||
.file_holder
|
||||
.file_content.wiki
|
||||
= preserve do
|
||||
= markdown @wiki.content
|
||||
= @wiki.formatted_content.html_safe
|
||||
|
||||
%p.time Last edited by #{link_to_member @project, @wiki.user}, #{time_ago_in_words @wiki.created_at} ago
|
||||
- commit = CommitDecorator.new(@wiki.version)
|
||||
%p.time Last edited by #{commit.author_link(avatar: true, size: 16)} #{time_ago_in_words @wiki.created_at} ago
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue