项目 版本 和 版本库 标签改动

This commit is contained in:
lizanle 2015-04-16 14:59:05 +08:00
parent d8a4977c4d
commit 17f495e77b
7 changed files with 112 additions and 38 deletions

View File

@ -324,6 +324,28 @@ class ProjectsController < ApplicationController
@trackers = Tracker.sorted.all
@wiki ||= @project.wiki
@select_tab = params[:tab]
#版本库逻辑由于没有new操作了所以跳到项目配置就new一个版本库
if !params[:repository_error_message].to_s.blank?
html = ""
errors = params[:repository_error_message].flatten
errors.each do |error|
###by xianbo
if(error!=l(:label_repository_path_not_null))
html << error << ";"
end
###xianbo
end
if params[:repository] == "pswd_is_null"
html << l(:label_password_not_null)<< ";"
end
flash[:error] = html if !html.to_s.blank?
end
scm = params[:repository_scm] || (Redmine::Scm::Base.all & Setting.enabled_scm).first
@repository = Repository.factory(scm)
@repository.is_default = @project.repository.nil?
@repository.project = @project
end
def send_mail_to_member

View File

@ -25,6 +25,7 @@ class ChangesetNotFound < Exception; end
class InvalidRevisionParam < Exception; end
class RepositoriesController < ApplicationController
include ApplicationHelper
menu_item :repository
menu_item :settings, :only => [:new, :create, :edit, :update, :destroy, :committers]
default_search_scope :changesets
@ -122,7 +123,7 @@ update
if request.post? && @repository.save
redirect_to settings_project_url(@project, :tab => 'repositories')
else
render :action => 'new'
redirect_to settings_project_url(@project, :tab => 'repositories')
end
else # 原逻辑
##xianbo
@ -167,11 +168,12 @@ update
@repository.update_attributes(:login => User.current.login.to_s)
end
redirect_to settings_project_url(@project, :tab => 'repositories')
else if(@repository_tag)
render :action => 'newrepo', :layout =>'base_projects'
redirect_to settings_project_url(@project, :tab => 'repositories',:repository_error_message=>@repository.errors.full_messages)
else if(@repository_tag.blank?)
#render :action => 'newrepo', :layout =>'base_projects'
redirect_to settings_project_url(@project, :tab => 'repositories',:repository => "pswd_is_null",:repository_error_message=>@repository.errors.full_messages)
else
render :action => 'new', :layout =>'base_projects'
redirect_to settings_project_url(@project, :tab => 'repositories',:repository => @repository,:repository_error_message=>@repository.errors.full_messages)
end
end

View File

@ -3,8 +3,12 @@
$(function(){
<%if @select_tab == "modules"%>
project_setting(2);
<% else @select_tab == "versions"%>
<% elsif @select_tab == "versions"%>
project_setting(4);
<% elsif @select_tab == "repositories" %>
project_setting(6);
<%else%>
<% end%>
});
<% end%>

View File

@ -1,3 +1,10 @@
<script>
function pro_st_show_ku()
{
$("#pro_st_edit_ku").toggle();
}
</script>
<%= error_messages_for 'repository' %>
<% project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT %>
<% ip = RepositoriesHelper::REPO_IP_ADDRESS %><!--Added by tanxianbo For formatting project's path-->
<% if @project.repositories.any? %>
@ -48,7 +55,44 @@
<a href="javascript:viod(0)" class="c_blue fl" onclick="pro_st_show_ku();">
<% course_tag = @project.project_type %>
<% if User.current.allowed_to?(:manage_repository, @project) %>
<%= link_to l(:label_repository_new_repos), newrepo_project_repository_path(@project, :course => course_tag), :class => 'c_blue fl' %></p>
<!--newrepo_project_repository_path(@project, :course => course_tag) -->
<%= link_to l(:label_repository_new_repos),"#" , :onclick=>"pro_st_show_ku();", :class => 'c_blue fl' %></p>
<% end %>
</a>
<div class="cl"></div>
<%= labelled_form_for :repository, @repository, :url =>project_repositories_path(@project),:html => {:id => 'repository-form',:method=>"post"} do |f| %>
<div id="pro_st_edit_ku" class="pro_st_edit_ku">
<ul>
<li >
<label class="label02">&nbsp;管理系统&nbsp;&nbsp;</label>
<%= select_tag('repository_scm',
options_for_select(["Git"],@repository.class.name.demodulize),
:data => {:remote => true, :method => 'get'})%>
<% if @repository && ! @repository.class.scm_available %>
<span class="c_grey"><%= l(:text_scm_command_not_available) %></span>
<% end %>
</li>
<li >
<label class="label02">&nbsp;主版本库&nbsp;&nbsp;</label>
<%= f.check_box :is_default, :label => "" %></p>
</li>
<li >
<label class="label02"><span class="c_red">*</span>&nbsp;版本库名&nbsp;&nbsp;</label>
<%= f.text_field :identifier, :disabled =>@repository.nil? || @repository.identifier_frozen? ? true:false,:label=>""%>
<% unless @repository.identifier_frozen? %>
<span class="c_grey">长度必须在 1 到 254 个字符之间。 仅小写字母a-z、数字、破折号-和下划线_可以使用。
一旦保存,标识无法修改。</span>
<% end %>
</li>
<li >
<label class="label02"><span class="c_red">*</span>&nbsp;密码&nbsp;&nbsp;</label>
<%= f.password_field :upassword, :label=> "" %>
<span class="c_grey">该密码在项目组内可共享</span>
</li>
<div class="cl"></div>
</ul>
<a href="#" onclick="$('#repository-form').submit();" class="blue_btn fl ml110">保存</a>
<a href="<%= settings_project_path(@project, :tab => 'repositories')%>" class="grey_btn fl ml10">取消</a>
</div><!--pro_st_edit_issues end-->
<% end %>

