rosa-build/app/views/git/blobs/_show.html.haml

57 lines
1.7 KiB
Plaintext

%h3= t("layout.projects.files_in_project")
.files
.l
= render :partial => 'git/shared/whereami'
.both
- render_way = choose_render_way(@blob)
.file
.top
.l
= @blob.mode + ' | '
- if (render_way == :text)
- text = @blob.data.split("\n")
= "#{text.length} lines (#{text.select{|s| s.strip.length > 0}.length} sloc) | "
= "#{(@blob.size / 1024.0).round(3)} Kb"
.r
- if render_way == :text and can? :write, @project and @treeish.in? @project.branches.map(&:name)
= raw "#{link_to "Edit", edit_blob_path(@project, @treeish, @path) } | "
= raw "#{link_to "Raw", raw_path(@project, @treeish, @path)} | "
=# raw "#{link_to "Blame", blame_path(@project, @treeish, @path)} | "
= link_to "History", commits_path(@project, @treeish, @path)
.both
.data
- case render_way
- when :image
%table.table.blob
%tr
%td.lines
%td.blob
:plain
<br/>
<center> <img src='?raw=true'/></center>
<br/>
- when :text
.gutter
= render_line_numbers(text.length)
#output.formatted
%pre#code
=#{render_blob(@blob)}
:preserve
#{h(@blob.data.encode_to_default).html_safe}
.both
- when :binary
%table.table.blob
%tr
%td.lines
%td.blob
:plain
<br/>
<pre>#{ link_to @blob.basename.encode_to_default, raw_path(@project, @treeish, @path) }</pre>
<br/>
:javascript
$(document).ready(function() {
var text = $('#code').innerHTML.replace(/&amp;/gi, '&');
CodeMirror.runMode(text, "#{@blob.mime_type}", document.getElementById("output"));
});