增加个人活动列表,作业过滤功能,删除课程作业搜索框,修复课程页面以学生角色搜索也会出现新建课程的bug

This commit is contained in:
nieguanghui 2013-10-31 21:44:10 +08:00
parent c7d96dd183
commit 75c0480071
11 changed files with 109 additions and 20 deletions

View File

@ -28,8 +28,6 @@ class BidsController < ApplicationController
@bids = Bid.visible.where('reward_type = ?', 1)
end
@bids = @bids.like(params[:name]) if params[:name].present?
@bid_count = @bids.count
@bid_pages = Paginator.new @bid_count, @limit, params['page']
@ -310,6 +308,18 @@ class BidsController < ApplicationController
# @project = Project.where("id in []", a)
@user = @bid.author
@bidding_project = @bid.biding_projects.all
if params[:student_id].present?
@temp = []
@bidding_project.each do |pro|
if pro.project && pro.project.project_status
if /#{params[:student_id]}/ =~ pro.user.user_extensions.student_id
@temp << pro
end
end
@temp
end
@bidding_project = @temp
else
#added by nie
@temp = []
@bidding_project.each do |pro|
@ -322,6 +332,8 @@ class BidsController < ApplicationController
@bidding_project = @temp.sort {|a,b| b.project.project_status.grade <=> a.project.project_status.grade}
end
#ended
end
if @bid.homework_type == 1
@homework = HomeworkAttach.new
@homework_list = @bid.homeworks

View File

@ -113,6 +113,8 @@ class UsersController < ApplicationController
events << Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 30)
end
@events_by_day = events.group_by(&:event_date)
unless User.current.admin?
@ -424,6 +426,23 @@ class UsersController < ApplicationController
@state = 0
end
if params[:user].present?
user_temp = User.find_by_sql("select id from users where firstname like '%#{params[:user]}%' or lastname like '%#{params[:user]}%'")
if user_temp.size > 1
activity = Activity.where('user_id in (?)', user_temp).order('id desc')
elsif user_temp.size == 1
activity = Activity.where('user_id = ?', user_temp).order('id desc')
else
activity = Activity.where("1 = 0")
end
@offset, @limit = api_offset_and_limit({:limit => 10})
@activity_count = activity.count
@activity_pages = Paginator.new @activity_count, @limit, params['page']
@offset ||= @activity_pages.offset
@activity = activity.offset(@offset).limit(@limit)
@state = 0
end
#Modified by nie
unless User.current.admin?

View File

@ -1,6 +1,25 @@
<%= form_tag(:controller => 'bids', :action => "show_project", :method => :get) do %>
<div class="project-search-block">
<table width="100%" valign="center">
<tr>
<td width="16%"><span style="margin-left:0px"><%= l(:label_task_plural)%></span></td>
<td align="right">
<div class="project-search">
<%= text_field_tag 'student_id', params[:student_id], :size => 30 %>
<%= submit_tag l(:label_search_by_student_id), :class => "small", :name => nil %>
</div></td>
</tr>
</table>
</div>
<% end %>
<% bidding_project.each do |b_project|%>
<% if b_project.project %>
<table width="90%" border="0" align='center'>
<tr>
<td>
@ -24,7 +43,7 @@
<td style="color: red;" align="right" valign="0.1em" width="16%">
<strong><span id="reward_result_<%=b_project.id%>"> <!-- 调用js进行刷新 -->
<%= l(:label_system_grade) %>:<%= (b_project.project.project_status.nil? ? 0 : b_project.project.project_status.grade) unless (b_project.project.project_status.nil? && b_project.project.nil?) %>
<%= l(:label_system_grade) %>:<%= (b_project.project.project_status.nil? ? 0.0 : b_project.project.project_status.grade) unless (b_project.project.project_status.nil? && b_project.project.nil?) %>
<% if get_prize(b_project).nil? or get_prize(b_project) == "" %>
<% if @bid.deadline < Date.today %>
<%= l(:label_noawards)%>

