diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 5791e05..1418e96 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -66,7 +66,10 @@ class CoursesController < ApplicationController @course_display=@course @theparams=params @credit_isdegree, @credit_nodegree=cal_degree - + end + + def classtable + @course=current_user.courses end def credit#add credit method @@ -89,6 +92,7 @@ class CoursesController < ApplicationController redirect_to courses_path,flash: {:success=> "已经成功将 #{@course.name} 选为非学位课"} end + def select @allcourse=current_user.courses @course=Course.find_by_id(params[:id]) diff --git a/app/views/courses/classtable.html.erb b/app/views/courses/classtable.html.erb new file mode 100644 index 0000000..f1fed1d --- /dev/null +++ b/app/views/courses/classtable.html.erb @@ -0,0 +1,62 @@ +
+ | 周一 | +周二 | +周三 | +周四 | +周五 | +周六 | +周日 | +
<%=i%> | + <%for m in 0..6%> + <%k[m]=0%> + <%end%> + <%for j in 0..6 %> + <% @course.each do |h| %> + <%if(h.course_time.empty?)%> + <%next%> + <%end%> + <%if(h.course_time[1]==op[j]&&h.course_time[3].to_i<=i&&h.course_time[5,h.course_time.length-1].to_i>=i)%> +<%=h.name%> | + <%k[j]=1%> + <%end%> + <%end%> + <%if k[j]==0%> +<%" "%> | + <%end%> + <%end%> +