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

This commit is contained in:
daiao 2016-10-25 15:38:01 +08:00
commit c6bc304c04
25 changed files with 95 additions and 73 deletions

View File

@ -73,29 +73,20 @@ class BoardsController < ApplicationController
def show
# 顶部导航
@project_menu_type = 3
# 讨论区消息状态更新(已读和未读)
@order, @b_sort,@type = params[:order] || 1, params[:sort] || 1, params[:type] || 1
@order, @b_sort,@type = params[:order] || 1, params[:sort] || 1, params[:type] || 1
#确定 sort_type 1升序 2 降序
if @order.to_i == @type.to_i
@b_sort = @b_sort.to_i == 1 ? 2 : 1
else
@b_sort = 2
end
sort_name = "updated_on"
sort_type = @b_sort == 1 ? "asc" : "desc"
# 讨论区消息状态更新(已读和未读)
if @project
ForgeMessage.where("user_id =? and project_id =? and viewed =?", User.current.id, @project.id, 0).update_all(:viewed => true)
# 更新@消息为已读
# 注释掉这句是因为和上面的方法代码重复,一个类型的消息,已经更新就不需要再更新
# @project.boards.each do |board|
# board.messages.each do |m|
# User.current.at_messages.unviewed('Message', m.id).each {|x| x.viewed!}
# end
# end
elsif @course
CourseMessage.where("user_id =? and course_id =? and viewed =?", User.current.id, @course.id, 0).update_all(:viewed => true)
end

View File

@ -37,6 +37,9 @@ class MessagesController < ApplicationController
# Show a topic and its replies
def show
# 顶部导航
@project_menu_type = 3
@isReply = true
# page = params[:page]
# # Find the page of the requested reply

View File

@ -179,7 +179,7 @@ class PullRequestsController < ApplicationController
begin
@comments = @g.create_merge_request_comment(@project.gpid, params[:id], content, User.current.gid)
respond_to do |format|
format.html{redirect_to project_pull_request_path(params[:id], :project_id => @project.id)}
format.js{redirect_to project_pull_request_path(params[:id], :project_id => @project.id)}
end
rescue Exception => e
@message = e.message

View File

@ -265,7 +265,7 @@ update
if request.post? && @repository.save
s = Trustie::Gitlab::Sync.new
s.create_project(@project, @repository)
redirect_to settings_project_url(@project, :tab => 'repositories')
redirect_to(:controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).try(:identifier))
else
redirect_to settings_project_url(@project, :tab => 'repositories',:repository_error_message=>@repository.errors.full_messages)
end
@ -387,12 +387,10 @@ update
if request.xhr?
@entries ? render(:partial => 'dir_list_content') : render(:nothing => true)
else
unless @entries.blank?
@changesets_latest_coimmit = @g.commit(@project.gpid, @entries.first.try(:lastrev))
# @changesets_latest_coimmit = @g.commits(@project.gpid, :ref_name => @rev)[0]
# 总的提交数
@changesets_all_count = @g.user_static(@project.gpid, :rev => @rev).count
# 获取默认分支
@g_default_branch = @g_project.default_branch.nil? ? "master" : @g_project.default_branch
@ -400,6 +398,10 @@ update
gitlab_address = Redmine::Configuration['gitlab_address']
# REDO:需优化,仅测试用
@zip_path = Gitlab.endpoint.to_s + "/projects/" + @project.gpid.to_s + "/repository/archive?&private_token=" + Gitlab.private_token
end
@creator = @project.owner.to_s
gitlab_address = Redmine::Configuration['gitlab_address']
@repos_url = gitlab_address.to_s+"/" + @creator + "/" + @repository.identifier+"."+"git"
# 一些数据的异步同步更新
@ -410,6 +412,7 @@ update
else
project_score.update_column(:changeset_num, @changesets_all_count)
end
# 更新提交时间,用于课程
unless @changesets_latest_coimmit.blank?
update_commits_date(@project, @changesets_latest_coimmit)
end

View File

