Merge branch 'rep_quality' of https://git.trustie.net/jacknudt/trustieforge into rep_quality

dev_blankdatabase
cxt 9 years ago
commit f4e965c9fb

@ -77,16 +77,18 @@ class FilesController < ApplicationController
if params[:insite] if params[:insite]
if q == "%%" if q == "%%"
@result = [] @result = []
@searched_attach = paginateHelper @result,10 # @searched_attach = paginateHelper @result,10
else else
@result = find_public_attache q,sort @result = find_public_attache q,sort
@result = visable_attachemnts_insite @result,@course @result = visable_attachemnts_insite @result,@course
@searched_attach = paginateHelper @result,10 # @searched_attach = paginateHelper @result,10
end end
else else
@result = find_course_attache q,@course,sort @result = find_course_attache q,@course,sort
@result = visable_attachemnts @result @result = visable_attachemnts @result
# @searched_attach = paginateHelper @result,10
@tag_list = get_course_tag_list @course
end
@all_attachments = @result @all_attachments = @result
@limit = 10 @limit = 10
@feedback_count = @all_attachments.count @feedback_count = @all_attachments.count
@ -94,11 +96,6 @@ class FilesController < ApplicationController
@offset ||= @feedback_pages.offset @offset ||= @feedback_pages.offset
#@curse_attachments_all = @all_attachments[@offset, @limit] #@curse_attachments_all = @all_attachments[@offset, @limit]
@obj_attachments = paginateHelper @all_attachments,10 @obj_attachments = paginateHelper @all_attachments,10
# @searched_attach = paginateHelper @result,10
@tag_list = get_course_tag_list @course
end
#rescue Exception => e #rescue Exception => e
# #render 'stores' # #render 'stores'
# redirect_to search_course_files_url # redirect_to search_course_files_url
@ -153,18 +150,26 @@ class FilesController < ApplicationController
if params[:insite] if params[:insite]
if q == "%%" if q == "%%"
@project_attachment_result = [] @project_attachment_result = []
@searched_attach = paginateHelper @project_attachment_result, 10 # @searched_attach = paginateHelper @project_attachment_result, 10
else else
@project_attachment_result = find_public_attache q,sort @project_attachment_result = find_public_attache q,sort
@project_attachment_result = visable_attachemnts_insite @project_attachment_result, @project @project_attachment_result = visable_attachemnts_insite @project_attachment_result, @project
@searched_attach = paginateHelper @project_attachment_result, 10 # @searched_attach = paginateHelper @project_attachment_result, 10
end end
else else
@project_attachment_result = find_project_attache q, @project,sort @project_attachment_result = find_project_attache q, @project,sort
@project_attachment_result = visable_attachemnts @project_attachment_result @project_attachment_result = visable_attachemnts @project_attachment_result
@searched_attach = paginateHelper @project_attachment_result,10 # @searched_attach = paginateHelper @project_attachment_result,10
@tag_list = get_project_tag_list @project @tag_list = get_project_tag_list @project
end end
@all_attachments = @project_attachment_result
@limit = 10
@feedback_count = @all_attachments.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset
#@curse_attachments_all = @all_attachments[@offset, @limit]
@obj_attachments = paginateHelper @all_attachments,10
#rescue Exception => e #rescue Exception => e
# #render 'stores' # #render 'stores'
# redirect_to search_course_files_url # redirect_to search_course_files_url

@ -47,9 +47,9 @@ module RepositoriesHelper
end end
# 获取文件目录的最新动态 # 获取文件目录的最新动态
def get_trees_last_changes(project_id, rev, ent_name, g) def get_trees_last_changes(gpid, rev, ent_name, g)
begin begin
tree_changes = g.rep_last_changes(project_id, :rev => rev, :path => ent_name) tree_changes = g.rep_last_changes(gpid, :rev => rev, :path => ent_name)
rescue Exception => e rescue Exception => e
puts e puts e
end end

@ -66,17 +66,10 @@
<% end %> <% end %>
<% end %> <% end %>
<% if project_attachments.count == 10%> <ul class="wlist">
<% if params[:action] == 'search_project' %> <%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true%>
<!--<ul class="wlist">--> </ul>
<!--<%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>-->
<!--</ul>-->
<%=link_to "点击展开更多", search_project_project_files_path({:project_id => project.id, :page => @obj_pages.nil? ? @feedback_pages.page + 1 : @obj_pages.page + 1}.merge(params)),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
<%else%>
<!-- 全站搜索的时候 返回的页码对象是obj_pages,而站内搜索返回的页码对象是feedback_pages -->
<%=link_to "点击展开更多", project_files_path(:project_id => project.id,:page => @page),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
<%end%>
<% end%>

