将课程和作业分开

作业单独一个tabs
This commit is contained in:
huangjingquan 2013-10-11 20:25:24 +08:00
parent 508eee45f2
commit c49209cbfb
8 changed files with 45 additions and 29 deletions

View File

@ -23,12 +23,14 @@ class UsersController < ApplicationController
menu_item :requirement_focus, :only => :watch_bids
menu_item :user_newfeedback, :only => :user_newfeedback
menu_item :user_course, :only => :user_courses
menu_item :user_homework, :only => :user_homeworks
#Ended by young
before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info, :user_watchlist, :user_fanslist,:update, :user_courses]
before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info, :user_watchlist, :user_fanslist,:update,
:user_courses, :user_homeworks]
#edit has been deleted by huang, 2013-9-23
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses,
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :user_homeworks,
:destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info]
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save
@ -79,7 +81,7 @@ class UsersController < ApplicationController
def watch_bids
cond = 'bids.reward_type <> 1'
@bids = Bid.watched_by(@user)
@bids = Bid.visible.where('reward_type = ?', 1) # modified by huang
@bids = Bid.visible.where('reward_type = ?', 1) # added by huang
@offset, @limit = api_offset_and_limit({:limit => 10})
@bid_count = @bids.count
@bid_pages = Paginator.new @bid_count, @limit, params['page']
@ -123,19 +125,32 @@ class UsersController < ApplicationController
end
# end
# added by fq
def user_courses
case params[:type]
when "2"
# added by huang
def user_homeworks
@membership = @user.memberships.all(:conditions => Project.visible_condition(User.current))
@memberships = []
@membership.each do |membership|
if membership.project.project_type == 1
@membership << membership
end
end
@state = 2
if membership.project.project_type == 1
@memberships << membership
end
end
@bid = []
@memberships.each do |membership|
@bid += membership.project.homeworks
end
@bid = @bid.group_by {|bid| bid.courses.first.id}
#add by huang
unless User.current.admin?
if !@user.active?
render_404
return
end
end
end
# added by fq
def user_courses
case params[:type]
when "1"
@membership = @user.memberships.all(:conditions => Project.visible_condition(User.current))
@memberships = []
@ -214,7 +229,7 @@ class UsersController < ApplicationController
when 'xml', 'json'
@offset, @limit = api_offset_and_limit({:limit => 15})
else
@limit = 15#per_page_option
@limit = 15 #per_page_option
end
@status = params[:status] || 1

View File

@ -18,7 +18,7 @@
<% else %>
<% unless @user != User.current %>
<% if @user.user_extensions.identity == 0 %>
<%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1}, :class => 'icon icon-add' %>
<p><%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1}, :class => 'icon icon-add' %></p>
<% end %>
<% end %>
<ul class="user_project_sort">

View File

@ -1,19 +1,8 @@
<!-- added by fq -->
<!--huang-->
<%= user_course @state%>
<% if @state == 0 %>
<% if @user.user_extensions.identity == 0 %> <!-- for teacher-->
<%= render :partial => 'my_course' %>
<% else %> <!--for student-->
<%= render :partial => 'my_joinedcourse' %>
<% end %>
<% elsif @state == 1 %>
<% if @user.user_extensions.identity == 0 %>
<%= render :partial => 'my_create_homework' %>
<% else %>
<%= render :partial => 'my_homework' %>
<% end %>
<% else @state == 2 %>
<%= render :partial => 'my_joinedcourse' %>
<% end %>

View File

@ -0,0 +1,9 @@
<!-- added by fq -->
<!--huang-->
<% if @user.user_extensions.identity == 0 %>
<%= render :partial => 'my_create_homework' %>
<% else %>
<%= render :partial => 'my_homework' %>
<% end %>

View File

@ -3,7 +3,7 @@
<% if @bid.size > 0%>
<% for bid in @bid%>
<% for bid in @bid %>
<table width="90%" border="0" align="center" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px; margin-top: 30px;font-size:14px;">
<tr>

View File

@ -1489,6 +1489,7 @@ zh:
label_welcome_trustie_description: 面向有创意和激情的高校大学生与创业者,提供社交化的项目管理、协同研究、软件开发和众包平台。
label_user_project: 项目
label_user_course: 课程
label_user_homework: 作业
label_bid_respond_quote: 回复
label_bid_if_agreement: 如果喜欢我,请点击我
label_bid_respond_delete: 删除
@ -1497,6 +1498,7 @@ zh:
label_newfeedback_delete: 删除
label_user_all_activity: 所有动态
label_user_activity_myself: 只看自己
label_my_honework_no_homework: 暂无任何作业!
label_user_all_respond: 所有反馈
label_layouts_feedback: 留言
label_welcome_participate: 参与了

View File

@ -92,6 +92,7 @@ RedmineApp::Application.routes.draw do
match 'user_watchlist', :to => 'users#user_watchlist', :via => :get, :as => "user_watchlist" #add by huang
match 'user_fanslist', :to => 'users#user_fanslist', :via => :get, :as => "user_fanslist" #add by huang
match 'user_courses', :to => 'users#user_courses', :via => :get
match 'user_homeworks', :to => 'users#user_homeworks', :via => :get
end
end
match 'users/:id/user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "feedback"

View File

@ -330,8 +330,8 @@ end
Redmine::MenuManager.map :user_menu do |menu|
menu.push :activity, {:controller => 'users', :action => 'show' }
menu.push :user_course, {:controller => 'users', :action => 'user_courses'}
menu.push :user_project, {:controller => 'users', :action => 'user_projects'}
menu.push :user_homework, {:controller => 'users', :action => 'user_homeworks'}
menu.push :user_project, {:controller => 'users', :action => 'user_projects'}
menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids'}
menu.push :user_newfeedback, {:controller => 'users', :action => 'user_newfeedback'}