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

This commit is contained in:
Tim 2016-10-25 13:36:28 +08:00
commit a33e6a1578
15 changed files with 185 additions and 101 deletions

View File

@ -380,6 +380,8 @@ class ProjectsController < ApplicationController
project_org_ids = "(" + project_org_ids.join(',') + ")"
@orgs_not_in_project = Organization.where("id not in #{project_org_ids} and is_public = 1")
end
# 里程碑
@versions = @project.shared_versions.sort
# 处理从新建版本库返回来的错误信息
if !params[:repository_error_message].to_s.blank?

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,19 +387,21 @@ update
if request.xhr?
@entries ? render(:partial => 'dir_list_content') : render(:nothing => true)
else
@changesets_latest_coimmit = @g.commit(@project.gpid, @entries.first.try(:lastrev))
# @changesets_latest_coimmit = @g.commits(@project.gpid, :ref_name => @rev)[0]
unless @entries.blank?
@changesets_latest_coimmit = @g.commit(@project.gpid, @entries.first.try(:lastrev))
# 总的提交数
@changesets_all_count = @g.user_static(@project.gpid, :rev => @rev).count
# 获取默认分支
@g_default_branch = @g_project.default_branch.nil? ? "master" : @g_project.default_branch
# 总的提交数
@changesets_all_count = @g.user_static(@project.gpid, :rev => @rev).count
# 获取默认分支
@g_default_branch = @g_project.default_branch.nil? ? "master" : @g_project.default_branch
@creator = @project.owner.to_s
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']
# REDO:需优化,仅测试用
@zip_path = Gitlab.endpoint.to_s + "/projects/" + @project.gpid.to_s + "/repository/archive?&private_token=" + Gitlab.private_token
@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

@ -185,44 +185,54 @@ class VersionsController < ApplicationController
end
def update
if request.put? && params[:version] && params[:flag].to_i == 1
@version.update_attribute(:status, params[:status])
if @version.save
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
redirect_to settings_project_path(@project, :tab => 'versions')
}
format.js
format.api { render_api_ok }
end
else
respond_to do |format|
format.html { render :action => 'edit' }
format.api { render_validation_errors(@version) }
end
end
else if request.put? && params[:version]
attributes = params[:version].dup
attributes.delete('sharing') unless @version.allowed_sharings.include?(attributes['sharing'])
@version.safe_attributes = attributes
if @version.save
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
redirect_to settings_project_path(@project, :tab => 'versions')
}
format.api { render_api_ok }
if request.put? && params[:version]
# 处理里程碑里面的更新
if params[:flag].to_i == 1
@version.update_attribute(:status, params[:status])
if @version.save
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
redirect_to settings_project_path(@project, :tab => 'versions')
}
format.js
format.api { render_api_ok }
end
else
respond_to do |format|
format.html { render :action => 'edit' }
format.api { render_validation_errors(@version) }
end
end
else
respond_to do |format|
format.html { render :action => 'edit' }
format.api { render_validation_errors(@version) }
attributes = params[:version].dup
attributes.delete('sharing') unless @version.allowed_sharings.include?(attributes['sharing'])
@version.safe_attributes = attributes
@is_setting = params[:is_setting]
if @version.save
# 为了再setting里面局部刷新
if @is_setting
@versions = @version.project.shared_versions.sort
end
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
redirect_to settings_project_path(@project, :tab => 'versions')
}
format.js
format.api { render_api_ok }
end
else
respond_to do |format|
format.html { render :action => 'edit' }
format.js
format.api { render_validation_errors(@version) }
end
end
end
end
end
end
end
def close_completed
if request.put?
@project.close_completed_versions

View File

