diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index ae80f8fcb..a58906c67 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -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| diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 12925b0b1..c25035fdb 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -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) diff --git a/app/views/projects/create.js.erb b/app/views/projects/create.js.erb new file mode 100644 index 000000000..9bb447789 --- /dev/null +++ b/app/views/projects/create.js.erb @@ -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("创建成功"); \ No newline at end of file diff --git a/app/views/student_work/_new_project.html.erb b/app/views/student_work/_new_project.html.erb new file mode 100644 index 000000000..3d9214c7d --- /dev/null +++ b/app/views/student_work/_new_project.html.erb @@ -0,0 +1,31 @@ +
+ <%= labelled_form_for(Project.new,:remote => "true") do |f| %> +

新建项目

+
+
+
+ + +

+
+
+ +

+ +
+ +
+ +
+ + 确定 + + 取消 +
+
+ <% end%> +
+
diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index de9ede9ff..c755014d1 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -9,12 +9,21 @@ ""); $('#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("" + + ""); + $('#ajax-modal').parent().css("top","30%").css("left","20%").css("position","fixed"); + }
@@ -82,7 +91,8 @@
<%= 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 => "快速创建"%> +
@@ -94,4 +104,4 @@
<% end%>
- + \ No newline at end of file diff --git a/public/javascripts/new_user.js b/public/javascripts/new_user.js index 9e5a858f6..3548d1f90 100644 --- a/public/javascripts/new_user.js +++ b/public/javascripts/new_user.js @@ -255,4 +255,48 @@ var autoTextarea = function (elem, extra, maxHeight) { addEvent('input', change); addEvent('focus', change); change(); -}; \ No newline at end of file +}; + +/////////////////////////////////////////////////////////////////////////////////////创建项目 +//验证项目名称是不是为空 +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 \ No newline at end of file diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 128890d4b..184a6c49e 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -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; }