Merge pull request #578 from github/fileview-hover-fix
Fileview hover fix
This commit is contained in:
@@ -0,0 +1,25 @@
|
|||||||
|
# https://help.github.com/articles/dealing-with-line-endings
|
||||||
|
# Set default behaviour, in case users don't have core.autocrlf set.
|
||||||
|
* text=auto
|
||||||
|
|
||||||
|
# Explicitly declare text files we want to always be normalized and converted
|
||||||
|
# to native line endings on checkout.
|
||||||
|
*.txt text
|
||||||
|
*.md text
|
||||||
|
*.rb text
|
||||||
|
*.js text
|
||||||
|
*.html text
|
||||||
|
*.yml text
|
||||||
|
*.mustache text
|
||||||
|
*.css text
|
||||||
|
Rakefile text
|
||||||
|
Gemfile text
|
||||||
|
LICENSE text
|
||||||
|
COPYRIGHT text
|
||||||
|
gollum text
|
||||||
|
.gitattributes text
|
||||||
|
.gitignore text
|
||||||
|
|
||||||
|
# Denote all files that are truly binary and should not be modified.
|
||||||
|
*.png binary
|
||||||
|
*.jpg binary
|
||||||
@@ -22,7 +22,7 @@ module Gollum
|
|||||||
def new_page page
|
def new_page page
|
||||||
name = page.name
|
name = page.name
|
||||||
url = url_for_page page
|
url = url_for_page page
|
||||||
%Q( <li class="file"><a href="#{url}">#{name}</a></li>\n)
|
%Q( <li class="file"><a href="#{url}"><span class="icon"></span>#{name}</a></li>)
|
||||||
end
|
end
|
||||||
|
|
||||||
def new_folder folder_path
|
def new_folder folder_path
|
||||||
@@ -38,10 +38,7 @@ module Gollum
|
|||||||
end
|
end
|
||||||
|
|
||||||
def end_folder
|
def end_folder
|
||||||
<<-HTML
|
"</ol></li>\n"
|
||||||
</ol>
|
|
||||||
</li>
|
|
||||||
HTML
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def url_for_page page
|
def url_for_page page
|
||||||
@@ -85,13 +82,11 @@ module Gollum
|
|||||||
# Handle special case of only one folder.
|
# Handle special case of only one folder.
|
||||||
if (count - folder_start == 1)
|
if (count - folder_start == 1)
|
||||||
page = @pages[ folder_start ]
|
page = @pages[ folder_start ]
|
||||||
name = page.name
|
|
||||||
url = url_for_page page
|
|
||||||
html += <<-HTML
|
html += <<-HTML
|
||||||
<li>
|
<li>
|
||||||
<label>#{::File.dirname(page.path)}</label> <input type="checkbox" #{@checked} />
|
<label>#{::File.dirname(page.path)}</label> <input type="checkbox" #{@checked} />
|
||||||
<ol>
|
<ol>
|
||||||
<li class="file"><a href="#{url}">#{name}</a></li>
|
#{new_page page}
|
||||||
</ol>
|
</ol>
|
||||||
</li>
|
</li>
|
||||||
HTML
|
HTML
|
||||||
|
|||||||
@@ -72,16 +72,23 @@ ol.tree
|
|||||||
}
|
}
|
||||||
li.file a
|
li.file a
|
||||||
{
|
{
|
||||||
background: url(../images/fileview/document.png) 0 0 no-repeat;
|
|
||||||
color: #fff;
|
color: #fff;
|
||||||
padding-left: 21px;
|
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
display: block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
li.file a[href *= '.pdf'] { background: url(../images/fileview/document.png) 0 0 no-repeat; }
|
li.file a span.icon
|
||||||
li.file a[href *= '.html'] { background: url(../images/fileview/document.png) 0 0 no-repeat; }
|
{
|
||||||
li.file a[href $= '.css'] { background: url(../images/fileview/document.png) 0 0 no-repeat; }
|
width: 14px;
|
||||||
li.file a[href $= '.js'] { background: url(../images/fileview/document.png) 0 0 no-repeat; }
|
height: 18px;
|
||||||
|
background: url(../images/fileview/document.png) 0 0 no-repeat;
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 7px;
|
||||||
|
vertical-align: text-top;
|
||||||
|
}
|
||||||
|
li.file a[href *= '.pdf'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
|
||||||
|
li.file a[href *= '.html'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
|
||||||
|
li.file a[href $= '.css'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
|
||||||
|
li.file a[href $= '.js'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
|
||||||
li input
|
li input
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
<ol class="tree">
|
<ol class="tree">
|
||||||
<li class="file"><a href="0">0</a></li>
|
<li class="file">
|
||||||
|
<a href="0"><span class="icon"></span>0</a>
|
||||||
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
<ol class="tree">
|
<ol class="tree">
|
||||||
<li>
|
<li>
|
||||||
<label>folder0</label> <input type="checkbox" checked />
|
<label>folder0</label>
|
||||||
<ol>
|
<input type="checkbox" />
|
||||||
<li class="file"><a href="folder0/0">0</a></li>
|
<ol>
|
||||||
</ol>
|
<li class="file">
|
||||||
</li>
|
<a href="folder0/0"><span class="icon"></span>0</a>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
<ol class="tree">
|
<ol class="tree">
|
||||||
<li>
|
<li>
|
||||||
<label>.</label> <input type="checkbox" checked />
|
<label>.</label>
|
||||||
<ol>
|
<input type="checkbox" />
|
||||||
<li class="file"><a href="folder0">folder0</a></li>
|
<ol>
|
||||||
</ol>
|
<li class="file">
|
||||||
</li>
|
<a href="folder0"><span class="icon"></span>folder0</a>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
@@ -1,12 +1,20 @@
|
|||||||
<ol class="tree">
|
<ol class="tree">
|
||||||
<li>
|
<li>
|
||||||
<label>folder0</label> <input type="checkbox" checked />
|
<label>folder0</label>
|
||||||
<ol>
|
<input type="checkbox" />
|
||||||
<li class="file"><a href="folder0/0">0</a></li>
|
<ol>
|
||||||
</ol>
|
<li class="file">
|
||||||
|
<a href="folder0/0"><span class="icon"></span>0</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
</ol>
|
||||||
<label>folder1</label> <input type="checkbox" checked />
|
</li>
|
||||||
<ol>
|
<li>
|
||||||
<li class="file"><a href="folder1/1">1</a></li>
|
<label>folder1</label>
|
||||||
|
<input type="checkbox" />
|
||||||
|
<ol>
|
||||||
|
<li class="file">
|
||||||
|
<a href="folder1/1"><span class="icon"></span>1</a>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
@@ -1,13 +1,23 @@
|
|||||||
<ol class="tree">
|
<ol class="tree">
|
||||||
<li class="file"><a href="root">root</a></li>
|
<li class="file">
|
||||||
<li>
|
<a href="root"><span class="icon"></span>root</a>
|
||||||
<label>folder0</label> <input type="checkbox" checked />
|
</li>
|
||||||
<ol>
|
<li>
|
||||||
<li class="file"><a href="folder0/0">0</a></li>
|
<label>folder0</label>
|
||||||
</ol>
|
<input type="checkbox" />
|
||||||
|
<ol>
|
||||||
|
<li class="file">
|
||||||
|
<a href="folder0/0"><span class="icon"></span>0</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
</ol>
|
||||||
<label>folder1</label> <input type="checkbox" checked />
|
</li>
|
||||||
<ol>
|
<li>
|
||||||
<li class="file"><a href="folder1/1">1</a></li>
|
<label>folder1</label>
|
||||||
|
<input type="checkbox" />
|
||||||
|
<ol>
|
||||||
|
<li class="file">
|
||||||
|
<a href="folder1/1"><span class="icon"></span>1</a>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
@@ -1,28 +1,41 @@
|
|||||||
<ol class="tree">
|
<ol class="tree">
|
||||||
|
<li>
|
||||||
|
<label>folder0</label>
|
||||||
|
<input type="checkbox" />
|
||||||
|
<ol>
|
||||||
<li>
|
<li>
|
||||||
<label>folder0</label> <input type="checkbox" checked />
|
<label>folder1</label>
|
||||||
|
<input type="checkbox" />
|
||||||
<ol>
|
<ol>
|
||||||
<li>
|
<li>
|
||||||
<label>folder1</label> <input type="checkbox" checked />
|
<label>folder2</label>
|
||||||
<ol>
|
<input type="checkbox" />
|
||||||
<li>
|
<ol>
|
||||||
<label>folder2</label> <input type="checkbox" checked />
|
<li class="file">
|
||||||
<ol>
|
<a href="folder0/folder1/folder2/0"><span class="icon"></span>0</a>
|
||||||
<li class="file"><a href="folder0/folder1/folder2/0">0</a></li>
|
</li>
|
||||||
|
</ol>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label>folder3</label>
|
||||||
|
<input type="checkbox" />
|
||||||
|
<ol>
|
||||||
|
<li class="file">
|
||||||
|
<a href="folder0/folder1/folder3/1"><span class="icon"></span>1</a>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
</ol>
|
||||||
<label>folder3</label> <input type="checkbox" checked />
|
</li>
|
||||||
<ol>
|
<li>
|
||||||
<li class="file"><a href="folder0/folder1/folder3/1">1</a></li>
|
<label>folder4</label>
|
||||||
</ol>
|
<input type="checkbox" />
|
||||||
|
<ol>
|
||||||
|
<li class="file">
|
||||||
|
<a href="folder4/2"><span class="icon"></span>2</a>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<label>folder4</label> <input type="checkbox" checked />
|
|
||||||
<ol>
|
|
||||||
<li class="file"><a href="folder4/2">2</a></li>
|
|
||||||
</ol>
|
</ol>
|
||||||
+17
-1
@@ -68,10 +68,26 @@ def write file, content
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@@format_xslt = File.expand_path(File.join(File.dirname(__FILE__), 'format.xslt'))
|
||||||
|
|
||||||
|
def to_html html
|
||||||
|
# Remove blank nodes for proper formatting
|
||||||
|
doc = Nokogiri.XML(html) do |cfg|
|
||||||
|
cfg.default_xml.noblanks
|
||||||
|
end
|
||||||
|
|
||||||
|
# Save as XHTML
|
||||||
|
doc.to_xml( { :save_with => Nokogiri::XML::Node::SaveOptions::DEFAULT_XHTML, :indent => 2, :encoding => 'UTF-8' } )
|
||||||
|
end
|
||||||
|
|
||||||
def check name, pages_array
|
def check name, pages_array
|
||||||
pages = FakePages.new pages_array
|
pages = FakePages.new pages_array
|
||||||
expected = read name
|
expected = read name
|
||||||
actual = view pages
|
actual = to_html view pages
|
||||||
|
|
||||||
|
# Uncomment when updating tests
|
||||||
|
# write name, actual
|
||||||
|
|
||||||
assert_equal expected, actual
|
assert_equal expected, actual
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user