相关路由

This commit is contained in:
sw 2015-11-13 16:40:39 +08:00
parent 466f3c4cc3
commit 70c5b27a43
8 changed files with 59 additions and 0 deletions

View File

@ -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

View File

@ -0,0 +1,3 @@
# encoding: utf-8
module ExerciseHelper
end

View File

@ -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

View File

@ -0,0 +1 @@
111111111111

View File

View File

@ -0,0 +1 @@
111111

View File

@ -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 %>
</div>
<div class="subNav">
<%= link_to "在线测验", exercise_index_path(:course_id => @course.id), :class => " f14 c_blue02"%>
<%= link_to "(#{@course.exercises.count})", exercise_index_path(:course_id => @course.id), :class => "subnav_num c_orange" %>
<%= link_to( "+新建试卷", new_exercise_path(:course_id => @course.id), :class => 'subnav_green c_white') if is_teacher %>
</div>
</div><!--项目侧导航 end-->
<div class="cl"></div>
<div class="project_intro">

View File

@ -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'