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 %> +
diff --git a/config/routes.rb b/config/routes.rb index 6cf872180..9c557c9a5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -96,6 +96,15 @@ RedmineApp::Application.routes.draw do end end + #show、index、new、create、edit、update、destroy路由自动生成 + resources :exercise do + member do #生成路径为 /exercise/:id/方法名 + end + + collection do #生成路径为 /exercise/方法名 + end + end + resources :homework_common, :except => [:show]do member do get 'start_anonymous_comment'