@ -1,8 +1,9 @@
<% if @course %> <% if @course %>
$("#resource_list").html("<%= escape_javascript( render :partial => 'files/course_file',:locals => {course:@course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} )%>"); $("#resource_list").html("<%= escape_javascript( render :partial => 'files/course_file',:locals => {course:@course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments}) %>");
$("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>'); $("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>');
<% elsif @project %> <% elsif @project %>
$("#show_more_attachments").replaceWith("<%= escape_javascript( render :partial => 'files/project_list', :locals => {project:@project, all_attachments:@all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments})%>"); $("#resource_list").html("<%= escape_javascript( render :partial => 'files/project_file',:locals => {project:@project, all_attachments:@all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments}) %>");
$("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>');
<% elsif @org_subfield %> <% elsif @org_subfield %>
$("#show_more_attachments").replaceWith("<%= escape_javascript( render :partial => 'files/org_subfield_list', :locals => {org_subfield:@org_subfield, all_attachments:@all_attachments, sort:@sort, order:@order, org_subfield_attachments:@obj_attachments})%>"); $("#show_more_attachments").replaceWith("<%= escape_javascript( render :partial => 'files/org_subfield_list', :locals => {org_subfield:@org_subfield, all_attachments:@all_attachments, sort:@sort, order:@order, org_subfield_attachments:@obj_attachments})%>");
<%end %> <%end %>

@ -1,7 +1,2 @@
<% if (@obj_pages &&( @obj_pages.page > 1)) || (@feedback_pages && (@feedback_pages.page > 1)) %> //搜索的时候有时候是需要加载下一页,有时候是直接替换当前 #course_list。这个根据 page来判定 $("#resource_list").html("<%= escape_javascript( render :partial => 'files/project_file',:locals => {project:@project, all_attachments:@all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments}) %>");
$("#show_more_attachments").replaceWith("<%= escape_javascript( render :partial => 'files/project_list', $("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>');
:locals => {project: @project, all_attachments:@result, sort:@sort, order:@order, project_attachments:@searched_attach})%>");
<% else %>
$("#course_list").html("<%= escape_javascript(render :partial => 'files/project_list',:locals => {project:@project, all_attachments:@result, sort:@sort, order:@order,project_attachments:@searched_attach})%>");
$("#attachment_count").html("<%= @project_attachment_result.count %>")
<% end %>

@ -2,6 +2,6 @@
$("#resource_list").html("<%= escape_javascript( render :partial => 'files/course_file',:locals => {course:@course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} )%>"); $("#resource_list").html("<%= escape_javascript( render :partial => 'files/course_file',:locals => {course:@course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} )%>");
$("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>'); $("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>');
<% else %> <% else %>
$("#course_list").html("<%= escape_javascript(render :partial => 'project_list',:locals => {project:@project, all_attachments:@result_search_project, sort:@sort, order:@order, project_attachments:@searched_attach}) %>"); $("#resource_list").html("<%= escape_javascript( render :partial => 'files/project_file',:locals => {project:@project, all_attachments:@all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments}) %>");
$("#attachment_count").html("<%= @result_search_project.count%>") $("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>');
<% end %> <% end %>

@ -26,19 +26,19 @@
</td> </td>
<div id="children_tree"> <div id="children_tree">
<td class="tree-comments c_grey hidden"> <td class="tree-comments c_grey hidden">
<div class="hidden" title="<%= (latest_changes.message) if latest_changes && latest_changes.message %>"> <div class="hidden" title="<%= (latest_changes.message) if latest_changes %>">
<%= (latest_changes.message) if latest_changes && latest_changes.message %> <%= (latest_changes.message) if latest_changes %>
</div> </div>
</td> </td>
<td class="tree-author c_grey"> <td class="tree-author c_grey">
<div class="hidden" title="<%= (latest_changes.author) if latest_changes && latest_changes.author %>"> <div class="hidden" title="<%= (latest_changes.author_name) if latest_changes %>">
<%= (latest_changes.author) if latest_changes && latest_changes.author %> <%= (latest_changes.author_name) if latest_changes %>
</div> </div>
</td> </td>
<td class="tree-age c_grey"> <td class="tree-age c_grey">
<div class="hidden" title="<%= format_time(latest_changes.time) %>"> <div class="hidden" title="<%= format_time(latest_changes.time) if latest_changes %>">
<%# 为了转换UTC时间时差8小时 %> <%# 为了转换UTC时间时差8小时 %>
<%= distance_of_time_in_words(latest_changes.time, Time.now + 8.hours) if latest_changes && latest_changes.time %> <%= distance_of_time_in_words(latest_changes.time, Time.now) if latest_changes %>
</div> </div>
</td> </td>
</div> </div>

@ -160,9 +160,9 @@ div.thumbnails div {background:#fff;display:inline-block;margin-right:2px;}
.repos_files ul:hover{ background:#ffffdd;} .repos_files ul:hover{ background:#ffffdd;}
.repos_t_c li{ text-align:center;} .repos_t_c li{ text-align:center;}
.pic_stats{display:block; background:url(/images/public_icon.png) 0px -548px no-repeat; width:20px; height:15px;} .pic_stats{display:block; background:url(/images/public_icon.png) 0px -548px no-repeat; width:20px; height:15px;}
.tree-age{width:10%; text-align:right;} .tree-age{width:15%; text-align:right;}
.tree-author{width:10%; text-align:left;} .tree-author{width:10%; text-align:left;}
.tree-comments{width:40%; text-align:left;} .tree-comments{width:35%; text-align:left;}
/* 里程碑 */ /* 里程碑 */
.roadmap_box{ background:#f8f8f8; width:648px; padding:10px; margin-top:5px; border:1px solid #ddd; color:#555;} .roadmap_box{ background:#f8f8f8; width:648px; padding:10px; margin-top:5px; border:1px solid #ddd; color:#555;}

Loading…
Cancel
Save