版本库文件局部刷新
This commit is contained in:
parent
f086f5acd3
commit
5992bcc128
|
@ -14,8 +14,12 @@ class GamesController < ApplicationController
|
|||
def show
|
||||
@git_url = git_repository_url(@myshixun, "Myshixun")
|
||||
@entries = @repository.entries(@path, @rev)
|
||||
if request.xhr?
|
||||
@entries ? render(:partial => 'dir_list_content') : render(:nothing => true)
|
||||
# if request.xhr?
|
||||
# @entries ? render(:partial => 'tree') : render(:nothing => true)
|
||||
# end
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -23,12 +27,8 @@ class GamesController < ApplicationController
|
|||
def entry
|
||||
entry_and_raw(false)
|
||||
@content = @repository.cat(@path, @rev)
|
||||
# @changesets_latest_coimmit = @g.commit(@project.gpid, @entry.try(:lastrev))
|
||||
@changesets_latest_coimmit = @g.rep_last_changes(@project.gpid, :rev => @rev, :path => @path)
|
||||
# 总的提交数
|
||||
@changesets_all_count = @g.user_static(@project.gpid, :rev => @rev).count
|
||||
if is_entry_text_data?(@content, @path)
|
||||
render :layout => 'base_projects'
|
||||
render :layout => 'base_myshixun'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -77,6 +77,17 @@ class GamesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def is_entry_text_data?(ent, path)
|
||||
# UTF-16 contains "\x00".
|
||||
# It is very strict that file contains less than 30% of ascii symbols
|
||||
# in non Western Europe.
|
||||
return true if Redmine::MimeType.is_type?('text', path)
|
||||
# Ruby 1.8.6 has a bug of integer divisions.
|
||||
# http://apidock.com/ruby/v1_8_6_287/String/is_binary_data%3F
|
||||
return false if ent.is_binary_data?
|
||||
true
|
||||
end
|
||||
|
||||
def find_repository
|
||||
@repository = @myshixun.repository
|
||||
render_404 if @myshixun.gpid.nil?
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<% unless @path.blank? %>
|
||||
<%= link_to "#{@repository.identifier.present? ? h(@repository.identifier) : 'root'}", ({:controller => 'repositories', :action => 'myshixun_show', :id => @shixun,
|
||||
:repository_id => @repository.try(:identifier)}), :class => "c_blue f14 fb" %>
|
||||
<!--<a href="#">testrepo</a> / <a href="#">lib</a> / <a href="#">plugins</a> / <a href="#">acts_as_searchable</a> / <span class="color-light-green">init.rb</span>-->
|
||||
<% if @path.blank? %>
|
||||
<%= @repository.identifier %>
|
||||
<% else %>
|
||||
<%= link_to "#{@repository.identifier.present? ? h(@repository.identifier) : 'root'}", myshixun_game_path(@game, :myshixun_id => @myshixun) %>
|
||||
<%
|
||||
dirs = path.split('/')
|
||||
if 'file' == kind
|
||||
|
@ -12,8 +14,8 @@
|
|||
link_path << '/' unless link_path.empty?
|
||||
link_path << "#{dir}"
|
||||
%>
|
||||
<span class="c_grey">/</span> <%= link_to h(dir), {:action => 'myshixun_show', :id => @shixun, :repository_id => @repository.identifier_param,
|
||||
:path => to_path_param(link_path), :rev => @rev}, :class => "f14 fb" %>
|
||||
<span class="c_grey">/</span> <%= link_to h(dir), {:action => 'show', :id => @game, :myshixun_id => @myshixun, :path => to_path_param(link_path), :rev => @rev},
|
||||
:remote => true, :class => "f14 fb" %>
|
||||
<% end %>
|
||||
<% if filename %>
|
||||
<span class="c_grey">/</span> <%#= link_to h(filename),
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
<div class="autoscroll">
|
||||
<table class="list entries mt5" id="browser" style="table-layout: fixed;">
|
||||
<% unless @path.blank? %>
|
||||
<tbody>
|
||||
<tr style="border: 1px solid #DDD; border-bottom:none;">
|
||||
<td colspan="4">
|
||||
<a href="javascript:history.go(-1)" class="fl linkBlue2 mt3" >
|
||||
<span class="new_roadmap_icons_back mr5"></span>
|
||||
<span></span>返回上级目录
|
||||
<%= render :partial => 'myshixun_breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<% end %>
|
||||
<tbody style="line-height: 1.9;">
|
||||
<% @entries.each do |entry| %>
|
||||
<% tr_id = Digest::MD5.hexdigest(entry.path)
|
||||
depth = params[:depth].to_i %>
|
||||
<% sub_path = entry.path[0] == "/" ? entry.path.sub("/", "") : entry.path %>
|
||||
<% ent_path = Redmine::CodesetUtil.replace_invalid_utf8(sub_path) %>
|
||||
<% ent_name = Redmine::CodesetUtil.replace_invalid_utf8(entry.name) %>
|
||||
|
||||
<tr id="<%= tr_id %>" class="<%= h params[:parent_id] %> entry <%= entry.kind %>">
|
||||
<td style="padding-left: <%=18 * depth%>px;" class="filename_no_report hidden">
|
||||
<% if entry.is_dir? %>
|
||||
<%# 展开文件目录 %>
|
||||
<span class="expander" onclick="scmEntryClick('<%= tr_id %>', '<%= escape_javascript(url_for(
|
||||
:action => 'show',
|
||||
:id => @myshixun,
|
||||
:repository_id => @repository.identifier_param,
|
||||
:path => to_path_param(ent_path),
|
||||
:rev => @rev,
|
||||
:depth => (depth + 1),
|
||||
:parent_id => tr_id)) %>');"> </span>
|
||||
<% end %>
|
||||
<%= link_to h(ent_name),
|
||||
{:action => (entry.is_dir? ? 'show' : 'entry'), :id => @game, :myshixun_id => @myshixun, :path => to_path_param(ent_path), :rev => @rev},
|
||||
:class => (entry.is_dir? ? 'old-icon old-icon-folder' : "old-icon old-icon-file #{Redmine::MimeType.css_class_of(ent_name)}")%>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Load last commit log for each file in tree
|
||||
$('#tree-slider').waitForImages(function() {
|
||||
ajaxGet('#{@logs_path}');
|
||||
});
|
||||
</script>
|
|
@ -1,10 +1,26 @@
|
|||
<div class="wrap-big">
|
||||
<div class="repository_con" style="line-height:1.9;">
|
||||
<% if !@entries.blank? && authorize_for('repositories', 'browse') %>
|
||||
<%= render :partial => 'myshixun_dir_list' %>
|
||||
<div class="content-editor col-width-5 fl ">
|
||||
<div class="panel-header clearfix">
|
||||
|
||||
<h3 class="fl">
|
||||
<%= render :partial => 'myshixun_breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %>
|
||||
</h3>
|
||||
<div class="fr mt5 ">
|
||||
<% if params[:action] == "entry" %>
|
||||
<a href="#"><i class="fa fa-edit font-18 fl color-grey mr10"></i></a>
|
||||
<% end %>
|
||||
<a href="#"><i class="fa fa-check-circle font-18 fl color-grey"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content-editor-inner">
|
||||
<% if params[:action] == "entry" %>
|
||||
<%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %>
|
||||
<% else %>
|
||||
<%= render :partial => "projects/no_data" %>
|
||||
<% if !@entries.blank? %>
|
||||
<%= render :partial => 'tree' %>
|
||||
<% else %>
|
||||
<%= render :partial => "projects/no_data" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -1,31 +1,40 @@
|
|||
<% @entries.each do |entry| %>
|
||||
<% tr_id = Digest::MD5.hexdigest(entry.path)
|
||||
depth = params[:depth].to_i %>
|
||||
<% sub_path = entry.path[0] == "/" ? entry.path.sub("/", "") : entry.path %>
|
||||
<% ent_path = Redmine::CodesetUtil.replace_invalid_utf8(sub_path) %>
|
||||
<% ent_name = Redmine::CodesetUtil.replace_invalid_utf8(entry.name) %>
|
||||
<%# latest_changes = get_trees_last_changes(@project.gpid, @rev, ent_path, @g) %>
|
||||
<div class="autoscroll">
|
||||
<table class="list entries mt5" id="browser" style="table-layout: fixed;">
|
||||
<tbody style="line-height: 1.9;">
|
||||
<% @entries.each do |entry| %>
|
||||
<% tr_id = Digest::MD5.hexdigest(entry.path)
|
||||
depth = params[:depth].to_i %>
|
||||
<% sub_path = entry.path[0] == "/" ? entry.path.sub("/", "") : entry.path %>
|
||||
<% ent_path = Redmine::CodesetUtil.replace_invalid_utf8(sub_path) %>
|
||||
<% ent_name = Redmine::CodesetUtil.replace_invalid_utf8(entry.name) %>
|
||||
|
||||
<tr id="<%= tr_id %>" class="<%= h params[:parent_id] %> entry <%= entry.kind %>">
|
||||
<td style="padding-left: <%=18 * depth%>px;" class="filename_no_report hidden">
|
||||
<% if entry.is_dir? %>
|
||||
<%# 展开文件目录 %>
|
||||
<span class="expander" onclick="scmEntryClick('<%= tr_id %>', '<%= escape_javascript(url_for(
|
||||
<tr id="<%= tr_id %>" class="<%= h params[:parent_id] %> entry <%= entry.kind %>">
|
||||
<td style="padding-left: <%=18 * depth%>px;" class="filename_no_report hidden">
|
||||
<% if entry.is_dir? %>
|
||||
<%# 展开文件目录 %>
|
||||
<span class="expander" onclick="scmEntryClick('<%= tr_id %>', '<%= escape_javascript(url_for(
|
||||
:action => 'show',
|
||||
:id => @project,
|
||||
:id => @myshixun,
|
||||
:repository_id => @repository.identifier_param,
|
||||
:path => to_path_param(ent_path),
|
||||
:rev => @rev,
|
||||
|
||||
:depth => (depth + 1),
|
||||
:parent_id => tr_id)) %>');"> </span>
|
||||
<% end %>
|
||||
<%= link_to h(ent_name),
|
||||
{:action => (entry.is_dir? ? 'show' : 'entry'), :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(ent_path), :rev => @rev},
|
||||
:class => (entry.is_dir? ? 'old-icon old-icon-folder' : "old-icon old-icon-file #{Redmine::MimeType.css_class_of(ent_name)}")%>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
|
||||
<% end %>
|
||||
<%= link_to h(ent_name),
|
||||
{:action => (entry.is_dir? ? 'show' : 'entry'), :id => @game, :myshixun_id => @myshixun, :path => to_path_param(ent_path), :rev => @rev},
|
||||
:remote => true,
|
||||
:class => (entry.is_dir? ? 'old-icon old-icon-folder' : "old-icon old-icon-file #{Redmine::MimeType.css_class_of(ent_name)}")%>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Load last commit log for each file in tree
|
||||
$('#tree-slider').waitForImages(function() {
|
||||
ajaxGet('#{@logs_path}');
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -6,9 +6,7 @@
|
|||
<%= render :partial => 'myshixun_breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<%= render :partial => 'latest_commit' %>
|
||||
<%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= stylesheet_link_tag "scm" %>
|
||||
<% end %>
|
||||
|
|
|
@ -80,18 +80,9 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content-editor col-width-5 fl ">
|
||||
<div class="panel-header clearfix">
|
||||
<h3 class="fl">testrepo</h3>
|
||||
<div class="fr mt5">
|
||||
<a href="#"><i class="fa fa-minus font-14 mr10 fl color-grey"></i></a>
|
||||
<a href="#"><i class="fa fa-arrows font-14 fl color-grey"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content-editor-inner">
|
||||
</div>
|
||||
<div id="code_content">
|
||||
<%= render :partial => 'repository' %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class=" col-width-5 fl content-history mt15" >
|
||||
<div class="panel-header clearfix">
|
||||
<h3 class="fl">测评历史</h3>
|
||||
|
@ -134,25 +125,15 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<%= link_to "提交评测", {:controller => 'games', :action => "game_build", :id => @game, :myshixun_id => @myshixun}, :class => "task-display-span bBlue mt10", :onclick => "training_task_submmit();", :remote => true %>
|
||||
tpi
|
||||
</br>
|
||||
<% outputs = GameOutputs.where(:game_id => @game) %>
|
||||
|
||||
<% unless outputs .nil?%>
|
||||
<% outputs.each do |output| %>
|
||||
code: <%= output.code %></br>
|
||||
mes: <%= output.msg %></br>
|
||||
output : <%= output.out_put %></br>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
||||
<%= link_to "下一关" %>
|
||||
<%= render :partial => "repository" %>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
//课程大纲tab
|
||||
function g(o){return document.getElementById(o);}
|
||||
function HoverLi(n){
|
||||
for(var i=1;i<=3;i++){
|
||||
g('tab_nav_'+i).className='tab_nomal';
|
||||
g('tab_con_'+i).className='undis';
|
||||
}
|
||||
g('tab_con_'+n).className='dis';
|
||||
g('tab_nav_'+n).className='tab_hover';
|
||||
}
|
||||
</script>
|
|
@ -45,6 +45,10 @@
|
|||
<%= yield %>
|
||||
</div>
|
||||
</div>
|
||||
<div id="ajax-indicator" style="display:none;">
|
||||
<span><%= l(:label_loading) %></span>
|
||||
</div>
|
||||
<div id="ajax-modal" style="display:none;"></div>
|
||||
</body>
|
||||
<!-- MathJax的配置 -->
|
||||
<script type="text/javascript" src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
|
||||
|
|
|
@ -256,8 +256,10 @@ module Redmine
|
|||
end
|
||||
if @project
|
||||
file = @g.files(@project, path, identifier)
|
||||
else
|
||||
elsif @shixun
|
||||
file = @g.files(@shixun, path, identifier)
|
||||
elsif @myshixun
|
||||
file = @g.files(@myshixun, path, identifier)
|
||||
end
|
||||
cat = Base64.decode64 file.content
|
||||
rescue ScmCommandAborted
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 37 KiB |
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
Binary file not shown.
After Width: | Height: | Size: 77 KiB |
Loading…
Reference in New Issue