修改未批、已批、全部作业、留言action的路由

This commit is contained in:
sw 2014-10-31 10:21:38 +08:00
parent 70495af3ef
commit e6fdda1702
6 changed files with 23 additions and 13 deletions

View File

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

View File

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

View File

@ -14,17 +14,17 @@
<div id="tb_" class="tb_">
<ul>
<li id="tb_1" class="hovertab">
<%= link_to "未批作业", get_not_batch_homework_homework_attach_path(@bid), {:remote => true}%>
<%= link_to "未批作业", get_not_batch_homework_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
</li>
<li id="tb_2" class="normaltab">
<%= link_to "已改作业", get_batch_homeworks_homework_attach_path(@bid), {:remote => true}%>
<%= link_to "已改作业", get_batch_homeworks_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
</li>
<li id="tb_3" class="normaltab">
<%= link_to "全部作业", get_homeworks_homework_attach_path(@bid), {:remote => true}%>
<%= link_to "全部作业", get_homeworks_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
</li>
<li id="tb_4" class="normaltab" onclick="o:HoverLi(4);"><a href="#">作业下载</a></li>
<li id="tb_5" class="normaltab">
<%= link_to "留言", get_homework_jours_homework_attach_path(@bid), {:remote => true}%>
<%= link_to "留言", get_homework_jours_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
(<span class="c_red f_12">23</span>)
</li>
</ul>

View File

@ -61,4 +61,6 @@
<div class="cl"></div>
<% end %>
<% else %>
<% end %>
<% end %>
<div class="pagination"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %></div>

View File

@ -60,7 +60,7 @@
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
<strong style="vertical-align: top">描&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;述&nbsp;&nbsp;</strong>&nbsp;
<span style="margin-left:-10px;padding-right: 20px;">
<%= 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;" %>
</span>
</p>
<p style="padding-left: 60px">

View File

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