From e6fdda1702a0e13c31bf1f450e080a3150df7eba Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 31 Oct 2014 10:21:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=AA=E6=89=B9=E3=80=81?= =?UTF-8?q?=E5=B7=B2=E6=89=B9=E3=80=81=E5=85=A8=E9=83=A8=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E3=80=81=E7=95=99=E8=A8=80action=E7=9A=84=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_attach_controller.rb | 10 +++++++++- app/helpers/application_helper.rb | 8 ++++---- app/views/bids/_homework_list.html.erb | 8 ++++---- app/views/homework_attach/_homeworks_list.html.erb | 4 +++- app/views/homework_attach/edit.html.erb | 2 +- config/routes.rb | 4 ++-- 6 files changed, 23 insertions(+), 13 deletions(-) diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index 740823c81..1f8217c75 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -4,7 +4,8 @@ class HomeworkAttachController < ApplicationController ############################### before_filter :can_show_course,except: [] #判断当前角色权限时需先找到当前操作的project - before_filter :find_course_by_bid_id, :only => [:new,:get_not_batch_homework,:get_batch_homeworks,:get_homeworks,:get_homework_jours] + before_filter :find_course_by_bid_id, :only => [:new] + before_filter :find_bid_and_course,:only => [:get_not_batch_homework,:get_batch_homeworks,:get_homeworks,:get_homework_jours] before_filter :find_course_by_hoemwork_id, :only => [:edit,:update,:destroy,:show,:add_homework_users,:destory_homework_users] #判断当前角色是否有操作权限 #勿删 before_filter :authorize, :only => [:new,:edit,:update,:destroy] @@ -383,6 +384,13 @@ class HomeworkAttachController < ApplicationController end end + def find_bid_and_course + @bid = Bid.find(params[:bid_id]) + @course = @bid.courses.first + rescue ActiveRecord::RecordNotFound + render_404 + end + def find_course_by_bid_id @bid = Bid.find(params[:id]) @course = @bid.courses.first diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ccc9a884c..5de549d15 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1895,13 +1895,13 @@ module ApplicationHelper def sort_homework_path(bid, sort, direction) case self.action_name when 'show_courseEx' - get_not_batch_homework_homework_attach_path(bid, sort: sort, direction: 'asc') + get_not_batch_homework_homework_attach_index_path(bid_id: bid.id, sort: sort, direction: 'asc') when 'get_not_batch_homework' - get_not_batch_homework_homework_attach_path(bid, sort: sort, direction: direction) + get_not_batch_homework_homework_attach_index_path(bid_id: bid.id, sort: sort, direction: direction) when 'get_batch_homeworks' - get_batch_homeworks_homework_attach_path(bid, sort: sort, direction: direction) + get_batch_homeworks_homework_attach_index_path(bid_id: bid.id, sort: sort, direction: direction) when 'get_homeworks' - get_homeworks_homework_attach_path(bid, sort: sort, direction: direction) + get_homeworks_homework_attach_index_path(bid_id: bid.id, sort: sort, direction: direction) else '#' end diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index 960e3acff..53ed014dd 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -14,17 +14,17 @@
diff --git a/app/views/homework_attach/_homeworks_list.html.erb b/app/views/homework_attach/_homeworks_list.html.erb index 578c1f9e5..380be2120 100644 --- a/app/views/homework_attach/_homeworks_list.html.erb +++ b/app/views/homework_attach/_homeworks_list.html.erb @@ -61,4 +61,6 @@
<% end %> <% else %> -<% end %> \ No newline at end of file +<% end %> + + \ No newline at end of file diff --git a/app/views/homework_attach/edit.html.erb b/app/views/homework_attach/edit.html.erb index 542fe5565..d122dfcf8 100644 --- a/app/views/homework_attach/edit.html.erb +++ b/app/views/homework_attach/edit.html.erb @@ -60,7 +60,7 @@

描      述  :  - <%= f.text_area :description, :rows => 8, :name => "homework_description", :class => 'wiki-edit', :maxlength => 65534, :style => "font-size:small;width:490px;margin-left:10px;" %> + <%= f.text_area :description, :rows => 8, :name => "homework_description", :class => 'wiki-edit', :maxlength => 3000, :style => "font-size:small;width:490px;margin-left:10px;" %>

diff --git a/config/routes.rb b/config/routes.rb index 535f9aa9e..8cc79cf9d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -44,12 +44,12 @@ RedmineApp::Application.routes.draw do match 'add_jour_reply', :via => [:get,:post] match 'destroy_jour', :via => [:get,:post] match 'comprehensive_evaluation_jour', :via => [:get,:post] - end - member do get 'get_not_batch_homework' get 'get_batch_homeworks' get 'get_homeworks' get 'get_homework_jours' + end + member do match 'add_homework_users', :via => [:get,:post] match 'destory_homework_users', :via => [:get,:post] end