View File

@ -213,12 +213,14 @@
<%= render_menu :user_menu %>
<% end %>
</div>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div>
<%= render_flash_messages %>
</div>
<%= render :partial => 'layouts/base_footer'%>
</div>
<div id="ajax-indicator" style="display:none;">

View File

@ -89,7 +89,7 @@
</div>
<div class="grade">
<% if @project.project_type !=1 %>
<%= content_tag('span', "#{l(:label_project_grade)}: ")%><span style='color:red'><%= @project.project_status.grade%></span>
<%= content_tag('span', "#{l(:label_project_grade)}: ")%><span style='color:red'><%=@project.project_status ? @project.project_status.grade : 0.0 %></span>
<% end %>
</div>
<!-- added by liuping -->

View File

@ -12,10 +12,13 @@
</span></td>
<td valign="center"><%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %></td>
<% else %>
<%= l(:label_new_course)%>
</span></td>
<% if User.current.user_extensions.identity == 0 %>
<td valign="center"><%= link_to(l(:label_course_new), {:controller => 'projects', :action => 'new', :course => 1, :project_type => @project_type}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %></td>
<% end %>
<% end %>
<td align="right">
<div class="project-search">

View File

@ -1,6 +1,22 @@
<% if User.current.id == @user.id%>
<%= show_activity @state%>
<%= form_tag(:controller => 'users', :action => "show") do %>
<div class="user-search-block">
<table width="100%" valign="center">
<tr>
<td align="right">
<div class="project-search">
<%= text_field_tag 'user', params[:user], :size => 30 %>
<%= submit_tag l(:label_search_by_user), :class => "small", :name => nil %>
</div></td>
</tr>
</table>
</div>
<% end %>
<% end %>
<% unless @state == 2%>
<% unless @activity.empty? %>
<div id="activity">

View File

@ -19,6 +19,7 @@
<% unless @events_by_day.empty? %>
<div id="activity">
<% @events_by_day.keys.sort.reverse.each do |day| %>
<% @events_by_day[day].sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%>

View File

@ -827,7 +827,7 @@ zh:
label_user_login: "最后登录:"
label_user_mail: "邮件地址:"
label_user_joinin: "加入时间:"
label_user_activities: 当前还没有活动,快来加入我们吧
label_user_activities: 没有关注该用户,请尝试重新输入
label_user_activities_other: 该用户暂无任何动态!
label_project_overview: "概述"
label_project_tool: "工具"
@ -1603,6 +1603,8 @@ zh:
one: 份资料
other: 份资料
#add by men
label_technicl_title_professor: 教授
label_technicl_title_associate_professor: 副教授
@ -1663,4 +1665,7 @@ zh:
label_has_watched_project: 关注的项目
label_project_take: 参与的项目
label_peoject_take_in: 加入了项目:
label_search_by_user: 按用户搜索
label_update_homework_succeed: 作业更新成功
label_task_plural: 作业
label_search_by_student_id: 按学号过滤

View File

@ -81,6 +81,7 @@ RedmineApp::Application.routes.draw do
get 'projects/:id/issues/report', :to => 'reports#issue_report', :as => 'project_issues_report'
get 'projects/:id/issues/report/:detail', :to => 'reports#issue_report_details', :as => 'project_issues_report_details'
post '/users/:id/user_activities', :to => 'users#show', :as => "user_activities"
#added by young
resources :users do

View File

@ -1571,6 +1571,17 @@ div.issue-note .description {
overflow: hidden;
}
/*
*Added by nie
*/
div.user-search-block {
display: inline;
float: right;
margin-top: -65px;
}
/*issue style Added by nie
*/
@ -1710,7 +1721,7 @@ div.member_content {
}
/*
* Designed for search content
* Designed for project#search
* Added by nie
*/
div.project-search-block {