@ -1,13 +1,13 @@
<style type="text/css">
input.is_public,input.is_public_checkbox{height:12px;}
input.is_public_checkbox{margin-left:4px;margin-right:4px;}
input.is_public,input.is_public_checkbox{height:12px;}
input.is_public_checkbox{margin-left:4px;margin-right:4px;}
</style>
<div class="fl">
<span id="attachments_fields" xmlns="http://www.w3.org/1999/html">
<% if defined?(container) && container && container.saved_attachments %>
<% container.attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>" class="attachment">
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'upload_filename readonly', :readonly => 'readonly') %>
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'upload_filename readonly', :readonly => 'readonly', :style=>'border:none;') %>
<%#= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style => "display: inline-block;") %>
<!--<span class="ispublic-label"><%#= l(:field_is_public) %>:</span>-->
<%#= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public, attachment.is_public == 1 ? true : false, :class => 'is_public') %>

View File

@ -61,7 +61,11 @@
<%= render :partial => 'attachments/form', :locals => {:container => @issue} %>
</li>
<li class="clear">
<% if params[:action] == "new" %>
<a href="<%= project_issues_path(@project, :remote => true) %>" class="sy_btn_grey mr5 fr"> 取消</a>
<% else %>
<a href="javascript:void(0);" onclick="issueDetailShow();" class="sy_btn_grey mr5 fr" > 取消 </a>
<% end %>
<a href="javascript:void(0);" class="sy_btn_blue mr5 fr"> 保存并继续</a>
<a href="javascript:void(0);" onclick="issue_desc_editor.sync();$('#issue-form').submit();" class="sy_btn_blue mr5 fr" id="issue_confirm"> 保存</a>
</li>
@ -81,7 +85,13 @@
{:onchange => "change_assigned_tip();",:class => "w150"} %>
<% end %>
</li>
<li class=" clear" id="assigned_to_tips">未指派</li>
<li class=" clear" id="assigned_to_tips">
<% if @issue.assigned_to.nil? %>
未指派
<% else %>
已指派
<% end %>
</li>
<li class=" clear">
<% if @issue.safe_attribute?('fixed_version_id') && @issue.assignable_versions.any? %>
<%= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version),
@ -97,7 +107,11 @@
<% end %>
</li>
<li class=" clear" id="milestone_option_tips">
无里程碑
<% if @issue.fixed_version.nil? %>
无里程碑
<% else %>
已指派里程碑
<% end %>
<%= link_to "", new_project_version_path(@issue.project), :class => "pic_add mt5 ml5 fr", :target => "_blank" %>
</li>
<li class=" clear" style="border:1px solid #c8c8c8;">
@ -108,7 +122,11 @@
<% end %>
</li>
<li class=" clear" id="option_start_date_tips">
未选择开始日期
<% if @issue.start_date.nil? %>
未选择开始日期
<% else %>
已选择开始日期
<% end %>
</li>
<li class=" clear" style="border:1px solid #c8c8c8;">
<label class="label02" ></label>
@ -119,7 +137,11 @@
<% end %>
</li>
<li class=" clear " id="option_end_date_tips">
未选择结束日期
<% if @issue.due_date.nil? %>
未选择结束日期
<% else %>
已选择结束日期
<% end %>
</li>
<li class=" clear"><%= l(:field_estimated_hours) %></li>
<li class=" clear">

View File

@ -16,9 +16,9 @@
});
</script>
<div class="mb10" id =issue_show_total"">
<div class="banner-big f16 fontGrey3">
问题跟踪
</div>
<div class="banner-big f16 fontGrey3">
问题跟踪
</div>
<div class="container-big mt10" >
<div class="pro_page_box">
@ -26,9 +26,6 @@
<div id="issue_detail_show">
<%= render :partial => 'issues/detail'%>
</div>
<div id="issue_edit_show">
<%= render :partial => 'issues/edit'%>
</div>
</div>
<!--problem_main end-->
@ -47,4 +44,8 @@
</div>
</div>
</div>
<div id="issue_edit_show" class="mt10 pro_newissue_con clear">
<%= render :partial => 'issues/edit'%>
</div>
</div>

View File

@ -44,7 +44,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

