From 70c5b27a437df83d823f1442fa5e945b7cd2ff56 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 13 Nov 2015 16:40:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=B8=E5=85=B3=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 39 +++++++++++++++++++++++++ app/helpers/exercise_helper.rb | 3 ++ app/models/course.rb | 1 + app/views/exercise/index.html.erb | 1 + app/views/exercise/new.html.erb | 0 app/views/exercise/show.html.erb | 1 + app/views/layouts/base_courses.html.erb | 5 ++++ config/routes.rb | 9 ++++++ 8 files changed, 59 insertions(+) create mode 100644 app/controllers/exercise_controller.rb create mode 100644 app/helpers/exercise_helper.rb create mode 100644 app/views/exercise/index.html.erb create mode 100644 app/views/exercise/new.html.erb create mode 100644 app/views/exercise/show.html.erb diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb new file mode 100644 index 000000000..96a965f79 --- /dev/null +++ b/app/controllers/exercise_controller.rb @@ -0,0 +1,39 @@ +class ExerciseController < ApplicationController + layout "base_courses" + + before_filter :find_course, :only => [:index,:new,:create] + def index + + end + + def show + + end + + def new + + end + + def create + + end + + def edit + + end + + def update + + end + + def destroy + + end + + private + def find_course + @course = Course.find params[:course_id] + rescue Exception => e + render_404 + end +end \ No newline at end of file diff --git a/app/helpers/exercise_helper.rb b/app/helpers/exercise_helper.rb new file mode 100644 index 000000000..7fc7b1421 --- /dev/null +++ b/app/helpers/exercise_helper.rb @@ -0,0 +1,3 @@ +# encoding: utf-8 +module ExerciseHelper +end \ No newline at end of file diff --git a/app/models/course.rb b/app/models/course.rb index 7288c3b3b..913449d22 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -39,6 +39,7 @@ class Course < ActiveRecord::Base has_many :course_activities # 课程消息 has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy + has_many :exercises, :dependent => :destroy acts_as_taggable acts_as_nested_set :order => 'name', :dependent => :destroy diff --git a/app/views/exercise/index.html.erb b/app/views/exercise/index.html.erb new file mode 100644 index 000000000..52cfcc97f --- /dev/null +++ b/app/views/exercise/index.html.erb @@ -0,0 +1 @@ +111111111111 \ No newline at end of file diff --git a/app/views/exercise/new.html.erb b/app/views/exercise/new.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/exercise/show.html.erb b/app/views/exercise/show.html.erb new file mode 100644 index 000000000..b23c1c517 --- /dev/null +++ b/app/views/exercise/show.html.erb @@ -0,0 +1 @@ +111111 \ No newline at end of file diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 39de4faeb..ac8727e21 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -157,6 +157,11 @@ <%= link_to "(#{course_poll_count})", poll_index_path(:polls_type => "Course", :polls_group_id => @course.id), :class => "subnav_num c_orange" %> <%= link_to( "+#{l(:label_new_poll)}", new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => 'subnav_green c_white') if is_teacher %> +