新建/编辑里程碑,名字相同时提示更改;课程的资源库动态无法被筛选;待审批消息旧数据依旧存在的问题
This commit is contained in:
parent
a668ed7a81
commit
cfa81fc79d
|
@ -19,11 +19,11 @@ class VersionsController < ApplicationController
|
|||
layout "base_projects"
|
||||
menu_item :roadmap
|
||||
model_object Version
|
||||
before_filter :find_model_object, :except => [:index, :new, :create, :close_completed]
|
||||
before_filter :find_model_object, :except => [:index, :new, :create, :close_completed,:judge_version_title]
|
||||
#before_filter :find_model_object_contest, :except => [:index, :new, :create]
|
||||
before_filter :find_project_from_association, :except => [:index, :new, :create, :close_completed]
|
||||
before_filter :find_project_by_project_id, :only => [:index, :new, :create, :close_completed]
|
||||
before_filter :authorize
|
||||
before_filter :find_project_from_association, :except => [:index, :new, :create, :close_completed, :judge_version_title]
|
||||
before_filter :find_project_by_project_id, :only => [:index, :new, :create, :close_completed,:judge_version_title]
|
||||
before_filter :authorize, :except => [:judge_version_title]
|
||||
|
||||
accept_api_auth :index, :show, :create, :update, :destroy
|
||||
|
||||
|
@ -189,9 +189,9 @@ class VersionsController < ApplicationController
|
|||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html { flash[:error] = @version.errors.full_messages.flatten.to_s
|
||||
redirect_to settings_project_url(@project, :tab => 'versions') }
|
||||
format.js { render :action => 'new' }
|
||||
# format.html { flash[:error] = @version.errors.full_messages.flatten.to_s
|
||||
# redirect_to settings_project_url(@project, :tab => 'versions') }
|
||||
format.js { @error = @version.errors.full_messages.flatten.to_s }
|
||||
format.api { render_validation_errors(@version) }
|
||||
end
|
||||
end
|
||||
|
@ -275,6 +275,21 @@ class VersionsController < ApplicationController
|
|||
redirect_to settings_contest_url(@contest, :tab => 'versions')
|
||||
end
|
||||
|
||||
# 判断里程碑是否重名
|
||||
def judge_version_title
|
||||
begin
|
||||
version = Version.where(:name => params[:version_name]).first
|
||||
if version.blank?
|
||||
result = {:result => true}
|
||||
else
|
||||
result = {:result => false}
|
||||
end
|
||||
rescue Exception => e
|
||||
puts e
|
||||
end
|
||||
render :json => result
|
||||
end
|
||||
|
||||
def destroy
|
||||
begin
|
||||
project = @version.project
|
||||
|
|
|
@ -42,8 +42,7 @@
|
|||
<h4 style="font-size: 18px;margin-top: 10px; padding-bottom: 10px;"><%= l(:notice_email_register_time) %></h4>
|
||||
<div class="to-email mb10" style="padding-bottom: 8px; font-size: 14px">
|
||||
<div class="to-email" style="padding-bottom:15px; font-size:14px; padding-top:10px;">
|
||||
<span ><%= l(:notice_email_arrival)%></span>
|
||||
<a href="#" class="f-blue"><%= @user.mail %></a>
|
||||
<span ><%= l(:notice_email_arrival)%> : <%= @user.mail %></span>
|
||||
</div>
|
||||
<p>
|
||||
<a href="http://mail.<%= email %>" class="btn btn-blue" target="_blank"><%= l(:label_check_email)%></a>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<% if @project.shared_versions.empty? %>
|
||||
<div class="pro_new_prompt ml15 mr15 mb10"><p><%= l(:milestone_no_data) %></p></div>
|
||||
<div class="pro_new_prompt ml15 mr15 mb10"><p><%= l(:milestone_no_data) %></p></div>
|
||||
<% end %>
|
||||
<div class=" sy_new_tchbox clear " >
|
||||
<a href="javascript:void(0);" class=" sy_btn_green mb10 fr" onclick="pro_st_show_ban1();">新建里程碑</a>
|
||||
|
@ -8,73 +8,45 @@
|
|||
</div>
|
||||
|
||||
<% if @project.shared_versions.any? %>
|
||||
<div class=" clear ml15 mr15" >
|
||||
<table class="sy_new_table clear mb15" cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="fl" style="width:156px;">名称</th>
|
||||
<th class="w80 fl">结束日期</th>
|
||||
<th class="w350 fl">描述</th>
|
||||
<th class="w50 fl">状态</th>
|
||||
<th class="w150 fl">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @project.shared_versions.reverse.each do |version| %>
|
||||
<div class=" clear ml15 mr15" >
|
||||
<table class="sy_new_table clear mb15" cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="fl hidden" style="width:156px;" title="<%= version.name %>" >
|
||||
<%= link_to version.name, version_path(version), :class => "c_blue02" %>
|
||||
</th>
|
||||
<th class="fl w80"><%= format_date(version.effective_date) %></th>
|
||||
<th class="fl w350 hidden"><%=h version.description %></th>
|
||||
<th class="fl w50"><%= l("version_status_#{version.status}") %></th>
|
||||
<th class="fl w150">
|
||||
<% if version.project == @project && User.current.allowed_to?(:manage_versions, @project) %>
|
||||
<%= link_to l(:button_edit), edit_version_path(version, :is_setting => true), :class => 'sy_btn_blue mr5', :remote => true %>
|
||||
<%= delete_link_version version_path(version, :is_setting => true), :class=>"sy_btn_grey mr5", :remote => true %>
|
||||
<% end %>
|
||||
</th>
|
||||
<th class="fl" style="width:156px;">名称</th>
|
||||
<th class="w80 fl">结束日期</th>
|
||||
<th class="w350 fl">描述</th>
|
||||
<th class="w50 fl">状态</th>
|
||||
<th class="w150 fl">操作</th>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @project.shared_versions.reverse.each do |version| %>
|
||||
<tr>
|
||||
<th class="fl hidden" style="width:156px;" title="<%= version.name %>" >
|
||||
<%= link_to version.name, version_path(version), :class => "c_blue02" %>
|
||||
</th>
|
||||
<th class="fl w80"><%= format_date(version.effective_date) %></th>
|
||||
<th class="fl w350 hidden"><%=h version.description %></th>
|
||||
<th class="fl w50"><%= l("version_status_#{version.status}") %></th>
|
||||
<th class="fl w150">
|
||||
<% if version.project == @project && User.current.allowed_to?(:manage_versions, @project) %>
|
||||
<%= link_to l(:button_edit), edit_version_path(version, :is_setting => true), :class => 'sy_btn_blue mr5', :remote => true %>
|
||||
<%= delete_link_version version_path(version, :is_setting => true), :class=>"sy_btn_grey mr5", :remote => true %>
|
||||
<% end %>
|
||||
</th>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<script>
|
||||
// 新建版本
|
||||
function project_version_commit()
|
||||
{
|
||||
if(regex_version_name())
|
||||
{
|
||||
$("#new_project_version_form").submit();
|
||||
}
|
||||
}
|
||||
|
||||
function regex_version_name()
|
||||
{
|
||||
var name = $.trim($("#setting_version_name").val());
|
||||
if(name.length == 0)
|
||||
{
|
||||
$("#project_setting_version_title").show();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#project_setting_version_title").hide();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function pro_st_show_ban1()
|
||||
{
|
||||
$("#pro_st_edit_ban1").toggle();
|
||||
$("#setting_version_name").val("");
|
||||
$("#project_setting_create_version_title").val("");
|
||||
$("#setting_version_description").val("");
|
||||
$("#setting_version_effective_date").val("");
|
||||
}
|
||||
function pro_st_show_ban()
|
||||
{
|
||||
$("#pro_st_edit_ban").toggle();
|
||||
}
|
||||
</script>
|
|
@ -1,10 +1,10 @@
|
|||
<%= form_for :version, :url => project_versions_path(@project, :is_setting => true),:html=>{:id=>"new_project_version_form", :remote => true} do |f| %>
|
||||
<%= form_for :version, :url => project_versions_path(@project, :is_setting => true),:html=>{:id => "setting_new_project_version_form", :remote => true} do |f| %>
|
||||
<div id="pro_st_edit_ban1" style="display:none;">
|
||||
<ul class="pro_newsetting_con mb15">
|
||||
<li class="mb10 clear">
|
||||
<label class="label02"><span class="c_red f12">*</span> <%= l(:field_name) %> : </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>
|
||||
<%= f.text_field :name, :maxlength => 60, :class=>"w650 fl", :style=>"height: 28px;", :id => "project_setting_create_version_title" %>
|
||||
<p class="c_orange ml100" style="display: none" id="project_setting_version_name">标题不能为空</p>
|
||||
</li>
|
||||
<li class="mb10 clear">
|
||||
<label class="fl"> <%= l(:label_version_description) %> : </label>
|
||||
|
@ -24,11 +24,30 @@
|
|||
<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>
|
||||
<a href="javascript:void(0);" onclick="project_setting_version_commit();" class="fr sy_btn_blue mr5">保存</a>
|
||||
</div>
|
||||
<% end %>
|
||||
<script>
|
||||
function project_version_commit(){
|
||||
$("#new_project_version_form").submit();
|
||||
}
|
||||
// 新建版本
|
||||
function project_setting_version_commit()
|
||||
{
|
||||
if(regex_setting_version_name())
|
||||
{
|
||||
$("#setting_new_project_version_form").submit();
|
||||
}
|
||||
}
|
||||
function regex_setting_version_name()
|
||||
{
|
||||
var name = $.trim($("#project_setting_create_version_title").val());
|
||||
if(name.length == 0)
|
||||
{
|
||||
$("#project_setting_version_name").show();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#project_setting_version_name").hide();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -48,13 +48,11 @@
|
|||
|
||||
<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)
|
||||
|
|
|
@ -57,6 +57,8 @@
|
|||
<%# cache [act, act.comments.count] do %>
|
||||
<%= render :partial => 'course_news', :locals => {:activity => act, :user_activity_id => user_activity.id} %>
|
||||
<%# end %>
|
||||
<% when 'Attachment'%>
|
||||
<%= render :partial => 'users/course_attachment', :locals => {:activity => act, :user_activity_id => user_activity.id} %>
|
||||
<% when 'Message' %>
|
||||
<%= render :partial => 'course_message', :locals => {:activity => act, :user_activity_id => user_activity.id, :is_course => 0, :is_board => 0} %>
|
||||
<% when 'Poll' %>
|
||||
|
|
|
@ -12,9 +12,11 @@
|
|||
<%= labelled_form_for @version, :html => {:id => "popub_new_project_version_form", :remote => @is_setting ? true :false}, :is_setting => @is_setting, :is_index => @is_index, :is_create => @is_create do |f| %>
|
||||
<ul class="pro_newsetting_con mb15 ">
|
||||
<li class="mb10 clear">
|
||||
<label class=" fl"><span class="c_red f12">*</span> 名称 : </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>
|
||||
<label class="fl"><span class="c_red f12">*</span> 名称 : </label>
|
||||
<%= f.text_field :name, :maxlength => 60, :class => "w650 fl", :style=>"height: 28px;", :id => "popub_setting_version_name", :no_label => true %>
|
||||
<div class="clear"></div>
|
||||
<p class="c_orange ml50" style="display: none" id="pupub_project_setting_version_title">名称不能为空</p>
|
||||
<p class="c_orange ml50" style="display: none" id="version_name_repetition_tip">名称已经被使用</p>
|
||||
</li>
|
||||
<li class="mb10 clear">
|
||||
<label class="fl ml5"> 描述 : </label>
|
||||
|
@ -63,13 +65,32 @@
|
|||
var name = $.trim($("#popub_setting_version_name").val());
|
||||
if(name.length == 0)
|
||||
{
|
||||
$("#version_name_repetition_tip").hide();
|
||||
$("#pupub_project_setting_version_title").show();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#pupub_project_setting_version_title").hide();
|
||||
return true;
|
||||
$.ajax({
|
||||
url:"<%= judge_version_title_project_versions_path(:project_id => @project) %>",
|
||||
type: "GET",
|
||||
data: {
|
||||
version_name: $.trim($("#popub_setting_version_name").val())
|
||||
},
|
||||
success:function(data){
|
||||
if(data.result == true) {
|
||||
$("#pupub_project_setting_version_title").hide();
|
||||
$("#popub_new_project_version_form").submit();
|
||||
hideModal();
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
$("#pupub_project_setting_version_title").hide();
|
||||
$("#version_name_repetition_tip").show();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -8,13 +8,15 @@
|
|||
<div class="muban_popup_con " >
|
||||
<div class="clear mt30 ml20 " >
|
||||
<%#= form_tag( url_for(:controller => 'versions', :action => 'update', :is_setting => true, :is_index => @is_index), :remote => true, :id => 'project_applied_form') do %>
|
||||
<%= form_for :version, :url => project_versions_path(@project, :is_setting => @is_setting, :is_issue => @is_issue, :is_create => @is_create, :issue_project_id => @issue_project_id),:html => {:id=>"popub_new_project_version_form", :remote => @is_setting ? true : false} do |f| %>
|
||||
<%= form_for :version, :url => project_versions_path(@project, :is_setting => @is_setting, :is_issue => @is_issue, :is_create => @is_create, :issue_project_id => @issue_project_id),
|
||||
:html => {:id => "popub_new_project_version_form", :remote => @is_setting ? true : false} do |f| %>
|
||||
<%#= labelled_form_for @version, :html => {:id => "popub_new_project_version_form", :remote => true, :is_setting => true, :is_index => params[:is_index] } do |f| %>
|
||||
<ul class="pro_newsetting_con mb15 ">
|
||||
<li class="mb10 clear">
|
||||
<label><span class="c_red f12">*</span> 名称 : </label>
|
||||
<%= f.text_field :name, :maxlength => 60, :class=>"w650", :style=>"height: 28px;", :id => "popub_setting_version_name", :no_label => true %>
|
||||
<p class="c_orange ml100" style=" margin-left:50px;display: none" id="pupub_project_setting_version_title">标题不能为空</p>
|
||||
<p class="c_orange ml100" style=" margin-left:50px;display: none" id="pupub_project_setting_version_title">名称不能为空</p>
|
||||
<p class="c_orange ml100" style=" margin-left:50px;display: none" id="version_name_repetition_tip">名称已经被使用</p>
|
||||
</li>
|
||||
<li class="mb10 clear">
|
||||
<label class="ml5"> 描述 : </label>
|
||||
|
@ -44,11 +46,7 @@
|
|||
// 新建版本
|
||||
function popub_project_version_commit()
|
||||
{
|
||||
if(popub_regex_version_name())
|
||||
{
|
||||
$("#popub_new_project_version_form").submit();
|
||||
hideModal();
|
||||
}
|
||||
popub_regex_version_name();
|
||||
}
|
||||
|
||||
function popub_regex_version_name()
|
||||
|
@ -56,13 +54,32 @@
|
|||
var name = $.trim($("#popub_setting_version_name").val());
|
||||
if(name.length == 0)
|
||||
{
|
||||
$("#version_name_repetition_tip").hide();
|
||||
$("#pupub_project_setting_version_title").show();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#pupub_project_setting_version_title").hide();
|
||||
return true;
|
||||
$.ajax({
|
||||
url:"<%= judge_version_title_project_versions_path(:project_id => @project) %>",
|
||||
type: "GET",
|
||||
data: {
|
||||
version_name: $.trim($("#popub_setting_version_name").val())
|
||||
},
|
||||
success:function(data){
|
||||
if(data.result == true) {
|
||||
$("#pupub_project_setting_version_title").hide();
|
||||
$("#popub_new_project_version_form").submit();
|
||||
hideModal();
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
$("#pupub_project_setting_version_title").hide();
|
||||
$("#version_name_repetition_tip").show();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<div style="width:460px;">
|
||||
<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" style="width:380px;">
|
||||
<ul class="sy_popup_add" >
|
||||
|
||||
<li class="center mb5" style="line-height:20px;text-align: center;">
|
||||
名称已经被使用
|
||||
</li>
|
||||
<li class="mt10">
|
||||
<label class="mr27"> </label>
|
||||
<a href="javascript:void(0);" class="sy_btn_grey fl" onclick="hideModal()">取 消</a>
|
||||
<%#= link_to "确 定", {:controller => 'repositories', :action => 'forked'}, :class => "sy_btn_blue fl ml20", :onclick => "hideModal();", :target => "_blank" %>
|
||||
<a href="javascript:void(0);" class="sy_btn_blue fl ml20" onclick="hideModal()">确 定</a>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
|
@ -1 +1,6 @@
|
|||
$("#pro_st_tbc_04").html('<%= escape_javascript( render :partial => 'projects/settings/new_versions') %>');
|
||||
<% if @error %>
|
||||
var htmlvalue = "<%= escape_javascript(render :partial => 'versions/version_name_repetition_tip') %>";
|
||||
pop_box_new(htmlvalue,300,316);
|
||||
<% else %>
|
||||
$("#pro_st_tbc_04").html('<%= escape_javascript( render :partial => 'projects/settings/new_versions') %>');
|
||||
<% end %>
|
||||
|
|
|
@ -983,6 +983,7 @@ RedmineApp::Application.routes.draw do
|
|||
resources :versions, :except => [:index, :show, :edit, :update, :destroy] do
|
||||
collection do
|
||||
put 'close_completed'
|
||||
get 'judge_version_title'
|
||||
end
|
||||
end
|
||||
get 'versions.:format', :to => 'versions#index'
|
||||
|
|
Loading…
Reference in New Issue