diff options
-rw-r--r-- | app/models/wiki_page.rb | 4 | ||||
-rw-r--r-- | app/views/projects/show.html.haml | 1 | ||||
-rw-r--r-- | app/views/projects/wikis/_main_links.html.haml | 4 | ||||
-rw-r--r-- | app/views/projects/wikis/history.html.haml | 5 | ||||
-rw-r--r-- | app/views/projects/wikis/pages.html.haml | 30 | ||||
-rw-r--r-- | app/views/projects/wikis/show.html.haml | 2 |
6 files changed, 17 insertions, 29 deletions
diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index b7629b9f24c..a7e6fea5ad0 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 1efea5d72d3..8a3427f3980 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 cb8ccf81c7b..1001bb10c4f 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 6544102b83f..344a5e88e6e 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 829617d77cd..59d104a985b 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 dc814382adc..63e7f12b7fe 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 |