Merge branch 'dev_newproject' of https://git.trustie.net/jacknudt/trustieforge into dev_newproject
This commit is contained in:
commit
269c061053
|
@ -44,6 +44,7 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
helper :bids
|
||||
include BidsHelper
|
||||
helper :contests
|
||||
|
@ -658,6 +659,23 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
#end
|
||||
|
||||
# 获取项目tree目录的最新提交记录
|
||||
# 异步请求
|
||||
# gpid, rev, ent_name, g
|
||||
def repository_tree_changes
|
||||
rev = params[:rev]
|
||||
ent_path = params[:ent_path]
|
||||
gpid = params[:gpid]
|
||||
g = Gitlab.client
|
||||
begin
|
||||
result = g.rep_last_changes(gpid, :rev => rev, :path => ent_path)
|
||||
# result.time = distance_of_time_in_words(result.time, Time.now)
|
||||
rescue Exception => e
|
||||
puts e
|
||||
end
|
||||
render :json => result
|
||||
end
|
||||
|
||||
def update
|
||||
@project.safe_attributes = params[:project]
|
||||
@project.organization_id = params[:organization_id]
|
||||
|
|
|
@ -37,6 +37,11 @@ module ApplicationHelper
|
|||
# super
|
||||
# end
|
||||
|
||||
# 超出1w后用k+形式显示
|
||||
def switch_integer_into_k number
|
||||
number > 10000 ? (number / 1000).to_s + "k+" : number
|
||||
end
|
||||
|
||||
# 隐藏项目以外的信息
|
||||
# return: true 显示,false 不显示
|
||||
def hidden_unproject_infos
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<li id="project_menu_01">
|
||||
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "pro_new_proname" %>
|
||||
<% if project_acts > 0 %>
|
||||
<span class="issues_nav_tag ml5"><%= project_acts %></span>
|
||||
<span class="issues_nav_tag ml5"><%= switch_integer_into_k(project_acts) %></span>
|
||||
<% end %>
|
||||
</li>
|
||||
<!--问题跟踪-->
|
||||
|
@ -33,7 +33,7 @@
|
|||
<li id="project_menu_02">
|
||||
<%= link_to l(:label_issue_tracking), project_issues_path(@project, :remote => true), :class => "pro_new_proname" %>
|
||||
<% if project_issue_count > 0 %>
|
||||
<span class="issues_nav_tag ml5"><%= project_issue_count %></span>
|
||||
<span class="issues_nav_tag ml5"><%= switch_integer_into_k project_issue_count %></span>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
@ -42,7 +42,7 @@
|
|||
<li id="project_menu_03">
|
||||
<%= link_to l(:project_module_boards), project_boards_path(@project), :class => "pro_new_proname" %>
|
||||
<% unless project_score.board_num == 0 %>
|
||||
<span class="issues_nav_tag ml5"><%= project_score.board_num %></span>
|
||||
<span class="issues_nav_tag ml5"><%= switch_integer_into_k project_score.board_num %></span>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
@ -51,7 +51,7 @@
|
|||
<li id="project_menu_04">
|
||||
<%= link_to l(:project_module_files), project_files_path(@project), :class => "pro_new_proname" %>
|
||||
<% unless project_file_num == 0 %>
|
||||
<span class="issues_nav_tag ml5"><%= project_file_num %></span>
|
||||
<span class="issues_nav_tag ml5"><%= switch_integer_into_k project_file_num %></span>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
@ -59,19 +59,19 @@
|
|||
<% if visible_repository?(@project) %>
|
||||
<li id="project_menu_05"><%= link_to l(:project_module_repository),({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).try(:identifier)}), :class => "pro_new_proname" %>
|
||||
<% unless @project.project_score.changeset_num == 0 %>
|
||||
<span class="issues_nav_tag ml5"><%= project_score.changeset_num %></span>
|
||||
<span class="issues_nav_tag ml5"><%= switch_integer_into_k project_score.changeset_num %></span>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
<!--Pull Request-->
|
||||
<li id="project_menu_06">
|
||||
<%= link_to "Pull Requests", project_pull_requests_path(@project), :class => "pro_new_proname" %>
|
||||
<span class="issues_nav_tag ml5"><%= project_score.pull_request_num %></span>
|
||||
<span class="issues_nav_tag ml5"><%= switch_integer_into_k project_score.pull_request_num %></span>
|
||||
</li>
|
||||
<!--里程碑-->
|
||||
<li id="project_menu_07">
|
||||
<%= link_to l(:label_roadmap) ,project_roadmap_path(@project), :class => "pro_new_proname" %>
|
||||
<span class="issues_nav_tag ml5">25</span>
|
||||
<span class="issues_nav_tag ml5"><%= switch_integer_into_k @project.versions.count %></span>
|
||||
</li>
|
||||
<!--日历-->
|
||||
<% unless @project.enabled_modules.where("name = 'calendar'").empty? %>
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<% project = Project.find(activity.project_id) %>
|
||||
<% user = User.find(project.user_id)%>
|
||||
<div class="resources mt10">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="container-big mt10">
|
||||
<div class="pr">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_path(user), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTo break_word" style="width:620px">
|
||||
<div class="content-big">
|
||||
<div class="homepagePostTo break_word">
|
||||
<%= link_to user.show_name, user_path(user), :class => "newsBlue mr15" %>
|
||||
TO
|
||||
<%= link_to project.to_s+" | 项目", project_path(project.id,:host=>Setting.host_course), :class => "newsBlue ml15" %>
|
||||
|
|
|
@ -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,
|
||||
|
||||
:depth => (depth + 1),
|
||||
:parent_id => tr_id)) %>');"> </span>
|
||||
<% end %>
|
||||
|
@ -26,21 +26,42 @@
|
|||
</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 %>">
|
||||
<%#= (latest_changes.message) if latest_changes %>
|
||||
</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 %>">
|
||||
<%#= (latest_changes.author_name) if latest_changes %>
|
||||
</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 %>
|
||||
<%#= distance_of_time_in_words(latest_changes.time, Time.now) if latest_changes %>
|
||||
<%#= link_to "", repository_tree_changes_project_path(@project, :rev => @rev, :ent_name => ent_name) %>
|
||||
</div>
|
||||
</td>
|
||||
</div>
|
||||
</tr>
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
console.log("2222222222");
|
||||
$.ajax({
|
||||
url:"<%= repository_tree_changes_project_path(@project, :rev => @rev, :ent_path => ent_path, :gpid => @project.gpid) %>",
|
||||
type: "GET",
|
||||
data: "text",
|
||||
success:function(data){
|
||||
console.log(data);
|
||||
$('#changes_message_<%=tr_id %>').html(data.message)
|
||||
$('#changes_author_<%=tr_id %>').html(data.author_name)
|
||||
$('#changes_time_<%=tr_id %>').html(data.time)
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
<%= call_hook(:view_repositories_show_contextual, { :repository => @repository, :project => @project }) %>
|
||||
<div style="padding-left: 8px; padding-top: 10px;">
|
||||
<div class="contextual">
|
||||
<%= render :partial => 'navigation' %>
|
||||
</div>
|
||||
|
||||
<h3><%= l(:label_revision_path) %> :<%= @path %></h3>
|
||||
|
||||
<%= render :partial => 'link_to_functions' %>
|
||||
|
||||
<%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= stylesheet_link_tag "scm" %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= call_hook(:view_repositories_show_contextual, { :repository => @repository, :project => @project }) %>
|
||||
<div class="wrap-big">
|
||||
<div style="padding-left: 8px;">
|
||||
<div class="contextual">
|
||||
<%= render :partial => 'navigation' %>
|
||||
</div>
|
||||
|
||||
<h3><%= l(:label_revision_path) %> :<%= @path %></h3>
|
||||
|
||||
<%= render :partial => 'link_to_functions' %>
|
||||
|
||||
<%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= stylesheet_link_tag "scm" %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -752,6 +752,7 @@ RedmineApp::Application.routes.draw do
|
|||
match 'store_mine', :to => 'projects#store_mine', :as => 'store_mine'
|
||||
get 'file', :action => 'file', :as => 'file'
|
||||
get 'statistics', :action => 'statistics', :as => 'statistics'
|
||||
get 'repository_tree_changes', :action => 'repository_tree_changes', :as => 'repository_tree_changes'
|
||||
|
||||
get 'feedback', :action => 'feedback', :as => 'project_feedback'
|
||||
get 'watcherlist', :action=> 'watcherlist'
|
||||
|
|
Loading…
Reference in New Issue