Commit 0e387919c3827260434aed48e1f28ee02ce5e58d

Authored by Dmitriy Zaporozhets
1 parent ffa234bc

Fixed wrong last-edit time for wiki

app/models/wiki_page.rb
... ... @@ -89,6 +89,10 @@ class WikiPage
89 89 @page.versions.map { |v| Commit.new(Gitlab::Git::Commit.new(v)) }
90 90 end
91 91  
  92 + def commit
  93 + versions.first
  94 + end
  95 +
92 96 # Returns the Date that this latest version was
93 97 # created on.
94 98 def created_at
... ...
app/views/projects/show.html.haml
... ... @@ -44,4 +44,3 @@
44 44 %hr
45 45 = link_to @project.gitlab_ci_service.builds_path do
46 46 = image_tag @project.gitlab_ci_service.status_img_path, alt: "build status"
47   -
... ...
app/views/projects/wikis/_main_links.html.haml
1 1 %span.pull-right
2 2 - if (@wiki && @wiki.persisted?)
3   - = link_to history_project_wiki_path(@project, @wiki), class: "btn btn-small grouped" do
  3 + = link_to history_project_wiki_path(@project, @wiki), class: "btn grouped" do
4 4 Page History
5 5 - if can?(current_user, :write_wiki, @project)
6   - = link_to edit_project_wiki_path(@project, @wiki), class: "btn btn-small grouped" do
  6 + = link_to edit_project_wiki_path(@project, @wiki), class: "btn grouped" do
7 7 %i.icon-edit
8 8 Edit
... ...
app/views/projects/wikis/history.html.haml
1 1 = render 'nav'
2 2 %h3.page-title
3 3 %span.light History for
4   - = @wiki.title.titleize
5   - = render 'main_links'
6   -%br
  4 + = link_to @wiki.title.titleize, project_wiki_path(@project, @wiki)
  5 +
7 6 %table
8 7 %thead
9 8 %tr
... ...
app/views/projects/wikis/pages.html.haml
1 1 = render 'nav'
2 2 %h3.page-title
3 3 All Pages
4   - = render 'main_links'
5   -%br
6   -%table
7   - %thead
8   - %tr
9   - %th Title
10   - %th Format
11   - %th Last updated
12   - %th Updated by
13   - %tbody
14   - - @wiki_pages.each do |wiki_page|
15   - %tr
16   - %td
17   - %strong= link_to wiki_page.title.titleize, project_wiki_path(@project, wiki_page)
18   - %td
19   - %strong= wiki_page.format
20   - %td
21   - = wiki_page.created_at.to_s(:short) do
22   - (#{time_ago_in_words(wiki_page.created_at)}
23   - ago)
24   - %td
25   - = commit_author_link(wiki_page.version, avatar: true, size: 24)
  4 +%ul.bordered-list
  5 + - @wiki_pages.each do |wiki_page|
  6 + %li
  7 + %h4
  8 + = link_to wiki_page.title.titleize, project_wiki_path(@project, wiki_page)
  9 + %small (#{wiki_page.format})
  10 + .pull-right
  11 + %small Last edited #{time_ago_in_words(wiki_page.commit.created_at)} ago
... ...
app/views/projects/wikis/show.html.haml
... ... @@ -12,4 +12,4 @@
12 12 = preserve do
13 13 = render_wiki_content(@wiki)
14 14  
15   -%p.time Last edited by #{commit_author_link(@wiki.version, avatar: true, size: 16)} #{time_ago_in_words @wiki.created_at} ago
  15 +%p.time Last edited by #{commit_author_link(@wiki.commit, avatar: true, size: 16)} #{time_ago_in_words @wiki.commit.created_at} ago
... ...