@ -886,14 +886,14 @@ module ApplicationHelper
# 项目版本库可见权限判断:
# modules中设置可见
# 版本库存在
# 版本库设置了隐藏则仅仅项目成员可见(hidden_repo:1 隐藏版本库)
# 版本库设置了隐藏则仅仅项目成员或超级管理员可见(hidden_repo:1 隐藏版本库)
# return -> true 可见
def visible_repository?(project)
repository = Repository.where(:project_id => project.id, :type => "Repository::Gitlab").first
if project.enabled_modules.where("name = 'repository'").empty? || repository.nil?
result = false
else
result = (project.hidden_repo && !User.current.member_of?(project)) ? false : true
result = (project.hidden_repo && !User.current.admin && !User.current.member_of?(project)) ? false : true
end
end

View File

@ -49,12 +49,12 @@ module IssuesHelper
@cached_label_project ||= l(:field_project)
link_to_issue(issue) + "<br /><br />".html_safe +
"<strong>#{@cached_label_project}</strong>: #{link_to_project(issue.project)}<br />".html_safe +
"<strong>#{@cached_label_status}</strong>: #{h(issue.status.name)}<br />".html_safe +
"<strong>#{@cached_label_start_date}</strong>: #{format_date(issue.start_date)}<br />".html_safe +
"<strong>#{@cached_label_due_date}</strong>: #{format_date(issue.due_date)}<br />".html_safe +
"<strong>#{@cached_label_assigned_to}</strong>: #{h(issue.assigned_to)}<br />".html_safe +
"<strong>#{@cached_label_priority}</strong>: #{h(issue.priority.name)}".html_safe
"<div class='f12'><strong>#{@cached_label_project}</strong>: #{link_to_project(issue.project)}</div>".html_safe +
"<div class='f12'><strong>#{@cached_label_status}</strong>: #{h(issue.status.name)}</div>".html_safe +
"<div class='f12'><strong>#{@cached_label_start_date}</strong>: #{format_date(issue.start_date)}</div>".html_safe +
"<div class='f12'><strong>#{@cached_label_due_date}</strong>: #{format_date(issue.due_date)}</div>".html_safe +
"<div class='f12'><strong>#{@cached_label_assigned_to}</strong>: #{h(issue.assigned_to)}</div>".html_safe +
"<div class='f12'><strong>#{@cached_label_priority}</strong>: #{h(issue.priority.name)}</div>".html_safe
end
def states_done_ratio(issue)

View File

@ -366,10 +366,10 @@ module WatchersHelper
def store_project_link project_id, user_id
collected = Member.where(:project_id => project_id, :user_id => user_id).first.try(:is_collect)
text = collected == 1 ? l(:label_project_collect) : l(:label_project_collect_cancel)
text = collected == 1 ? l(:label_project_collect_cancel) : l(:label_project_collect)
url = store_mine_project_path(project_id)
method = 'post'
link = link_to(text, url, :remote => true, :method => method, :id => "#{project_id}", :class => "pro_new_topbtn_left fl", :title => "点击将其从个人主页的项目列表中移除")
link = link_to(text, url, :remote => true, :method => method, :id => "#{project_id}", :class => "pro_new_topbtn_left fl", :title => "#{collected == 1 ? '点击将其从个人主页的项目列表中移除' : '点击将其添加至人主页的项目列表中'}")
# link.html_safe
end

View File

@ -8,7 +8,7 @@
<a href="#L<%= line_num %>" style="padding-top: 0px;"><%= line_num %></a>
</th>
<td class="line-code">
<pre style="width:auto;white-space: nowrap;overflow: auto; "><%= line.html_safe %></pre>
<pre style="width:auto;overflow: auto; "><%= line.html_safe %></pre>
</td>
</tr>
<% line_num += 1 %>

View File

@ -3,7 +3,6 @@
<% project_acts = ForgeActivity.where("project_id = ?", @project.id).count %>
<% raodmaps = Version.where("project_id = ?", @project.id).count %>
<% project_score = @project.project_score %>
<% project_modules = @project.enabled_modules.where("name = 'issue_tracking'") %>
<%# 更新访问数,刷新的时候更新访问次数 %>
<% update_visiti_count @project %>
@ -44,7 +43,7 @@
<% end %>
<!--版本库-->
<% if visible_repository?(@project) %>
<li id="project_menu_05"><%= link_to @project.project_score.changeset_num > 0 ? "#{l(:project_module_repository)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k project_score.changeset_num}</span>".html_safe : "#{l(:project_module_repository)}",({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).try(:identifier)}), :class => "pro_new_proname", :title => "#{project_score.changeset_num}" %>
<li id="project_menu_05"><%= link_to @project.project_score.changeset_num.to_i > 0 ? "#{l(:project_module_repository)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k project_score.changeset_num}</span>".html_safe : "#{l(:project_module_repository)}",({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).try(:identifier)}), :class => "pro_new_proname", :title => "#{project_score.changeset_num}" %>
</li>
<% end %>
<!--Pull Request-->