@ -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>
@ -26,7 +26,7 @@
</li>
</ul>
<a href="javascript:void(0)" onclick="cancel_for_create();" class="fr sy_btn_grey"><%=l(:button_cancel)%></a>
<a href="" onclick="project_repository_commit();" class="fr sy_btn_blue mr5"><%=l(:lable_project_rep_create) %></a>
<a href="javascript:void(0)" onclick="project_repository_commit();" class="fr sy_btn_blue mr5"><%=l(:lable_project_rep_create) %></a>
<% end %>
</div>
<% else %>

View File

@ -44,7 +44,7 @@
</tr>
</thead>
<tbody>
<% @project.shared_versions.sort.each do |version| %>
<% @versions.each do |version| %>
<tr>
<th>
<a><%= 'shared' if version.project != @project %> <%= link_to_version version %></a>

View File

@ -82,13 +82,13 @@
<% unless memo.nil? %>
<a href="<%= Setting.protocol + "://" %><%=Setting.host_name %>/forums/1/memos/1232" >如何提交代码</a>
<% end %>
<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>
<% 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

@ -1,33 +1,70 @@
<div class="sy_popup_top">
<h3 class="fl">新建里程碑</h3>
<a href="javascript:void(0);" class="sy_icons_close fr" onclick="hideModal()"></a>
<div class="cl"></div>
</div>
<div class="sy_popup_con">
<%= form_for :version, :url => project_versions_path(@project, :is_setting => true),:html=>{:id=>"new_project_version_form", :remote => true} do |f| %>
<div id="pro_st_edit_ban1">
<ul class="pro_newsetting_con mb15">
<li class="mb10 clear">
<label class="label02"><span class="c_red f12">*</span>&nbsp;<%= l(:field_name) %>&nbsp;&nbsp;:&nbsp;</label>
<%= f.text_field :name, :maxlength => 60, :class=>"w650 fl", :style=>"height: 28px;", :id => "setting_version_name" %>
<p class="c_orange ml100 " style="display: none" id="project_setting_version_title">标题不能为空</p>
</li>
<li class="mb10 clear">
<label class="fl">&nbsp;<%= l(:label_version_description) %>&nbsp;&nbsp;:&nbsp;</label>
<%= f.text_field :description, :maxlength => 60, :class=>"w650 fl", :style=>"height:28px;"%>
</li>
<li class="mb10 clear">
<label class=" fl">&nbsp;<%= l(:milestone_date_closed) %>&nbsp;&nbsp;:&nbsp;</label>
<%= f.text_field :effective_date, :size => 10, :readonly => true,:class=>"issues_calendar_input fl", :placeholder=>"结束日期", :style=>"height:28px;" %>
<%= calendar_for('version_effective_date') %>
</li>
<li class="mb10 clear">
<label class="fl">&nbsp;<%= l(:field_status) %>&nbsp;&nbsp;:&nbsp;</label>
<%= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]},{},{:style=>"height:28px"} %>
</li>
<div class="cl mb10"></div>
</ul>
<a href="javascript:void(0);" class="fr sy_btn_grey " onclick="pro_st_show_ban1();">取消</a><a href="javascript:void(0);" onclick="project_version_commit();" class="fr sy_btn_blue mr5">保存</a>
</div>
<% end %>
<div id="muban_popup_box" style="width:820px;">
<div class="muban_popup_top">
<h3 class="fl">编辑里程碑</h3>
<a href="javascript:void(0);" class="muban_icons_close fr" onclick="hideModal()"></a>
<div class="cl"></div>
</div>
<div class="muban_popup_con " >
<div class="clear mt30 ml20 " >
<%#= form_tag( url_for(:controller => 'versions', :action => 'update', :is_setting => true), :remote => true, :id => 'project_applied_form') do %>
<%= labelled_form_for @version, :html => {:id => "popub_new_project_version_form", :remote => true, :is_setting => true, } do |f| %>
<ul class="pro_newsetting_con mb15 ">
<li class="mb10 clear">
<label class=" fl"><span class="c_red f12">*</span>&nbsp;名称&nbsp;&nbsp;:&nbsp;</label>
<%= f.text_field :name, :maxlength => 60, :class=>"w650 fl", :style=>"height: 28px;", :id => "popub_setting_version_name", :no_label => true %>
<p class="c_orange ml100" style="display: none" id="pupub_project_setting_version_title">标题不能为空</p>
</li>
<li class="mb10 clear">
<label class=" fl">&nbsp;描述&nbsp;&nbsp;:&nbsp;</label>
<%= f.text_field :description, :maxlength => 60, :class=>"w650 fl", :style=>"height:28px;", :no_label => true %>
</li>
<li class="mb10 clear">
<label class=" fl"><span class="c_red f12">*</span>&nbsp;结束日期&nbsp;&nbsp;:&nbsp;</label>
<%= f.text_field :effective_date, :size => 10, :readonly => true,:class=>"issues_calendar_input fl", :id => "version_effective_date2", :placeholder=>"结束日期", :style=>"height:28px;", :no_label => true %>
<%= calendar_for('version_effective_date2') %>
<!--<input type="text" placeholder="结束日期" class="issues_calendar_input fl ">-->
<!--<a href="" class="issues_data_img fl"></a>-->
</li>
<li class="mb10 clear">
<label class=" fl">&nbsp;状态&nbsp;&nbsp;:&nbsp;</label>
<%= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]},{:no_label => true },{:style=>"height:28px;"} %>
</li>
<input value="true" name="is_setting" type="hidden">
</ul>
<a href="javascript:void(0);" class="fr sy_btn_grey mr45" onclick="hideModal()">取消</a>
<a href="javascript:void(0);" class="fr sy_btn_blue mr5" onclick="popub_project_version_commit();">保存</a>
<% end %>
</div>
</div>
</div>
<script>
// 新建版本
function popub_project_version_commit()
{
if(popub_regex_version_name())
{
hideModal();
$("#popub_new_project_version_form").submit();
}
}
function popub_regex_version_name()
{
var name = $.trim($("#popub_setting_version_name").val());
if(name.length == 0)
{
$("#pupub_project_setting_version_title").show();
return false;
}
else
{
$("#pupub_project_setting_version_title").hide();
return true;
}
}
</script>

