快速创建项目
This commit is contained in:
parent
f79b2cda94
commit
cd96fd99a8
|
@ -216,6 +216,7 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
}
|
||||
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) }
|
||||
format.js
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
include AvatarHelper
|
||||
include StudentWorkHelper
|
||||
module ProjectsHelper
|
||||
def link_to_version(version, options = {})
|
||||
return '' unless version && version.is_a?(Version)
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
$("#project_id").replaceWith("<%= escape_javascript(select_tag :project_id, options_for_select(user_projects_option), {:class => "InputBox W680 fl"})%>");
|
||||
hideModal("#popbox02");
|
||||
alert("创建成功");
|
|
@ -0,0 +1,31 @@
|
|||
<div class="BluePopupBox" id="popbox02">
|
||||
<%= labelled_form_for(Project.new,:remote => "true") do |f| %>
|
||||
<h2 class="BluePopuph2 fl">新建项目</h2>
|
||||
<div class="cl"></div>
|
||||
<div class="">
|
||||
<div class="mt10 mb10">
|
||||
<input type="text" class="none" />
|
||||
<input class="InputBox W700" placeholder="项目名称" name="project[name]" id="project_name" onkeyup="regex_project_name();" />
|
||||
<p id="project_name_error_msg" class="c_red"></p>
|
||||
</div>
|
||||
<div class="mb10">
|
||||
<textarea class="InputBox W700" placeholder="项目描述" id="project_description" name="project[description]" onkeyup="regex_project_desc();"></textarea>
|
||||
<p id="project_desc_error_msg" class="c_red"></p>
|
||||
<script>
|
||||
var text = document.getElementById("project_description");
|
||||
autoTextarea(text);// 调用
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<div class="fl">
|
||||
<input type="checkbox" name="project[is_public]" class="mt5" checked value="1" /><label class=" ml5 ">公开</label>
|
||||
</div>
|
||||
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_project();">确定</a>
|
||||
<span class="fr mr10 mt3">或</span>
|
||||
<a href="javascript:void(0);" class=" fr mr10 mt3" onclick="clickCanel();">取消</a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
</div><!----BluePopupBox end-->
|
|
@ -9,12 +9,21 @@
|
|||
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().css("top","30%").css("left","40%");
|
||||
$('#ajax-modal').parent().addClass("anonymos_work");
|
||||
// alert("当前作业已开启匿评,您提交作品后将不会收到任何匿评作品,您的作品也不会被其他用户匿评,如需获得最终成绩,请您联系主讲老师对您的作品单独进行评分");
|
||||
});
|
||||
<% end%>
|
||||
|
||||
//匿评弹框取消按钮
|
||||
function clickCanel(){hideModal("#popbox02");}
|
||||
|
||||
//快速创建项目的弹框
|
||||
function new_project(){
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/new_project') %>');
|
||||
showModal('ajax-modal', '800px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().css("top","30%").css("left","20%").css("position","fixed");
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="homepageRightBanner mb10">
|
||||
|
@ -82,7 +91,8 @@
|
|||
|
||||
<div class="mt10 none" id="about_project">
|
||||
<%= select_tag :project_id, options_for_select(user_projects_option, @student_work.project_id), {:class => "InputBox W680 fl"} %>
|
||||
<%=link_to "", new_project_path, :class => "ml5 mt5 SetUpIcon fl", :title => "快速创建"%>
|
||||
<%#=link_to "", new_project_path, :class => "ml5 mt5 SetUpIcon fl", :title => "快速创建"%>
|
||||
<a class=" ml5 mt5 SetUpIcon fl" href="javascript:void(0)" title="快速创建" onclick="new_project();"></a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
|
@ -94,4 +104,4 @@
|
|||
<div class="cl"></div>
|
||||
<% end%>
|
||||
</div><!----HomeWorkCon end-->
|
||||
</div>
|
||||
</div>
|
|
@ -255,4 +255,48 @@ var autoTextarea = function (elem, extra, maxHeight) {
|
|||
addEvent('input', change);
|
||||
addEvent('focus', change);
|
||||
change();
|
||||
};
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////创建项目
|
||||
//验证项目名称是不是为空
|
||||
function regex_project_name(){
|
||||
var name = $.trim($("#project_name").val());
|
||||
if(name=="")
|
||||
{
|
||||
$("#project_name_error_msg").text("项目名称不能为空");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#project_name_error_msg").text("");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//验证项目名称是否重复---项目名称可以重复。。。。
|
||||
function regex_project_name_same(){
|
||||
var name = $.trim($("#project_name").val());
|
||||
return true;
|
||||
}
|
||||
|
||||
//验证项目描述
|
||||
function regex_project_desc(){
|
||||
var desc = $.trim($("#project_description").val());
|
||||
if(desc == "")
|
||||
{
|
||||
$("#project_desc_error_msg").text("项目名称不能为空");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#project_desc_error_msg").text("");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//提交
|
||||
function submit_project(){
|
||||
if(regex_project_name()&®ex_project_desc()){
|
||||
$("#new_project").submit();
|
||||
}
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////创建项目 end
|
|
@ -938,7 +938,7 @@ a:hover.UsersApBtn{border:1px solid #888888; }
|
|||
.C_Blue{ color:#3598db;}
|
||||
a.C_Blue{ color:#3598db;}
|
||||
a:hover.C_Blue{ color:#297fb8;}
|
||||
.BluePopupBox{ border:3px solid #3598db; padding:20px; background:#fff; width:707px;}
|
||||
.BluePopupBox{ padding:20px; background:#fff; width:707px;}
|
||||
/*.BluePopupBox:hover{ border:3px solid #297fb8; }*/
|
||||
a.CloseBtn{background:url(../images/CloseBtn.png) 0px 0px no-repeat; width:13px; height:13px; display:block; float:right;}
|
||||
a:hover.CloseBtn{background:url(../images/CloseBtn.png) 0px -24px no-repeat; }
|
||||
|
|
Loading…
Reference in New Issue