View File

@ -13,16 +13,6 @@
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= yield :header_tags -%>
<!-- MathJax的配置 -->
<script type="text/javascript" src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<!-- 配置 在生成的公式图片上去掉Math定义的右键菜单$$ $$ \( \) \[ \] 中的公式给予显示-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
showMathMenu: false,
showMathMenuMSIE: false,
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
</head>
<!--add by huang-->
@ -58,6 +48,16 @@
</div>
<%= call_hook :view_layouts_base_body_bottom %>
</body>
<!-- MathJax的配置 -->
<script type="text/javascript" src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<!-- 配置 在生成的公式图片上去掉Math定义的右键菜单$$ $$ \( \) \[ \] 中的公式给予显示-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
showMathMenu: false,
showMathMenuMSIE: false,
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
<%= javascript_include_tag 'cookie','project',"avatars", 'header','prettify','select_list_move','attachments' %>
</html>

View File

@ -0,0 +1,23 @@
<div class="ReplyToMessageContainer borderBottomNone" id="reply_to_message_<%= reply.id%>" style="width:895px;">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
<div class="ReplyToMessageInputContainer mb10" style="width:840px;">
<% if User.current.logged? %>
<div nhname='new_message_<%= reply.id%>'>
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :method => "post", :id => 'new_form' do |f| %>
<%= hidden_field_tag 'parent_id', params[:parent_id], :value => reply.id %>
<%= hidden_field_tag 'reply_id', params[:reply_id], :value => reply.author.id %>
<%= hidden_field_tag 'activity_id',params[:activity_id],:value =>@topic.id %>
<div nhname='toolbar_container_<%= reply.id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="content"></textarea>
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= reply.id%>'></p>
<% end%>
</div>
<% else %>
<%= render :partial => "users/show_unlogged" %>
<% end %>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>

View File

@ -10,7 +10,7 @@
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
</div>
<div class="reply-content ml15" onmouseover="$('#delete_reply_<%=reply.id %>').show();" onmouseout="$('#delete_reply_<%=reply.id %>').hide();">
<%= render :partial => 'users/message_contents', :locals => {:comment => reply}%>
<%= render :partial => 'projects/project_message_contents', :locals => {:comment => reply}%>
<div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>">
<%= reply.content.html_safe%>
@ -24,7 +24,7 @@
<span style="position: relative" class="fr mr20">
<%= link_to(
l(:button_reply),
{:action => 'quote', :id => reply},
{:action => 'quote', :id => reply, :is_project => true},
:remote => true,
:method => 'get',
:title => l(:button_reply)) if !@topic.locked? && authorize_for('messages', 'reply') %>

View File

@ -1,7 +1,6 @@
<div class="ReplyToMessageContainer borderBottomNone" id="reply_to_message_<%= reply.id%>" style="width:895px;">
<div class="ReplyToMessageContainer borderBottomNone" id="reply_to_message_<%= reply.id%>">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
<div class="ReplyToMessageInputContainer mb10" style="width:840px;">
<div class="ReplyToMessageInputContainer mb10">
<% if User.current.logged? %>
<div nhname='new_message_<%= reply.id%>'>
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :method => "post", :id => 'new_form' do |f| %>

View File