View File

@ -1,3 +1,3 @@
var htmlvalue = "<%= escape_javascript(render :partial => 'versions/edit') %>";
pop_box_new(htmlvalue,580,366);
pop_box_new(htmlvalue,820,316);

View File

@ -1 +1,6 @@
$('#version_status_con_id').html('<%= escape_javascript( render :partial => 'versions/type_ico', :locals => {:version => @version}) %>');
<%# @is_setting:如果是settings里面新建则直接局部刷新setting如果是列表则直接局部刷新列表 %>
<% if @is_setting %>
$("#pro_st_tbc_04").html('<%= escape_javascript( render :partial => 'projects/settings/new_versions') %>');
<% else %>
$('#version_status_con_id').html('<%= escape_javascript( render :partial => 'versions/type_ico', :locals => {:version => @version}) %>');
<% end %>

View File

@ -565,12 +565,14 @@ function cancel_relation(orgId,projectId){
function issueEditShow(){
$("#issue_detail").hide();
$(".container-big").hide();
$("#issue_edit").show();
}
function issueDetailShow(){
$("#issue_edit").hide();
$("#issue_detail").show();
$(".container-big").show();
}
//项目讨论区提交

View File

@ -4,6 +4,8 @@
.muban_popup_top h3{ font-size:16px; color:#fff; font-weight:normal; line-height:40px; padding-left:10px; }
a.muban_icons_close{width:20px; height:20px;display:block;background: url(/images/sy/sy_icons_close.png) 0 0px no-repeat; margin:8px 10px 0 0;}
a:hover.muban_icons_close{background: url(/images/sy/sy_icons_close.png) -40px 0px no-repeat;}
#muban_popup_box input,#muban_popup_box select{ border:1px solid #c8c8c8; height: 28px; color: #888;}
#muban_popup_box label{width: 100px; text-align: right; display: inline-block;}
/*模板表格 20161013byLB*/
.muban_table{ width:100%; background:#fff; border:1px solid #e5e5e5; border-bottom: none; }
.muban_table thead tr{ height:40px; line-height:40px;}