From 6a6fbea446d71b47b901bd6b355e78a10c123b7b Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 2 Sep 2015 19:41:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BD=9C=E5=93=81=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 4 + app/helpers/student_work_helper.rb | 2 + app/views/student_work/new.html.erb | 141 +++++++++++---------- public/stylesheets/new_user.css | 47 +++++++ 4 files changed, 124 insertions(+), 70 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 7726ab3da..30922230e 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -134,10 +134,14 @@ class StudentWorkController < ApplicationController end def new + @user = User.current @student_work = @homework.student_works.where("user_id = ?",User.current.id).first if @student_work.nil? @student_work = StudentWork.new end + respond_to do |format| + format.html{ render :layout => "new_base_user"} + end end def create diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb index f24d5078f..bff997ba4 100644 --- a/app/helpers/student_work_helper.rb +++ b/app/helpers/student_work_helper.rb @@ -1,4 +1,6 @@ # encoding: utf-8 +include UserScoreHelper + module StudentWorkHelper def user_projects_option cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1" diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index 8d27f31aa..dbda0b863 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -17,75 +17,77 @@ }); <% end%> -
-
- <%= f.text_field "name", :required => true, :size => 60, :class => "bo fl", :maxlength => 200, :placeholder => "作品名称", :onkeyup => "regexStudentWorkName();" %>
- <% if @homework.homework_type != 2%>
-
- 项目信息
-
-
- <% end%>
-
- - <%= f.select :project_id,options_for_select(user_projects_option), {},{:class => "bo02 mb10"} %> -
- -- - <% if @homework.homework_type == 2 && @homework.homework_detail_programing%> - <%= f.text_area "description", :class => "w620 hwork_txt h400", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();", :value => @homework.homework_detail_programing.language == "1" ? c_stantard_code_student : c_stantard_code_student_%> - <% else %> - <%= f.text_area "description", :class => "w620 hwork_txt", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();"%> - <% end%> -
- - - - <% if @homework.homework_type != 2%> -- - <%= render :partial => 'attachments/new_form' %> -
- +
+
+ <%= f.text_field "name", :required => true, :size => 60, :class => "bo fl", :maxlength => 200, :placeholder => "作品名称", :onkeyup => "regexStudentWorkName();" %>
+ <% if @homework.homework_type != 2%>
+
+ 项目信息
+
+
+ <% end%>
+
+ + <%= f.select :project_id,options_for_select(user_projects_option), {},{:class => "bo02 mb10"} %> +
+ ++ + <% if @homework.homework_type == 2 && @homework.homework_detail_programing%> + <%= f.text_area "description", :class => "w620 hwork_txt h400", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();", :value => @homework.homework_detail_programing.language == "1" ? c_stantard_code_student : c_stantard_code_student_%> + <% else %> + <%= f.text_area "description", :class => "w620 hwork_txt", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();"%> + <% end%> +
+ + + + <% if @homework.homework_type != 2%> ++ + <%= render :partial => 'attachments/new_form' %> +
+ + <% end%> ++ 提交作品 + <%= link_to "返 回".html_safe, student_work_index_path(:homework => @homework), :class => "blue_btn grey_btn fl c_white"%> +
+ +- 提交作品 - <%= link_to "返 回".html_safe, student_work_index_path(:homework => @homework), :class => "blue_btn grey_btn fl c_white"%> -
- -