@ -1,5 +1,10 @@
if($("#reply_message_<%= @message.id%>").length > 0) {
<% if params[:is_project] %>
$("#reply_message_<%= @message.id%>").replaceWith("<%= escape_javascript(render :partial => 'messages/project_rereply_message', :locals => {:reply => @message}) %>");
<% else %>
$("#reply_message_<%= @message.id%>").replaceWith("<%= escape_javascript(render :partial => 'reply_message', :locals => {:reply => @message}) %>");
<% end %>
$(function(){
/*$('#reply_subject').val("<%#= raw escape_javascript(@subject) %>");
$('#quote_quote').val("<%#= raw escape_javascript(@temp.content.html_safe) %>");*/

View File

@ -17,7 +17,7 @@
<% end %>
<% else %>
<!--项目收藏-->
<% my_stores = Member.where(:project_id => @project.id, :is_collect => 0).count %>
<% my_stores = Member.where(:project_id => @project.id, :is_collect => 1).count %>
<li class="mr5 fl"><%= store_project_link(@project.id, User.current.id) %><%= link_to my_stores, store_mine_project_path(@project), :class => "pro_new_topbtn fl" %></li>
<!--项目创建者不能退出项目-->
<% if User.current.id != @project.user_id %>

View File

@ -2,7 +2,7 @@
<% if @gitlab_repository.nil? %>
<div class=" sy_new_tchbox clear " >
<a href="javascript:void(0);" class=" sy_btn_green mb10">新建版本库</a>
<%= labelled_form_for :repository, @repository, :url =>project_repositories_path(@project),:html => {:id => 'repository-form',:method=>"post",:autocomplete=>'off', :remote => true} do |f| %>
<%= labelled_form_for :repository, @repository, :url =>project_repositories_path(@project), :html => {:id => 'repository-form', :method=>"post", :autocomplete => 'off'} do |f| %>
<ul class="pro_newsetting_con mb15">
<li style="display: none">
<label class="label02"><%=l(:label_scm)%></label>

View File

@ -33,15 +33,12 @@
<ul class="new_roadmap_nav fl" >
<li class="new_roadmap_nav_hover" id="new_roadmap_nav_1" onclick="HoverLi(1);">
<%= link_to "评论<span class='new_roadmap_nav_taghover ml5' id='new_roadmap_num_1'>#{@comments_count}</span>".html_safe, pull_request_comments_project_pull_request_path(@request.id, :project_id => @project.id, :type => "1"), :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1" %>
<!--<a href="javascript:void(0);" id="new_roadmap_type_1" class="new_roadmap_type_nomal" >评论<span id="new_roadmap_num_1" class="new_roadmap_nav_taghover ml5">210</span></a>-->
</li>
<li id="new_roadmap_nav_2" onclick="HoverLi(2);">
<%= link_to "提交<span class='new_roadmap_nav_tagnomal ml5' id='new_roadmap_num_2'>#{@commits_count}</span>".html_safe, pull_request_commits_project_pull_request_path(@request.id, :project_id => @project.id, :type => "2"), :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_2" %></li>
<!--<a href="javascript:void(0);" id="new_roadmap_type_2" class="new_roadmap_type_nomal" >提交<span id="new_roadmap_num_2" class="new_roadmap_nav_tagnomal ml5">25</span></a>-->
</li>
<li id="new_roadmap_nav_3" onclick="HoverLi(3);">
<%= link_to "改动<span class='new_roadmap_nav_tagnomal ml5' id='new_roadmap_num_3'>#{@changes_count}</span>".html_safe, pull_request_changes_project_pull_request_path(@request.id, :project_id => @project.id, :type => "3"), :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_3" %></li>
<!--<a href="javascript:void(0);" id="new_roadmap_type_3" class="new_roadmap_type_nomal" >改动<span id="new_roadmap_num_3" class="new_roadmap_nav_tagnomal ml5">5</span></a>-->
</li>
</ul>

View File

@ -1,2 +1,3 @@
<%= render :partial => "pull_requests/pull_request_container" %>
<%= render :partial => "pull_requests/show" %>
<div id="pull_request_show">
<%= render :partial => "pull_requests/show" %>
</div>

View File

@ -1,3 +1,4 @@
<%# 详情页面和新建页面都会跳入,所以用两种局部刷新 %>
<%# 新建页面局部替换 %>
$("#pull_request_new_form").html('<%= escape_javascript(render :partial => "pull_requests/show") %>');
<%# 详情页面局部替换 %>
$("#pull_request_show").html('<%= escape_javascript(render :partial => "pull_requests/show") %>');

View File

@ -1,6 +1,6 @@
<% if @entry && @entry.kind == 'file' %>
<p class="mt13 mb13">
<p class="mt5 mb5">
<%= link_to_if action_name != 'changes', l(:label_history), {:action => 'changes', :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(@path), :rev => @rev } %> |
<% if @repository.supports_cat? %>
<%= link_to_if action_name != 'entry', l(:button_view), {:action => 'entry', :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(@path), :rev => @rev } %> |

View File

@ -8,7 +8,7 @@
:repository_id => @repository.identifier_param,
:path => to_path_param(@path), :rev=> @rev}, :method => 'get') do %>
<%= hidden_field_tag('rev_to', params[:rev_to]) if params[:rev_to] %>
<p class="mt13 mb13">
<p class="mt5 mb5">
<%= l(:label_view_diff) %>:
<label><%= radio_button_tag 'type', 'inline', @diff_type != 'sbs', :onchange => "this.form.submit()" %> <%= l(:label_diff_inline) %></label>
<label><%= radio_button_tag 'type', 'sbs', @diff_type == 'sbs', :onchange => "this.form.submit()" %> <%= l(:label_diff_side_by_side) %></label>

View File

@ -82,13 +82,13 @@
<% unless memo.nil? %>
<a href="<%= Setting.protocol + "://" %><%=Setting.host_name %>/forums/1/memos/1232" >如何提交代码</a>
<% end %>
<% unless @entries.blank? %>
<div class="fr">
<a style="color: #7f7f7f;">导出统计结果:</a>
<%= link_to "最近一周", {:controller => 'repositories', :action => 'export_rep_static', :format => 'xls', :rev => @rev, :cycle => "week" } %> <a style="color: #7f7f7f;">|</a>
<%= link_to "最近一月", {:controller => 'repositories', :action => 'export_rep_static', :format => 'xls', :rev => @rev, :cycle => "month" } %>
</div>
<% end %>
<%#= link_to "导出excel", {:controller => 'repositories', :action => 'export_rep_static', :rev => @rev}, :format => 'xls' %>
<!--<a href="<%#=project_issues_path(:project_id => @project, :format => 'xls')%>" class="hw_btn_blue fr" alt="导出EXCEL">导出EXCEL</a>-->
</div>

View File

@ -8,21 +8,21 @@
<% length = parents_rely.length %>
<div id="comment_reply_<%=comment.id %>">
<% if length <= 3 %>
<%=render :partial => 'projects/project_journal_comment_reply', :locals => {:comment => comment.parent} %>
<%=render :partial => 'users/journal_comment_reply', :locals => {:comment => comment.parent} %>
<% else %>
<div class="orig_cont clearfix">
<div class="orig_cont clearfix">
<div>
<%=render :partial => 'projects/project_journal_comment_reply', :locals => {:comment => parents_rely[length - 1]} %>
<%=render :partial => 'users/journal_comment_reply', :locals => {:comment => parents_rely[length - 1]} %>
</div>
<%=render :partial => 'projects/project_comment_reply_detail', :locals => {:comment => parents_rely[length - 2]} %>
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[length - 2]} %>
</div>
<div class="orig_cont_hide clearfix">
<span class="orig_icon" >&darr; </span>
<span class="orig_icon" style="display:none;" > &uarr;</span>
<%= link_to '点击展开隐藏楼层', show_all_replies_users_path(:comment => comment, :type => comment.class),:remote=>true %>
</div>
<%=render :partial => 'projects/project_comment_reply_detail', :locals => {:comment => parents_rely[0]} %>
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[0]} %>
</div>
<% end %>
</div>

View File

@ -782,7 +782,7 @@ a.files_tag_select{ background:#64bdd9; color:#fff; border:1px solid #bbe2ef; pa
.issues{ background:url(/images/public_icon.png) -66px 5px no-repeat; width:18px; height:21px;}
.duty{ background:url(/images/public_icon.png) -66px -18px no-repeat; width:18px; height:21px;}
.support{ background:url(/images/public_icon.png) -66px -45px no-repeat; width:18px; height:21px;}
.function{ background:url(/images/public_icon.png) -66px -70px no-repeat; width:18px; height:21px;}
/*.function{ background:url(/images/public_icon.png) -66px -70px no-repeat; width:18px; height:21px;}*/
.issues-function{ background:url(/images/public_icon.png) -66px -70px no-repeat; width:18px; height:21px;}
.weekly{ background:url(/images/public_icon.png) -66px -95px no-repeat; width:18px; height:21px;}

View File

@ -61,7 +61,7 @@ table.filecontent th.line-num a {
table.filecontent td.line-code {padding: 0 0 0 4px;}
table.filecontent td.line-code pre {
margin: 0px;
white-space: pre-wrap;
/*white-space: pre-wrap;*/
font-family:"Liberation Mono", Courier, monospace; font-size:12px;
}