View File

@ -1,34 +1,34 @@
<%= back_url_hidden_field_tag %>
<%= error_messages_for 'version' %>
<div class="box tabular">
<p style="margin-left:-10px;">
<%= f.text_field :name, :maxlength => 60, :required => true %>
</p>
<p style="margin-left:-20px;">
<%= f.text_field :description, :maxlength => 60, :style => "margin-left:10px;" %>
</p>
<p style="margin-left:-20px;">
<span style="margin-left:10px;">
<%= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]} %>
</span>
</p>
<p style="margin-left:-20px;">
<span style="margin-left:10px;">
<%= f.text_field :wiki_page_title, :size =>60, :label => :label_wiki_page, :disabled => @project.wiki.nil? %>
</span>
</p>
<p style="margin-left:-20px;">
<span style="margin-left:10px;">
<%= f.text_field :effective_date, :size => 10, :readonly => true %>
<%= calendar_for('version_effective_date') %>
</span>
</p>
<p style="margin-left:-20px;">
<span style="margin-left:10px;">
<%= f.select :sharing, @version.allowed_sharings.collect {|v| [format_version_sharing(v), v]} %>
</span>
</p>
<div id="pro_st_edit_ban" class="pro_st_edit_ban_display">
<ul>
<li >
<label class="label02"><span class="c_red">*</span>&nbsp;名称&nbsp;&nbsp;</label>
<%= f.text_field :name, :maxlength => 60,:class=>" w280", :label => ""%>
</li>
<li >
<label class="label02">&nbsp;描述 &nbsp;&nbsp;</label>
<%= f.text_field :description, :maxlength => 60,:class=>" w280", :label => "" %>
</li>
<li >
<label class="label02">&nbsp;状态&nbsp;&nbsp;</label>
<%= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]}, :label => "" %>
</li>
<li >
<label class="label02">&nbsp;Wiki 页面&nbsp;&nbsp;</label>
<%= f.text_field :wiki_page_title, :size =>60, :label => "", :disabled => @project.wiki.nil? %>
</li>
<li >
<label class="label02">&nbsp;日期 &nbsp;&nbsp;</label>
<%= f.text_field :effective_date, :size => 10, :readonly => true,:class=>'f1',:label => "" %>
<%= calendar_for('version_effective_date') %>
</li>
<div class="cl mb10"></div>
<li >
<label class="label02">&nbsp;共享 &nbsp;&nbsp;</label>
<%= f.select :sharing, @version.allowed_sharings.collect {|v| [format_version_sharing(v), v]},:label=>"" %>
</li>
</ul>
<% @version.custom_field_values.each do |value| %>
<p style="margin-left:-20px;">

View File

@ -1,7 +1,7 @@
<h3><%=l(:label_version)%></h3>
<%= labelled_form_for @version do |f| %>
<%= labelled_form_for @version,:html=>{:id=>"new_project_version_form"} do |f| %>
<%= render :partial => 'form', :locals => { :f => f } %>
<%= submit_tag l(:button_save) %>
<a href="#" onclick="$('#new_project_version_form').submit();" class="blue_btn ml110">保存</a>
<% end %>

View File

@ -404,6 +404,8 @@ a:hover.member_btn{ background:#329cbd;}
.pro_st_edit_issues{ display:none; margin-top:20px;}
.pro_st_edit_issues ul li{ margin-bottom:10px;}
.pro_st_edit_ban{ display:none; margin-top:20px;}
.pro_st_edit_ban_display{ margin-top:20px;}
.pro_st_edit_ban_display ul li{ margin-bottom:10px;}
.pro_st_edit_ban ul li{ margin-bottom:10px;}
.pro_st_edit_ku{display:none; margin-top:20px;}
.pro_st_edit_ku ul li{margin-bottom:10px;}