版本库界面优化(未完)

This commit is contained in:
huang 2016-10-12 10:45:14 +08:00
parent a206a471af
commit 57d1397597
4 changed files with 54 additions and 14 deletions

View File

@ -420,6 +420,11 @@ update
alias_method :browse, :show
# 获取版本文件目录的
def tree_head_message
end
def changes
@entry = @repository.entry(@path, @rev)
(show_error_not_found; return) unless @entry

View File

@ -1,8 +1,14 @@
<div class="autoscroll">
<table class="list entries" id="browser" style="table-layout: fixed;">
<tbody>
<%= render :partial => 'dir_list_content' %>
</tbody>
</table>
<table class="list entries" id="browser" style="table-layout: fixed;">
<tbody>
<%= render :partial => 'dir_list_content' %>
</tbody>
</table>
</div>
<script>
// Load last commit log for each file in tree
$('#tree-slider').waitForImages(function() {
ajaxGet('#{@logs_path}');
});
</script>

View File

@ -4,7 +4,7 @@
<% 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) %>
<%# latest_changes = get_trees_last_changes(@project.gpid, @rev, ent_path, @g) %>
<tr id="<%= tr_id %>" class="<%= h params[:parent_id] %> entry <%= entry.kind %>">
<td style="padding-left: <%=18 * depth%>px;" class="filename_no_report hidden">
@ -16,7 +16,7 @@
:repository_id => @repository.identifier_param,
:path => to_path_param(ent_path),
:rev => @rev,
:latest_changes => latest_changes,
# :latest_changes => latest_changes,
:depth => (depth + 1),
:parent_id => tr_id)) %>');">&nbsp;</span>
<% end %>
@ -26,21 +26,49 @@
</td>
<div id="children_tree">
<td class="tree-comments c_grey hidden">
<div class="hidden" title="<%= (latest_changes.message) if latest_changes %>">
<%= (latest_changes.message) if latest_changes %>
<div class="hidden" id="changes_message_<%= tr_id %>">
</div>
</td>
<td class="tree-author c_grey">
<div class="hidden" title="<%= (latest_changes.author_name) if latest_changes %>">
<%= (latest_changes.author_name) if latest_changes %>
<div class="hidden" id="changes_author_<%= tr_id %>">
</div>
</td>
<td class="tree-age c_grey">
<div class="hidden" title="<%= format_time(latest_changes.time) if latest_changes %>">
<div class="hidden" id="changes_time_<%= tr_id %>">
<%# 为了转换UTC时间时差8小时 %>
<%= distance_of_time_in_words(latest_changes.time, Time.now) if latest_changes %>
<%= link_to tree_head_message_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch) %>
</div>
</td>
</div>
</tr>
<!--&lt;!&ndash;<script>&ndash;&gt;-->
<!--// $("#changes_message_<%#=tr_id %>").html("999")-->
<!--// $("#changes_author_<%#=tr_id %>").html("<%#= get_trees_last_changes(@project.gpid, @rev, ent_path, @g).author_name %>")-->
<!--// $("#changes_time_<%#=tr_id %>").html("<%#= distance_of_time_in_words(get_trees_last_changes(@project.gpid, @rev, ent_path, @g).time, Time.now) %>")-->
<!--&lt;!&ndash;</script>&ndash;&gt;-->
<script>
$(document).ready(function(){
$.ajax({
type:"GET",
url:"Venue.aspx?act=init",
dataType:"html",
success:function(result){ //function1()
f1();
f2();
}
failure:function (result) {
alert('Failed');
}
}
alert("test");
alert(<%#= get_trees_last_changes(@project.gpid, @rev, ent_path, @g).author_name %>);
document.getElementById('changes_author_<%=tr_id %>').html(<%= get_trees_last_changes(@project.gpid, @rev, ent_path, @g).author_name %>);
});
</script>
<% end %>

View File

@ -986,6 +986,7 @@ RedmineApp::Application.routes.draw do
get 'projects/:id/repository/changes(/*path(.:ext))', :to => 'repositories#changes'
get 'projects/:id/repository/forked', :to => 'repositories#forked'
get 'projects/:id/repository/tree_head_message', :to => 'repositories#tree_head_message', :as => "tree_head_message"
get 'projects/:id/repository/export_rep_static', :to => 'repositories#export_rep_static'
get 'projects/:id/repository/project_archive', :to => 'repositories#project_archive', :as => 'project_archive'
get 'projects/:id/repository/revisions', :to => 'repositories#revisions'