[issue #64] Added page history views.

This commit is contained in:
George Vinogradov 2012-01-18 03:30:54 +04:00
parent a9989f07fe
commit 2522dd3c63
5 changed files with 113 additions and 8 deletions

View File

@ -1,4 +1,9 @@
module WikiHelper
def gravatar_url(email)
"http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(email)}?s=16"
end
def escaped_name
CGI.escape(@name)
end
@ -11,6 +16,10 @@ module WikiHelper
end
end
def view_path(project, name)
name == 'Home' ? project_wiki_index_path(project) : project_wiki_path(project, name)
end
def formats
Gollum::Page::FORMAT_NAMES.map do |key, val|
[ val, key.to_s ]

View File

@ -0,0 +1,30 @@
#wiki-history
%ul.actions
%li.minibutton
= link_to t("layout.wiki.compare_revisions"), "javascript:void(0);",
:class => "action-compare-revision"
= form_tag compare_project_wiki_path(@project, escaped_name), :name => "compare-versions", :id => "version-form" do
%fieldset
%table
%tbody
- @versions.each do |v|
%tr{:class => cycle("odd", "even")}
%td.checkbox
= check_box_tag "versions[]", v.id
%td.author
= link_to "javascript:void(0)" do
%img{:src => gravatar_url(v.author.email), :alt => "avatar: #{v.author.name}", :class => "mini-gravatar"}
%span.username= v.author.name
%td.commit-name
%span.time-elapsed= "#{v.committed_date.strftime("%B %d, %Y")}:"
 
= v.message
= raw "[#{link_to v.id[0..6], versioned_project_wiki_path(@project, escaped_name, v.id), :title => t("layout.wiki.view_commit")}]"
#gollum-footer
%ul.actions
%li.minibutton
= link_to t("layout.wiki.compare_revisions"), "javascript:void(0);", :class => "action-compare-revision"
%li.minibutton
= link_to t("layout.wiki.back_to_top"), "#wiki", :class => "action-back-to-top"

View File

@ -0,0 +1,60 @@
- content_for :javascripts do
= javascript_include_tag 'gollum/gollum.js', 'gollum/gollum.dialog.js', 'gollum/gollum.placeholder.js'
- content_for :stylesheets do
= stylesheet_link_tag 'gollum/gollum.css', 'gollum/dialog.css', 'gollum/ie7.css', 'gollum/template.css'
.block
.secondary-navigation
%ul.wat-cf
%li.first= link_to t("layout.projects.list"), projects_path
%li= link_to t("layout.projects.new"), new_project_path
%li.active= link_to t("layout.projects.show"), project_path(@project)
%li= link_to t("layout.git.repositories.source"), project_repo_path(@project)
%li= link_to t("layout.projects.build"), new_project_build_list_path(@project)
%li= link_to t("layout.projects.issues"), project_issues_path(@project)
.content
.inner
%p
%b
= t("activerecord.attributes.project.name")
\:
= @project.name
%p
%b
= t("activerecord.attributes.project.owner")
\:
= link_to @project.owner.try(:name), url_for(@project.owner)
%a{ :name => "wiki"}
.block
.secondary-navigation
%ul.wat-cf
%li.first{:class => "#{(@name == 'Home') ? 'active' : ''}" }
= link_to t("layout.wiki.home"), project_wiki_index_path(@project)
%li= link_to t("layout.wiki.pages"), pages_project_wiki_index_path(@project)
%li= link_to t("layout.wiki.wiki_history"), '#'
%li= link_to t("layout.wiki.git_access"), '#'
.content
#wiki-wrapper.inner.history
#head
%h1
= t("layout.wiki.history_for")
%strong= @name
%ul.actions
%li.minibutton
= link_to t("layout.wiki.view_page"), view_path(@project, escaped_name),
:class => 'action-view-page'
%li.minibutton
= link_to t("layout.wiki.edit_page"), edit_project_wiki_path(@project, escaped_name),
:class => 'aciton-edit-page'
= render :partial => 'searchbar'
#wiki-content
= render :partial => "history"
- content_for :sidebar do
- render :partial => 'projects/sidebar'

View File

@ -177,7 +177,10 @@ ru:
preview: Предпросмотр
save_changes: Сохранить текущие изменения
save_button: Сохранить
view_page: Показать
view_commit: Показать версию
compare_revisions: Сравнить версии
back_to_top: Наверх
roles:
confirm_delete: Вы уверены, что хотите удалить эту роль?

View File

@ -14,18 +14,21 @@
#wiki-wrapper {
margin: 0 auto;
overflow: visible;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 10px;*/ /* -> 1em */
/* width: 80%; */
}
/*
a:link {
#wiki-wrapper a:link {
color: #4183c4;
text-decoration: none;
}
a:hover, a:visited {
#wiki-wrapper a:hover, a:visited {
color: #4183c4;
text-decoration: underline;
}*/
}
/* @section head */
@ -486,7 +489,7 @@ ul.actions {
margin-left: 0.6em;
}
.minibutton a {
#wiki-wrapper .minibutton a {
background-color: #f7f7f7;
border: 1px solid #d4d4d4;
color: #333;
@ -527,7 +530,7 @@ ul.actions {
-webkit-border-radius: 3px;
}
.minibutton a:hover,
#wiki-wrapper .minibutton a:hover,
#search-submit:hover {
background: #3072b3;
border-color: #518cc6 #518cc6 #2a65a0;
@ -540,7 +543,7 @@ ul.actions {
background: -moz-linear-gradient(top, #599bdc, #3072b3);
}
.minibutton a:visited {
#wiki-wrapper .minibutton a:visited {
text-decoration: none;
}