diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index b7629b9f24c7c30693f15a4efb2478bbdbcc0563..a7e6fea5ad0497c1367224356c656918d5eb744d 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -89,6 +89,10 @@ class WikiPage @page.versions.map { |v| Commit.new(Gitlab::Git::Commit.new(v)) } end + def commit + versions.first + end + # Returns the Date that this latest version was # created on. def created_at diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 1efea5d72d33d39eb9d0582fe6e13ab6747f8421..8a3427f3980f1fa72a54c82f05259b839ea41271 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -44,4 +44,3 @@ %hr = link_to @project.gitlab_ci_service.builds_path do = image_tag @project.gitlab_ci_service.status_img_path, alt: "build status" - diff --git a/app/views/projects/wikis/_main_links.html.haml b/app/views/projects/wikis/_main_links.html.haml index cb8ccf81c7b6399621532e3b4857660515abbd99..1001bb10c4f51183b0f27df9d2bffe01526743ce 100644 --- a/app/views/projects/wikis/_main_links.html.haml +++ b/app/views/projects/wikis/_main_links.html.haml @@ -1,8 +1,8 @@ %span.pull-right - if (@wiki && @wiki.persisted?) - = link_to history_project_wiki_path(@project, @wiki), class: "btn btn-small grouped" do + = link_to history_project_wiki_path(@project, @wiki), class: "btn grouped" do Page History - if can?(current_user, :write_wiki, @project) - = link_to edit_project_wiki_path(@project, @wiki), class: "btn btn-small grouped" do + = link_to edit_project_wiki_path(@project, @wiki), class: "btn grouped" do %i.icon-edit Edit diff --git a/app/views/projects/wikis/history.html.haml b/app/views/projects/wikis/history.html.haml index 6544102b83f9d3faca24654c0a73de75b52a4e97..344a5e88e6e93e831977089e8766e213d8e4bd41 100644 --- a/app/views/projects/wikis/history.html.haml +++ b/app/views/projects/wikis/history.html.haml @@ -1,9 +1,8 @@ = render 'nav' %h3.page-title %span.light History for - = @wiki.title.titleize - = render 'main_links' -%br + = link_to @wiki.title.titleize, project_wiki_path(@project, @wiki) + %table %thead %tr diff --git a/app/views/projects/wikis/pages.html.haml b/app/views/projects/wikis/pages.html.haml index 829617d77cd0c850cfbb294271684e2976cc2afe..59d104a985bd65562ae5b341ed3f9ef72e64ba3f 100644 --- a/app/views/projects/wikis/pages.html.haml +++ b/app/views/projects/wikis/pages.html.haml @@ -1,25 +1,11 @@ = render 'nav' %h3.page-title All Pages - = render 'main_links' -%br -%table - %thead - %tr - %th Title - %th Format - %th Last updated - %th Updated by - %tbody - - @wiki_pages.each do |wiki_page| - %tr - %td - %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 - = commit_author_link(wiki_page.version, avatar: true, size: 24) +%ul.bordered-list + - @wiki_pages.each do |wiki_page| + %li + %h4 + = link_to wiki_page.title.titleize, project_wiki_path(@project, wiki_page) + %small (#{wiki_page.format}) + .pull-right + %small Last edited #{time_ago_in_words(wiki_page.commit.created_at)} ago diff --git a/app/views/projects/wikis/show.html.haml b/app/views/projects/wikis/show.html.haml index dc814382adc9a7241a9dadd0de20d3c3d19f9a26..63e7f12b7fe9b04c92f35bace6d2322f9bd67395 100644 --- a/app/views/projects/wikis/show.html.haml +++ b/app/views/projects/wikis/show.html.haml @@ -12,4 +12,4 @@ = preserve do = render_wiki_content(@wiki) -%p.time Last edited by #{commit_author_link(@wiki.version, avatar: true, size: 16)} #{time_ago_in_words @wiki.created_at} ago +%p.time Last edited by #{commit_author_link(@wiki.commit, avatar: true, size: 16)} #{time_ago_in_words @wiki.commit.created_at} ago